run-scene-v2 0.0.25 → 0.0.26
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/index.js +1 -1
- package/package.json +20 -20
package/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("axios"),require("uuid1"),require("three"),require("@allex/md5"),require("js-funcs-three"),require("js-funcs")):"function"==typeof define&&define.amd?define(["axios","uuid1","three","@allex/md5","js-funcs-three","js-funcs"],t):"object"==typeof exports?exports.RunScene=t(require("axios"),require("uuid1"),require("three"),require("@allex/md5"),require("js-funcs-three"),require("js-funcs")):e.RunScene=t(e.axios,e.uuid1,e.three,e["@allex/md5"],e["js-funcs-three"],e["js-funcs"])}(self,((e,t,r,n,i,o)=>{return s={685:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},i=(Object.defineProperty(t,"__esModule",{value:!0}),t.downloadFile=t.getFileName=t.urlToBase64=t.toResult=t.getPrefixWord=t.getBackWord=t.bToMB=t.arrayBufferToStr=t.strToArrayBuffer=t.toUrl=t.blobToDataUrl=t.bufferToArrayBuffer=t.base64ToFile=void 0,n(r(300)));t.base64ToFile=function(e,t){for(var r=(e=e.split(","))[0].match(/:(.*?);/)[1],n=atob(e[1]),i=n.length,o=new Uint8Array(i);i--;)o[i]=n.charCodeAt(i);return new File([o],t,{type:r})},t.bufferToArrayBuffer=function(e){for(var t=new ArrayBuffer(e.length),r=new Uint8Array(t),n=0;n<e.length;++n)r[n]=e[n];return t},t.blobToDataUrl=function(e){return i.default.get(e,{baseURL:"",responseType:"blob",timeout:5e3}).then((function(e){return(0,t.toResult)(e.data)})).catch((function(e){return!1}))},t.toUrl=function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"any.json";return e=e instanceof File?e:(e=JSON.stringify(e),new File([e],t)),window.URL.createObjectURL(e)},t.strToArrayBuffer=function(e){for(var t="",r=0;r<e.length;r++)""===t?t=e.charCodeAt(r).toString(16):t+=","+e.charCodeAt(r).toString(16);return new Uint8Array(t.match(/[\da-f]{2}/gi).map((function(e){return parseInt(e,16)}))).buffer},t.arrayBufferToStr=function(e){return new Promise((function(t){var r=new Blob([e]),n=new FileReader;n.readAsText(r,"utf-8"),n.onload=function(){t(n.result)}}))},t.bToMB=function(e){return e=e/1024/1024,1<arguments.length&&void 0!==arguments[1]&&arguments[1]?e:e.toFixed(2)+"MB"},t.getBackWord=function(e){return e.substr(e.lastIndexOf(".")+1).toLowerCase()},t.getPrefixWord=function(e){return e.substr(0,e.lastIndexOf("."))},t.toResult=function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"text",r=new FileReader;return"text"===t?r.readAsText(e):"arrayBuffer"===t?r.readAsArrayBuffer(e):"base64"===t&&r.readAsDataURL(e),new Promise((function(e){r.onload=function(t){return e(t.target.result)}}))},t.urlToBase64=function(e){return i.default.get(e,{responseType:"arraybuffer"}).then((function(e){var t=e.headers["content-type"];return e=new Buffer(e.data,"binary").toString("base64"),"data:".concat(t,";base64,")+e}))},t.getFileName=function(e){return e.substring(e.lastIndexOf("-")+1)},t.downloadFile=function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"any.text",r=document.createElement("a");e instanceof File||e instanceof Blob?r.setAttribute("href",window.URL.createObjectURL(e)):r.setAttribute("href",e),r.setAttribute("download",t),document.body.insertAdjacentElement("beforeend",r),r.click(),r.remove()}},298:function(e,t,r){"use strict";function n(e){return(n="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 i(){i=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,o=(m="function"==typeof Symbol?Symbol:{}).iterator||"@@iterator",a=m.asyncIterator||"@@asyncIterator",s=m.toStringTag||"@@toStringTag";function l(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(t){l=function(e,t,r){return e[t]=r}}function u(e,t,r,n){var i,o,a,s;return t=t&&t.prototype instanceof p?t:p,t=Object.create(t.prototype),n=new S(n||[]),t._invoke=(i=e,o=r,a=n,s="suspendedStart",function(e,t){if("executing"===s)throw new Error("Generator is already running");if("completed"===s){if("throw"===e)throw t;return{value:void 0,done:!0}}for(a.method=e,a.arg=t;;){var r=a.delegate;if(r&&(r=function e(t,r){var n=t.iterator[r.method];if(void 0===n){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=void 0,e(t,r),"throw"===r.method))return h;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}return"throw"===(n=c(n,t.iterator,r.arg)).type?(r.method="throw",r.arg=n.arg,r.delegate=null,h):(n=n.arg)?n.done?(r[t.resultName]=n.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,h):n:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,h)}(r,a),r)){if(r===h)continue;return r}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if("suspendedStart"===s)throw s="completed",a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);if(s="executing","normal"===(r=c(i,o,a)).type){if(s=a.done?"completed":"suspendedYield",r.arg===h)continue;return{value:r.arg,done:a.done}}"throw"===r.type&&(s="completed",a.method="throw",a.arg=r.arg)}}),t}function c(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var h={};function p(){}function d(){}function f(){}var m,v,y=(l(m={},o,(function(){return this})),(v=(v=Object.getPrototypeOf)&&v(v(T([]))))&&v!==t&&r.call(v,o)&&(m=v),f.prototype=p.prototype=Object.create(m));function g(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function b(e,t){var i;this._invoke=function(o,a){function s(){return new t((function(i,s){!function i(o,a,s,l){var u;if("throw"!==(o=c(e[o],e,a)).type)return(a=(u=o.arg).value)&&"object"==n(a)&&r.call(a,"__await")?t.resolve(a.__await).then((function(e){i("next",e,s,l)}),(function(e){i("throw",e,s,l)})):t.resolve(a).then((function(e){u.value=e,s(u)}),(function(e){return i("throw",e,s,l)}));l(o.arg)}(o,a,i,s)}))}return i=i?i.then(s,s):s()}}function x(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 w(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function S(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(x,this),this.reset(!0)}function T(e){if(e){var t,n=e[o];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return t=-1,(n=function n(){for(;++t<e.length;)if(r.call(e,t))return n.value=e[t],n.done=!1,n;return n.value=void 0,n.done=!0,n}).next=n}return{next:_}}function _(){return{value:void 0,done:!0}}return l(y,"constructor",d.prototype=f),l(f,"constructor",d),d.displayName=l(f,s,"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,f):(e.__proto__=f,l(e,s,"GeneratorFunction")),e.prototype=Object.create(y),e},e.awrap=function(e){return{__await:e}},g(b.prototype),l(b.prototype,a,(function(){return this})),e.AsyncIterator=b,e.async=function(t,r,n,i,o){void 0===o&&(o=Promise);var a=new b(u(t,r,n,i),o);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},g(y),l(y,s,"Generator"),l(y,o,(function(){return this})),l(y,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t,r=[];for(t in e)r.push(t);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=T,S.prototype={constructor:S,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(w),!e)for(var t in this)"t"===t.charAt(0)&&r.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 n(r,n){return a.type="throw",a.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var i=this.tryEntries.length-1;0<=i;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var s=r.call(o,"catchLoc"),l=r.call(o,"finallyLoc");if(s&&l){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;0<=n;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}var a=(o=o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc?null:o)?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,h):this.complete(a)},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),h},finish:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),w(r),h}},catch:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var r,n,i=this.tryEntries[t];if(i.tryLoc===e)return"throw"===(r=i.completion).type&&(n=r.arg,w(i)),n}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:T(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),h}},e}function o(e){return function(e){if(Array.isArray(e))return a(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 a(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(r="Object"===r&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?a(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 a(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var s=this&&this.__awaiter||function(e,t,r,n){return new(r=r||Promise)((function(i,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))},l=(Object.defineProperty(t,"__esModule",{value:!0}),t.deepArrByMaps=t.map=t.multiArrToArr=t.eachTriggerArray=t.eachTriggerArrGetControls=t.emptyArray=t.delArrEle=t.lastArrayEle=void 0,r(185));function u(e,t,r,n){return s(void 0,void 0,void 0,i().mark((function o(){var a,s,l;return i().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(a=e[t++]){i.next=3;break}return i.abrupt("return",r());case 3:if((s=a())instanceof Promise)return i.next=7,s;i.next=11;break;case 7:l=i.sent,null!=n&&n.eachCb(l,t),i.next=18;break;case 11:if(s.promise&&s.promise instanceof Promise)return null!=n&&n.eachCb(s,t),i.next=15,s.promise;i.next=17;break;case 15:i.next=18;break;case 17:null!=n&&n.eachCb(s,t);case 18:u(e,t,r,n);case 19:case"end":return i.stop()}}),o)})))}function c(e,t){e.map((function(e){if("array"===(0,l.getType)(e))return c(e,t);t.push(e)}))}t.lastArrayEle=function(e){return e.slice(-1)[0]},t.delArrEle=function(e,t){var r=e.slice(0,t);return e=e.slice(t+1),[].concat(o(r),o(e))},t.emptyArray=function(e){return 0===e.length},t.eachTriggerArrGetControls=function(e){var r=new Proxy({run:!0,clean:!1,target:e,index:0,runningAnima:null,eachCb:function(e,t){e.anima&&(r.runningAnima=e.anima),r.index=t}},{set:function(e,t,n){return"clean"===t&&!0===n&&!1===e[t]&&(r.run=!1,r.target.splice(0)),"run"===t&&!1===n&&!0===e[t]&&(console.log(r,"controls"),r.runningAnima&&r.runningAnima.pause()),"run"===t&&!0===n&&!1===e[t]&&r.runningAnima&&r.runningAnima.resume(),e[t]=n,!0}});return e=(0,t.eachTriggerArray)(e,r),{controls:r,promise:e}},t.eachTriggerArray=function(e,t){return new Promise((function(r){return u(e,0,r,t)}))},t.multiArrToArr=function(e){var t=[];return c(e,t),t},t.map=function(e,t){return e.map((function(r,n){return t(r,n,e)})).filter((function(e){return e}))},t.deepArrByMaps=function(e){var r=e.arr,n=e.typeList,i=e.findType;if(e=e.mapType,!r||!n||!i)return r;var a=o(n),s=r.find((function(e){return e[i]===n[0]}));return s?1!==n.length&&s[e]instanceof Array?(a.shift(),(0,t.deepArrByMaps)({arr:s[e],typeList:a,findType:i,mapType:e})):s:r}},594:(e,t,r)=>{"use strict";t.qR=t.js=t.CV=void 0,r(185),t.CV=function(e){return 0===Object.values(e).length},t.js=function(e,t){return Object.keys(e).map((function(r,n){var i=e[r];return t(r,i,n)}))},t.qR=function(e,t){var r=-1;return function e(n){return r++,t.length===r+1?n:e(n[t[r]])}(e)}},251:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},i=(Object.defineProperty(t,"__esModule",{value:!0}),t.getId=t.getMacro=t.getUuid=void 0,n(r(937))),o=n(r(181));t.getUuid=function(){return i.default.UUID1()},t.getMacro=function(e){var t=setTimeout((function(){return clearTimeout(t),t=null,e()}),1<arguments.length&&void 0!==arguments[1]?arguments[1]:0)},t.getId=function(){return(0,o.default)()}},185:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isTrue=t.getType=void 0,t.getType=function(e){if(void 0!==e){if(null===e)return null;var t;switch(e.constructor){case Array:t="Array";break;case Object:t="Object";break;case String:t="String";break;case Number:t="Number";break;case Boolean:t="Boolean";break;case Function:t="Function"}return t&&t.toLowerCase()||"Object"}},t.isTrue=function(e){return!(null==e||!1===e)}},326:e=>{e.exports=function(e,t,r){for(var n=(2<<Math.log(t.length-1)/Math.LN2)-1,i=-~(1.6*n*r/t.length),o="";;)for(var a=e(i),s=i;s--;)if((o+=t[a[s]&n]||"").length===+r)return o}},181:(e,t,r)=>{"use strict";e.exports=r(882)},488:(e,t,r)=>{"use strict";var n,i,o,a=r(87),s="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-";function l(){o=!1}function u(e){if(e){if(e!==n){if(e.length!==s.length)throw new Error("Custom alphabet for shortid must be "+s.length+" unique characters. You submitted "+e.length+" characters: "+e);var t=e.split("").filter((function(e,t,r){return t!==r.lastIndexOf(e)}));if(t.length)throw new Error("Custom alphabet for shortid must be "+s.length+" unique characters. These characters were not unique: "+t.join(", "));n=e,l()}}else n!==s&&(n=s,l())}function c(){return o=o||function(){n||u(s);var e,t=n.split(""),r=[];for(a.nextValue();0<t.length;)e=a.nextValue(),e=Math.floor(e*t.length),r.push(t.splice(e,1)[0]);return r.join("")}()}e.exports={get:function(){return n||s},characters:function(e){return u(e),n},seed:function(e){a.seed(e),i!==e&&(l(),i=e)},lookup:function(e){return c()[e]},shuffled:c}},239:(e,t,r)=>{"use strict";var n,i,o=r(253);r(488),e.exports=function(e){var t="",r=Math.floor(.001*(Date.now()-1567752802062));return r===i?n++:(n=0,i=r),t=(t+=o(7))+o(e),0<n&&(t+=o(n)),t+o(r)}},253:(e,t,r)=>{"use strict";var n=r(488),i=r(19),o=r(326);e.exports=function(e){for(var t,r=0,a="";!t;)a+=o(i,n.get(),1),t=e<Math.pow(16,r+1),r++;return a}},882:(e,t,r)=>{"use strict";var n=r(488),i=r(239),o=r(40),a=r(595)||0;function s(){return i(a)}e.exports=s,e.exports.generate=s,e.exports.seed=function(t){return n.seed(t),e.exports},e.exports.worker=function(t){return a=t,e.exports},e.exports.characters=function(e){return void 0!==e&&n.characters(e),n.shuffled()},e.exports.isValid=o},40:(e,t,r)=>{"use strict";var n=r(488);e.exports=function(e){return!(!e||"string"!=typeof e||e.length<6||new RegExp("[^"+n.get().replace(/[|\\{}()[\]^$+*?.-]/g,"\\$&")+"]").test(e))}},19:e=>{"use strict";function t(e){return(t="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 r="object"===("undefined"==typeof window?"undefined":t(window))&&(window.crypto||window.msCrypto),n=r&&r.getRandomValues?function(e){return r.getRandomValues(new Uint8Array(e))}:function(e){for(var t=[],r=0;r<e;r++)t.push(Math.floor(256*Math.random()));return t};e.exports=n},87:e=>{"use strict";var t=1;e.exports={nextValue:function(){return(t=(9301*t+49297)%233280)/233280},seed:function(e){t=e}}},595:e=>{"use strict";e.exports=0},129:e=>{"use strict";e.exports=n},300:t=>{"use strict";t.exports=e},1:e=>{"use strict";e.exports=o},356:e=>{"use strict";e.exports=i},881:e=>{"use strict";e.exports=r},937:e=>{"use strict";e.exports=t}},l={},a.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return a.d(t,{a:t}),t},a.d=(e,t)=>{for(var r in t)a.o(t,r)&&!a.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),a.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},u={},(()=>{"use strict";a.d(u,{default:()=>Id});var e={},t=(a.r(e),a.d(e,{bindTextureBaseData:()=>Pi,default:()=>Si,disposeTexture:()=>Ei,getBlobByTexture:()=>Oi,getMimeByTexture:()=>_i,getSizeByTexture:()=>Di,getTextureGpuMemory:()=>Mi,getUrlByTexture:()=>Li,initTexture:()=>Ri,loadTexture:()=>Ai,parseImageBitMapByBlob:()=>ki,setTextureMapping:()=>Ci,textureNameMap:()=>Ti}),{}),r=(a.r(t),a.d(t,{angleToNum:()=>ya,anima:()=>_o,arrayBufferToBase64:()=>Do,arrayBufferToBlobUr:()=>Lo,arrayToVector3:()=>fa,base64ToArrayBuffer:()=>ko,base64ToBlob:()=>jo,bitMapToCanvas:()=>Ho,blobToFile:()=>Bo,canvasToBlob:()=>Qo,changeModelOpc:()=>sa,changeModelOpcs:()=>la,clone:()=>aa,compressImgToUrl:()=>Go,deepMergeObject:()=>ba,domTo2Dui:()=>na,domTo3DSprite:()=>ia,domTo3Dui:()=>ra,fileAndBlobToCanvas:()=>Vo,fileToBlob:()=>Uo,getArrIndexByItem:()=>xa,getCamAnimaData:()=>ta,getCurve:()=>da,getDistance:()=>ea,getFilesByDataTransfer:()=>Zo,getImgPixels:()=>Yo,getImgPixels1:()=>qo,getLine2:()=>ma,getMacro:()=>oa,getMd5:()=>Fo,getNamesByNum:()=>ua,getProgress:()=>wa,getRes:()=>Jo,getTruthBase64:()=>Ao,getType:()=>ga,getTypeByBase64:()=>zo,getVideoTexture:()=>pa,getWorldLocal:()=>Mo,hslToRgb:()=>Xo,imgArrayBufferToBlobUrl:()=>Co,imgBitMapToBase64:()=>Eo,imgBitMapToBlob:()=>Po,imgBitMapToBlobAndBase64:()=>Ro,mergeObject:()=>$o,removeUnLess:()=>ha,reverseImg:()=>Oo,rgbToHsl:()=>Wo,setDynamic:()=>va,textureToThreeD:()=>ca,transByte:()=>No,urlToBlob:()=>Io,vector:()=>Ko}),{}),n=(a.r(r),a.d(r,{createDefMaterial:()=>Xa,defAllMaterialMap:()=>Ga,defBaseMaterialMap:()=>Ha,default:()=>Wa,disposeMaterial:()=>Ya,getTextures:()=>Qa,getTexturesByMaterial:()=>Za,initMaterial:()=>Ja,mergeMaterial:()=>qa,setMaterialTexture:()=>Ka}),{}),i=(a.r(n),a.d(n,{createDefModel:()=>as,default:()=>os,disposeModel:()=>ss,instanceModel:()=>ls,setHelper:()=>cs,withAnima:()=>us}),{}),o=(a.r(i),a.d(i,{AsyncCompress:()=>Lu,AsyncDecompress:()=>qu,AsyncDeflate:()=>_u,AsyncGunzip:()=>ju,AsyncGzip:()=>Lu,AsyncInflate:()=>Ou,AsyncUnzipInflate:()=>vc,AsyncUnzlib:()=>Hu,AsyncZipDeflate:()=>pc,AsyncZlib:()=>Nu,Compress:()=>Au,DecodeUTF8:()=>$u,Decompress:()=>Xu,Deflate:()=>Tu,EncodeUTF8:()=>ec,Gunzip:()=>Iu,Gzip:()=>Au,Inflate:()=>Pu,Unzip:()=>yc,UnzipInflate:()=>mc,UnzipPassThrough:()=>fc,Unzlib:()=>Vu,Zip:()=>dc,ZipDeflate:()=>hc,ZipPassThrough:()=>cc,Zlib:()=>zu,compress:()=>Cu,compressSync:()=>Du,decompress:()=>function(e,t,r){if(r||(r=t,t={}),"function"!=typeof r)throw"no callback";return(31==e[0]&&139==e[1]&&8==e[2]?Uu:8!=(15&e[0])||7<e[0]>>4||(e[0]<<8|e[1])%31?Ru:Gu)(e,t,r)},decompressSync:()=>function(e,t){return(31==e[0]&&139==e[1]&&8==e[2]?Bu:8!=(15&e[0])||7<e[0]>>4||(e[0]<<8|e[1])%31?ku:Wu)(e,t)},deflate:()=>Mu,deflateSync:()=>Eu,gunzip:()=>Uu,gunzipSync:()=>Bu,gzip:()=>Cu,gzipSync:()=>Du,inflate:()=>Ru,inflateSync:()=>ku,strFromU8:()=>rc,strToU8:()=>tc,unzip:()=>function(e,t){if("function"!=typeof t)throw"no callback";for(var r=[],n=function(){for(var e=0;e<r.length;++e)r[e]()},i={},o=e.length-22;101010256!=fu(e,o);--o)if(!o||65558<e.length-o)return void t("invalid zip file",null);var a=du(e,o+8);a||t(null,{});var s=a,l=fu(e,o+16),u=4294967295==l;if(u){if(o=fu(e,o-12),101075792!=fu(e,o))return void t("invalid zip file",null);s=a=fu(e,o+32),l=fu(e,o+48)}for(var c=function(o){function s(e,r){e?(n(),t(e,null)):(i[d]=r,--a||t(null,i))}var c=(m=oc(e,l,u))[0],h=m[1],p=m[2],d=m[3],f=m[4],m=m[5];if(m=ic(e,m),l=f,c)if(8==c)if(f=e.subarray(m,m+h),h<32e4)try{s(null,ku(f,new cl(p)))}catch(o){s(o,null)}else r.push(Ru(f,{size:p},s));else s("unknown compression type "+c,null);else s(null,Ul(e,m,m+h))},h=0;h<s;++h)c();return n},unzipSync:()=>function(e){for(var t={},r=e.length-22;101010256!=fu(e,r);--r)if(!r||65558<e.length-r)throw"invalid zip file";var n=du(e,r+8);if(!n)return{};var i=fu(e,r+16),o=4294967295==i;if(o){if(r=fu(e,r-12),101075792!=fu(e,r))throw"invalid zip file";n=fu(e,r+32),i=fu(e,r+48)}for(var a=0;a<n;++a){var s=(p=oc(e,i,o))[0],l=p[1],u=p[2],c=p[3],h=p[4],p=p[5];if(p=ic(e,p),i=h,s){if(8!=s)throw"unknown compression type "+s;t[c]=ku(e.subarray(p,p+l),new cl(u))}else t[c]=Ul(e,p,p+l)}return t},unzlib:()=>Gu,unzlibSync:()=>Wu,zip:()=>function(e,t,r){if(r||(r=t,t={}),"function"!=typeof r)throw"no callback";function n(){for(var e=0;e<p.length;++e)p[e]()}function i(){for(var e=new cl(u+22),t=l,n=u-l,i=u=0;i<c;++i){var o=h[i];try{var a=o.c.length,s=(lc(e,u,o,o.f,o.u,a),30+o.f.length+sc(o.extra)),p=u+s;e.set(o.c,p),lc(e,l,o,o.f,o.u,a,u,o.m),l+=16+s+(o.m?o.m.length:0),u=p+a}catch(e){return r(e,null)}}uc(e,l,h.length,n,t),r(null,e)}var o={},a=(Yu(e,"",o,t),Object.keys(o)),s=a.length,l=0,u=0,c=s,h=new Array(s),p=[];s||i();for(var d=function(e){function t(t,o){t?(n(),r(t,null)):(t=o.length,h[e]=eu(m,{size:y,crc:v.d(),c:o,f:g,m:w,u:b!=c.length||w&&x.length!=S,compression:_}),l+=30+b+T+t,u+=76+2*(b+T)+(S||0)+t,--s||i())}var c=a[e],d=o[c],f=d[0],m=d[1],v=Kl(),y=f.length,g=(v.p(f),tc(c)),b=g.length,x=m.comment,w=x&&tc(x),S=w&&w.length,T=sc(m.extra),_=0==m.level?0:8;if(65535<b&&t("filename too long",null),_)if(y<16e4)try{t(null,Eu(f,m))}catch(d){t(d,null)}else p.push(Mu(f,m,t));else t(null,f)},f=0;f<c;++f)d(f);return n},zipSync:()=>function(e,t){var r,n={},i=[],o=(Yu(e,"",n,t=t||{}),0),a=0;for(r in n){var s,l=(s=n[r])[0],u=0==(s=s[1]).level?0:8,c=(x=tc(r)).length,h=s.comment,p=h&&tc(h),d=p&&p.length,f=sc(s.extra);if(65535<c)throw"filename too long";var m=u?Eu(l,s):l,v=m.length,y=Kl();y.p(l),i.push(eu(s,{size:l.length,crc:y.d(),c:m,f:x,m:p,u:c!=r.length||p&&h.length!=d,o,compression:u})),o+=30+c+f+v,a+=76+2*(c+f)+(d||0)+v}for(var g=new cl(a+22),b=(e=o,t=a-o,0);b<i.length;++b){var x=i[b],w=(lc(g,x.o,x,x.f,x.u,x.c.length),30+x.f.length+sc(x.extra));g.set(x.c,x.o+w),lc(g,o,x,x.f,x.u,x.c.length,x.o,x.m),o+=16+w+(x.m?x.m.length:0)}return uc(g,o,i.length,t,e),g},zlib:()=>function(e,t,r){if(r||(r=t,t={}),"function"!=typeof r)throw"no callback";return pu(e,t,[ou,lu,function(){return[Fu]}],(function(e){return cu(Fu(e.data[0],e.data[1]))}),4,r)},zlibSync:()=>Fu}),a(300)),s=a.n(o),l=a(251),c=a(881);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,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function d(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function f(e,t,r){return t&&d(e.prototype,t),r&&d(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function m(){return(m="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=b(e)););return e}(e,t);if(n)return(n=Object.getOwnPropertyDescriptor(n,t)).get?n.get.call(arguments.length<3?e:r):n.value}).apply(this,arguments)}function v(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&&y(e,t)}function y(e,t){return(y=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function g(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=b(e);if(r=t?(r=b(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===h(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function b(e){return(b=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var x=new c.Vector3,w=new c.Quaternion,S=new c.Vector3,T=function(){v(t,c.Object3D);var e=g(t);function t(){var r,n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:document.createElement("div");return p(this,t),(r=e.call(this)).element=n,r.element.style.position="absolute",r.element.style.pointerEvents="auto",r.element.style.userSelect="none",r.element.setAttribute("draggable",!1),r.addEventListener("removed",(function(){this.traverse((function(e){e.element instanceof Element&&null!==e.element.parentNode&&e.element.parentNode.removeChild(e.element)}))})),r}return f(t,[{key:"copy",value:function(e,r){return m(b(t.prototype),"copy",this).call(this,e,r),this.element=e.element.cloneNode(!0),this}}]),t}(),_=(T.prototype.isCSS3DObject=!0,function(){v(t,T);var e=g(t);function t(r){return p(this,t),(r=e.call(this,r)).rotation2D=0,r}return f(t,[{key:"copy",value:function(e,r){return m(b(t.prototype),"copy",this).call(this,e,r),this.rotation2D=e.rotation2D,this}}]),t}()),M=(_.prototype.isCSS3DSprite=!0,new c.Matrix4),E=new c.Matrix4,P=f((function e(){var t,r,n,i,o=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},a=(p(this,e),this),s={camera:{fov:0,style:""},objects:new WeakMap},l=void 0!==o.element?o.element:document.createElement("div"),u=(l.style.overflow="hidden",this.domElement=l,document.createElement("div"));function c(e){return Math.abs(e)<1e-10?0:e}function h(e){return"matrix3d("+c((e=e.elements)[0])+","+c(-e[1])+","+c(e[2])+","+c(e[3])+","+c(e[4])+","+c(-e[5])+","+c(e[6])+","+c(e[7])+","+c(e[8])+","+c(-e[9])+","+c(e[10])+","+c(e[11])+","+c(e[12])+","+c(-e[13])+","+c(e[14])+","+c(e[15])+")"}function d(e){return"translate(-50%,-50%)matrix3d("+c((e=e.elements)[0])+","+c(e[1])+","+c(e[2])+","+c(e[3])+","+c(-e[4])+","+c(-e[5])+","+c(-e[6])+","+c(-e[7])+","+c(e[8])+","+c(e[9])+","+c(e[10])+","+c(e[11])+","+c(e[12])+","+c(e[13])+","+c(e[14])+","+c(e[15])+")"}u.style.transformStyle="preserve-3d",u.style.pointerEvents="none",l.appendChild(u),this.getSize=function(){return{width:t,height:r}},this.render=function(e,t){var r=t.projectionMatrix.elements[5]*i,o=(s.camera.fov!==r&&(l.style.perspective=t.isPerspectiveCamera?r+"px":"",s.camera.fov=r),!0===e.autoUpdate&&e.updateMatrixWorld(),null===t.parent&&t.updateMatrixWorld(),t.isOrthographicCamera&&(o=-(t.right+t.left)/2,p=(t.top+t.bottom)/2),t.isOrthographicCamera?"scale("+r+")translate("+c(o)+"px,"+c(p)+"px)"+h(t.matrixWorldInverse):"translateZ("+r+"px)"+h(t.matrixWorldInverse)),p=o+"translate("+n+"px,"+i+"px)";s.camera.style!==p&&(u.style.transform=p,s.camera.style=p),function e(t,r,n,i){var o,l,c;t.isCSS3DObject&&(o=!0===t.visible&&!0===t.layers.test(n.layers),t.element.style.display=1==o?"":"none",1==o&&(t.onBeforeRender(a,r,n),o=t.isCSS3DSprite?(M.copy(n.matrixWorldInverse),M.transpose(),0!==t.rotation2D&&M.multiply(E.makeRotationZ(t.rotation2D)),t.matrixWorld.decompose(x,w,S),M.setPosition(x),M.scale(S),M.elements[3]=0,M.elements[7]=0,M.elements[11]=0,M.elements[15]=1,d(M)):d(t.matrixWorld),l=t.element,void 0!==(c=s.objects.get(t))&&c.style===o||(c={style:l.style.transform=o},s.objects.set(t,c)),l.parentNode!==u&&u.appendChild(l),t.onAfterRender(a,r,n)));for(var h=0,p=t.children.length;h<p;h++)e(t.children[h],r,n,i)}(e,e,t,o)},this.setSize=function(e,o){n=(t=e)/2,i=(r=o)/2,l.style.width=e+"px",l.style.height=o+"px",u.style.width=e+"px",u.style.height=o+"px"}}));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 R(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function k(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function A(e,t,r){return t&&k(e.prototype,t),r&&k(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function L(){return(L="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=D(e)););return e}(e,t);if(n)return(n=Object.getOwnPropertyDescriptor(n,t)).get?n.get.call(arguments.length<3?e:r):n.value}).apply(this,arguments)}function C(e,t){return(C=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function D(e){return(D=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}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");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&C(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=D(e);if(r=t?(r=D(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===O(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(){var e,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:document.createElement("div");return R(this,n),(e=r.call(this)).element=t,e.element.style.position="absolute",e.element.style.userSelect="none",e.element.setAttribute("draggable",!1),e.addEventListener("removed",(function(){this.traverse((function(e){e.element instanceof Element&&null!==e.element.parentNode&&e.element.parentNode.removeChild(e.element)}))})),e}return A(n,[{key:"copy",value:function(e,t){return L(D(n.prototype),"copy",this).call(this,e,t),this.element=e.element.cloneNode(!0),this}}]),n}(c.Object3D),j=(I.prototype.isCSS2DObject=!0,new c.Vector3),U=new c.Matrix4,B=new c.Matrix4,z=new c.Vector3,N=new c.Vector3,F=A((function e(){var t,r,n,i,o=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},a=(R(this,e),this),s={objects:new WeakMap},l=void 0!==o.element?o.element:document.createElement("div");function u(e,t){return z.setFromMatrixPosition(e.matrixWorld),N.setFromMatrixPosition(t.matrixWorld),z.distanceToSquared(N)}l.style.overflow="hidden",this.domElement=l,this.getSize=function(){return{width:t,height:r}},this.render=function(e,t){!0===e.autoUpdate&&e.updateMatrixWorld(),null===t.parent&&t.updateMatrixWorld(),U.copy(t.matrixWorldInverse),B.multiplyMatrices(t.projectionMatrix,U),function e(t,r,o){var c;t.isCSS2DObject&&(j.setFromMatrixPosition(t.matrixWorld),j.applyMatrix4(B),c=!0===t.visible&&-1<=j.z&&j.z<=1&&!0===t.layers.test(o.layers),t.element.style.display=1==c?"":"none",1==c&&(t.onBeforeRender(a,r,o),c=t.element,/apple/i.test(navigator.vendor)?c.style.transform="translate(-50%,-50%) translate("+Math.round(j.x*n+n)+"px,"+Math.round(-j.y*i+i)+"px)":c.style.transform="translate(-50%,-50%) translate("+(j.x*n+n)+"px,"+(-j.y*i+i)+"px)",c.parentNode!==l&&l.appendChild(c),t.onAfterRender(a,r,o)),c={distanceToCameraSquared:u(o,t)},s.objects.set(t,c));for(var h=0,p=t.children.length;h<p;h++)e(t.children[h],r,o)}(e,e,t);for(var r=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:s.objects.get(e).distanceToCameraSquared-s.objects.get(t).distanceToCameraSquared})),o=r.length,c=0,h=r.length;c<h;c++)r[c].element.style.zIndex=o-c},this.setSize=function(e,o){n=(t=e)/2,i=(r=o)/2,l.style.width=e+"px",l.style.height=o+"px"}}));class V{constructor(e){this.scene=null,this.camera=null,this.controls=null,this.renderer=null,this.engineDom=null,this.disposeRender=e=>{e&&(e.render=()=>{},e.domElement.remove())},this.runScene=e}initRender3(){const e=new P;return e.setSize(this.engineDom.clientWidth,this.engineDom.clientHeight),e.domElement.style.position="absolute",e.domElement.style.top=String(0),e.domElement.className="css3dRenderer",this.engineDom.appendChild(e.domElement),e}initRender2(){const e=new F;return e.setSize(this.engineDom.clientWidth,this.engineDom.clientHeight),e.domElement.style.position="absolute",e.domElement.classList.add("css2dRenderer"),e.domElement.style.top="0px",e.domElement.style.left="0px",this.engineDom.insertBefore(e.domElement,this.engineDom.childNodes[0]),e}reset(){this.renderer=this.runScene.renderEx.create(this.engineDom),this.runScene.renderEx.setSize(),this.renderer.setAnimationLoop(this.runScene.render.bind(this.runScene));var e=this.camera;this.controls=this.runScene.controlsEx.create(e,this.renderer.domElement)}dispose(){this.disposeRender(this.render2),this.disposeRender(this.render3)}init(e){var t=this.runScene.sceneEx.create(),r=this.runScene.cameraEx.create();const n=this.runScene.renderEx.create(e);var i=this.runScene.controlsEx.create(r,e),{render2:o,render3:a}=this.runScene.optionsEx.options;return this.camera=r,this.scene=t,this.renderer=n,this.controls=i,this.engineDom=e,this.runScene.renderEx.setSize(),o&&(this.render2=this.initRender2()),a&&(this.render3=this.initRender3()),n.setAnimationLoop(this.runScene.render.bind(this.runScene)),{scene:t,camera:r,render:n,controls:i,engineDom:e}}get(){var{scene:e,camera:t,renderer:r,controls:n,engineDom:i}=this;return{scene:e,camera:t,renderer:r,controls:n,engineDom:i}}}var H={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\tgl_FragColor = texture2D( tDiffuse, vUv );\n\t\t\tgl_FragColor.a *= opacity;\n\n\n\t\t}"};function G(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function W(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function X(e,t,r){t&&W(e.prototype,t),r&&W(e,r),Object.defineProperty(e,"prototype",{writable:!1})}var q=function(){function e(){G(this,e),this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}return X(e,[{key:"setSize",value:function(){}},{key:"render",value:function(){console.error("THREE.Pass: .render() must be implemented in derived pass.")}}]),e}(),Y=new c.OrthographicCamera(-1,1,1,-1,0,1),Z=new c.BufferGeometry,Q=(Z.setAttribute("position",new c.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3)),Z.setAttribute("uv",new c.Float32BufferAttribute([0,2,0,0,2,0],2)),function(){function e(t){G(this,e),this._mesh=new c.Mesh(Z,t)}return X(e,[{key:"dispose",value:function(){this._mesh.geometry.dispose()}},{key:"render",value:function(e){e.render(this._mesh,Y)}},{key:"material",get:function(){return this._mesh.material},set:function(e){this._mesh.material=e}}]),e}());function K(e){return(K="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 J(e,t){return(J=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function $(e){return($=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var ee=function(){var e=n,t=q;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&&J(e,t);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=$(e);if(r=t?(r=$(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===K(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(e,t){var i;if(this instanceof n)return(i=r.call(this)).textureID=void 0!==t?t:"tDiffuse",e instanceof c.ShaderMaterial?(i.uniforms=e.uniforms,i.material=e):e&&(i.uniforms=c.UniformsUtils.clone(e.uniforms),i.material=new c.ShaderMaterial({defines:Object.assign({},e.defines),uniforms:i.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),i.fsQuad=new Q(i.material),i;throw new TypeError("Cannot call a class as a function")}return e=n,(t=[{key:"render",value:function(e,t,r){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=r.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)}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),n}(),te={shaderID:"luminosityHighPass",uniforms:{tDiffuse:{value:null},luminosityThreshold:{value:1},smoothWidth:{value:1},defaultColor:{value:new c.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 re(e){return(re="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 ne(e,t){return(ne=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ie(e){return(ie=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var oe=function(){var e=n,t=q;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&&ne(e,t);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=ie(e);if(r=t?(r=ie(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===re(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(e,t,i,o){var a;if(!(this instanceof n))throw new TypeError("Cannot call a class as a function");(a=r.call(this)).strength=void 0!==t?t:1,a.radius=i,a.threshold=o,a.resolution=void 0!==e?new c.Vector2(e.x,e.y):new c.Vector2(256,256),a.clearColor=new c.Color(0,0,0),a.renderTargetsHorizontal=[],a.renderTargetsVertical=[],a.nMips=5;var s=Math.round(a.resolution.x/2),l=Math.round(a.resolution.y/2);a.renderTargetBright=new c.WebGLRenderTarget(s,l),a.renderTargetBright.texture.name="UnrealBloomPass.bright",a.renderTargetBright.texture.generateMipmaps=!1;for(var u=0;u<a.nMips;u++){var h;((h=new c.WebGLRenderTarget(s,l)).texture.name="UnrealBloomPass.h"+u,h.texture.generateMipmaps=!1,a.renderTargetsHorizontal.push(h),h=new c.WebGLRenderTarget(s,l)).texture.name="UnrealBloomPass.v"+u,h.texture.generateMipmaps=!1,a.renderTargetsVertical.push(h),s=Math.round(s/2),l=Math.round(l/2)}i=te;for(var p=(a.highPassUniforms=c.UniformsUtils.clone(i.uniforms),a.highPassUniforms.luminosityThreshold.value=o,a.highPassUniforms.smoothWidth.value=.01,a.materialHighPassFilter=new c.ShaderMaterial({uniforms:a.highPassUniforms,vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,defines:{}}),a.separableBlurMaterials=[],[3,5,7,9,11]),d=(s=Math.round(a.resolution.x/2),l=Math.round(a.resolution.y/2),0);d<a.nMips;d++)a.separableBlurMaterials.push(a.getSeperableBlurMaterial(p[d])),a.separableBlurMaterials[d].uniforms.texSize.value=new c.Vector2(s,l),s=Math.round(s/2),l=Math.round(l/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.needsUpdate=!0,a.compositeMaterial.uniforms.bloomFactors.value=[1,.8,.6,.4,.2],a.bloomTintColors=[new c.Vector3(1,1,1),new c.Vector3(1,1,1),new c.Vector3(1,1,1),new c.Vector3(1,1,1),new c.Vector3(1,1,1)],a.compositeMaterial.uniforms.bloomTintColors.value=a.bloomTintColors,e=H,a.copyUniforms=c.UniformsUtils.clone(e.uniforms),a.copyUniforms.opacity.value=1,a.materialCopy=new c.ShaderMaterial({uniforms:a.copyUniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader,blending:c.AdditiveBlending,depthTest:!1,depthWrite:!1,transparent:!0}),a.enabled=!0,a.needsSwap=!1,a._oldClearColor=new c.Color,a.oldClearAlpha=1,a.basic=new c.MeshBasicMaterial,a.fsQuad=new Q(null),a}return e=n,(t=[{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()}},{key:"setSize",value:function(e,t){var r=Math.round(e/2),n=Math.round(t/2);this.renderTargetBright.setSize(r,n);for(var i=0;i<this.nMips;i++)this.renderTargetsHorizontal[i].setSize(r,n),this.renderTargetsVertical[i].setSize(r,n),this.separableBlurMaterials[i].uniforms.texSize.value=new c.Vector2(r,n),r=Math.round(r/2),n=Math.round(n/2)}},{key:"render",value:function(e,t,r,i,o){e.getClearColor(this._oldClearColor),this.oldClearAlpha=e.getClearAlpha();for(var a=e.autoClear,s=(e.autoClear=!1,e.setClearColor(this.clearColor,0),o&&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=s.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),s=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.materialCopy,this.copyUniforms.tDiffuse.value=this.renderTargetsHorizontal[0].texture,o&&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=a}},{key:"getSeperableBlurMaterial",value:function(e){return new c.ShaderMaterial({defines:{KERNEL_RADIUS:e,SIGMA:e},uniforms:{colorTexture:{value:null},texSize:{value:new c.Vector2(.5,.5)},direction:{value:new c.Vector2(.5,.5)}},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 texSize;\n\t\t\t\tuniform vec2 direction;\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\t\t\t\tvoid main() {\n\t\t\t\t\tvec2 invSize = 1.0 / texSize;\n\t\t\t\t\tfloat fSigma = float(SIGMA);\n\t\t\t\t\tfloat weightSum = gaussianPdf(0.0, fSigma);\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 = gaussianPdf(x, fSigma);\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 c.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 r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),n}();function ae(e){return(ae="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 se(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function le(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function ue(e,t,r){t&&le(e.prototype,t),r&&le(e,r),Object.defineProperty(e,"prototype",{writable:!1})}function ce(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&&he(e,t)}function he(e,t){return(he=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function pe(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=de(e);if(r=t?(r=de(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===ae(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function de(e){return(de=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}oe.BlurDirectionX=new c.Vector2(1,0),oe.BlurDirectionY=new c.Vector2(0,1);var fe=function(){ce(t,q);var e=pe(t);function t(r,n){var i;return se(this,t),(i=e.call(this)).scene=r,i.camera=n,i.clear=!0,i.needsSwap=!1,i.inverse=!1,i}return ue(t,[{key:"render",value:function(e,t,r){var n,i,o=e.getContext(),a=e.state;a.buffers.color.setMask(!1),a.buffers.depth.setMask(!1),a.buffers.color.setLocked(!0),a.buffers.depth.setLocked(!0),i=this.inverse?(n=0,1):(n=1,0),a.buffers.stencil.setTest(!0),a.buffers.stencil.setOp(o.REPLACE,o.REPLACE,o.REPLACE),a.buffers.stencil.setFunc(o.ALWAYS,n,4294967295),a.buffers.stencil.setClear(i),a.buffers.stencil.setLocked(!0),e.setRenderTarget(r),this.clear&&e.clear(),e.render(this.scene,this.camera),e.setRenderTarget(t),this.clear&&e.clear(),e.render(this.scene,this.camera),a.buffers.color.setLocked(!1),a.buffers.depth.setLocked(!1),a.buffers.stencil.setLocked(!1),a.buffers.stencil.setFunc(o.EQUAL,1,4294967295),a.buffers.stencil.setOp(o.KEEP,o.KEEP,o.KEEP),a.buffers.stencil.setLocked(!0)}}]),t}(),me=function(){ce(t,q);var e=pe(t);function t(){var r;return se(this,t),(r=e.call(this)).needsSwap=!1,r}return ue(t,[{key:"render",value:function(e){e.state.buffers.stencil.setLocked(!1),e.state.buffers.stencil.setTest(!1)}}]),t}();function ve(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var ye=function(){function e(t,r){var n;(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,e),this.renderer=t,void 0===r?(n=t.getSize(new c.Vector2),this._pixelRatio=t.getPixelRatio(),this._width=n.width,this._height=n.height,(r=new c.WebGLRenderTarget(this._width*this._pixelRatio,this._height*this._pixelRatio)).texture.name="EffectComposer.rt1"):(this._pixelRatio=1,this._width=r.width,this._height=r.height),this.renderTarget1=r,this.renderTarget2=r.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,this.passes=[],void 0===ee&&console.error("THREE.EffectComposer relies on ShaderPass"),this.copyPass=new ee(H),this.clock=new c.Clock}return function(e,t,r){t&&ve(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1})}(e,[{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(),r=!1,n=0,i=this.passes.length;n<i;n++){var o,a,s=this.passes[n];!1!==s.enabled&&(s.renderToScreen=this.renderToScreen&&this.isLastEnabledPass(n),s.render(this.renderer,this.writeBuffer,this.readBuffer,e,r),s.needsSwap&&(r&&(o=this.renderer.getContext(),(a=this.renderer.state.buffers.stencil).setFunc(o.NOTEQUAL,1,4294967295),this.copyPass.render(this.renderer,this.writeBuffer,this.readBuffer,e),a.setFunc(o.EQUAL,1,4294967295)),this.swapBuffers()),void 0!==fe&&(s instanceof fe?r=!0:s instanceof me&&(r=!1)))}this.renderer.setRenderTarget(t)}},{key:"reset",value:function(e){var t;void 0===e&&(t=this.renderer.getSize(new c.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 r=this._width*this._pixelRatio,n=this._height*this._pixelRatio;this.renderTarget1.setSize(r,n),this.renderTarget2.setSize(r,n);for(var i=0;i<this.passes.length;i++)this.passes[i].setSize(r,n)}},{key:"setPixelRatio",value:function(e){this._pixelRatio=e,this.setSize(this._width,this._height)}}]),e}();function ge(e){return(ge="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 be(e,t){return(be=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function xe(e){return(xe=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}new c.OrthographicCamera(-1,1,1,-1,0,1),(o=new c.BufferGeometry).setAttribute("position",new c.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3)),o.setAttribute("uv",new c.Float32BufferAttribute([0,2,0,0,2,0],2));var we=function(){var e=n,t=q;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&&be(e,t);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=xe(e);if(r=t?(r=xe(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===ge(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(e,t,i,o){var a;if(!(this instanceof n))throw new TypeError("Cannot call a class as a function");return(a=r.call(this)).scene=e,a.camera=t,a.sampleLevel=4,a.unbiased=!0,a.clearColor=void 0!==i?i:0,a.clearAlpha=void 0!==o?o:0,a._oldClearColor=new c.Color,e=H,a.copyUniforms=c.UniformsUtils.clone(e.uniforms),a.copyMaterial=new c.ShaderMaterial({uniforms:a.copyUniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader,transparent:!0,blending:c.AdditiveBlending,depthTest:!1,depthWrite:!1}),a.fsQuad=new Q(a.copyMaterial),a}return e=n,(t=[{key:"dispose",value:function(){this.sampleRenderTarget&&(this.sampleRenderTarget.dispose(),this.sampleRenderTarget=null)}},{key:"setSize",value:function(e,t){this.sampleRenderTarget&&this.sampleRenderTarget.setSize(e,t)}},{key:"render",value:function(e,t,r){this.sampleRenderTarget||(this.sampleRenderTarget=new c.WebGLRenderTarget(r.width,r.height),this.sampleRenderTarget.texture.name="SSAARenderPass.sample");var n=Se[Math.max(0,Math.min(this.sampleLevel,5))],i=e.autoClear,o=(e.autoClear=!1,e.getClearColor(this._oldClearColor),e.getClearAlpha()),a=1/n.length,s=(this.copyUniforms.tDiffuse.value=this.sampleRenderTarget.texture,{fullWidth:r.width,fullHeight:r.height,offsetX:0,offsetY:0,width:r.width,height:r.height});(r=Object.assign({},this.camera.view)).enabled&&Object.assign(s,r);for(var l=0;l<n.length;l++){var u=n[l];this.camera.setViewOffset&&this.camera.setViewOffset(s.fullWidth,s.fullHeight,s.offsetX+.0625*u[0],s.offsetY+.0625*u[1],s.width,s.height),u=a,this.unbiased&&(u+=1/32*((l+.5)/n.length-.5)),this.copyUniforms.opacity.value=u,e.setClearColor(this.clearColor,this.clearAlpha),e.setRenderTarget(this.sampleRenderTarget),e.clear(),e.render(this.scene,this.camera),e.setRenderTarget(this.renderToScreen?null:t),0===l&&(e.setClearColor(0,0),e.clear()),this.fsQuad.render(e)}this.camera.setViewOffset&&r.enabled?this.camera.setViewOffset(r.fullWidth,r.fullHeight,r.offsetX,r.offsetY,r.width,r.height):this.camera.clearViewOffset&&this.camera.clearViewOffset(),e.autoClear=i,e.setClearColor(this._oldClearColor,o)}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),n}(),Se=[[[0,0]],[[4,4],[-4,-4]],[[-2,-6],[6,-2],[-6,2],[2,6]],[[1,-3],[-1,3],[5,1],[-3,-5],[-5,5],[-7,-1],[3,7],[7,-7]],[[1,1],[-1,-3],[-3,2],[4,-1],[-5,-2],[2,5],[5,3],[3,-5],[-2,6],[0,-7],[-4,-6],[-6,4],[-8,0],[7,-4],[6,7],[-7,-8]],[[-4,-7],[-7,-5],[-3,-5],[-5,-4],[-1,-4],[-2,-2],[-6,-1],[-4,0],[-7,1],[-1,2],[-6,3],[-3,3],[-7,6],[-3,6],[-5,7],[-1,7],[5,-7],[1,-6],[6,-5],[4,-4],[2,-3],[7,-2],[1,-1],[4,-1],[2,1],[6,2],[0,4],[4,4],[2,5],[7,5],[5,6],[3,7]]];function Te(e){return(Te="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 _e(){return(_e="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=Ee(e)););return e}(e,t);if(n)return(n=Object.getOwnPropertyDescriptor(n,t)).get?n.get.call(arguments.length<3?e:r):n.value}).apply(this,arguments)}function Me(e,t){return(Me=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Ee(e){return(Ee=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Pe=function(){var e=n,t=we;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&&Me(e,t);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Ee(e);if(r=t?(r=Ee(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Te(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(e,t,i,o){if(this instanceof n)return(e=r.call(this,e,t,i,o)).sampleLevel=0,e.accumulate=!1,e;throw new TypeError("Cannot call a class as a function")}return e=n,(t=[{key:"render",value:function(e,t,r,i){if(!1===this.accumulate)return _e(Ee(n.prototype),"render",this).call(this,e,t,r,i),void(this.accumulateIndex=-1);var o=Oe[5],a=(void 0===this.sampleRenderTarget&&(this.sampleRenderTarget=new c.WebGLRenderTarget(r.width,r.height,this.params),this.sampleRenderTarget.texture.name="TAARenderPass.sample"),void 0===this.holdRenderTarget&&(this.holdRenderTarget=new c.WebGLRenderTarget(r.width,r.height,this.params),this.holdRenderTarget.texture.name="TAARenderPass.hold"),-1===this.accumulateIndex&&(_e(Ee(n.prototype),"render",this).call(this,e,this.holdRenderTarget,r,i),this.accumulateIndex=0),i=e.autoClear,e.autoClear=!1,1/o.length);if(0<=this.accumulateIndex&&this.accumulateIndex<o.length){this.copyUniforms.opacity.value=a,this.copyUniforms.tDiffuse.value=t.texture;for(var s=Math.pow(2,this.sampleLevel),l=0;l<s;l++){var u=o[this.accumulateIndex];if(this.camera.setViewOffset&&this.camera.setViewOffset(r.width,r.height,.0625*u[0],.0625*u[1],r.width,r.height),e.setRenderTarget(t),e.clear(),e.render(this.scene,this.camera),e.setRenderTarget(this.sampleRenderTarget),0===this.accumulateIndex&&e.clear(),this.fsQuad.render(e),this.accumulateIndex++,this.accumulateIndex>=o.length)break}this.camera.clearViewOffset&&this.camera.clearViewOffset()}0<(a=this.accumulateIndex*a)&&(this.copyUniforms.opacity.value=1,this.copyUniforms.tDiffuse.value=this.sampleRenderTarget.texture,e.setRenderTarget(t),e.clear(),this.fsQuad.render(e)),a<1&&(this.copyUniforms.opacity.value=1-a,this.copyUniforms.tDiffuse.value=this.holdRenderTarget.texture,e.setRenderTarget(t),0==a&&e.clear(),this.fsQuad.render(e)),e.autoClear=i}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),n}(),Oe=[[[0,0]],[[4,4],[-4,-4]],[[-2,-6],[6,-2],[-6,2],[2,6]],[[1,-3],[-1,3],[5,1],[-3,-5],[-5,5],[-7,-1],[3,7],[7,-7]],[[1,1],[-1,-3],[-3,2],[4,-1],[-5,-2],[2,5],[5,3],[3,-5],[-2,6],[0,-7],[-4,-6],[-6,4],[-8,0],[7,-4],[6,7],[-7,-8]],[[-4,-7],[-7,-5],[-3,-5],[-5,-4],[-1,-4],[-2,-2],[-6,-1],[-4,0],[-7,1],[-1,2],[-6,3],[-3,3],[-7,6],[-3,6],[-5,7],[-1,7],[5,-7],[1,-6],[6,-5],[4,-4],[2,-3],[7,-2],[1,-1],[4,-1],[2,1],[6,2],[0,4],[4,4],[2,5],[7,5],[5,6],[3,7]]];class Re extends q{constructor(e,t,r){super(),this.baseTextureID=void 0!==t?t:"tDiffuse",this.effectTextureID=void 0!==r?r:"tDiffuse",e instanceof c.ShaderMaterial?(this.uniforms=e.uniforms,this.material=e):e&&(this.uniforms=c.UniformsUtils.clone(e.uniforms),this.material=new c.ShaderMaterial({defines:Object.assign({},e.defines),uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),this.fsQuad=new Q(this.material)}render(e,t,r){this.uniforms[this.baseTextureID]&&(this.uniforms[this.baseTextureID].value=t.texture),this.uniforms[this.effectTextureID]&&(this.uniforms[this.effectTextureID].value=r.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 ke extends q{constructor(e,t,r,n,i){super(),this.scene=e,this.camera=t,this.layerIndex=0,this.overrideMaterial=r,this.clearColor=n,this.clearAlpha=void 0!==i?i:0,this.clear=!0,this.clearDepth=!1,this.needsSwap=!1,this.oldClearColor=new c.Color,this.oldCameraLayer=t.layers.mask}render(e,t,r){var n=e.autoClear;let i,o;e.autoClear=!1,void 0!==this.overrideMaterial&&(o=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:r),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.clearColor&&e.setClearColor(this.oldClearColor,i),void 0!==this.overrideMaterial&&(this.scene.overrideMaterial=o),this.scene.background=this.sceneBg,e.autoClear=n}}const Ae={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 Le{constructor(e){this.modelLength=new Set,this.runScene=e,this.init()}init(){const{setLayers:e,add:t,remove:r}=this.runScene.optionsEx.cb.model;e.add("glow-set-layers",(e=>{var{model:e,val:t}=e;0===t&&0===this.modelLength.size||this[0===t?"remove":"add"](e)})),r.add("glow-set-layers",(({model:e})=>{1!==e.layers.mask&&this.remove(e)})),t.add("glow-set-layers",(({model:e})=>{1!==e.layers.mask&&this.add(e)}))}add(e){this.modelLength.add(e.userData.id),0<this.modelLength.size&&(this.runScene.optionsEx.cb.bloom.glow.setStatus.cb(!0),this.runScene.bloom.glow.bloomParams.isBloom=!0)}remove(e){this.modelLength.delete(e.userData.id),this.modelLength.size<=0&&(this.runScene.optionsEx.cb.bloom.glow.setStatus.cb(!1),this.runScene.bloom.glow.bloomParams.isBloom=!1)}}class Ce{constructor(e){this.bloomParams={isBloom:!1,bloomStrength:2,bloomThreshold:0,bloomRadius:0},this.runScene=e,this.info=new Le(this.runScene),this.BLOOM_SCENE=1,this.bloomParams.isBloom=!1,this.isUpdate=!0,this.sceneBackground=null,this.runScene.exporter.gltf.options.addOption({type:"bloom-glow",process:e=>this.toJSON(),parse:e=>{e=JSON.parse(e),this.setData(e)}})}static getInstance(e){return Ce.instance||(Ce.instance=new Ce(e)),Ce.instance}set rendererTone(e){this.renderer&&(this.renderer.toneMapping=e?c.ACESFilmicToneMapping:c.NoToneMapping)}init(e){var{camera:e,scene:t,renderer:r}=e;this.mainScene=t,this.mainCamera=e,this.renderer=r,this.renderer&&(t=this.renderer.getDrawingBufferSize(new c.Vector2),this.rtSize={width:t.width,height:t.height},this.postProcessing())}setData(e){e=e.bloomParams;var{bloomRadius:e,bloomStrength:t,bloomThreshold:r,isBloom:n}=e;this.bloomParams.isBloom=n,this.bloomParams.bloomRadius=e,this.bloomParams.bloomStrength=t,this.bloomParams.bloomThreshold=r,this.bloomPass&&(this.bloomPass.strength=t,this.bloomPass.radius=e,this.bloomPass.threshold=r),this.runScene.optionsEx.cb.bloom.glow.setData.cb(this.bloomParams)}setSize(e,t){this.renderer&&(this.rtSize={width:e,height:t},this.effectComposer&&this.effectComposer.setSize(this.rtSize.width,this.rtSize.height))}setBackground(e){this.sceneBackground&&this.sceneBackground instanceof c.Texture&&this.sceneBackground.dispose(),this.sceneBackground=e,this.bloomRenderPass&&(this.bloomRenderPass.sceneBg=this.sceneBackground)}setUpdate(e){this.isUpdate=e}postProcessing(){this.renderer&&(this.renderer.autoClear=!1),this.effectRT?(this.effectRT.setSize(this.rtSize.width,this.rtSize.height),this.effectRT.depthTexture.dispose()):(this.effectRT=new c.WebGLRenderTarget(this.rtSize.width,this.rtSize.height),this.effectRT.texture.name="EffectComposer.pass",this.effectRT.texture.type=c.FloatType,this.effectRT.texture.format=c.RGBAFormat,this.effectRT.texture.encoding=c.sRGBEncoding,this.effectRT.texture.minFilter=c.LinearFilter,this.effectRT.texture.magFilter=c.LinearFilter),this.effectRT.depthTexture=new c.DepthTexture(this.rtSize.width,this.rtSize.height),this.effectRT.depthTexture.format=c.DepthFormat,this.effectRT.depthTexture.type=c.UnsignedIntType,this.taaRenderPass?(this.taaRenderPass.scene=this.mainScene,this.taaRenderPass.camera=this.mainCamera):(this.taaRenderPass=new Pe(this.mainScene,this.mainCamera,0,0),this.taaRenderPass.unbiased=!1,this.taaRenderPass.sampleLevel=1,this.taaRenderPass.accumulate=!1),this.sampleRT?this.sampleRT.setSize(this.rtSize.width,this.rtSize.height):(this.sampleRT=new c.WebGLRenderTarget(this.rtSize.width,this.rtSize.height),this.sampleRT.texture.name="TAARenderPass.sample",this.sampleRT.texture.type=c.FloatType,this.sampleRT.texture.format=c.RGBAFormat,this.sampleRT.texture.encoding=c.sRGBEncoding,this.sampleRT.texture.minFilter=c.LinearFilter,this.sampleRT.texture.magFilter=c.LinearFilter,this.sampleRT.depthTexture=this.effectRT.depthTexture,this.taaRenderPass.sampleRenderTarget=this.sampleRT),this.holdRT?this.holdRT.setSize(this.rtSize.width,this.rtSize.height):(this.holdRT=new c.WebGLRenderTarget(this.rtSize.width,this.rtSize.height),this.holdRT.texture.name="TAARenderPass.hold",this.holdRT.texture.type=c.FloatType,this.holdRT.texture.format=c.RGBAFormat,this.holdRT.texture.encoding=c.sRGBEncoding,this.holdRT.texture.minFilter=c.LinearFilter,this.holdRT.texture.magFilter=c.LinearFilter,this.holdRT.depthTexture=this.effectRT.depthTexture,this.taaRenderPass.holdRenderTarget=this.holdRT),this.bloomRenderPass?(this.bloomRenderPass.scene=this.mainScene,this.bloomRenderPass.camera=this.mainCamera):(this.bloomRenderPass=new ke(this.mainScene,this.mainCamera),this.bloomRenderPass.layerIndex=this.BLOOM_SCENE,this.bloomRenderPass.clearDepth=!1,this.bloomRenderPass.sceneBg=this.sceneBackground),this.bloomPass?this.bloomPass.setSize(this.rtSize.width,this.rtSize.height):this.bloomPass=new oe(new c.Vector2(this.rtSize.width,this.rtSize.height),1.5,.4,.85),this.bloomPass.strength=this.bloomParams.bloomStrength,this.bloomPass.radius=this.bloomParams.bloomRadius,this.bloomPass.threshold=this.bloomParams.bloomThreshold,this.mixingPass||(this.mixingPass=new Re(Ae,"baseTexture","bloomTexture"),this.mixingPass.renderToScreen=!1),this.effectCopy||(this.effectCopy=new ee(H),this.effectCopy.clear=!1,this.effectCopy.renderToScreen=!1,this.effectCopy.needsSwap=!1,this.effectCopy.material.depthWrite=!1),this.effectComposer?this.effectComposer.renderer=this.renderer:(this.effectComposer=new ye(this.renderer,this.effectRT),this.effectComposer.addPass(this.taaRenderPass),this.effectComposer.addPass(this.effectCopy),this.effectComposer.addPass(this.bloomRenderPass),this.effectComposer.addPass(this.bloomPass),this.effectComposer.addPass(this.mixingPass))}dispose(){this.mainScene=null,this.mainCamera=null,this.setBackground(null),this.effectRT&&(this.effectRT.depthTexture.dispose(),this.effectRT.depthTexture=null,this.effectRT.dispose(),this.effectRT=null),this.sampleRT&&(this.sampleRT.depthTexture.dispose(),this.sampleRT.depthTexture=null,this.sampleRT.dispose(),this.sampleRT=null),this.holdRT&&(this.holdRT.depthTexture.dispose(),this.holdRT.depthTexture=null,this.holdRT.dispose(),this.holdRT=null),this.taaRenderPass&&(this.taaRenderPass.dispose(),this.taaRenderPass=null),this.bloomPass&&(this.bloomPass.dispose(),this.bloomPass=null),this.mixingPass=null,this.effectCopy=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)}update(){this.isUpdate&&this.mainCamera&&this.mainScene&&this.renderer&&(this.renderer.clear(),this.bloomParams.isBloom?this.effectComposer.render():this.renderer.render(this.mainScene,this.mainCamera))}toJSON(){const e={};var t=this.bloomParams;return e.bloomParams=Object.assign({},t),JSON.stringify(e)}reset(){this.bloomParams.isBloom=!1,this.rendererTone=!1,this.setBackground(null)}}class De{constructor(e){this.runScene=e}create(){return new c.PerspectiveCamera}reset(e){e.position.set(0,20,20);const t=this.runScene.assetsEx.get().controls;t.target.set(0,0,0),t.update()}get(){return this.runScene.assetsEx.get().camera}}function Ie(e){return(Ie="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 je(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&&Ue(e,t)}function Ue(e,t){return(Ue=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Be(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ze(e){return(ze=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Ne={type:"change"},Fe={type:"start"},Ve={type:"end"},He=function(){je(t,c.EventDispatcher);var e=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=ze(e);if(r=t?(r=ze(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Ie(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return Be(n)}}(t);function t(r,n){(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,t),i=e.call(this),void 0===n&&console.warn('THREE.OrbitControls: The second parameter "domElement" is now mandatory.'),n===document&&console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),i.object=r,i.domElement=n,i.domElement.style.touchAction="none",i.enabled=!0,i.target=new c.Vector3,i.minDistance=0,i.maxDistance=1/0,i.minZoom=0,i.maxZoom=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.autoRotate=!1,i.autoRotateSpeed=2,i.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},i.mouseButtons={LEFT:c.MOUSE.ROTATE,MIDDLE:c.MOUSE.DOLLY,RIGHT:c.MOUSE.PAN},i.touches={ONE:c.TOUCH.ROTATE,TWO:c.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 v.phi},i.getAzimuthalAngle=function(){return v.theta},i.getDistance=function(){return this.object.position.distanceTo(this.target)},i.listenToKeyEvents=function(e){e.addEventListener("keydown",re),this._domElementKeyEvents=e},i.saveState=function(){p.target0.copy(p.target),p.position0.copy(p.object.position),p.zoom0=p.object.zoom},i.reset=function(){p.target.copy(p.target0),p.object.position.copy(p.position0),p.object.zoom=p.zoom0,p.object.updateProjectionMatrix(),p.dispatchEvent(Ne),p.update(),f=d.NONE},i.update=(o=new c.Vector3,a=(new c.Quaternion).setFromUnitVectors(r.up,new c.Vector3(0,1,0)),s=a.clone().invert(),l=new c.Vector3,u=new c.Quaternion,h=2*Math.PI,function(){var e=p.object.position,t=(o.copy(e).sub(p.target),o.applyQuaternion(a),v.setFromVector3(o),p.autoRotate&&f===d.NONE&&C(2*Math.PI/60/60*p.autoRotateSpeed),p.enableDamping?(v.theta+=y.theta*p.dampingFactor,v.phi+=y.phi*p.dampingFactor):(v.theta+=y.theta,v.phi+=y.phi),p.minAzimuthAngle),r=p.maxAzimuthAngle;return isFinite(t)&&isFinite(r)&&(t<-Math.PI?t+=h:t>Math.PI&&(t-=h),r<-Math.PI?r+=h:r>Math.PI&&(r-=h),v.theta=t<=r?Math.max(t,Math.min(r,v.theta)):v.theta>(t+r)/2?Math.max(t,v.theta):Math.min(r,v.theta)),v.phi=Math.max(p.minPolarAngle,Math.min(p.maxPolarAngle,v.phi)),v.makeSafe(),v.radius*=g,v.radius=Math.max(p.minDistance,Math.min(p.maxDistance,v.radius)),!0===p.enableDamping?p.target.addScaledVector(b,p.dampingFactor):p.target.add(b),o.setFromSpherical(v),o.applyQuaternion(s),e.copy(p.target).add(o),p.object.lookAt(p.target),!0===p.enableDamping?(y.theta*=1-p.dampingFactor,y.phi*=1-p.dampingFactor,b.multiplyScalar(1-p.dampingFactor)):(y.set(0,0,0),b.set(0,0,0)),g=1,!(!(x||l.distanceToSquared(p.object.position)>m||8*(1-u.dot(p.object.quaternion))>m)||(p.dispatchEvent(Ne),l.copy(p.object.position),u.copy(p.object.quaternion),x=!1))}),i.dispose=function(){p.domElement.removeEventListener("contextmenu",ne),p.domElement.removeEventListener("pointerdown",K),p.domElement.removeEventListener("pointercancel",ee),p.domElement.removeEventListener("wheel",te),p.domElement.removeEventListener("pointermove",J),p.domElement.removeEventListener("pointerup",$),null!==p._domElementKeyEvents&&p._domElementKeyEvents.removeEventListener("keydown",re)};var i,o,a,s,l,u,h,p=Be(i),d={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},f=d.NONE,m=1e-6,v=new c.Spherical,y=new c.Spherical,g=1,b=new c.Vector3,x=!1,w=new c.Vector2,S=new c.Vector2,T=new c.Vector2,_=new c.Vector2,M=new c.Vector2,E=new c.Vector2,P=new c.Vector2,O=new c.Vector2,R=new c.Vector2,k=[],A={};function L(){return Math.pow(.95,p.zoomSpeed)}function C(e){y.theta-=e}function D(e){y.phi-=e}I=new c.Vector3;var I,j,U,B=function(e,t){I.setFromMatrixColumn(t,0),I.multiplyScalar(-e),b.add(I)},z=(j=new c.Vector3,function(e,t){!0===p.screenSpacePanning?j.setFromMatrixColumn(t,1):(j.setFromMatrixColumn(t,0),j.crossVectors(p.object.up,j)),j.multiplyScalar(e),b.add(j)}),N=(U=new c.Vector3,function(e,t){var r,n=p.domElement;p.object.isPerspectiveCamera?(r=p.object.position,U.copy(r).sub(p.target),r=U.length(),r*=Math.tan(p.object.fov/2*Math.PI/180),B(2*e*r/n.clientHeight,p.object.matrix),z(2*t*r/n.clientHeight,p.object.matrix)):p.object.isOrthographicCamera?(B(e*(p.object.right-p.object.left)/p.object.zoom/n.clientWidth,p.object.matrix),z(t*(p.object.top-p.object.bottom)/p.object.zoom/n.clientHeight,p.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),p.enablePan=!1)});function F(e){p.object.isPerspectiveCamera?g/=e:p.object.isOrthographicCamera?(p.object.zoom=Math.max(p.minZoom,Math.min(p.maxZoom,p.object.zoom*e)),p.object.updateProjectionMatrix(),x=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),p.enableZoom=!1)}function V(e){p.object.isPerspectiveCamera?g*=e:p.object.isOrthographicCamera?(p.object.zoom=Math.max(p.minZoom,Math.min(p.maxZoom,p.object.zoom/e)),p.object.updateProjectionMatrix(),x=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),p.enableZoom=!1)}function H(e){w.set(e.clientX,e.clientY)}function G(e){_.set(e.clientX,e.clientY)}function W(){var e,t;1===k.length?w.set(k[0].pageX,k[0].pageY):(e=.5*(k[0].pageX+k[1].pageX),t=.5*(k[0].pageY+k[1].pageY),w.set(e,t))}function X(){var e,t;1===k.length?_.set(k[0].pageX,k[0].pageY):(e=.5*(k[0].pageX+k[1].pageX),t=.5*(k[0].pageY+k[1].pageY),_.set(e,t))}function q(){var e=k[0].pageX-k[1].pageX,t=k[0].pageY-k[1].pageY;e=Math.sqrt(e*e+t*t),P.set(0,e)}function Y(e){1==k.length?S.set(e.pageX,e.pageY):(r=ae(e),t=.5*(e.pageX+r.x),e=.5*(e.pageY+r.y),S.set(t,e)),T.subVectors(S,w).multiplyScalar(p.rotateSpeed);var t,r=p.domElement;C(2*Math.PI*T.x/r.clientHeight),D(2*Math.PI*T.y/r.clientHeight),w.copy(S)}function Z(e){var t,r;1===k.length?M.set(e.pageX,e.pageY):(t=ae(e),r=.5*(e.pageX+t.x),e=.5*(e.pageY+t.y),M.set(r,e)),E.subVectors(M,_).multiplyScalar(p.panSpeed),N(E.x,E.y),_.copy(M)}function Q(e){var t=ae(e),r=e.pageX-t.x;e=e.pageY-t.y,t=Math.sqrt(r*r+e*e),O.set(0,t),R.set(0,Math.pow(O.y/P.y,p.zoomSpeed)),F(R.y),P.copy(O)}function K(e){if(!1!==p.enabled)if(0===k.length&&(p.domElement.setPointerCapture(e.pointerId),p.domElement.addEventListener("pointermove",J),p.domElement.addEventListener("pointerup",$)),k.push(e),"touch"===e.pointerType){switch(oe(e),k.length){case 1:switch(p.touches.ONE){case c.TOUCH.ROTATE:if(!1===p.enableRotate)return;W(),f=d.TOUCH_ROTATE;break;case c.TOUCH.PAN:if(!1===p.enablePan)return;X(),f=d.TOUCH_PAN;break;default:f=d.NONE}break;case 2:switch(p.touches.TWO){case c.TOUCH.DOLLY_PAN:if(!1===p.enableZoom&&!1===p.enablePan)return;p.enableZoom&&q(),p.enablePan&&X(),f=d.TOUCH_DOLLY_PAN;break;case c.TOUCH.DOLLY_ROTATE:if(!1===p.enableZoom&&!1===p.enableRotate)return;p.enableZoom&&q(),p.enableRotate&&W(),f=d.TOUCH_DOLLY_ROTATE;break;default:f=d.NONE}break;default:f=d.NONE}f!==d.NONE&&p.dispatchEvent(Fe)}else{var t,r=e;switch(r.button){case 0:t=p.mouseButtons.LEFT;break;case 1:t=p.mouseButtons.MIDDLE;break;case 2:t=p.mouseButtons.RIGHT;break;default:t=-1}switch(t){case c.MOUSE.DOLLY:if(!1===p.enableZoom)return;!function(e){P.set(e.clientX,e.clientY)}(r),f=d.DOLLY;break;case c.MOUSE.ROTATE:if(r.ctrlKey||r.metaKey||r.shiftKey){if(!1===p.enablePan)return;G(r),f=d.PAN}else{if(!1===p.enableRotate)return;H(r),f=d.ROTATE}break;case c.MOUSE.PAN:if(r.ctrlKey||r.metaKey||r.shiftKey){if(!1===p.enableRotate)return;H(r),f=d.ROTATE}else{if(!1===p.enablePan)return;G(r),f=d.PAN}break;default:f=d.NONE}f!==d.NONE&&p.dispatchEvent(Fe)}}function J(e){if(!1!==p.enabled)if("touch"===e.pointerType){var t=e;switch(oe(t),f){case d.TOUCH_ROTATE:if(!1===p.enableRotate)return;Y(t),p.update();break;case d.TOUCH_PAN:if(!1===p.enablePan)return;Z(t),p.update();break;case d.TOUCH_DOLLY_PAN:if(!1===p.enableZoom&&!1===p.enablePan)return;!function(e){p.enableZoom&&Q(e),p.enablePan&&Z(e)}(t),p.update();break;case d.TOUCH_DOLLY_ROTATE:if(!1===p.enableZoom&&!1===p.enableRotate)return;!function(e){p.enableZoom&&Q(e),p.enableRotate&&Y(e)}(t),p.update();break;default:f=d.NONE}}else{var r=e;if(!1!==p.enabled)switch(f){case d.ROTATE:if(!1===p.enableRotate)return;!function(e){S.set(e.clientX,e.clientY),T.subVectors(S,w).multiplyScalar(p.rotateSpeed),e=p.domElement,C(2*Math.PI*T.x/e.clientHeight),D(2*Math.PI*T.y/e.clientHeight),w.copy(S),p.update()}(r);break;case d.DOLLY:if(!1===p.enableZoom)return;!function(e){O.set(e.clientX,e.clientY),R.subVectors(O,P),0<R.y?F(L()):R.y<0&&V(L()),P.copy(O),p.update()}(r);break;case d.PAN:if(!1===p.enablePan)return;!function(e){M.set(e.clientX,e.clientY),E.subVectors(M,_).multiplyScalar(p.panSpeed),N(E.x,E.y),_.copy(M),p.update()}(r)}}}function $(e){ie(e),0===k.length&&(p.domElement.releasePointerCapture(e.pointerId),p.domElement.removeEventListener("pointermove",J),p.domElement.removeEventListener("pointerup",$)),p.dispatchEvent(Ve),f=d.NONE}function ee(e){ie(e)}function te(e){!1!==p.enabled&&!1!==p.enableZoom&&f===d.NONE&&(e.preventDefault(),p.dispatchEvent(Fe),e.deltaY<0?V(L()):0<e.deltaY&&F(L()),p.update(),p.dispatchEvent(Ve))}function re(e){if(!1!==p.enabled&&!1!==p.enablePan){var t=!1;switch(e.code){case p.keys.UP:N(0,p.keyPanSpeed),t=!0;break;case p.keys.BOTTOM:N(0,-p.keyPanSpeed),t=!0;break;case p.keys.LEFT:N(p.keyPanSpeed,0),t=!0;break;case p.keys.RIGHT:N(-p.keyPanSpeed,0),t=!0}t&&(e.preventDefault(),p.update())}}function ne(e){!1!==p.enabled&&e.preventDefault()}function ie(e){delete A[e.pointerId];for(var t=0;t<k.length;t++)if(k[t].pointerId==e.pointerId)return void k.splice(t,1)}function oe(e){var t=A[e.pointerId];void 0===t&&(t=new c.Vector2,A[e.pointerId]=t),t.set(e.pageX,e.pageY)}function ae(e){return e=e.pointerId===k[0].pointerId?k[1]:k[0],A[e.pointerId]}return p.domElement.addEventListener("contextmenu",ne),p.domElement.addEventListener("pointerdown",K),p.domElement.addEventListener("pointercancel",ee),p.domElement.addEventListener("wheel",te,{passive:!1}),i.update(),i}return function(e,t,r){return Object.defineProperty(e,"prototype",{writable:!1}),e}(t)}();class Ge{create(e,t){return new He(e,t)}static toJSON(e){return e.target}}class We{constructor(e){this._state=!1,this._libsState=!1,this.map={val:"Box",type:"base-model"},this.libsMap={data:"Box",type:"texture"},this.events=e}get state(){return this._state}set state(e){this._state=e}setVal(e){this.state=!0,this.map=e}getVal(){if(this.state)return this.state=!1,this.map}setLibsVal(e){this._libsState=!0,this.libsMap=e}getLibsVal(){if(this._libsState)return this._libsState=!1,this.libsMap}}var Xe=a(594),qe=a(129),Ye=a(685);function Ze(){return(Ze="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=et(e)););return e}(e,t);if(n)return(n=Object.getOwnPropertyDescriptor(n,t)).get?n.get.call(arguments.length<3?e:r):n.value}).apply(this,arguments)}function Qe(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&&Ke(e,t)}function Ke(e,t){return(Ke=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Je(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=et(e);if(r=t?(r=et(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===at(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return $e(n)}}function $e(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function et(e){return(et=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function tt(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function rt(e,t,r){return t&&tt(e.prototype,t),r&&tt(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function nt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function it(e){return function(e){if(Array.isArray(e))return ot(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 ot(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(r="Object"===r&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ot(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 ot(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function at(e){return(at="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 st(e){return void 0===e}function lt(){return"undefined"!=typeof window}function ut(e){return Ir(e)||Dr(e)}function ct(e){return(Zr=bt(e,Yr))&&mi}function ht(e,t){return!t&&console.warn(e)}function pt(e,t){return e&&(Yr[e]=t)&&Zr&&(Zr[e]=t)||Yr}function dt(){return 0}function ft(e,t,r){return(r=e[t])&&Ir(r)?e[t]():st(r)&&e.getAttribute&&e.getAttribute(t)||r}function mt(e,t){(e=e.split(",")).forEach(t)}function vt(e,t,r,n){Jr.length&&un(),e.render(t,r,n),Jr.length&&un()}function yt(e){var t=parseFloat(e);return(t||0===t)&&(e+"").match(Xr).length<2?t:Dr(e)?e.trim():e}function gt(e){return e}function bt(e,t){for(var r in t)e[r]=t[r];return e}function xt(e,t){for(var r in t)"__proto__"!==r&&"constructor"!==r&&"prototype"!==r&&(e[r]=Ur(t[r])?xt(e[r]||(e[r]={}),t[r]):t[r]);return e}function wt(e){var t,r=e.parent||er,n=e.keyframes?(t=Nr(e.keyframes),function(e,r){for(var n in r)n in e||"duration"===n&&t||"ease"===n||(e[n]=r[n])}):cn;if(Br(e.inherit))for(;r;)n(e,r.vars.defaults),r=r.parent||r._dp;return e}function St(e){return!e||e._ts&&St(e.parent)}function Tt(e){return e._repeat?_t(e._tTime,e=e.duration()+e._rDelay)*e:0}function _t(e,t){return t=Math.floor(e/=t),e&&t===e?t-1:t}function Mt(e,t){return(e-t._start)*t._ts+(0<=t._ts?0:t._dirty?t.totalDuration():t._tDur)}function Et(e,t){var r;if((t._time||t._initted&&!t._dur)&&(r=Mt(e.rawTime(),t),(!t._dur||jt(0,t.totalDuration(),r)-t._tTime>Pr)&&t.render(r,!0)),fn(e,t)._dp&&e._initted&&e._time>=e._dur&&e._ts){if(e._dur<e.duration())for(r=e;r._dp;)0<=r.rawTime()&&r.totalTime(r._tTime),r=r._dp;e._zTime=-Pr}}function Pt(e,t,r,n){return t.parent&&dn(t),t._start=ln((jr(r)?r:r||e!==er?Dt(e,r,t):e._time)+t._delay),t._end=ln(t._start+(t.totalDuration()/Math.abs(t.timeScale())||0)),function(e,t){var r,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"_first",i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:"_last",o=4<arguments.length?arguments[4]:void 0,a=e[i];if(o)for(r=t[o];a&&a[o]>r;)a=a._prev;a?(t._next=a._next,a._next=t):(t._next=e[n],e[n]=t),t._next?t._next._prev=t:e[i]=t,t._prev=a,t.parent=t._dp=e}(e,t,"_first","_last",e._sort?"_start":0),At(t)||(e._recent=t),n||Et(e,t),e}function Ot(e,t){(Yr.ScrollTrigger||Qr("scrollTrigger",t))&&Yr.ScrollTrigger.create(t,e)}function Rt(e,t,r,n){return Nn(e,t),e._initted?!r&&e._pt&&(e._dur&&!1!==e.vars.lazy||!e._dur&&e.vars.lazy)&&or!==An.frame?(Jr.push(e),e._lazy=[t,n]):void 0:1}function kt(e){return(e=e.parent)&&e._ts&&e._initted&&!e._lock&&(e.rawTime()<0||kt(e))}function At(e){return"isFromStart"===(e=e.data)||"isStart"===e}function Lt(e,t,r,n){var i=e._repeat,o=ln(t)||0;return(t=e._tTime/e._tDur)&&!n&&(e._time*=o/e._dur),e._dur=o,e._tDur=i?i<0?1e10:ln(o*(i+1)+e._rDelay*i):o,0<t&&!n?vn(e,e._tTime=e._tDur*t):e.parent&&mn(e),r||fn(e.parent,e),e}function Ct(e){return e instanceof Jn?fn(e):Lt(e,e._dur)}function Dt(e,t,r){var n,i,o,a=e.labels,s=e._recent||yn,l=e.duration()>=Er?s.endTime(!1):e._dur;return Dr(t)&&(isNaN(t)||t in a)?(i=t.charAt(0),o="%"===t.substr(-1),n=t.indexOf("="),"<"===i||">"===i?(0<=n&&(t=t.replace(/=/,"")),("<"===i?s._start:s.endTime(0<=s._repeat))+(parseFloat(t.substr(1))||0)*(o?(n<0?s:r).totalDuration()/100:1)):n<0?(t in a||(a[t]=l),a[t]):(i=parseFloat(t.charAt(n-1)+t.substr(n+1)),o&&r&&(i=i/100*(Nr(r)?r[0]:r).totalDuration()),1<n?Dt(e,t.substr(0,n-1),r)+i:l+i)):null==t?l:+t}function It(e,t,r){var n,i,o=jr(t[1]),a=(o?2:1)+(e<2?0:1),s=t[a];if(o&&(s.duration=t[1]),s.parent=r,e){for(n=s,i=r;i&&!("immediateRender"in n);)n=i.vars.defaults||{},i=Br(i.vars.inherit)&&i.parent;s.immediateRender=Br(n.immediateRender),e<2?s.runBackwards=1:s.startAt=t[a-1]}return new ii(t[0],s,t[1+a])}function jt(e,t,r){return r<e?e:t<r?t:r}function Ut(e){if(Ir(e))return e;var t=Ur(e)?e:{each:e},r=Un(t.ease),n=t.from||0,i=parseFloat(t.base)||0,o={},a=(e=0<n&&n<1,isNaN(n)||e),s=t.axis,l=n,u=n;return Dr(n)?l=u={center:.5,edges:.5,end:1}[n]||0:!e&&a&&(l=n[0],u=n[1]),function(e,c,h){var p,d,f,m,v,y,g,b,x=(h||t).length,w=o[x];if(!w){if(!(b="auto"===t.grid?0:(t.grid||[1,Er])[1])){for(y=-Er;y<(y=h[b++].getBoundingClientRect().left)&&b<x;);b--}for(w=o[x]=[],p=a?Math.min(b,x)*l-.5:n%b,d=b===Er?0:a?x*u/b-.5:n/b|0,g=Er,v=y=0;v<x;v++)m=v%b-p,f=d-(v/b|0),w[v]=m=s?Math.abs("y"===s?f:m):Ar(m*m+f*f),y<m&&(y=m),m<g&&(g=m);"random"===n&&Tn(w),w.max=y-g,w.min=g,w.v=x=(parseFloat(t.amount)||parseFloat(t.each)*(x<b?x-1:s?"y"===s?x/b:b:Math.max(b,x/b))||0)*("edges"===n?-1:1),w.b=x<0?i-x:i,w.u=bn(t.amount||t.each)||0,r=r&&x<0?jn(r):r}return x=(w[e]-w.min)/w.max||0,ln(w.b+(r?r(x):x)*w.v)+w.u}}function Bt(e){var t=Math.pow(10,((e+"").split(".")[1]||"").length);return function(r){var n=Math.round(parseFloat(r)/e)*e*t;return(n-n%1)/t+(jr(r)?0:bn(r))}}function zt(e,t){var r,n,i=Nr(e);return!i&&Ur(e)&&(r=i=e.radius||Er,e.values?(e=Sn(e.values),(n=!jr(e[0]))&&(r*=r)):e=Bt(e.increment)),gn(t,i?Ir(e)?function(t){return n=e(t),Math.abs(n-t)<=r?n:t}:function(t){for(var i,o,a=parseFloat(n?t.x:t),s=parseFloat(n?t.y:0),l=Er,u=0,c=e.length;c--;)(i=n?(i=e[c].x-a)*i+(o=e[c].y-s)*o:Math.abs(e[c]-a))<l&&(l=i,u=c);return u=!r||l<=r?e[u]:t,n||u===t||jr(t)?u:u+bn(t)}:Bt(e))}function Nt(e,t,r,n){return gn(Nr(e)?!t:!0===r?!!(r=0):!n,(function(){return Nr(e)?e[~~(Math.random()*e.length)]:(r=r||1e-5)&&(n=r<1?Math.pow(10,(r+"").length-2):1)&&Math.floor(Math.round((e-r/2+Math.random()*(t-e+.99*r))/r)*r*n)/n}))}function Ft(e,t,r){return gn(r,(function(r){return e[~~t(r)]}))}function Vt(e,t,r,n,i){var o=t-e,a=n-r;return gn(i,(function(t){return r+((t-e)/o*a||0)}))}function Ht(e,t,r){var n,i,o,a=e.labels,s=Er;for(n in a)(i=a[n]-t)<0==!!r&&i&&s>(i=Math.abs(i))&&(o=n,s=i);return o}function Gt(e,t,r){var n=e.vars,i=n[t];i&&(t=n[t+"Params"],n=n.callbackScope||e,r&&Jr.length&&un(),t?i.apply(n,t):i.call(n))}function Wt(e){return dn(e),e.scrollTrigger&&e.scrollTrigger.kill(!1),e.progress()<1&&Gt(e,"onInterrupt"),e}function Xt(e,t,r){return(6*(e+=e<0?1:1<e?-1:0)<1?t+(r-t)*e*6:e<.5?r:3*e<2?t+(r-t)*(2/3-e)*6:t)*Mn+.5|0}function qt(e,t,r){var n,i,o,a,s="",l=(e+s).match(Rn),u=t?"hsla(":"rgba(",c=0;if(!l)return e;if(l=l.map((function(e){return(e=Pn(e,t,1))&&u+(t?e[0]+","+e[1]+"%,"+e[2]+"%,"+e[3]:e.join(","))+")"})),r&&(o=On(e),(n=r.c).join(s)!==o.c.join(s)))for(a=(i=e.replace(Rn,"1").split(Hr)).length-1;c<a;c++)s+=i[c]+(~n.indexOf(c)?l.shift()||u+"0,0,0,0)":(o.length?o:l.length?l:r).shift());if(!i)for(a=(i=e.split(Rn)).length-1;c<a;c++)s+=i[c]+l[c];return s+i[a]}function Yt(e,t){for(var r,n=e._first;n;)n instanceof Jn?Yt(n,t):!n.vars.yoyoEase||n._yoyo&&n._repeat||n._yoyo===t||(n.timeline?Yt(n.timeline,t):(r=n._ease,n._ease=n._yEase,n._yEase=r,n._yoyo=t)),n=n._next}function Zt(e,t){var r,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:function(e){return 1-t(1-e)},i={easeIn:t,easeOut:n,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}};mt(e,(function(e){for(var t in Cn[e]=Yr[e]=i,Cn[r=e.toLowerCase()]=n,i)Cn[r+("easeIn"===t?".in":"easeOut"===t?".out":".inOut")]=Cn[e+"."+t]=i[t]}))}function Qt(e){return function(t){return t<.5?(1-e(1-2*t))/2:.5+e(2*(t-.5))/2}}function Kt(e,t,r){function n(e){return 1===e?1:i*Math.pow(2,-10*e)*Cr((e-o)*a)+1}var i=1<=t?t:1,o=(a=(r||(e?.3:.45))/(t<1?t:1))/Or*(Math.asin(1/i)||0),a=(r="out"===e?n:"in"===e?function(e){return 1-n(1-e)}:Qt(n),Or/a);return r.config=function(t,r){return Kt(e,t,r)},r}function Jt(e){function t(e){return e?--e*e*((r+1)*e+r)+1:0}var r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1.70158,n="out"===e?t:"in"===e?function(e){return 1-t(1-e)}:Qt(t);return n.config=function(t){return Jt(e,t)},n}var $t,er,tr,rr,nr,ir,or,ar,sr,lr,ur,cr,hr,pr,dr,fr,mr,vr,yr,gr,br,xr,wr,Sr,Tr,_r={autoSleep:120,force3D:"auto",nullTargetWarn:1,units:{lineHeight:""}},Mr={duration:.5,overwrite:!1,delay:0},Er=1e8,Pr=1/Er,Or=2*Math.PI,Rr=Or/4,kr=0,Ar=Math.sqrt,Lr=Math.cos,Cr=Math.sin,Dr=function(e){return"string"==typeof e},Ir=function(e){return"function"==typeof e},jr=function(e){return"number"==typeof e},Ur=function(e){return"object"==at(e)},Br=function(e){return!1!==e},zr="function"==typeof ArrayBuffer&&ArrayBuffer.isView||function(){},Nr=Array.isArray,Fr=/(?:-?\.?\d|\.)+/gi,Vr=/[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g,Hr=/[-+=.]*\d+[.e-]*\d*[a-z%]*/g,Gr=/[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi,Wr=/[+-]=-?[.\d]+/,Xr=/[^,'"\[\]\s]+/gi,qr=/[\d.+\-=]+(?:e[-+]\d*)*/i,Yr={},Zr={},Qr=function(e,t){return console.warn("Invalid property",e,"set to",t,"Missing plugin? gsap.registerPlugin()")},Kr={},Jr=[],$r={},en={},tn={},rn=30,nn=[],on="",an=function(e){var t,r,n=e[0];if(Ur(n)||Ir(n)||(e=[e]),!(t=(n._gsap||{}).harness)){for(r=nn.length;r--&&!nn[r].targetTest(n););t=nn[r]}for(r=e.length;r--;)e[r]&&(e[r]._gsap||(e[r]._gsap=new Qn(e[r],t)))||e.splice(r,1);return e},sn=function(e){return e._gsap||an(Sn(e))[0]._gsap},ln=function(e){return Math.round(1e7*e)/1e7||0},un=function(){var e,t,r=Jr.length,n=Jr.slice(0);for($r={},e=Jr.length=0;e<r;e++)(t=n[e])&&t._lazy&&(t.render(t._lazy[0],t._lazy[1],!0)._lazy=0)},cn=function(e,t){for(var r in t)r in e||(e[r]=t[r]);return e},hn=function(e,t){var r,n={};for(r in e)r in t||(n[r]=e[r]);return n},pn=function(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"_first",n=3<arguments.length&&void 0!==arguments[3]?arguments[3]:"_last",i=t._prev,o=t._next;i?i._next=o:e[r]===t&&(e[r]=o),o?o._prev=i:e[n]===t&&(e[n]=i),t._next=t._prev=t.parent=null},dn=function(e,t){!e.parent||t&&!e.parent.autoRemoveChildren||e.parent.remove(e),e._act=0},fn=function(e,t){if(e&&(!t||t._end>e._dur||t._start<0))for(var r=e;r;)r._dirty=1,r=r.parent;return e},mn=function(e){return e._end=ln(e._start+(e._tDur/Math.abs(e._ts||e._rts||Pr)||0))},vn=function(e,t){var r=e._dp;return r&&r.smoothChildTiming&&e._ts&&(e._start=ln(r._time-(0<e._ts?t/e._ts:((e._dirty?e.totalDuration():e._tDur)-t)/-e._ts)),mn(e),r._dirty||fn(r,e)),e},yn={_start:0,endTime:dt,totalDuration:dt},gn=function(e,t){return e||0===e?t(e):t},bn=function(e,t){return Dr(e)&&(t=qr.exec(e))?e.substr(t.index+t[0].length):""},xn=[].slice,wn=function(e,t){return e&&Ur(e)&&"length"in e&&(!t&&!e.length||e.length-1 in e&&Ur(e[0]))&&!e.nodeType&&e!==tr},Sn=function(e,t,r){return!Dr(e)||r||!rr&&Ln()?Nr(e)?function(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:[];return e.forEach((function(e){return Dr(e)&&!t||wn(e,1)?r.push.apply(r,it(Sn(e))):r.push(e)}))||r}(e,r):wn(e)?xn.call(e,0):e?[e]:[]:xn.call((t||nr).querySelectorAll(e),0)},Tn=function(e){return e.sort((function(){return.5-Math.random()}))},_n=function(e){for(var t,r,n,i,o=0,a="";~(t=e.indexOf("random(",o));)n=e.indexOf(")",t),i="["===e.charAt(t+7),r=e.substr(t+7,n-t-7).match(i?Xr:Fr),a+=e.substr(o,t-o)+Nt(i?r:+r[0],i?0:+r[1],+r[2]||1e-5),o=n+1;return a+e.substr(o,e.length-o)},Mn=255,En={aqua:[0,Mn,Mn],lime:[0,Mn,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,Mn],navy:[0,0,128],white:[Mn,Mn,Mn],olive:[128,128,0],yellow:[Mn,Mn,0],orange:[Mn,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[Mn,0,0],pink:[Mn,192,203],cyan:[0,Mn,Mn],transparent:[Mn,Mn,Mn,0]},Pn=function(e,t,r){var n,i,o,a,s,l,u,c=e?jr(e)?[e>>16,e>>8&Mn,e&Mn]:0:En.black;if(!c){if(","===e.substr(-1)&&(e=e.substr(0,e.length-1)),En[e])c=En[e];else if("#"===e.charAt(0)){if(9===(e=e.length<6?"#"+(n=e.charAt(1))+n+(i=e.charAt(2))+i+(o=e.charAt(3))+o+(5===e.length?e.charAt(4)+e.charAt(4):""):e).length)return[(c=parseInt(e.substr(1,6),16))>>16,c>>8&Mn,c&Mn,parseInt(e.substr(7),16)/255];c=[(e=parseInt(e.substr(1),16))>>16,e>>8&Mn,e&Mn]}else if("hsl"===e.substr(0,3))if(c=u=e.match(Fr),t){if(~e.indexOf("="))return c=e.match(Vr),r&&c.length<4&&(c[3]=1),c}else a=+c[0]%360/360,s=+c[1]/100,n=2*(l=+c[2]/100)-(i=l<=.5?l*(s+1):l+s-l*s),3<c.length&&(c[3]*=1),c[0]=Xt(a+1/3,n,i),c[1]=Xt(a,n,i),c[2]=Xt(a-1/3,n,i);else c=e.match(Fr)||En.transparent;c=c.map(Number)}return t&&!u&&(n=c[0]/Mn,i=c[1]/Mn,o=c[2]/Mn,l=((e=Math.max(n,i,o))+(t=Math.min(n,i,o)))/2,e===t?a=s=0:(u=e-t,s=.5<l?u/(2-e-t):u/(e+t),a=e===n?(i-o)/u+(i<o?6:0):e===i?(o-n)/u+2:(n-i)/u+4,a*=60),c[0]=~~(a+.5),c[1]=~~(100*s+.5),c[2]=~~(100*l+.5)),r&&c.length<4&&(c[3]=1),c},On=function(e){var t=[],r=[],n=-1;return e.split(Rn).forEach((function(e){e=e.match(Hr)||[],t.push.apply(t,it(e)),r.push(n+=e.length+1)})),t.c=r,t},Rn=function(){var e,t="(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3,4}){1,2}\\b";for(e in En)t+="|"+e+"\\b";return new RegExp(t+")","gi")}(),kn=/hsl[a]?\(/,An=(dr=Date.now,fr=500,mr=33,vr=dr(),yr=vr,br=gr=1e3/240,wr={time:0,frame:0,tick:function(){Bn(!0)},deltaRatio:function(e){return hr/(1e3/(e||60))},wake:function(){ir&&(!rr&<()&&(tr=rr=window,nr=tr.document||{},Yr.gsap=mi,(tr.gsapVersions||(tr.gsapVersions=[])).push(mi.version),ct(Zr||tr.GreenSockGlobals||!tr.gsap&&tr||{}),cr=tr.requestAnimationFrame),lr&&wr.sleep(),ur=cr||function(e){return setTimeout(e,br-1e3*wr.time+1|0)},sr=1,Bn(2))},sleep:function(){(cr?tr.cancelAnimationFrame:clearTimeout)(lr),sr=0,ur=dt},lagSmoothing:function(e,t){fr=e||1/Pr,mr=Math.min(t,fr,0)},fps:function(e){gr=1e3/(e||240),br=1e3*wr.time+gr},add:function(e){xr.indexOf(e)<0&&xr.push(e),Ln()},remove:function(e,t){~(t=xr.indexOf(e))&&xr.splice(t,1)&&t<=pr&&pr--},_listeners:xr=[]}),Ln=function(){return!sr&&An.wake()},Cn={},Dn=/^[\d.\-M][\d.\-,\s]/,In=/["']/g,jn=function(e){return function(t){return 1-e(1-t)}},Un=function(e,t){return e&&(Ir(e)?e:Cn[e]||function(e){var t,r,n,i=(e+"").split("("),o=Cn[i[0]];return o&&1<i.length&&o.config?o.config.apply(null,~e.indexOf("{")?[function(e){for(var t,r,n,i={},o=e.substr(1,e.length-3).split(":"),a=o[0],s=1,l=o.length;s<l;s++)r=o[s],t=s!==l-1?r.lastIndexOf(","):r.length,n=r.substr(0,t),i[a]=isNaN(n)?n.replace(In,"").trim():+n,a=r.substr(t+1).trim();return i}(i[1])]:(t=(i=e).indexOf("(")+1,r=i.indexOf(")"),n=i.indexOf("(",t),i.substring(t,~n&&n<r?i.indexOf(")",r+1):r).split(",").map(yt))):Cn._CE&&Dn.test(e)?Cn._CE("",e):o}(e))||t};function Bn(e){var t,r,n,i=dr()-yr,o=!0===e;if(fr<i&&(vr+=i-mr),(0<(i=(r=(yr+=i)-vr)-br)||o)&&(n=++wr.frame,hr=r-1e3*wr.time,wr.time=r/=1e3,br+=i+(gr<=i?4:gr-i),t=1),o||(lr=ur(Bn)),t)for(pr=0;pr<xr.length;pr++)xr[pr](r,hr,n,e)}function zn(e){return e<Tr?Sr*e*e:e<.7272727272727273?Sr*Math.pow(e-1.5/2.75,2)+.75:e<.9090909090909092?Sr*(e-=2.25/2.75)*e+.9375:Sr*Math.pow(e-2.625/2.75,2)+.984375}function Nn(e,t){var r,n,i,o,a,s,l,u,c,h,p,d,f,m=e.vars,v=m.ease,y=m.startAt,g=m.immediateRender,b=m.lazy,x=m.onUpdate,w=m.onUpdateParams,S=m.callbackScope,T=m.runBackwards,_=m.yoyoEase,M=m.keyframes,E=m.autoRevert,P=e._dur,O=e._startAt,R=e._targets,k=e.parent,A=k&&"nested"===k.data?k.parent._targets:R,L="auto"===e._overwrite&&!$t,C=e.timeline;if(e._ease=Un(v=!C||M&&v?v:"none",Mr.ease),e._yEase=_?jn(Un(!0===_?v:_,Mr.ease)):0,_&&e._yoyo&&!e._repeat&&(_=e._yEase,e._yEase=e._ease,e._ease=_),e._from=!C&&!!m.runBackwards,!C||M&&!m.stagger){if(d=(u=R[0]?sn(R[0]).harness:0)&&m[u.prop],r=hn(m,Kr),O&&dn(O.render(-1,!0)),y)if(dn(e._startAt=ii.set(R,cn({data:"isStart",overwrite:!1,parent:k,immediateRender:!0,lazy:Br(b),startAt:null,delay:0,onUpdate:x,onUpdateParams:w,callbackScope:S,stagger:0},y))),t<0&&!g&&!E&&e._startAt.render(-1,!0),g){if(0<t&&!E&&(e._startAt=0),P&&t<=0)return void(t&&(e._zTime=t))}else!1===E&&(e._startAt=0);else if(T&&P)if(O)E||(e._startAt=0);else if(i=cn({overwrite:!1,data:"isFromStart",lazy:(g=!t&&g)&&Br(b),immediateRender:g,stagger:0,parent:k},r),d&&(i[u.prop]=d),dn(e._startAt=ii.set(R,i)),t<0&&e._startAt.render(-1,!0),e._zTime=t,g){if(!t)return}else Nn(e._startAt,Pr);for(e._pt=0,b=P&&Br(b)||b&&!P,n=0;n<R.length;n++){if(l=(a=R[n])._gsap||an(R)[n]._gsap,e._ptLookup[n]=h={},$r[l.id]&&Jr.length&&un(),p=A===R?n:A.indexOf(a),u&&!1!==(c=new u).init(a,d||r,e,p,A)&&(e._pt=o=new pi(e._pt,a,c.name,0,1,c.render,c,0,c.priority),c._props.forEach((function(e){h[e]=o})),c.priority&&(s=1)),!u||d)for(i in r)en[i]&&(c=ti(i,r,e,p,a,A))?c.priority&&(s=1):h[i]=o=ei.call(e,a,i,"get",r[i],p,A,0,m.stringFilter);e._op&&e._op[n]&&e.kill(a,e._op[n]),L&&e._pt&&(Zn=e,er.killTweensOf(a,h,e.globalTime(t)),f=!e.parent,Zn=0),e._pt&&b&&($r[l.id]=1)}s&&hi(e),e._onInit&&e._onInit(e)}e._onUpdate=x,e._initted=(!e._op||e._pt)&&!f,M&&t<=0&&C.render(Er,!0,!0)}function Fn(e,t,r,n,i){return Ir(e)?e.call(t,r,n,i):Dr(e)&&~e.indexOf("random(")?_n(e):e}function Vn(e,t,r){return e.setAttribute(t,r)}function Hn(e,t){var r=t._pt,n="";if(!e&&t.b)n=t.b;else if(1===e&&t.e)n=t.e;else{for(;r;)n=r.p+(r.m?r.m(r.s+r.c*e):Math.round(1e4*(r.s+r.c*e))/1e4)+n,r=r._next;n+=t.c}t.set(t.t,t.p,n,t)}function Gn(e,t){for(var r=t._pt;r;)r.r(e,r.d),r=r._next}function Wn(e,t,r,n){for(var i,o=this._pt;o;)i=o._next,o.p===n&&o.modifier(e,t,r),o=i}function Xn(e){for(var t,r,n=this._pt;n;)r=n._next,n.p===e&&!n.op||n.op===e?pn(this,n,"_pt"):n.dep||(t=1),n=r;return!t}function qn(e,t,r,n){n.mSet(e,t,n.m.call(n.tween,r,n.mt),n)}function Yn(e,t){return{name:e,rawVars:1,init:function(e,r,n){n._onInit=function(e){var n,i;if(Dr(r)&&(n={},mt(r,(function(e){return n[e]=1})),r=n),t){for(i in n={},r)n[i]=t(r[i]);r=n}var o,a,s,l=e,u=r,c=l._targets;for(o in u)for(a=c.length;a--;)(s=(s=l._ptLookup[a][o])&&s.d)&&(s=s._pt?fi(s,o):s)&&s.modifier&&s.modifier(u[o],l,c[a],o)}}}}mt("Linear,Quad,Cubic,Quart,Quint,Strong",(function(e,t){var r=t<5?t+1:t;Zt(e+",Power"+(r-1),t?function(e){return Math.pow(e,r)}:function(e){return e},(function(e){return 1-Math.pow(1-e,r)}),(function(e){return e<.5?Math.pow(2*e,r)/2:1-Math.pow(2*(1-e),r)/2}))})),Cn.Linear.easeNone=Cn.none=Cn.Linear.easeIn,Zt("Elastic",Kt("in"),Kt("out"),Kt()),Sr=7.5625,Tr=1/2.75,Zt("Bounce",(function(e){return 1-zn(1-e)}),zn),Zt("Expo",(function(e){return e?Math.pow(2,10*(e-1)):0})),Zt("Circ",(function(e){return-(Ar(1-e*e)-1)})),Zt("Sine",(function(e){return 1===e?1:1-Lr(e*Rr)})),Zt("Back",Jt("in"),Jt("out"),Jt()),Cn.SteppedEase=Cn.steps=Yr.SteppedEase={config:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1,t=1<arguments.length?arguments[1]:void 0,r=1/e,n=e+(t?0:1),i=t?1:0,o=1-Pr;return function(e){return((n*jt(0,o,e)|0)+i)*r}}},Mr.ease=Cn["quad.out"],mt("onComplete,onUpdate,onStart,onRepeat,onReverseComplete,onInterrupt",(function(e){return on+=e+","+e+"Params,"}));var Zn,Qn=rt((function e(t,r){nt(this,e),this.id=kr++,(t._gsap=this).target=t,this.harness=r,this.get=r?r.get:ft,this.set=r?r.getSetter:li})),Kn=function(){function e(t){nt(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,Lt(this,+t.duration,1,1),this.data=t.data,sr||An.wake()}return rt(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,Lt(this,this._repeat<0?e:(e-this._repeat*this._rDelay)/(this._repeat+1))):this._tDur}},{key:"totalTime",value:function(e,t){if(Ln(),!arguments.length)return this._tTime;var r=this._dp;if(r&&r.smoothChildTiming&&this._ts){for(vn(this,e),r._dp&&!r.parent&&Et(r,this);r&&r.parent;)r.parent._time!==r._start+(0<=r._ts?r._tTime/r._ts:(r.totalDuration()-r._tTime)/-r._ts)&&r.totalTime(r._tTime,!0),r=r.parent;!this.parent&&this._dp.autoRemoveChildren&&(0<this._ts&&e<this._tDur||this._ts<0&&0<e||!this._tDur&&!e)&&Pt(this._dp,this,this._start-this._delay)}return(this._tTime!==e||!this._dur&&!t||this._initted&&Math.abs(this._zTime)===Pr||!e&&!this._initted&&(this.add||this._ptLookup))&&(this._ts||(this._pTime=e),vt(this,e,t)),this}},{key:"time",value:function(e,t){return arguments.length?this.totalTime(Math.min(this.totalDuration(),e+Tt(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)+Tt(this),t):this.duration()?Math.min(1,this._time/this._dur):this.ratio}},{key:"iteration",value:function(e,t){var r=this.duration()+this._rDelay;return arguments.length?this.totalTime(this._time+(e-1)*r,t):this._repeat?_t(this._tTime,r)+1:1}},{key:"timeScale",value:function(e){if(!arguments.length)return this._rts===-Pr?0:this._rts;if(this._rts===e)return this;for(var t=this.parent&&this._ts?Mt(this.parent._time,this):this._tTime,r=(this._rts=+e||0,this._ts=this._ps||e===-Pr?0:this._rts,e=this.totalTime(jt(-this._delay,this._tDur,t),!0)).parent;r&&r.parent;)r._dirty=1,r.totalDuration(),r=r.parent;return mn(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):(Ln(),this._ts=this._rts,this.totalTime(this.parent&&!this.parent.smoothChildTiming?this.rawTime():this._tTime||this._pTime,1===this.progress()&&Math.abs(this._zTime)!==Pr&&(this._tTime-=Pr)))),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||Pt(t,this,e-this._delay),this):this._start}},{key:"endTime",value:function(e){return this._start+(Br(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?Mt(t.rawTime(e),this):this._tTime:this._tTime}},{key:"globalTime",value:function(e){for(var t=this,r=arguments.length?e:t.rawTime();t;)r=t._start+r/(t._ts||1),t=t._dp;return r}},{key:"repeat",value:function(e){return arguments.length?(this._repeat=e===1/0?-2:e,Ct(this)):-2===this._repeat?1/0:this._repeat}},{key:"repeatDelay",value:function(e){var t;return arguments.length?(t=this._time,this._rDelay=e,Ct(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(Dt(this,e),Br(t))}},{key:"restart",value:function(e,t){return this.play().totalTime(e?-this._delay:0,Br(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?-Pr:0)),this):this._rts<0}},{key:"invalidate",value:function(){return this._initted=this._act=0,this._zTime=-Pr,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)-Pr))}},{key:"eventCallback",value:function(e,t,r){var n=this.vars;return 1<arguments.length?(t?(n[e]=t,r&&(n[e+"Params"]=r),"onUpdate"===e&&(this._onUpdate=t)):delete n[e],this):n[e]}},{key:"then",value:function(e){var t=this;return new Promise((function(r){function n(){var e=t.then;t.then=null,Ir(i)&&(i=i(t))&&(i.then||i===t)&&(t.then=e),r(i),t.then=e}var i=Ir(e)?e:gt;t._initted&&1===t.totalProgress()&&0<=t._ts||!t._tTime&&t._ts<0?n():t._prom=n}))}},{key:"kill",value:function(){Wt(this)}}]),e}(),Jn=(cn(Kn.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:-Pr,_prom:0,_ps:!1,_rts:1}),function(){Qe(t,Kn);var e=Je(t);function t(){var r,n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},i=1<arguments.length?arguments[1]:void 0;return nt(this,t),(r=e.call(this,n)).labels={},r.smoothChildTiming=!!n.smoothChildTiming,r.autoRemoveChildren=!!n.autoRemoveChildren,r._sort=Br(n.sortChildren),er&&Pt(n.parent||er,$e(r),i),n.reversed&&r.reverse(),n.paused&&r.paused(!0),n.scrollTrigger&&Ot($e(r),n.scrollTrigger),r}return rt(t,[{key:"to",value:function(e,t,r){return It(0,arguments,this),this}},{key:"from",value:function(e,t,r){return It(1,arguments,this),this}},{key:"fromTo",value:function(e,t,r,n){return It(2,arguments,this),this}},{key:"set",value:function(e,t,r){return t.duration=0,t.parent=this,wt(t).repeatDelay||(t.repeat=0),t.immediateRender=!!t.immediateRender,new ii(e,t,Dt(this,r),1),this}},{key:"call",value:function(e,t,r){return Pt(this,ii.delayedCall(0,e,t),r)}},{key:"staggerTo",value:function(e,t,r,n,i,o,a){return r.duration=t,r.stagger=r.stagger||n,r.onComplete=o,r.onCompleteParams=a,r.parent=this,new ii(e,r,Dt(this,i)),this}},{key:"staggerFrom",value:function(e,t,r,n,i,o,a){return r.runBackwards=1,wt(r).immediateRender=Br(r.immediateRender),this.staggerTo(e,t,r,n,i,o,a)}},{key:"staggerFromTo",value:function(e,t,r,n,i,o,a,s){return n.startAt=r,wt(n).immediateRender=Br(n.immediateRender),this.staggerTo(e,t,n,i,o,a,s)}},{key:"render",value:function(e,t,r){var n,i,o,a,s,l,u,c,h,p,d=this._time,f=this._dirty?this.totalDuration():this._tDur,m=this._dur,v=e<=0?0:ln(e),y=this._zTime<0!=e<0&&(this._initted||!m);if((v=this!==er&&f<v&&0<=e?f:v)!==this._tTime||r||y){if(d!==this._time&&m&&(v+=this._time-d,e+=this._time-d),n=v,c=this._start,s=!(u=this._ts),y&&(m||(d=this._zTime),!e&&t||(this._zTime=e)),this._repeat){if(y=this._yoyo,a=m+this._rDelay,this._repeat<-1&&e<0)return this.totalTime(100*a+e,t,r);if(n=ln(v%a),v===f?(o=this._repeat,n=m):((o=~~(v/a))&&o===v/a&&(n=m,o--),m<n&&(n=m)),h=_t(this._tTime,a),y&&1&o&&(n=m-n,p=1),o!==(h=!d&&this._tTime&&h!==o?o:h)&&!this._lock){var g=y&&1&h;if(y=g===(y&&1&o),d=(g=o<h?!g:g)?0:m,this._lock=1,this.render(d||(p?0:ln(o*a)),t,!m)._lock=0,this._tTime=v,!t&&this.parent&&Gt(this,"onRepeat"),this.vars.repeatRefresh&&!p&&(this.invalidate()._lock=1),d&&d!==this._time||s!=!this._ts||this.vars.onRepeat&&!this.parent&&!this._act)return this;if(m=this._dur,f=this._tDur,y&&(this._lock=2,this.render(d=g?m:-1e-4,!0),this.vars.repeatRefresh&&!p&&this.invalidate()),this._lock=0,!this._ts&&!s)return this;Yt(this,p)}}if(this._hasPause&&!this._forcing&&this._lock<2&&(l=function(e,t,r){var n;if(t<r)for(n=e._first;n&&n._start<=r;){if("isPause"===n.data&&n._start>t)return n;n=n._next}else for(n=e._last;n&&n._start>=r;){if("isPause"===n.data&&n._start<t)return n;n=n._prev}}(this,ln(d),ln(n)))&&(v-=n-(n=l._start)),this._tTime=v,this._time=n,this._act=!u,this._initted||(this._onUpdate=this.vars.onUpdate,this._initted=1,this._zTime=e,d=0),!d&&n&&!t&&(Gt(this,"onStart"),this._tTime!==v))return this;if(d<=n&&0<=e)for(b=this._first;b;){if(i=b._next,(b._act||n>=b._start)&&b._ts&&l!==b){if(b.parent!==this)return this.render(e,t,r);if(b.render(0<b._ts?(n-b._start)*b._ts:(b._dirty?b.totalDuration():b._tDur)+(n-b._start)*b._ts,t,r),n!==this._time||!this._ts&&!s){l=0,i&&(v+=this._zTime=-Pr);break}}b=i}else for(var b=this._last,x=e<0?e:n;b;){if(i=b._prev,(b._act||x<=b._end)&&b._ts&&l!==b){if(b.parent!==this)return this.render(e,t,r);if(b.render(0<b._ts?(x-b._start)*b._ts:(b._dirty?b.totalDuration():b._tDur)+(x-b._start)*b._ts,t,r),n!==this._time||!this._ts&&!s){l=0,i&&(v+=this._zTime=x?-Pr:Pr);break}}b=i}if(l&&!t&&(this.pause(),l.render(d<=n?0:-Pr)._zTime=d<=n?1:-1,this._ts))return this._start=c,mn(this),this.render(e,t,r);this._onUpdate&&!t&&Gt(this,"onUpdate",!0),!(v===f&&f>=this.totalDuration()||!v&&d)||c!==this._start&&Math.abs(u)===Math.abs(this._ts)||this._lock||(!e&&m||!(v===f&&0<this._ts||!v&&this._ts<0)||dn(this,1),t||e<0&&!d||!v&&!d&&f||(Gt(this,v===f&&0<=e?"onComplete":"onReverseComplete",!0),!this._prom||v<f&&0<this.timeScale()||this._prom()))}return this}},{key:"add",value:function(e,t){var r=this;if(jr(t)||(t=Dt(this,t,e)),!(e instanceof Kn)){if(Nr(e))return e.forEach((function(e){return r.add(e,t)})),this;if(Dr(e))return this.addLabel(e,t);if(!Ir(e))return this;e=ii.delayedCall(0,e)}return this!==e?Pt(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],r=!(2<arguments.length&&void 0!==arguments[2])||arguments[2],n=3<arguments.length&&void 0!==arguments[3]?arguments[3]:-Er,i=[],o=this._first;o;)o._start>=n&&(o instanceof ii?t&&i.push(o):(r&&i.push(o),e&&i.push.apply(i,it(o.getChildren(!0,t,r))))),o=o._next;return i}},{key:"getById",value:function(e){for(var t=this.getChildren(1,1,1),r=t.length;r--;)if(t[r].vars.id===e)return t[r]}},{key:"remove",value:function(e){return Dr(e)?this.removeLabel(e):Ir(e)?this.killTweensOf(e):(pn(this,e),e===this._recent&&(this._recent=this._last),fn(this))}},{key:"totalTime",value:function(e,r){return arguments.length?(this._forcing=1,!this._dp&&this._ts&&(this._start=ln(An.time-(0<this._ts?e/this._ts:(this.totalDuration()-e)/-this._ts))),Ze(et(t.prototype),"totalTime",this).call(this,e,r),this._forcing=0,this):this._tTime}},{key:"addLabel",value:function(e,t){return this.labels[e]=Dt(this,t),this}},{key:"removeLabel",value:function(e){return delete this.labels[e],this}},{key:"addPause",value:function(e,t,r){return(t=ii.delayedCall(0,t||dt,r)).data="isPause",this._hasPause=1,Pt(this,t,Dt(this,e))}},{key:"removePause",value:function(e){var t=this._first;for(e=Dt(this,e);t;)t._start===e&&"isPause"===t.data&&dn(t),t=t._next}},{key:"killTweensOf",value:function(e,t,r){for(var n=this.getTweensOf(e,r),i=n.length;i--;)Zn!==n[i]&&n[i].kill(e,t);return this}},{key:"getTweensOf",value:function(e,t){for(var r,n=[],i=Sn(e),o=this._first,a=jr(t);o;)o instanceof ii?function(e,t){for(var r=t.length,n=0;e.indexOf(t[n])<0&&++n<r;);return n<r}(o._targets,i)&&(a?(!Zn||o._initted&&o._ts)&&o.globalTime(0)<=t&&o.globalTime(o.totalDuration())>t:!t||o.isActive())&&n.push(o):(r=o.getTweensOf(i,t)).length&&n.push.apply(n,it(r)),o=o._next;return n}},{key:"tweenTo",value:function(e,t){t=t||{};var r,n=this,i=Dt(n,e),o=(e=t).startAt,a=e.onStart,s=e.onStartParams,l=(e=e.immediateRender,ii.to(n,cn({ease:t.ease||"none",lazy:!1,immediateRender:!1,time:i,overwrite:"auto",duration:t.duration||Math.abs((i-(o&&"time"in o?o.time:n._time))/n.timeScale())||Pr,onStart:function(){var e;n.pause(),r||(e=t.duration||Math.abs((i-(o&&"time"in o?o.time:n._time))/n.timeScale()),l._dur!==e&&Lt(l,e,0,1).render(l._time,!0,!0),r=1),a&&a.apply(l,s||[])}},t)));return e?l.render(0):l}},{key:"tweenFromTo",value:function(e,t,r){return this.tweenTo(t,cn({startAt:{time:Dt(this,e)}},r))}},{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 Ht(this,Dt(this,e))}},{key:"previousLabel",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this._time;return Ht(this,Dt(this,e),1)}},{key:"currentLabel",value:function(e){return arguments.length?this.seek(e,!0):this.previousLabel(this._time+Pr)}},{key:"shiftChildren",value:function(e,t){for(var r,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,i=this._first,o=this.labels;i;)i._start>=n&&(i._start+=e,i._end+=e),i=i._next;if(t)for(r in o)o[r]>=n&&(o[r]+=e);return fn(this)}},{key:"invalidate",value:function(){var e=this._first;for(this._lock=0;e;)e.invalidate(),e=e._next;return Ze(et(t.prototype),"invalidate",this).call(this)}},{key:"clear",value:function(){for(var e,t=!(0<arguments.length&&void 0!==arguments[0])||arguments[0],r=this._first;r;)e=r._next,this.remove(r),r=e;return this._dp&&(this._time=this._tTime=this._pTime=0),t&&(this.labels={}),fn(this)}},{key:"totalDuration",value:function(e){var t,r,n,i=0,o=this,a=o._last,s=Er;if(arguments.length)return o.timeScale((o._repeat<0?o.duration():o.totalDuration())/(o.reversed()?-e:e));if(o._dirty){for(n=o.parent;a;)t=a._prev,a._dirty&&a.totalDuration(),(r=a._start)>s&&o._sort&&a._ts&&!o._lock?(o._lock=1,Pt(o,a,r-a._delay,1)._lock=0):s=r,r<0&&a._ts&&(i-=r,(!n&&!o._dp||n&&n.smoothChildTiming)&&(o._start+=r/o._ts,o._time-=r,o._tTime-=r),o.shiftChildren(-r,!1,-1/0),s=0),a._end>i&&a._ts&&(i=a._end),a=t;Lt(o,o===er&&o._time>i?o._time:i,1,1),o._dirty=0}return o._tDur}}],[{key:"updateRoot",value:function(e){if(er._ts&&(vt(er,Mt(e,er)),or=An.frame),An.frame>=rn){rn+=_r.autoSleep||120;var t=er._first;if((!t||!t._ts)&&_r.autoSleep&&An._listeners.length<2){for(;t&&!t._ts;)t=t._next;t||An.sleep()}}}}]),t}()),$n=(cn(Jn.prototype,{_lock:0,_hasPause:0,_forcing:0}),function(e,t,r,n,i,o,a){var s,l,u,c,h,p=new pi(this._pt,e,t,0,1,Hn,null,i),d=0,f=0;for(p.b=r,p.e=n,r+="",(i=~(n+="").indexOf("random("))&&(n=_n(n)),o&&(o(o=[r,n],e,t),r=o[0],n=o[1]),s=r.match(Gr)||[];c=Gr.exec(n);)u=c[0],c=n.substring(d,c.index),l?l=(l+1)%5:"rgba("===c.substr(-5)&&(l=1),u!==s[f++]&&(h=parseFloat(s[f-1])||0,p._pt={_next:p._pt,p:c||1===f?c:",",s:h,c:"="===u.charAt(1)?parseFloat(u.substr(2))*("-"===u.charAt(0)?-1:1):parseFloat(u)-h,m:l&&l<4?Math.round:0},d=Gr.lastIndex);return p.c=d<n.length?n.substring(d,n.length):"",p.fp=a,(Wr.test(n)||i)&&(p.e=0),this._pt=p}),ei=function(e,t,r,n,i,o,a,s,l){var u;if(Ir(n)&&(n=n(i||0,e,o)),i=e[t],o="get"!==r?r:Ir(i)?l?e[t.indexOf("set")||!Ir(e["get"+t.substr(3)])?t:"get"+t.substr(3)](l):e[t]():i,r=Ir(i)?l?si:ai:oi,Dr(n)&&"="===(n=~n.indexOf("random(")?_n(n):n).charAt(1)&&(!(u=parseFloat(o)+parseFloat(n.substr(2))*("-"===n.charAt(0)?-1:1)+(bn(o)||0))&&0!==u||(n=u)),o!==n)return isNaN(o*n)||""===n?(i||t in e||Qr(t,n),$n.call(this,e,t,o,n,r,s||_r.stringFilter,l)):(u=new pi(this._pt,e,t,+o||0,n-(o||0),"boolean"==typeof i?ci:ui,0,r),l&&(u.fp=l),a&&u.modifier(a,this,e),this._pt=u)},ti=function(e,t,r,n,i,o){var a,s,l,u;if(en[e]&&!1!==(a=new en[e]).init(i,a.rawVars?t[e]:function(e,t,r,n,i){if(Ir(e)&&(e=Fn(e,i,t,r,n)),!Ur(e)||e.style&&e.nodeType||Nr(e)||zr(e))return Dr(e)?Fn(e,i,t,r,n):e;var o,a={};for(o in e)a[o]=Fn(e[o],i,t,r,n);return a}(t[e],n,i,o,r),r,n,o)&&(r._pt=s=new pi(r._pt,i,e,0,1,a.render,a,0,a.priority),r!==ar))for(l=r._ptLookup[r._targets.indexOf(i)],u=a._props.length;u--;)l[a._props[u]]=s;return a},ri=on+"repeat,repeatDelay,yoyo,repeatRefresh,yoyoEase",ni={},ii=(mt(ri+",id,stagger,delay,duration,paused,scrollTrigger",(function(e){return ni[e]=1})),function(){Qe(t,Kn);var e=Je(t);function t(r,n,i,o){nt(this,t),"number"==typeof n&&(i.duration=n,n=i,i=null);var a,s,l,u,c,h,p,d,f,m=(o=(a=e.call(this,o?n:wt(n))).vars).duration,v=o.delay,y=o.immediateRender,g=o.stagger,b=o.overwrite,x=o.keyframes,w=o.defaults,S=o.scrollTrigger,T=o.yoyoEase,_=(o=n.parent||er,(Nr(r)||zr(r)?jr(r[0]):"length"in n)?[r]:Sn(r));if(a._targets=_.length?an(_):ht("GSAP target "+r+" not found. https://greensock.com",!_r.nullTargetWarn)||[],a._ptLookup=[],a._overwrite=b,x||g||ut(m)||ut(v)){if(n=a.vars,(s=a.timeline=new Jn({data:"nested",defaults:w||{}})).kill(),s.parent=s._dp=$e(a),s._start=0,g||ut(m)||ut(v)){if(c=_.length,d=g&&Ut(g),Ur(g))for(h in g)~ri.indexOf(h)&&((f=f||{})[h]=g[h]);for(l=0;l<c;l++)(u=hn(n,ni)).stagger=0,T&&(u.yoyoEase=T),f&&bt(u,f),p=_[l],u.duration=+Fn(m,$e(a),l,p,_),u.delay=(+Fn(v,$e(a),l,p,_)||0)-a._delay,!g&&1===c&&u.delay&&(a._delay=v=u.delay,a._start+=v,u.delay=0),s.to(p,u,d?d(l,p,_):0),s._ease=Cn.none;s.duration()?m=v=0:a.timeline=0}else if(x){wt(cn(s.vars.defaults,{ease:"none"})),s._ease=Un(x.ease||n.ease||"none");var M,E,P,O=0;if(Nr(x))x.forEach((function(e){return s.to(_,e,">")}));else{for(h in u={},x)"ease"!==h&&"easeEach"!==h&&function(e,t,r,n){var i,o,a=t.ease||n||"power1.inOut";if(Nr(t))o=r[e]||(r[e]=[]),t.forEach((function(e,r){return o.push({t:r/(t.length-1)*100,v:e,e:a})}));else for(i in t)o=r[i]||(r[i]=[]),"ease"!==i&&o.push({t:parseFloat(e),v:t[i],e:a})}(h,x[h],u,x.easeEach);for(h in u)for(M=u[h].sort((function(e,t){return e.t-t.t})),l=O=0;l<M.length;l++)(P={ease:(E=M[l]).e,duration:(E.t-(l?M[l-1].t:0))/100*m})[h]=E.v,s.to(_,P,O),O+=P.duration;s.duration()<m&&s.to({},{duration:m-s.duration()})}}m||a.duration(m=s.duration())}else a.timeline=0;return!0!==b||$t||(Zn=$e(a),er.killTweensOf(_),Zn=0),Pt(o,$e(a),i),n.reversed&&a.reverse(),n.paused&&a.paused(!0),(y||!m&&!x&&a._start===ln(o._time)&&Br(y)&&St($e(a))&&"nested"!==o.data)&&(a._tTime=-Pr,a.render(Math.max(0,-v))),S&&Ot($e(a),S),a}return rt(t,[{key:"render",value:function(e,t,r){var n,i,o=this._time,a=this._tDur,s=this._dur,l=a-Pr<e&&0<=e?a:e<Pr?0:e;if(s){if(l!==this._tTime||!e||r||!this._initted&&this._tTime||this._startAt&&this._zTime<0!=e<0){if(m=l,f=this.timeline,this._repeat){if(h=s+this._rDelay,this._repeat<-1&&e<0)return this.totalTime(100*h+e,t,r);if(m=ln(l%h),l===a?(y=this._repeat,m=s):((y=~~(l/h))&&y===l/h&&(m=s,y--),s<m&&(m=s)),(d=this._yoyo&&1&y)&&(p=this._yEase,m=s-m),g=_t(this._tTime,h),m===o&&!r&&this._initted)return this;y!==g&&(f&&this._yEase&&Yt(f,d),!this.vars.repeatRefresh||d||this._lock||(this._lock=r=1,this.render(ln(h*y),!0).invalidate()._lock=0))}if(!this._initted){if(Rt(this,e<0?e:m,r,t))return this._tTime=0,this;if(s!==this._dur)return this.render(e,t,r)}if(this._tTime=l,this._time=m,!this._act&&this._ts&&(this._act=1,this._lazy=0),this.ratio=i=(p||this._ease)(m/s),this._from&&(this.ratio=i=1-i),m&&!o&&!t&&(Gt(this,"onStart"),this._tTime!==l))return this;for(n=this._pt;n;)n.r(i,n.d),n=n._next;f&&f.render(e<0?e:!m&&d?-Pr:f._dur*f._ease(m/this._dur),t,r)||this._startAt&&(this._zTime=e),this._onUpdate&&!t&&(e<0&&this._startAt&&this._startAt.render(e,!0,r),Gt(this,"onUpdate")),this._repeat&&y!==g&&this.vars.onRepeat&&!t&&this.parent&&Gt(this,"onRepeat"),l!==this._tDur&&l||this._tTime!==l||(e<0&&this._startAt&&!this._onUpdate&&this._startAt.render(e,!0,!0),!e&&s||!(l===this._tDur&&0<this._ts||!l&&this._ts<0)||dn(this,1),t||e<0&&!o||!l&&!o||(Gt(this,l===a?"onComplete":"onReverseComplete",!0),!this._prom||l<a&&0<this.timeScale()||this._prom()))}}else{var u,c,h=this,p=e,d=t,f=r,m=h.ratio,v=p<0||!p&&(!h._start&&kt(h)&&(h._initted||!At(h))||(h._ts<0||h._dp._ts<0)&&!At(h))?0:1,y=h._rDelay,g=0;if(y&&h._repeat&&(c=_t(g=jt(0,h._tDur,p),y),h._yoyo&&1&c&&(v=1-v),c!==_t(h._tTime,y)&&(m=1-v,h.vars.repeatRefresh&&h._initted&&h.invalidate())),v!==m||f||h._zTime===Pr||!p&&h._zTime){if(h._initted||!Rt(h,p,f,d)){for(c=h._zTime,h._zTime=p||(d?Pr:0),d=d||p&&!c,h.ratio=v,h._from&&(v=1-v),h._time=0,h._tTime=g,u=h._pt;u;)u.r(v,u.d),u=u._next;h._startAt&&p<0&&h._startAt.render(p,!0,!0),h._onUpdate&&!d&&Gt(h,"onUpdate"),g&&h._repeat&&!d&&h.parent&&Gt(h,"onRepeat"),(p>=h._tDur||p<0)&&h.ratio===v&&(v&&dn(h,1),d||(Gt(h,v?"onComplete":"onReverseComplete",!0),h._prom&&h._prom()))}}else h._zTime||(h._zTime=p)}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(),Ze(et(t.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?Wt(this):this;if(this.timeline)return p=this.timeline.totalDuration(),this.timeline.killTweensOf(e,t,Zn&&!0!==Zn.vars.overwrite)._first||Wt(this),this.parent&&p!==this.timeline.totalDuration()&&Lt(this,this._dur*this.timeline._tDur/p,0,1),this;var r,n,i,o,a,s,l,u=this._targets,c=e?Sn(e):u,h=this._ptLookup,p=this._pt;if((!t||"all"===t)&&function(e,t){for(var r=e.length,n=r===t.length;n&&r--&&e[r]===t[r];);return r<0}(u,c))return"all"===t&&(this._pt=0),Wt(this);for(r=this._op=this._op||[],"all"!==t&&(Dr(t)&&(a={},mt(t,(function(e){return a[e]=1})),t=a),t=function(e,t){var r,n,i,o,a=(e=e[0]?sn(e[0]).harness:0)&&e.aliases;if(!a)return t;for(n in r=bt({},t),a)if(n in r)for(i=(o=a[n].split(",")).length;i--;)r[o[i]]=r[n];return r}(u,t)),l=u.length;l--;)if(~c.indexOf(u[l]))for(a in n=h[l],"all"===t?(r[l]=t,o=n,i={}):(i=r[l]=r[l]||{},o=t),o)(s=n&&n[a])&&("kill"in s.d&&!0!==s.d.kill(a)||pn(this,s,"_pt"),delete n[a]),"all"!==i&&(i[a]=1);return this._initted&&!this._pt&&p&&Wt(this),this}}],[{key:"to",value:function(e,r){return new t(e,r,arguments[2])}},{key:"from",value:function(e,t){return It(1,arguments)}},{key:"delayedCall",value:function(e,r,n,i){return new t(r,0,{immediateRender:!1,lazy:!1,overwrite:!1,delay:e,onComplete:r,onReverseComplete:r,onCompleteParams:n,onReverseCompleteParams:n,callbackScope:i})}},{key:"fromTo",value:function(e,t,r){return It(2,arguments)}},{key:"set",value:function(e,r){return r.duration=0,r.repeatDelay||(r.repeat=0),new t(e,r)}},{key:"killTweensOf",value:function(e,t,r){return er.killTweensOf(e,t,r)}}]),t}()),oi=(cn(ii.prototype,{_targets:[],_lazy:0,_startAt:0,_op:0,_onInit:0}),mt("staggerTo,staggerFrom,staggerFromTo",(function(e){ii[e]=function(){var t=new Jn,r=xn.call(arguments,0);return r.splice("staggerFromTo"===e?5:4,0,0),t[e].apply(t,r)}})),function(e,t,r){return e[t]=r}),ai=function(e,t,r){return e[t](r)},si=function(e,t,r,n){return e[t](n.fp,r)},li=function(e,t){return Ir(e[t])?ai:st(e[t])&&e.setAttribute?Vn:oi},ui=function(e,t){return t.set(t.t,t.p,Math.round(1e6*(t.s+t.c*e))/1e6,t)},ci=function(e,t){return t.set(t.t,t.p,!!(t.s+t.c*e),t)},hi=function(e){for(var t,r,n,i,o=e._pt;o;){for(t=o._next,r=n;r&&r.pr>o.pr;)r=r._next;(o._prev=r?r._prev:i)?o._prev._next=o:n=o,(o._next=r)?r._prev=o:i=o,o=t}e._pt=n},pi=function(){function e(t,r,n,i,o,a,s,l,u){nt(this,e),this.t=r,this.s=i,this.c=o,this.p=n,this.r=a||ui,this.d=s||this,this.set=l||oi,this.pr=u||0,(this._next=t)&&(t._prev=this)}return rt(e,[{key:"modifier",value:function(e,t,r){this.mSet=this.mSet||this.set,this.set=qn,this.m=e,this.mt=r,this.tween=t}}]),e}(),di=(mt(on+"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 Kr[e]=1})),Yr.TweenMax=Yr.TweenLite=ii,Yr.TimelineLite=Yr.TimelineMax=Jn,er=new Jn({sortChildren:!1,defaults:Mr,autoRemoveChildren:!0,id:"root",smoothChildTiming:!0}),_r.stringFilter=function(e){var t=e.join(" ");if(Rn.lastIndex=0,Rn.test(t))return t=kn.test(t),e[1]=qt(e[1],t),e[0]=qt(e[0],t,On(e[1])),!0},{registerPlugin:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];t.forEach((function(e){var t=(e=!e.name&&e.default||e).name,r=Ir(e),n=(r=t&&!r&&e.init?function(){this._props=[]}:e,{init:dt,render:Gn,add:ei,kill:Xn,modifier:Wn,rawVars:0}),i={targetTest:0,get:0,getSetter:li,aliases:{},register:0};if(Ln(),e!==r){if(en[t])return;cn(r,cn(hn(e,n),i)),bt(r.prototype,bt(n,hn(e,i))),en[r.prop=t]=r,e.targetTest&&(nn.push(r),Kr[t]=1),t=("css"===t?"CSS":t.charAt(0).toUpperCase()+t.substr(1))+"Plugin"}pt(t,r),e.register&&e.register(mi,r,pi)}))},timeline:function(e){return new Jn(e)},getTweensOf:function(e,t){return er.getTweensOf(e,t)},getProperty:function(e,t,r,n){Dr(e)&&(e=Sn(e)[0]);var i=sn(e||{}).get,o=r?gt:yt;return"native"===r&&(r=""),e&&(t?o((en[t]&&en[t].get||i)(e,t,r,n)):function(t,r,n){return o((en[t]&&en[t].get||i)(e,t,r,n))})},quickSetter:function(e,t,r){var n,i;if(1<(e=Sn(e)).length)return n=e.map((function(e){return mi.quickSetter(e,t,r)})),i=n.length,function(e){for(var t=i;t--;)n[t](e)};e=e[0]||{};var o=en[t],a=sn(e),s=a.harness&&(a.harness.aliases||{})[t]||t,l=o?function(t){var n=new o;ar._pt=0,n.init(e,r?t+r:t,ar,0,[e]),n.render(1,n),ar._pt&&Gn(1,ar)}:a.set(e,s);return o?l:function(t){return l(e,s,r?t+r:t,a,1)}},isTweening:function(e){return 0<er.getTweensOf(e,!0).length},defaults:function(e){return e&&e.ease&&(e.ease=Un(e.ease,Mr.ease)),xt(Mr,e||{})},config:function(e){return xt(_r,e||{})},registerEffect:function(e){var t=e.name,r=e.effect,n=e.plugins,i=e.defaults;e=e.extendTimeline,(n||"").split(",").forEach((function(e){return e&&!en[e]&&!Yr[e]&&ht(t+" effect requires "+e+" plugin.")})),tn[t]=function(e,t,n){return r(Sn(e),cn(t||{},i),n)},e&&(Jn.prototype[t]=function(e,r,n){return this.add(tn[t](e,Ur(r)?r:(n=r)&&{},this),n)})},registerEase:function(e,t){Cn[e]=Un(t)},parseEase:function(e,t){return arguments.length?Un(e,t):Cn},getById:function(e){return er.getById(e)},exportRoot:function(){var e,t,r=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},n=1<arguments.length?arguments[1]:void 0,i=new Jn(r);for(i.smoothChildTiming=Br(r.smoothChildTiming),er.remove(i),i._dp=0,i._time=i._tTime=er._time,e=er._first;e;)t=e._next,!n&&!e._dur&&e instanceof ii&&e.vars.onComplete===e._targets[0]||Pt(i,e,e._start-e._delay),e=t;return Pt(er,i,0),i},utils:{wrap:function e(t,r,n){var i=r-t;return Nr(t)?Ft(t,e(0,t.length),r):gn(n,(function(e){return(i+(e-t)%i)%i+t}))},wrapYoyo:function e(t,r,n){var i=r-t,o=2*i;return Nr(t)?Ft(t,e(0,t.length-1),r):gn(n,(function(e){return t+(i<(e=(o+(e-t)%o)%o||0)?o-e:e)}))},distribute:Ut,random:Nt,snap:zt,normalize:function(e,t,r){return Vt(e,t,0,1,r)},getUnit:bn,clamp:function(e,t,r){return gn(r,(function(r){return jt(e,t,r)}))},splitColor:Pn,toArray:Sn,selector:function(e){return e=Sn(e)[0]||ht("Invalid scope")||{},function(t){var r=e.current||e.nativeElement||e;return Sn(t,r.querySelectorAll?r:r===e?ht("Invalid scope")||nr.createElement("div"):e)}},mapRange:Vt,pipe:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(e){return t.reduce((function(e,t){return t(e)}),e)}},unitize:function(e,t){return function(r){return e(parseFloat(r))+(t||bn(r))}},interpolate:function e(t,r,n,i){var o=isNaN(t+r)?0:function(e){return(1-e)*t+e*r};if(!o){var a,s,l,u,c,h=Dr(t),p={};if(!0===n&&(i=1)&&(n=null),h)t={p:t},r={p:r};else if(Nr(t)&&!Nr(r)){for(l=[],u=t.length,c=u-2,s=1;s<u;s++)l.push(e(t[s-1],t[s]));u--,o=function(e){e*=u;var t=Math.min(c,~~e);return l[t](e-t)},n=r}else i||(t=bt(Nr(t)?[]:{},t));if(!l){for(a in r)ei.call(p,t,a,"get",r[a]);o=function(e){return Gn(e,p),h?t.p:t}}}return gn(n,o)},shuffle:Tn},install:ct,effects:tn,ticker:An,updateRoot:Jn.updateRoot,plugins:en,globalTimeline:er,core:{PropTween:pi,globals:pt,Tween:ii,Timeline:Jn,Animation:Kn,getCache:sn,_removeLinkedListItem:pn,suppressOverwrites:function(e){return $t=e}}}),fi=(mt("to,from,fromTo,delayedCall,set,killTweensOf",(function(e){return di[e]=ii[e]})),An.add(Jn.updateRoot),ar=di.to({},{duration:0}),function(e,t){for(var r=e._pt;r&&r.p!==t&&r.op!==t&&r.fp!==t;)r=r._next;return r}),mi=di.registerPlugin({name:"attr",init:function(e,t,r,n,i){var o,a;for(o in t)(a=this.add(e,"setAttribute",(e.getAttribute(o)||0)+"",t[o],n,i,0,0,o))&&(a.op=o),this._props.push(o)}},{name:"endArray",init:function(e,t){for(var r=t.length;r--;)this.add(e,r,e[r]||0,t[r])}},Yn("roundProps",Bt),Yn("modifiers"),Yn("snap",zt))||di;ii.version=Jn.version=mi.version="3.9.1",ir=1,lt()&&Ln(),Cn.Power0,Cn.Power1,Cn.Power2,Cn.Power3,Cn.Power4,Cn.Linear,Cn.Quad,Cn.Cubic,Cn.Quart,Cn.Quint,Cn.Strong,Cn.Elastic,Cn.Back,Cn.SteppedEase,Cn.Bounce,Cn.Sine,Cn.Expo,Cn.Circ;const vi=c,yi=["map","normalMap","aoMap"],gi=["map","metalnessMap","roughnessMap","normalMap","aoMap","emissiveMap","alphaMap","lightMap","envMap","displacementMap"];class bi{}const xi=class extends bi{constructor(e){super(),this.type="修改材质";var{target:e,info:t,newVal:r,oldVal:n,runScene:i}=e;this.runScene=i,this.target=e,this.info=t,this.newVal=r,this.oldVal=n}_execute(e,t){this.target[this.info]=e,this.target.needsUpdate=!0,gi.includes(this.info)&&e&&this.runScene.uniqueEx.texture.addMaterial(e,{material:this.target,type:this.info})}execute(){return this.redo(),this}undo(){this._execute(this.oldVal,this.newVal)}redo(){this._execute(this.newVal,this.oldVal)}};var wi=function(e,t,r,n){return new(r=r||Promise)((function(i,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))};class Si{constructor(e){this.allTextures=new Set,this.runScene=e}load(e){return wi(this,void 0,void 0,(function*(){var t=yield Io(e);return this.parse(t)}))}parse(e){return wi(this,void 0,void 0,(function*(){var t="Blob"===ga(e)?e:yield Uo(e);return this.afterLoad(t,yield Ai(t))}))}clone(e){const t=new c.Texture(e.image);return t.userData=Object.assign(Object.assign({},e.userData),{id:(0,l.getId)()}),Pi(t),this.getSameAndAddtoAll(t)}getDef(e){return e=new c.Texture(e),Pi(e),this.getSameAndAddtoAll(e)}getSameAndAddtoAll(e){var t=e.userData.md5;return(t=this.getSameTexture(t,e))?(Ei(e),t):(this.initTextureAndAddtoAll(e),e)}afterLoad(e,t){return wi(this,void 0,void 0,(function*(){return this.getSameAndAddtoAll(yield Pi(t,e))}))}getSameTexture(e,t){for(const n in this.runScene.uniqueEx.texture.map){var r=this.runScene.uniqueEx.texture.get(n);if(r.userData.md5===e&&r.mapping===t.mapping)return r}}initTextureAndAddtoAll(e){return wi(this,void 0,void 0,(function*(){return Ri(e),Pi(e),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.optionsEx.cb.texture.add.cb(e)}getBlobAndBase64(e){return e.userData.blob?e.userData:Ro(e)}coverByImage(e,t){return wi(this,void 0,void 0,(function*(){let r;r=t instanceof c.Texture?t:t?yield this.parse(t):null;var n=this.runScene.uniqueEx.texture.getMaterials(this.runScene.uniqueEx.getId(e));if(n){const t=[];(0,Xe.js)(n,((n,i)=>{const o=this.runScene.uniqueEx.material.get(n);o&&i.forEach((n=>{t.push(new xi({target:o,info:n,newVal:r,oldVal:e,runScene:this.runScene}).execute())}))})),this.runScene.undoEx.addUndo(t)}}))}removeTexture(e){this.runScene.optionsEx.cb.texture.remove.cb(e),this.runScene.uniqueEx.texture.remove(e)}}const Ti={环境遮蔽:"aoMap",法线:"normalMap",金属度:"metalnessMap",粗糙度:"roughnessMap",自发光:"emissiveMap",颜色:"map",置换:"displacementMap",光照贴图:"lightMap",环境:"envMap",透明度:"alphaMap"},_i=e=>1023===e.format?"image/png":"image/jpeg",Mi=e=>{var{width:e,height:t}=e.image;return e*t*4*1.33},Ei=e=>{if(e){const r=e.image;var t=e.userData.url;r.close(),URL.revokeObjectURL(t),e.dispose()}},Pi=(e,t)=>wi(void 0,void 0,void 0,(function*(){const r=t||e.userData.blob||(yield Oi(e));var{md5:n,url:i}=e.userData;return e.userData.blob=r,n||(e.userData.md5=Fo(yield r.arrayBuffer())),i||(e.userData.url=URL.createObjectURL(r)),e.userData.gm=Mi(e),e.format=e.userData.format||-1!==r.type.indexOf("png")?1023:1022,e})),Oi=e=>e.userData.blob||Po(e.image),Ri=e=>(e.magFilter=1003,e.wrapS=vi.RepeatWrapping,e.wrapT=vi.RepeatWrapping,e.encoding=3e3,e.version=3,e.flipY=!1,e.minFilter=vi.LinearMipmapLinearFilter,e.needsUpdate=!0,e),ki=e=>createImageBitmap(e,{imageOrientation:"flipY",resizeQuality:"pixelated"}),Ai=e=>wi(void 0,void 0,void 0,(function*(){var t=yield ki(e instanceof Blob?e:yield Io(e));return new c.Texture(t)})),Li=e=>e.userData.url,Ci=(e,t="repeat")=>(e.mapping="repeat"===t?vi.EquirectangularReflectionMapping:300,e.needsUpdate=!0,e),Di=e=>{var{width:e,height:t}=e.image;return{width:e,height:t}};function Ii(e){return(Ii="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 ji(e,t){return(ji=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Ui(e){return(Ui=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Bi=new c.Box3,zi=new c.Vector3,Ni=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ji(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Ui(e);if(r=t?(r=Ui(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Ii(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(){var e;if(!(this instanceof n))throw new TypeError("Cannot call a class as a function");return(e=r.call(this)).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 c.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 c.Float32BufferAttribute([-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],2)),e}return t=n,(e=[{key:"applyMatrix4",value:function(e){var t=this.attributes.instanceStart,r=this.attributes.instanceEnd;return void 0!==t&&(t.applyMatrix4(e),r.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 c.InstancedInterleavedBuffer(t,6,1),this.setAttribute("instanceStart",new c.InterleavedBufferAttribute(e,3,0)),this.setAttribute("instanceEnd",new c.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 c.InstancedInterleavedBuffer(t,6,1),this.setAttribute("instanceColorStart",new c.InterleavedBufferAttribute(e,3,0)),this.setAttribute("instanceColorEnd",new c.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 c.WireframeGeometry(e.geometry)),this}},{key:"fromLineSegments",value:function(e){if(!(e=e.geometry).isGeometry)return e.isBufferGeometry&&this.setPositions(e.attributes.position.array),this;console.error("THREE.LineSegmentsGeometry no longer supports Geometry. Use THREE.BufferGeometry instead.")}},{key:"computeBoundingBox",value:function(){null===this.boundingBox&&(this.boundingBox=new c.Box3);var e=this.attributes.instanceStart,t=this.attributes.instanceEnd;void 0!==e&&void 0!==t&&(this.boundingBox.setFromBufferAttribute(e),Bi.setFromBufferAttribute(t),this.boundingBox.union(Bi))}},{key:"computeBoundingSphere",value:function(){null===this.boundingSphere&&(this.boundingSphere=new c.Sphere),null===this.boundingBox&&this.computeBoundingBox();var e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(void 0!==e&&void 0!==t){for(var r=this.boundingSphere.center,n=(this.boundingBox.getCenter(r),0),i=0,o=e.count;i<o;i++)zi.fromBufferAttribute(e,i),n=Math.max(n,r.distanceToSquared(zi)),zi.fromBufferAttribute(t,i),n=Math.max(n,r.distanceToSquared(zi));this.boundingSphere.radius=Math.sqrt(n),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 r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),n}(c.InstancedBufferGeometry);function Fi(e){return(Fi="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 Vi(e,t){return(Vi=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Hi(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Gi(e){return(Gi=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}Ni.prototype.isLineSegmentsGeometry=!0,c.UniformsLib.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new c.Vector2(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}},c.ShaderLib.line={uniforms:c.UniformsUtils.merge([c.UniformsLib.common,c.UniformsLib.fog,c.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\t// get the offset direction as perpendicular to the view vector\n\t\t\t\tvec3 worldDir = normalize( end.xyz - start.xyz );\n\t\t\t\tvec3 offset;\n\t\t\t\tif ( position.y < 0.5 ) {\n\n\t\t\t\t\toffset = normalize( cross( start.xyz, worldDir ) );\n\n\t\t\t\t} else {\n\n\t\t\t\t\toffset = normalize( cross( end.xyz, worldDir ) );\n\n\t\t\t\t}\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\tfloat forwardOffset = dot( worldDir, vec3( 0.0, 0.0, 1.0 ) );\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// extend the line bounds to encompass endcaps\n\t\t\t\t\tstart.xyz += - worldDir * linewidth * 0.5;\n\t\t\t\t\tend.xyz += worldDir * linewidth * 0.5;\n\n\t\t\t\t\t// shift the position of the quad so it hugs the forward edge of the line\n\t\t\t\t\toffset.xy -= dir * forwardOffset;\n\t\t\t\t\toffset.z += 0.5;\n\n\t\t\t\t#endif\n\n\t\t\t\t// endcaps\n\t\t\t\tif ( position.y > 1.0 || position.y < 0.0 ) {\n\n\t\t\t\t\toffset.xy += dir * 2.0 * forwardOffset;\n\n\t\t\t\t}\n\n\t\t\t\t// adjust for linewidth\n\t\t\t\toffset *= linewidth * 0.5;\n\n\t\t\t\t// set the world position\n\t\t\t\tworldPos = ( position.y < 0.5 ) ? start : end;\n\t\t\t\tworldPos.xyz += offset;\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 <encodings_fragment>\n\t\t\t#include <fog_fragment>\n\t\t\t#include <premultiplied_alpha_fragment>\n\n\t\t}\n\t\t"};var Wi=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Vi(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Gi(e);if(r=t?(r=Gi(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Fi(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return Hi(n)}}(n);function n(e){var t;if(this instanceof n)return t=r.call(this,{type:"LineMaterial",uniforms:c.UniformsUtils.clone(c.ShaderLib.line.uniforms),vertexShader:c.ShaderLib.line.vertexShader,fragmentShader:c.ShaderLib.line.fragmentShader,clipping:!0}),Object.defineProperties(Hi(t),{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(e){this.uniforms.diffuse.value=e}},worldUnits:{enumerable:!0,get:function(){return"WORLD_UNITS"in this.defines},set:function(e){!0===e?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(e){this.uniforms.linewidth.value=e}},dashed:{enumerable:!0,get:function(){return Boolean("USE_DASH"in this.defines)},set:function(e){Boolean(e)!==Boolean("USE_DASH"in this.defines)&&(this.needsUpdate=!0),!0===e?this.defines.USE_DASH="":delete this.defines.USE_DASH}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(e){this.uniforms.dashScale.value=e}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(e){this.uniforms.dashSize.value=e}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(e){this.uniforms.dashOffset.value=e}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(e){this.uniforms.gapSize.value=e}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(e){this.uniforms.opacity.value=e}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(e){this.uniforms.resolution.value.copy(e)}},alphaToCoverage:{enumerable:!0,get:function(){return Boolean("USE_ALPHA_TO_COVERAGE"in this.defines)},set:function(e){Boolean(e)!==Boolean("USE_ALPHA_TO_COVERAGE"in this.defines)&&(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)}}}),t.setValues(e),t;throw new TypeError("Cannot call a class as a function")}return t=n,Object.defineProperty(t,"prototype",{writable:!1}),t}(c.ShaderMaterial);function Xi(e){return(Xi="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,t){return(qi=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Yi(e){return(Yi=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}Wi.prototype.isLineMaterial=!0;var Zi,Qi,Ki,Ji,$i=new c.Vector3,eo=new c.Vector3,to=new c.Vector4,ro=new c.Vector4,no=new c.Vector4,io=new c.Vector3,oo=new c.Matrix4,ao=new c.Line3,so=new c.Vector3,lo=new c.Box3,uo=new c.Sphere,co=new c.Vector4;function ho(e,t,r){return co.set(0,0,-t,1).applyMatrix4(e.projectionMatrix),co.multiplyScalar(1/co.w),co.x=Ji/r.width,co.y=Ji/r.height,co.applyMatrix4(e.projectionMatrixInverse),co.multiplyScalar(1/co.w),Math.abs(Math.max(co.x,co.y))}var po=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&qi(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Yi(e);if(r=t?(r=Yi(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Xi(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new Ni,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new Wi({color:16777215*Math.random()}),i=this,o=n;if(i instanceof o)return(i=r.call(this,e,t)).type="LineSegments2",i;throw new TypeError("Cannot call a class as a function")}return t=n,(e=[{key:"computeLineDistances",value:function(){for(var e=this.geometry,t=e.attributes.instanceStart,r=e.attributes.instanceEnd,n=new Float32Array(2*t.count),i=0,o=0,a=t.count;i<a;i++,o+=2)$i.fromBufferAttribute(t,i),eo.fromBufferAttribute(r,i),n[o]=0===o?0:n[o-1],n[o+1]=n[o]+$i.distanceTo(eo);var s=new c.InstancedInterleavedBuffer(n,2,1);return e.setAttribute("instanceDistanceStart",new c.InterleavedBufferAttribute(s,1,0)),e.setAttribute("instanceDistanceEnd",new c.InterleavedBufferAttribute(s,1,1)),this}},{key:"raycast",value:function(e,t){var r=this.material.worldUnits,n=e.camera,i=(null!==n||r||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),o=(Zi=e.ray,e=this.matrixWorld,this.geometry),a=this.material;if(Ji=a.linewidth+i,Qi=o.attributes.instanceStart,Ki=o.attributes.instanceEnd,null===o.boundingSphere&&o.computeBoundingSphere(),uo.copy(o.boundingSphere).applyMatrix4(e),i=r?.5*Ji:ho(n,Math.max(n.near,uo.distanceToPoint(Zi.origin)),a.resolution),uo.radius+=i,!1!==Zi.intersectsSphere(uo)&&(null===o.boundingBox&&o.computeBoundingBox(),lo.copy(o.boundingBox).applyMatrix4(e),i=r?.5*Ji:ho(n,Math.max(n.near,lo.distanceToPoint(Zi.origin)),a.resolution),lo.expandByScalar(i),!1!==Zi.intersectsBox(lo)))if(r)for(var s=t,l=0,u=Qi.count;l<u;l++){ao.start.fromBufferAttribute(Qi,l),ao.end.fromBufferAttribute(Ki,l);var h=new c.Vector3,p=new c.Vector3;Zi.distanceSqToSegment(ao.start,ao.end,p,h),p.distanceTo(h)<.5*Ji&&s.push({point:p,pointOnLine:h,distance:Zi.origin.distanceTo(p),object:this,face:null,faceIndex:l,uv:null,uv2:null})}else{var d=this,f=t,m=(o=n).projectionMatrix,v=d.material.resolution,y=d.matrixWorld,g=(e=d.geometry).attributes.instanceStart,b=e.attributes.instanceEnd,x=-o.near;Zi.at(1,no),no.w=1,no.applyMatrix4(o.matrixWorldInverse),no.applyMatrix4(m),no.multiplyScalar(1/no.w),no.x*=v.x/2,no.y*=v.y/2,no.z=0,io.copy(no),oo.multiplyMatrices(o.matrixWorldInverse,y);for(var w,S,T,_,M=0,E=g.count;M<E;M++)to.fromBufferAttribute(g,M),ro.fromBufferAttribute(b,M),to.w=1,ro.w=1,to.applyMatrix4(oo),ro.applyMatrix4(oo),to.z>x&&ro.z>x||(to.z>x?(w=to.z-ro.z,w=(to.z-x)/w,to.lerp(ro,w)):ro.z>x&&(w=ro.z-to.z,S=(ro.z-x)/w,ro.lerp(to,S)),to.applyMatrix4(m),ro.applyMatrix4(m),to.multiplyScalar(1/to.w),ro.multiplyScalar(1/ro.w),to.x*=v.x/2,to.y*=v.y/2,ro.x*=v.x/2,ro.y*=v.y/2,ao.start.copy(to),ao.start.z=0,ao.end.copy(ro),ao.end.z=0,S=ao.closestPointToPointParameter(io,!0),ao.at(S,so),T=-1<=(T=c.MathUtils.lerp(to.z,ro.z,S))&&T<=1,_=io.distanceTo(so)<.5*Ji,T&&_&&(ao.start.fromBufferAttribute(g,M),ao.end.fromBufferAttribute(b,M),ao.start.applyMatrix4(y),ao.end.applyMatrix4(y),T=new c.Vector3,_=new c.Vector3,Zi.distanceSqToSegment(ao.start,ao.end,_,T),f.push({point:_,pointOnLine:T,distance:Zi.origin.distanceTo(_),object:d,face:null,faceIndex:M,uv:null,uv2:null})))}}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),n}(c.Mesh);function fo(e){return(fo="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 mo(){return(mo="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=yo(e)););return e}(e,t);if(n)return(n=Object.getOwnPropertyDescriptor(n,t)).get?n.get.call(arguments.length<3?e:r):n.value}).apply(this,arguments)}function vo(e,t){return(vo=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function yo(e){return(yo=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}po.prototype.isLineSegments2=!0;var go=function(){var e=n,t=Ni;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&&vo(e,t);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=yo(e);if(r=t?(r=yo(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===fo(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(){var e;if(this instanceof n)return(e=r.call(this)).type="LineGeometry",e;throw new TypeError("Cannot call a class as a function")}return 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 mo(yo(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 mo(yo(n.prototype),"setColors",this).call(this,r),this}},{key:"fromLine",value:function(e){if(!(e=e.geometry).isGeometry)return e.isBufferGeometry&&this.setPositions(e.attributes.position.array),this;console.error("THREE.LineGeometry no longer supports Geometry. Use THREE.BufferGeometry instead.")}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),n}();function bo(e){return(bo="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 xo(e,t){return(xo=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function wo(e){return(wo=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}go.prototype.isLineGeometry=!0;var So=function(){var e=n,t=po;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&&xo(e,t);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=wo(e);if(r=t?(r=wo(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===bo(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new go,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new Wi({color:16777215*Math.random()}),i=this,o=n;if(i instanceof o)return(i=r.call(this,e,t)).type="Line2",i;throw new TypeError("Cannot call a class as a function")}return e=n,Object.defineProperty(e,"prototype",{writable:!1}),e}(),To=(So.prototype.isLine2=!0,function(e,t,r,n){return new(r=r||Promise)((function(i,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))});const _o=(e,t,r,n,i)=>{let o=Object.assign({},e),a=new ii(o,r,t).eventCallback("onUpdate",(e=>n&&n(o))).eventCallback("onComplete",(e=>{i&&i(),ii.killTweensOf(a)}));return a},Mo=(e,t)=>(t.updateMatrixWorld(!0),t=new vi.Vector3,e.getWorldPosition(t),t),Eo=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()},Po=e=>To(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)}))}))})),Oo=e=>{const t=document.createElement("canvas"),r=(t.width=e.width,t.height=e.height,t.getContext("2d"));r.translate(0,t.height),r.scale(1,-1),r.drawImage(e,0,0,t.width,t.height)},Ro=e=>To(void 0,void 0,void 0,(function*(){var t=e.image;const r=document.createElement("canvas"),n=(r.width=t.width,r.height=t.height,r.getContext("2d")),i=_i(e);return n.drawImage(t,0,0,r.width,r.height),new Promise((e=>{r.toBlob((t=>{e({blob:t,base64:r.toDataURL(i)})}),i)}))})),ko=e=>To(void 0,void 0,void 0,(function*(){-1!==e.indexOf(",")&&(e=Ao(e));const t=window.atob(e);var r=t.length;const n=new Uint8Array(r);for(let e=0;e<r;e++)n[e]=t.charCodeAt(e);return n.buffer})),Ao=e=>e.substring(e.indexOf(",")+1),Lo=e=>URL.createObjectURL(new Blob([e])),Co=(e,t)=>URL.createObjectURL(new Blob([e],t)),Do=e=>{let t="";var r=new Uint8Array(e);for(let e=0,n=r.byteLength;e<n;e++)t+=String.fromCharCode(r[e]);return"data:image/jpg;base64,"+window.btoa(t)},Io=e=>To(void 0,void 0,void 0,(function*(){return(yield s().get(e,{responseType:"blob"})).data})),jo=e=>{let t=e.split(","),r=t[0].match(/:(.*?);/)[1],n=atob(t[1]),i=n.length,o=new Uint8Array(i);for(;i--;)o[i]=n.charCodeAt(i);return new Blob([o],{type:r})},Uo=e=>To(void 0,void 0,void 0,(function*(){return jo(yield(0,Ye.toResult)(e,"base64"))})),Bo=(e,t)=>new File([e],t),zo=e=>e.substring(e.indexOf(":")+1,e.indexOf(";")),No=e=>{let t="";const r=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=r.indexOf("."),"00"==r.substr(e+1,2)?r.substring(0,e)+r.substr(e+3,2):t},Fo=e=>(0,qe.md5)(e),Vo=(e,t)=>{var{width:t,height:r}=t;let n=new Image,i=(n.src=e,n.width=t,n.height=r,document.createElement("canvas")),o=(i.width=t,i.height=r,i.getContext("2d"));return new Promise((e=>{n.onload=function(){o.drawImage(n,0,0,i.width,i.height),e({canvas:i,ctx:o})}}))},Ho=e=>{const t=document.createElement("canvas"),r=t.getContext("2d");return r.drawImage(e,0,0,e.width,e.height),{ctx:r,canvas:t}},Go=(e,t)=>{const r=document.createElement("canvas"),n=r.getContext("2d");return r.width=e.width,r.height=e.height,n.drawImage(e,0,0,e.width,e.height),new Promise((e=>{r.toBlob((t=>{t&&e(URL.createObjectURL(t))}),"image/webp",t)}))},Wo=(e,t,r)=>{e/=255,t/=255,r/=255;var n,i=Math.max(e,t,r),o=Math.min(e,t,r),a=(i+o)/2;if(i==o)n=l=0;else{var s=i-o,l=.5<a?s/(2-i-o):s/(i+o);switch(i){case e:n=(t-r)/s+(t<r?6:0);break;case t:n=(r-e)/s+2;break;case r:n=(e-t)/s+4}n/=6}return[100*n,100*l,100*a]},Xo=(e,t,r)=>{var n,i,o,a;return 0==t?i=o=a=r:(i=(n=function(e,t,r){return r<0&&(r+=1),1<r&&--r,r<1/6?e+6*(t-e)*r:r<.5?t:r<2/3?e+(t-e)*(2/3-r)*6:e})(t=2*r-(r=r<.5?r*(1+t):r+t-r*t),r,e+1/3),o=n(t,r,e),a=n(t,r,e-1/3)),[255*i,255*o,255*a]},qo=e=>To(void 0,void 0,void 0,(function*(){var{bitmap:t,texture:r}=e;const{ctx:n,canvas:i}=yield Vo(URL.createObjectURL(r.userData.blob),{width:t.width,height:t.height});for(var o=n.getImageData(0,0,t.width,t.height,{colorSpace:"srgb"}),a=0,s=o.data.length;a<s;a+=4){var l=(c=Wo(o.data[a],o.data[a+1],o.data[a+2]))[0]/100,u=c[1]/100,c=c[2]/100;l=Xo(l,u,c),o.data[a]=l[0],o.data[a+1]=l[1],o.data[a+2]=l[2]}return n.putImageData(o,0,0),new vi.Texture(i)})),Yo=e=>{for(var t=(e=e.bitmap).width,r=e.height,n=Ho(e).ctx.getImageData(0,0,t,r).data,i=[],o=0;o<n/4;o+=1)i.push(n.slice(4*o,4*(o+1)))},Zo=e=>new Array(e.files.length).fill(0).map(((t,r)=>e.files.item(r))).filter((e=>null!==e)),Qo=e=>new Promise((t=>{e.toBlob((e=>{t(e)}))})),Ko={parse(e){var{x:e,y:t,z:r}=e;return void 0===r?new c.Vector2(e,t):new c.Vector3(e,t,r)},toJSON(e){var{x:t,y:r}=e;return e instanceof c.Vector2?{x:t,y:r}:{x:t,y:r,z:e.z}}},Jo=(e,t)=>s().get(e,{responseType:t||"arraybuffer"}).then((e=>e.data)).catch((e=>{console.log(e,"加载出错")})),$o=(e,t)=>Object.assign(e,t||{}),ea=(e,t)=>e.distanceTo(t),ta=(e,t,r,n,i,o)=>({cx:e,cy:t,cz:r,tx:n,ty:i,tz:o}),ra=e=>new T(e),na=e=>new I(e),ia=e=>new _(e),oa=(e,t=0)=>{let r=setTimeout((()=>(null!==r&&clearTimeout(r),r=null,e())),t)},aa=e=>{if(null===e)return null;if("object"!=typeof e)return e;var t,r,n=new e.constructor;for(t in e)e.hasOwnProperty(t)&&(r=e[t],n[t]=r);return n},sa=(e,t=.5,r=!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),r)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)},la=(e,t,r)=>{"Group"===e.type||"Object3D"===e.type?e.children.forEach((e=>la(e,t,r))):sa(e,t,r)},ua=(e,t,r=1,n)=>new Array(t).fill("").map(((t,i)=>e+(i+r)+(n||""))),ca=e=>(e.mapping=c.EquirectangularReflectionMapping,e),ha=e=>{let t=e=>"Group"!==e.type&&"Object3D"!==e.type||1!==e.children.length?e:t(e.children[0]);return t(e)},pa=(e,t)=>{let r=document.createElement("video");return r.style="position:absolute;top:0;left:0;z-index:1000000;",r.src=e,r.loop="loop",r.muted="muted",r.play(),t.appendChild(r),new c.VideoTexture(r)},da=(e,t=!1)=>{let r=new c.CatmullRomCurve3(e),n=new c.BufferGeometry;e=r.getSpacedPoints(100),n.setFromPoints(e),e=new c.LineBasicMaterial({color:26214});let i=new c.Line(n,e);return i.visible=t,{line:i,curve:r}},fa=e=>{let t=0;const r=[],n={},i={0:"x",1:"y",2:"z"};return e.map((e=>{var o,a,s;3===t&&(t=0,({x:o,y:a,z:s}=n),r.push(new c.Vector3(o,a,s))),n[i[t]]=e,t++})),r},ma=e=>{var{pointArray:e,material:t,lineWidth:r,colorArray:n}=e;const i=new go,o=(i.setPositions(e),t||new Wi({transparent:!0,side:c.DoubleSide,linewidth:r||5,vertexColors:!0})),a=(i.setColors(n||[1,1,1]),o.resolution.set(window.innerWidth,window.innerHeight),new So(i,o));return a.name="gw",a.computeLineDistances(),a},va=(()=>{const e=(e,t,r)=>{e.matrixAutoUpdate=t,r&&(r(),t&&(e.matrixAutoUpdate=!t))};return(t,r,n)=>{if(0===t.children.length)return e(t,r,n);const i=[];t.traverse((e=>i.push(e))),i.map((t=>e(t,r,n)))}})(),ya=e=>3.1415926*e/180,ga=e=>e.toString().replace(/(\[object )([a-zA-Z]+)(])/,"$2"),ba=(e,t)=>((0,Xe.js)(e,((r,n)=>{let i=t[r];void 0!==i&&("Object"===ga(n)&&"Object"===ga(i)&&(i=ba(n,i)),e[r]=i)})),e),xa=(e,t)=>e.find((e=>e===t)),wa=(e,t,r=!1)=>{let n=e/t;return r&&(n*=100),Number(n.toFixed(2))};class Sa{constructor(e){this.alt=!1,this.ctrl=!1,this.shift=!1,this.eventsMap={down:{},up:{}},this.allFn={s_saveScene:()=>function(e,t,r,n){return new(r=r||Promise)((function(t,i){function o(e){try{s(n.next(e))}catch(e){i(e)}}function a(e){try{s(n.throw(e))}catch(e){i(e)}}function s(e){var n;e.done?t(e.value):((n=e.value)instanceof r?n:new r((function(e){e(n)}))).then(o,a)}s((n=n.apply(e,[])).next())}))}(this,0,void 0,(function*(){this.events.runScene.optionsEx.log("正在保存","base","info"),yield this.events.runScene.optionsEx.cb.scene.saveNet.cb("")})),d_exporter_Gltf:()=>{this.events.runScene.exporter.gltf.scene()},alt_selectDom:()=>{console.log("多选dom")},r_runScript:()=>{console.log("运行脚本")},d_copyModel:()=>{console.log("复制模型")},g_createGroup:()=>{console.log("生成组")},meta_showMateriallLibrary:()=>{console.log("弹出材质库窗口")},f_focusModel:()=>{const e=this.events.runScene.modelEx.select;if(e){const{scene:r,camera:n,renderer:i,controls:o}=this.events.runScene.assetsEx.get(),a=new c.Vector3,s=new c.Vector3;if("Mesh"===e.type||"Group"===e.type||"Object3D"===e.type){const e=this.events.runScene.helperEx.boxHelper;if(e.update(),!e||!e.object)return;var t=i.domElement.getBoundingClientRect();let r=t.width/t.height;const o=new c.Vector3;t=e.geometry.attributes.position.array,o.set(Math.abs(t[0]-t[3]),Math.abs(t[1]-t[7]),Math.abs(t[2]-t[14])),s.x=.5*(t[0]+t[3]),s.y=.5*(t[1]+t[7]),s.z=.5*(t[2]+t[14]);let l=new c.Vector3;l.subVectors(n.position,s),l.projectOnPlane(new c.Vector3(0,1,0)),l.normalize(),1<r&&(r=1/r),t=2*Math.tan(.5*n.fov*Math.PI/180),t=o.length()/r/t,a.addVectors(s,l.multiplyScalar(t))}else{r.updateMatrixWorld(!0),t=new c.Vector3,e.getWorldPosition(t),s.set(t.x,t.y,t.z);let i=new c.Vector3;i.subVectors(n.position,s),i.projectOnPlane(new c.Vector3(0,1,0)),i.normalize(),a.addVectors(s,i.multiplyScalar(3))}_o({positionX:n.position.x,positionY:n.position.y,positionZ:n.position.z,targetX:o.target.x,targetY:o.target.y,targetZ:o.target.z},{positionX:a.x,positionY:a.y,positionZ:a.z,targetX:s.x,targetY:s.y,targetZ:s.z},.5,(e=>{n.position.set(e.positionX,e.positionY,e.positionZ),n.lookAt(e.targetX,e.targetY,e.targetZ),o.target.set(e.targetX,e.targetY,e.targetZ),o.update()}))}},z_undo:e=>{this.events.runScene.undoEx.undo()},y_redo:e=>{this.events.runScene.undoEx.redo()}},this.events=e}bindEvent(e,t,r){if(void 0!==this.eventsMap[e][t])throw SyntaxError("该函数名已存在");this.eventsMap[e][t]=r}init(e){"running"!==this.events.runScene.optionsEx.options.mode&&(document.addEventListener("keydown",this.keyDown.bind(this)),document.addEventListener("keyup",this.keyUp.bind(this)))}keyDown(e){const t=e.key.toLowerCase();switch((0,Xe.js)(this.eventsMap.down,((r,n)=>{n(t,e)})),t){case"s":this.ctrl&&(e.preventDefault(),this.allFn.s_saveScene());break;case"d":if(this.ctrl){e.preventDefault();var r=this.events.runScene.modelEx.select;if(!r)return;this.events.runScene.modelEx.selectNull();var n=this.events.runScene.modelEx.clone(r);if(!n)return;this.events.runScene.modelEx.add(n,r.parent,{isClone:!0})}break;case"alt":this.ctrl&&(e.preventDefault(),this.allFn.alt_selectDom()),this.alt=!0;break;case"control":case"ctrl":this.ctrl=!0;break;case"shift":this.shift=!0;break;case"w":e.preventDefault(),e.stopPropagation(),this.events.runScene.helperEx.transContro.changeMode("position");break;case"e":this.events.runScene.helperEx.transContro.changeMode("rotation");break;case"r":if(this.events.runScene.helperEx.transContro.changeMode("scale"),!this.ctrl)return;e.preventDefault(),this.allFn.r_runScript();break;case"g":this.events.runScene.optionsEx.cb.events.key.g.cb({event:e,eventKey:this});break;case"f":this.allFn.f_focusModel();break;case"delete":console.log("删除"),this.events.runScene.helperEx.unfocus(),n=this.events.runScene.multipSelector.getSelectedList("value"),this.events.runScene.sceneEx.remove(this.events.runScene.modelEx.select||n),n&&this.events.runScene.multipSelector.delete();break;case"z":if(!this.ctrl)return;this.allFn.z_undo(e),console.log("撤销功能~~~~");break;case"y":if(!this.ctrl)return;this.allFn.y_redo(e),console.log("向前功能~~~~")}}keyUp(e){const t=e.key.toLowerCase();switch((0,Xe.js)(this.eventsMap.up,((r,n)=>{n(t,e)})),t){case"meta":if(!this.ctrl)return;this.allFn.meta_showMateriallLibrary();break;case"s":if(this.ctrl)break;return;case"alt":this.alt=!1;break;case"control":case"ctrl":this.ctrl=!1;break;case"shift":this.shift=!1}}}class Ta{constructor(e){this.downPosition={x:0,y:0},this.enableUp=!0,this.fnMap={global:{down:{},up:{}},local:{down:{},up:{}}},this.down=e=>{(0,Xe.js)(this.fnMap.local.down,((t,r)=>{r(e)})),this.downPosition={x:e.offsetX,y:e.offsetY}},this.up=e=>{var t,r,n,i;2===e.button||null!=(t=this.events.runScene.helperEx.transContro)&&t.isDraggingChange||((0,Xe.js)(this.fnMap.local.up,((t,r)=>{r(e)})),t=e.offsetX,r=e.offsetY,({x:n,y:i}=this.downPosition),t===n&&r===i&&this.trigger(e))},this.events=e}bindEvent(e){var{type:e,name:t,fn:r,local:n}=e;this.fnMap[n][e][t]=r}init(e){e.addEventListener("pointerdown",this.down.bind(this)),e.addEventListener("pointerup",this.up.bind(this)),window.addEventListener("pointerdown",(e=>{this.events.runScene.optionsEx.cb.events.pointer.down.cb(e)})),window.addEventListener("pointerup",(e=>{this.events.runScene.optionsEx.cb.events.pointer.up.cb(e)}))}getTriggerModels(e){const t=new c.Raycaster,r=new c.Vector2,{engineDom:n,camera:i,scene:o}=this.events.runScene.assetsEx.get();return r.x=e.offsetX/n.clientWidth*2-1,r.y=-e.offsetY/n.clientHeight*2+1,t.setFromCamera(r,i),e=o.children.filter((e=>{if((!this.events.runScene.helperEx.isHelper(e)||e.userData.id)&&!e.userData.unClick)return e})),t.intersectObjects(e,!0).map((e=>e.object))}removeHideModel(e){return e.find((e=>this.events.runScene.modelEx.deepIsVisible(e)))}trigger(e){let t=this.removeHideModel(this.getTriggerModels(e));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(console.log("鼠标按下选中的模型:",t),this.events.key.ctrl)return this.enableUp=!1,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)})):void 0}this.events.runScene.modelEx.setSelectByModel(t),this.events.runScene.lightEx.isLight(t)&&this.events.runScene.lightEx.setSelect(t)}}class _a{constructor(e){this.runScene=e}}o=a(356);var Ma=a.n(o),Ea=a(298);const Pa=["Group","Box","Circle","Cylinder","Dodecahedron","Icosahedron","Lathe","Octahedron","Plane","Ring","Sphere","Sprite","Tetrahedron","Torus","TorusKnot","Tube","Reflector"];class Oa{static create(){return new c.MeshStandardMaterial}static isDefval(e){for(const t in this.defVal){const r=this.defVal[t],n=e[t];if(r instanceof c.Color){if(r.getHexString()!==n.getHexString())return!1}else if("object"==typeof r){if(n.x!==r.x)return!1}else if(n!==r)return!1}for(const t of gi)if(e[t])return!1;return!0}}Oa.defVal={color:new c.Color(16777215),emissive:new c.Color(0),roughness:1,metalness:0,lightMapIntensity:1,aoMapIntensity:1,emissiveIntensity:1,bumpScale:1,normalScale:new c.Vector2(1,1),displacementScale:1,envMapIntensity:1,wireframe:!1,transparent:!1,opacity:1};class Ra{constructor(e){this.undos=[],this.redos=[],this.dataMap={history:[],index:0},this.runScene=e}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))}}addUndos(e){var t;return this.undos.push(e),t=this.dataMap.history.push(e),this.dataMap.index=this.undos.length-1,this.runScene.optionsEx.cb.undo.addUndos.cb(e,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.optionsEx.cb.undo.removeUndos.cb(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.optionsEx.cb.undo.undoByIndex.cb(e)}addUndo(e){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))}}reset(){this.undos=[],this.redos=[],this.dataMap.history=[],this.dataMap.index=0,this.runScene.optionsEx.cb.undo.reset.cb("")}}function ka(e){if("object"!=typeof e)return e;if(null===e)return null;if(e){var t,r,n=new e.constructor;for(t in e)e.hasOwnProperty(t)&&(r=ka(e[t]),n[t]=r);return n}}const Aa=class extends bi{constructor(e){super(),this.type="多层级修改",this.target=e.target,this.typeList=e.typeList,this.new=e.newVal,this.cb=e.cb,this.old=(0,Xe.qR)(e.target,this.typeList)[(0,Ea.lastArrayEle)(e.typeList)]}execute(){return this.redo(),this}_execute(e){const t=(0,Xe.qR)(this.target,this.typeList);t[(0,Ea.lastArrayEle)(this.typeList)]=e,this.cb&&this.cb(t),"shadow"!==this.typeList[0]&&this.typeList[1]}undo(){this._execute(this.old)}redo(){this._execute(this.new)}};class La{constructor(e){this.tools={type:"FakeInterior",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},parseData:e=>{const{textures:t,normal:r}=e,n=new c.ShaderMaterial({uniforms:ka(Ca.uniforms),vertexShader:Ca.vertexShader,fragmentShader:Ca.fragmentShader});return t.forEach((e=>{"ceilingTex"===e.type?n.uniforms.ceilingTex.value=e.texture||null:"floorTex"===e.type?n.uniforms.floorTex.value=e.texture||null:"sideWallTex"===e.type?n.uniforms.sideWallTex.value=e.texture||null:"backWallTex"===e.type&&(n.uniforms.backWallTex.value=e.texture||null)})),Object.keys(r.uniforms).filter((e=>!La.TextureNames.includes(e))).map((e=>{var t=r.uniforms[e];n.uniforms[e].value="roomsXYZPropsW"===e||"positionOffsetRoomsXYZPropsW"===e||"roomColorTint"===e?new c.Vector4(t.x,t.y,t.z,t.w):t})),n.userData.tools=this.tools,n},toNormal:e=>{const t=Xa(),r=(t.userData=Object.assign(Object.assign({},t.userData),{normal:{type:this.tools.type,uniforms:{}},textures:this.tools.getTextures(e)}),{}),n=e.uniforms,i=Ca.uniforms;return Object.keys(n).filter((e=>!La.TextureNames.includes(e))).map((e=>{var t,o,a,s,l,u,h=n[e].value,p=i[e].value;h instanceof c.Vector4?(({x:t,y:o,z:a}=h),({x:s,y:l,z:u}=p),t===s&&o===l&&a===u||(r[e]=h)):h!==p&&(r[e]=h)})),t.userData.normal.uniforms=r,t},clone:function(e,t){return e}},this.runScene=e}create(){const e=new c.ShaderMaterial({uniforms:ka(Ca.uniforms),vertexShader:Ca.vertexShader,fragmentShader:Ca.fragmentShader});return e.userData.tools=this.tools,e}undo(e){var{material:e,list:t,val:r}=e;this.runScene.undoEx.addUndo(new Aa({target:e,typeList:["uniforms",...t],newVal:r}).execute())}}La.TextureNames=["sideWallTex","backWallTex","floorTex","ceilingTex"];const Ca={uniforms:{roomIntensity:{value:1},roomColorTint:{value:new c.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 c.Vector4(.35,.65,.1,1)},positionOffsetRoomsXYZPropsW:{value:new c.Vector4(4.7,2,-11,-3)}},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 "},Da={uniforms:{tDiffuse:new c.Uniform(null),h:new c.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}"},Ia={uniforms:{tDiffuse:new c.Uniform(null),v:new c.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}"};new c.Uniform(null),new c.Uniform(null),new c.Uniform(0),new c.Uniform(0),new c.Uniform(0),new c.Uniform(new c.Vector2),new c.Uniform(.1),new c.Uniform(1e3);class ja{constructor(e){this.materials={},this.render=()=>{(0,Xe.js)(this.materials,((e,t)=>{const{model:r,material:n}=t;n.update(r)}))},this.tools={type:"Reflector",getTextures:e=>Za(e),parseData:e=>{const{textures:t,normal:r,models:n,material:i}=e,o=qa(i,new Ua(void 0,void 0,this.runScene));return o.name=i.name,t.forEach((e=>{o[e.type]=e.texture})),Object.keys(r.uniforms).filter((e=>!ja.TextureNames.includes(e))).map((e=>{o[e]=r.uniforms[e]})),o.setRTSize(o.resolution),o.setBlurPass(o.blurSize),o.insertReflectorShader(),o.userData.tools=this.tools,this.bindData({model:n[0],material:o}),o},toNormal:e=>{const t=qa(e,Xa()),r=(t.userData=Object.assign(Object.assign({},t.userData),{normal:{type:this.tools.type,uniforms:{}},textures:this.tools.getTextures(e)}),t.name=e.name,{}),n=Ba.uniforms;return Object.keys(n).filter((e=>!ja.TextureNames.includes(e))).map((t=>{var i=e[t],o=n[t].value;"mirror"===t||"mixBlur"===t||"mixStrength"===t||"mixContrast"===t?i.value!==o&&(r[t]=i):i!==o&&(r[t]=i)})),t.userData.normal.uniforms=r,t},clone:(e,t)=>this.create(t)},this.runScene=e,this.init()}init(){this.runScene.optionsEx.cb.render.add("Reflector-render",this.render),this.runScene.optionsEx.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.optionsEx.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 r=(0,l.getId)();t.userData.id=r,this.materials[r]=e}create(e){const t=new Ua(void 0,void 0,this.runScene);return t.insertReflectorShader(),t.userData.tools=this.tools,(e=e||this.runScene.modelEx.select)&&(t.name=e.name),this.bindData({model:e,material:t}),t}undo(e){var{material:e,list:t,val:r}=e;this.runScene.undoEx.addUndo(new Aa({target:e,typeList:[...t],newVal:r}).execute())}dispose(){this.materials={}}}ja.TextureNames=["map","normalMap","roughnessMap","metalnessMap","tDiffuse","tDiffuseBlur"];class Ua extends c.MeshStandardMaterial{constructor(e,t,r){e?super(e):(super(),this.opacity=Ba.uniforms.opacity.value,this.transparent=Ba.uniforms.transparent.value,this.roughness=Ba.uniforms.roughness.value,this.metalness=Ba.uniforms.metalness.value),this.runScene=r,t?(this.resolution=t.resolution,this.blurSize=t.blurSize,this.mirror=new c.Uniform(t.mirror),this.mixBlur=new c.Uniform(t.mixBlur),this.mixStrength=new c.Uniform(t.mixStrength),this.mixContrast=new c.Uniform(t.mixContrast)):(this.resolution=Ba.uniforms.resolution.value,this.blurSize=Ba.uniforms.blurSize.value,this.mirror=new c.Uniform(Ba.uniforms.mirror.value),this.mixBlur=new c.Uniform(Ba.uniforms.mixBlur.value),this.mixStrength=new c.Uniform(Ba.uniforms.mixStrength.value),this.mixContrast=new c.Uniform(Ba.uniforms.mixContrast.value)),this.textureMatrix=new c.Uniform(new c.Matrix4),this.reflectorWorldPosition=new c.Vector3,this.cameraWorldPosition=new c.Vector3,this.rotationMatrix=new c.Matrix4,this.normal=new c.Vector3,this.view=new c.Vector3,this.lookAtPosition=new c.Vector3,this.target=new c.Vector3,this.tempQuaternion=new c.Vector4,this.virtualCamera=new c.PerspectiveCamera,this.reflectorPlane=new c.Plane,this.clipPlane=new c.Vector4,e={minFilter:c.LinearFilter,magFilter:c.LinearFilter,type:c.HalfFloatType,encoding:this.runScene.assetsEx.get().renderer.outputEncoding},this.glRT1=new c.WebGLRenderTarget(this.resolution,this.resolution,e),this.glRT2=new c.WebGLRenderTarget(this.resolution,this.resolution,e),this.tDiffuse=new c.Uniform(this.glRT1.texture),this.tDiffuseBlur=new c.Uniform(this.glRT2.texture),this.hBlurPass=new ee(Da),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 ee(Ia),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=Ba.vertexParas+""+e.vertexShader,e.vertexShader=e.vertexShader.replace("#include <project_vertex>",Ba.vertexShader),e.fragmentShader=Ba.fragmentParas+""+e.fragmentShader,e.fragmentShader=e.fragmentShader.replace("#include <emissivemap_fragment>",Ba.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 Ba={uniforms:{opacity:new c.Uniform(1),transparent:new c.Uniform(!1),roughness:new c.Uniform(1),metalness:new c.Uniform(.6),resolution:new c.Uniform(1024),blurSize:new c.Uniform(1024),mirror:new c.Uniform(0),mixBlur:new c.Uniform(10),mixStrength:new c.Uniform(2),mixContrast:new c.Uniform(1)},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 "};class za{constructor(e){this.tools={type:"Fresnel",getTextures(e){const t=[];return e.envMap&&t.push({type:"envMap",texture:e.envMap}),t},parseData:e=>{const{textures:t,normal:r,material:n}=e,i=qa(n,new Na(void 0,void 0,this.runScene));return i.name=n.name,t.forEach((e=>{i[e.type]=e.texture})),Object.keys(r.uniforms).filter((e=>!za.TextureNames.includes(e))).map((e=>{i[e]=r.uniforms[e]})),i.insertFresnelShader(),i.userData.tools=this.tools,i},toNormal:e=>{const t=qa(e,Xa()),r=(t.userData=Object.assign(Object.assign({},t.userData),{normal:{type:this.tools.type,uniforms:{}},textures:this.tools.getTextures(e)}),t.name=e.name,{}),n=Fa.uniforms;return Object.keys(n).filter((e=>!za.TextureNames.includes(e))).map((t=>{var i=e[t],o=n[t].value;"fresnelBias"===t||"fresnelScale"===t||"fresnelPower"===t?i.value!==o&&(r[t]=i):i!==o&&(r[t]=i)})),t.userData.normal.uniforms=r,t},clone:(e,t)=>this.create(t)},this.runScene=e}create(e){const t=new Na(void 0,void 0,this.runScene);return t.insertFresnelShader(),t.userData.tools=this.tools,(e=e||this.runScene.modelEx.select)&&(t.name=e.name),t}undo(e){var{material:e,list:t,val:r}=e;this.runScene.undoEx.addUndo(new Aa({target:e,typeList:[...t],newVal:r}).execute())}}za.TextureNames=["envMap"];class Na extends c.MeshPhysicalMaterial{constructor(e,t,r){if(e?super(e):(super(),this.emissive=new c.Color(65535),this.envMap=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=r,t?(this.fresnelBias=new c.Uniform(t.fresnelBias),this.fresnelScale=new c.Uniform(t.fresnelScale),this.fresnelPower=new c.Uniform(t.fresnelPower)):(this.fresnelBias=new c.Uniform(Fa.uniforms.fresnelBias.value),this.fresnelScale=new c.Uniform(Fa.uniforms.fresnelScale.value),this.fresnelPower=new c.Uniform(Fa.uniforms.fresnelPower.value)),!this.cubeCamera){const e=new c.WebGLCubeRenderTarget(2048);e.texture.mapping=c.CubeRefractionMapping,this.cubeCamera=new c.CubeCamera(.1,1e5,e),this.runScene.assetsEx.scene.add(this.cubeCamera),this.runScene.optionsEx.cb.render.add("Fresnel",(()=>{this.update()}))}}insertFresnelShader(){this.onBeforeCompile=e=>{e.uniforms.fresnelBias=this.fresnelBias,e.uniforms.fresnelScale=this.fresnelScale,e.uniforms.fresnelPower=this.fresnelPower,e.vertexShader=e.vertexShader.replace(/varying vec3 vWorldPosition;/g,Fa.vertexParas),e.vertexShader=e.vertexShader.replace(/vWorldPosition = worldPosition.xyz;/g,Fa.vertexShader),e.fragmentShader=e.fragmentShader.replace(/#include <transmission_pars_fragment>/g,Fa.fragmentParas),e.fragmentShader=e.fragmentShader.replace(/vec3 totalEmissiveRadiance = emissive;/g,Fa.fragmentShaderEmissive)}}update(){this.cubeCamera&&(this.cubeCamera.position.copy(this.runScene.assetsEx.camera.position),this.cubeCamera.update(this.runScene.assetsEx.renderer,this.runScene.assetsEx.scene))}}const Fa={uniforms:{fresnelBias:new c.Uniform(0),fresnelScale:new c.Uniform(1),fresnelPower:new c.Uniform(3)},vertexParas:"\n varying vec3 vWorldPosition;\n varying vec3 vWorldNormal;\n ",vertexShader:"\n vWorldPosition = worldPosition.xyz;\n vWorldNormal = normalize(vec3(modelMatrix * vec4(normal, 0.0)));\n ",fragmentParas:"\n #include <transmission_pars_fragment>\n varying vec3 vWorldNormal;\n uniform float fresnelBias;\n uniform float fresnelScale;\n uniform float fresnelPower;\n ",fragmentShaderEmissive:"\n vec3 viewDir = normalize(cameraPosition - vWorldPosition);\n float fresnelNdot = dot(viewDir, vWorldNormal);\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 "},Va=class extends bi{constructor(e){super(),this.type="修改属性",this.cb=e=>{};var{target:e,info:t,oldVal:r,newVal:n,runScene:i,cb:o,executeCb:a}=e;this.runScene=i,this.target=e,this.info=t,this.newVal=n,this.oldVal=r,o&&(this.cb=o),a&&(this.executeCb=a)}_execute(e){var{target:t,info:r}=this;if(this.executeCb)return this.executeCb({target:t,info:r,val:e});this.target[this.info]=e,"name"===this.info&&this.target.isObject3D?(t=this.runScene.uniqueEx.model.parseName(this.target),r=e,this.runScene.optionsEx.cb.model.changeName.cb({model:this.target,name:e=t||e,oldName:r})):"material"===this.info?this.runScene.uniqueEx.material.addModel(this.target,e,e===this.newVal?this.oldVal:this.newVal):"visible"===this.info&&this.runScene.optionsEx.cb.model.setVisible.cb({model:this.target,visible:e}),this.cb(this.target)}execute(){return this.redo(),this}undo(){this._execute(this.oldVal)}redo(){this._execute(this.newVal)}},Ha={depthTest:!0,depthWrite:!0,alphaTest:0,side:0,displacementScale:1,visible:!0,normalScale:{x:1,y:1},aoMapIntensity:1,lightMapIntensity:1,envMapIntensity:1},Ga=["color","emissive","roughness","metalness","normalScale","aoMapIntensity","displacementScale","transparent","lightMapIntensity","envMapIntensity","opacity","alphaTest"];class Wa{constructor(e){this.defMaterialMap={BaseMaterial:Oa,SpriteMaterial:$a,FakeInterior:La,Reflector:ja,Fresnel:za},this.defMaterial=Xa(),this.addCb=e=>{this.runScene.optionsEx.cb.material.add.cb(e)},this.setParses=[],this.runScene=e,this.runScene.optionsEx.cb.unique.material.add.add("engine-material-add",(e=>{"SpriteMaterial"!==e.type&&this.addCb(e)})),this.defMaterialMap={BaseMaterial:Oa,SpriteMaterial:$a,FakeInterior:new La(e),Reflector:new ja(e),Fresnel:new za(e)},this.addSetParses((e=>{const{material:t,type:r,newVal:n}=e;"opacity"===r&&n<1&&(t.transparent=!0)}))}add(e,t,r){this.runScene.uniqueEx.material.add(e,t,r)}create(){var e=new c.MeshStandardMaterial;return this.add(e),e}clone(e){const t=e.clone();return t.userData.id=(0,l.getId)(),t}addSetParses(e){this.setParses.push(e)}set(e){const{material:t,type:r,val:n}=e,i=t[r];return t[r]=n,t.needsUpdate=!0,this.setParses.map((e=>e({material:t,type:r,newVal:n,oldVal:i})))}setNormal(e,t=!0){return e=new xi(Object.assign(Object.assign({},e),{runScene:this.runScene})).execute(),t&&this.runScene.undoEx.addUndo(e),e}setTexture(e,t=!0){return function(e,t,r,n){return new(r=r||Promise)((function(t,i){function o(e){try{s(n.next(e))}catch(e){i(e)}}function a(e){try{s(n.throw(e))}catch(e){i(e)}}function s(e){var n;e.done?t(e.value):((n=e.value)instanceof r?n:new r((function(e){e(n)}))).then(o,a)}s((n=n.apply(e,[])).next())}))}(this,0,void 0,(function*(){var{info:r,newVal:n}=e,n=(n instanceof File&&(e.newVal=yield this.runScene.textureEx.parse(n)),"envMap"===r&&Ci(e.newVal),new xi(Object.assign(Object.assign({},e),{runScene:this.runScene})).execute());return t&&this.runScene.undoEx.addUndo(n),e.newVal}))}resetMaterial(e,t,r=!0){var n;e&&t&&e.material&&(n=new Va({target:e,runScene:this.runScene,info:"material",newVal:t,oldVal:e.material}).execute(),this.runScene.modelEx.select===e&&this.runScene.optionsEx.cb.setSelectMaterial.cb(t),r&&this.runScene.undoEx.addUndo(n))}getBase(e){const t=this.defMaterialMap[e];if(("SpriteMaterial"!==e||"Sprite"===(null==(e=this.runScene.modelEx.select)?void 0:e.type))&&t)return t.create()}toNromal(e){var t;const r=(null==(t=e.userData.tools)?void 0:t.toNormal(e))||e.clone();return r.userData=Object.assign(Object.assign({},r.userData),e.userData),r}setSelect(e){this.runScene.optionsEx.cb.setSelectMaterial.cb(e)}getDataByType(e,t){return this.defMaterialMap[e].tools.parseData(t)}dispose(){this.defMaterialMap.Reflector.dispose(),this.runScene.optionsEx.cb.material.dispose.cb("")}remove(e){}getDefNromals(e){var t;if(null!=(t=null==(t=e.userData)?void 0:t.tools)&&t.type)return{};const r={};return(0,Xe.js)(Ha,((t,n)=>{const i=e[t];if("object"==typeof i)for(const e in i)if(i[e]!==n[e])return void(r[t]=i.clone());i!==n&&(r[t]=i)})),r}parseNromals(e,t){(0,Xe.js)(e,((e,r)=>{var n,i,o,a,s;void 0!==Ha[e]&&("object"==typeof r?(({x:o,y:a,z:s}=r),null!=(i=null==(n=t[e])?void 0:n.set)&&i.call(n,o,a,s)):t[e]=r)}))}isBaseMaterial(e){return"MeshStandardMaterial"===e.type&&!e.userData.isTimeLineUsed&&Oa.isDefval(e)}}const Xa=()=>{const e=new c.MeshStandardMaterial;return e.userData.id=(0,l.getId)(),e},qa=(e,t)=>(Ga.map((r=>{const n=e[r];"object"==typeof n&&(t[r]=n.clone()),t[r]=n})),t),Ya=e=>{e.dispose();const t=Za(e);0!==t.length&&t.map((e=>{e=e.texture,Ei(e)}))},Za=e=>{var t=e.userData.textures||gi.map((t=>({type:t,texture:e[t]}))).filter((e=>e.texture));return delete e.userData.textures,t},Qa=e=>{var t;return(null==(t=e.userData.tools)?void 0:t.getTextures(e))||gi.map((t=>({type:t,texture:e[t]}))).filter((e=>e.texture))},Ka=e=>{const{material:t,type:r,texture:n}=e;"envMap"===r&&Ci(n),t[r]=n,t.needsUpdate=!0},Ja=e=>{e.vertexColors=!1,e.needsUpdate=!1};class $a{static create(){const e=new c.SpriteMaterial;return e.userData.tools=this.tools,e}}$a.modelTools={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,1===e.layers.mask?t.layers.set(0):t.layers.enable(1)},toNormal:e=>{const t=as("Box");return t.userData.normal={type:"MySpriteMaterial"},$a.modelTools.merge(e,t),t},parseData:(e,t)=>{const r=as("Sprite");return $a.modelTools.merge(e,r),r.material=e.material,r}},$a.tools={type:"SpriteMaterial",getTextures:function(e){return["map","alphaMap"].map((t=>{var r=e[t];if(r)return{type:t,texture:r}})).filter((e=>e))},parseData:function(e){const{textures:t,material:r}=e,n=qa(r,$a.create());return t.map((e=>{var{type:e,texture:t}=e;n[e]=t})),n},toNormal:e=>{const t=qa(e,Xa());return t.userData=Object.assign(Object.assign({},t.userData),{normal:{type:$a.tools.type},textures:$a.tools.getTextures(e)}),t},clone:function(e,t){return e}};class es{constructor(e){this.addTree=!0,this.isClone=!1,this.cb=(e,t)=>{};var{model:e,parent:t,cb:r,addTree:n,isClone:i,runScene:o}=e;this.runScene=o,this.model=e,this.parent=t,!1===n&&(this.addTree=n),!0===i&&(this.isClone=i),r&&(this.cb=r)}remove(e){const{model:t,parent:r,addTree:n,runScene:i}=e;i.modelEx.select===t&&i.modelEx.selectNull(),r.remove(t),n&&i.uniqueEx.model.remove(t),n&&i.optionsEx.cb.model.remove.cb({model:t,parent:r}),this.cb(t,"remove"),i.uniqueEx.material.addModel(t,void 0,t.material)}add(e){const{model:t,parent:r,addTree:n,isClone:i,runScene:o}=e;r.add(t),n&&o.uniqueEx.model.add(t),n&&o.optionsEx.cb.model.add.cb({model:t,parent:r,isClone:i}),this.cb(t,"add"),o.uniqueEx.material.addModel(t,t.material)}}class ts extends es{constructor(e){super(e),this.type="添加模型"}_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})}execute(){return this.redo(),this}}const rs=class extends bi{constructor(e){super(),this.type="修改父元素",this.runScene=e.runScene,this.oldParent=e.oldParent,this.newParent=e.newParent,this.target=e.target}execute(){return this.redo(),this}_execute(e){e.attach(this.target),this.runScene.optionsEx.cb.model.setParent.cb({model:this.target,parent:e})}undo(){this._execute(this.oldParent)}redo(){this._execute(this.newParent)}};class ns extends es{constructor(e){super(e),this.type="移除模型"}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}}const is=class extends bi{constructor(e){super(),this.type="三维矩阵修改";var{target:e,info:t,newV3:r,oldV3:n,runScene:i}=e;this.target=e,this.info=t,this.runScene=i,this.newV3=r,this.oldV3=n,this.target.uuid===(null==(e=this.runScene.modelEx.select)?void 0:e.uuid)&&(this.runScene.optionsEx.cb.model.setSelect.cb(null),this.runScene.optionsEx.cb.model.setSelect.cb(this.target))}_execute(e){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)}execute(){return this.redo(),this}undo(){this._execute(this.oldV3)}redo(){this._execute(this.newV3)}};class os{constructor(e){this._selectModel=void 0,this.defNodeMap={castShadow:!1,receiveShadow:!1,renderOrder:0,visible:!0},this.deepIsVisible=e=>"Scene"===e.type||!!e.visible&&!!e.parent&&this.deepIsVisible(e.parent),this.runScene=e}get select(){return this._selectModel}set select(e){this.setSelectByModel(e)}add(e,t,r){var{addUndo:n,isClone:i,select:o}=$o({addUndo:!0,isClone:!1,select:!0},r);if(e instanceof Array)return e.map((e=>this.add(e,t,r)));i?(this.runScene.uniqueEx.model.add(e,{hasReset:!0}),this.runScene.optionsEx.cb.model.clone.cb(e)):this.runScene.uniqueEx.model.add(e);var a=new ts({model:e,parent:t||this.runScene.sceneEx.get(),isClone:i,runScene:this.runScene}).execute();!0===n&&this.runScene.undoEx.addUndo(a),o&&this.setSelectByModel(e,{isDomTreeActive:!1,isClone:i})}addParse(){}setSelectByModel(e,t){var r,{isDomTreeActive:t,isClone:n}=t||{};if(this.runScene.events.key.shift&&this._selectModel)return(r=this.getBeTweenChildByTwoModel(this._selectModel,e))?void this.runScene.multipSelector.add([...r,e],!0):void 0;if(this.runScene.events.key.ctrl&&!n)this.runScene.multipSelector.add(e);else{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),this.runScene.optionsEx.cb.model.unFocus.cb(this._selectModel)}e&&(e.isCamera||(this.runScene.helperEx.focus(e),this.runScene.lightEx.setSelect(e)),this.runScene.optionsEx.cb.model.focus.cb({model:e,status:!0,domActive:!t}),this.runScene.materialEx.setSelect(e.material),this.runScene.optionsEx.cb.model.setSelect.cb(e),this._selectModel=e)}}setSelectById(e){(e=this.runScene.uniqueEx.model.get(e))&&this.setSelectByModel(e)}remove(e,t=!0){if(e instanceof Array)return e.map((e=>this.remove(e)));e=new ns({runScene:this.runScene,model:e,parent:e.parent||this.runScene.sceneEx.get()}).execute(),t&&this.runScene.undoEx.addUndo(e)}isNavieV3(e,t=0){var{x:e,y:r,z:n}=e;return e+r+n===t}isNavieV2(e,t=0){var{x:e,y:r}=e;return e===t&&r===t}isUnless(e){return!e.material&&this.isNavieV3(e.position)&&this.isNavieV3(e.rotation)&&this.isNavieV3(e.scale,3)&&0===e.children.length}isUnlessLevel(e){return this.isNavieV3(e.position)&&this.isNavieV3(e.rotation)&&this.isNavieV3(e.scale,3)&&1===e.children.length&&!us(e)}create(){return Ma().model.getModelByType("Box")}clone(e){if(!this.runScene.lightEx.isLight(e)){let n=e.clone();n.userData.cloneId=e.userData.id;var t,r=null==e?void 0:e.material;return null!=(t=null==r?void 0:r.userData)&&t.tools&&(t=null==(t=r.userData.tools)?void 0:t.clone(r,n))&&t.uuid!==r.uuid&&(this.runScene.materialEx.resetMaterial(n,t,!0),this.runScene.materialEx.add(t,e,r)),this.runScene.uniqueEx.model.add(n,{reset:!0}),n}this.runScene.lightEx.clone(e)}getLevel(e,t=0){return e.parent&&"Scene"!==e.parent.type?this.getLevel(e.parent,++t):t}selectNull(){var e=this._selectModel;e&&(this.runScene.optionsEx.cb.model.unFocus.cb(e),this.runScene.materialEx.setSelect(null),this.runScene.lightEx.setNull(e)),this._selectModel=void 0,this.runScene.optionsEx.cb.model.setSelect.cb(null),this.runScene.helperEx.unfocus()}cloneV3(e){return e.clone()}setParent(e,t,r=!0){if(t=new rs({oldParent:e.parent,newParent:t,target:e,runScene:this.runScene}).execute(),!r)return t;this.runScene.undoEx.addUndo(t)}setV3(e,t=!0,r=!0){var{model:e,info:n,newV3:i,oldV3:o}=e;const a=new is({target:e,info:n,oldV3:o,newV3:i,runScene:this.runScene});r&&a.execute(),t&&this.runScene.undoEx.addUndo(a)}setNormal(e,t=!0){var{model:e,info:r,val:n}=e;e=new Va({target:e,info:r,runScene:this.runScene,oldVal:e[r],newVal:n}).execute(),t&&this.runScene.undoEx.addUndo(e)}setMaterial(e,t,r=!0){var n=new Va({target:e,info:"material",runScene:this.runScene,oldVal:e.material,newVal:t}).execute();this.select===e&&this.runScene.optionsEx.cb.setSelectMaterial.cb(t),e.material.needsUpdate=!0,r&&this.runScene.undoEx.addUndo(n)}addDef(e){this.add(as(e))}isModel(e){return!(e.isLight||e.isCamera)}getSphere(){var e=new c.MeshBasicMaterial,t=new c.SphereGeometry(.7,150,150);return new c.Mesh(t,e)}getIndexByModel(e){var t;return e.parent?null==(t=e.parent)?void 0:t.children.findIndex((t=>t===e)):-1}getBeTweenChildByTwoModel(e,t){if(e.parent.uuid===t.parent.uuid){var r=this.getIndexByModel(e);if(t=this.getIndexByModel(t),-1!==r&&-1!==t){const n=Math.max(r,t),i=r===n?t:r;return e.parent.children.map(((e,t)=>t>i&&t<n&&e)).filter((e=>e))}}}setMultip(e){var{model:e,typeList:t,newVal:r}=e;this.runScene.undoEx.addUndo(new Aa({target:e,typeList:t,newVal:r}).execute())}createGroup(e,t,r){const n=t||new c.Group,i=[];i.push(new ts({model:n,runScene:this.runScene,parent:r||this.runScene.assetsEx.get().scene}).execute()),e instanceof Array?i.push(...e.map((e=>new rs({target:e,oldParent:e.parent,newParent:n,runScene:this.runScene}).execute()))):i.push(new rs({target:e,oldParent:e.parent,newParent:n,runScene:this.runScene}).execute()),r&&this.runScene.optionsEx.cb.model.setOpen.cb({isOpen:!0,model:r}),this.runScene.optionsEx.cb.model.setOpen.cb({isOpen:!0,model:n}),this.runScene.optionsEx.cb.model.setMainStatue.cb({status:!0,model:n}),this.runScene.undoEx.addUndo(i),this.setSelectByModel(n)}cleanGroup(e,t=!0){if(e instanceof Array){const t=(0,Ea.multiArrToArr)(e.map((e=>(this.runScene.optionsEx.cb.model.unFocus.cb(e),this.cleanGroup(e,!1)))).filter((e=>e)));return this.runScene.undoEx.addUndo(t),t}if(this.runScene.optionsEx.cb.model.unFocus.cb(e),0!==e.children.length){const r=[],n=e.children.map((e=>{if(e.parent.parent)return new rs({target:e,oldParent:e.parent,newParent:e.parent.parent,runScene:this.runScene})})).filter((e=>e));return r.push(...n.map((e=>e.execute()))),r.push(new ns({runScene:this.runScene,model:e,parent:e.parent}).execute()),t&&this.runScene.undoEx.addUndo(r),r}}hideOther(e){const t=e.uuid,r=0<e.children.length,n=this.runScene.sceneEx.getClearModels(),i=[];n.map((n=>{n.traverse((n=>{r?!1===Ma().model.deepFindParentByUuid(n,t)&&n.uuid!==e.uuid&&i.push(n):n.uuid!==e.uuid&&i.push(n)}))}));var o=i.map((e=>new Va({target:e,info:"visible",newVal:!1,runScene:this.runScene,oldVal:e.visible}).execute()));this.runScene.undoEx.addUndo(o),Ma().model.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 r=t.map((e=>new Va({target:e,info:"visible",runScene:this.runScene,newVal:!0,oldVal:e.visible}).execute()));this.runScene.undoEx.addUndo(r)}removeHide(){const e=this.runScene.sceneEx.getClearModels(),t=new Set,r=[];e.map((e=>{e.traverse((e=>{e.visible||t.add(e)}))})),t.forEach((e=>{r.push(new ns({runScene:this.runScene,model:e,parent:e.parent}).execute())})),this.runScene.undoEx.addUndo(r)}_getModel(e){if(e=this.runScene.uniqueEx.model.nameMap[e])return this.runScene.uniqueEx.model.get(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 c.Vector3;return e.getWorldPosition(t),t}getClickObj(e,t,r=!1){let n=new c.Raycaster,i=new c.Vector2,o=(i.x=e.offsetX/this.runScene.assetsEx.engineDom.clientWidth*2-1,i.y=-e.offsetY/this.runScene.assetsEx.engineDom.clientHeight*2+1,n.setFromCamera(i,this.runScene.assetsEx.camera),n.intersectObjects(t,!0)),a={intersects:null,obj:null};if(0===o.length)return a;if(r){if(0===(e=o.filter((e=>Ma().model.isVisible(e.object)))).length)return a;a={intersects:e,obj:e[0].object}}else a={intersects:o,obj:o[0].object};return a}getCamLocal(){var{x:e,y:t,z:r}=this.runScene.assetsEx.camera.position,{x:n,y:i,z:o}=this.runScene.assetsEx.controls.target;return{cx:e,cy:t,cz:r,tx:n,ty:i,tz:o}}camAnima(e,t,r=1,n,i){return _o(e,t,r,(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=>{n&&n()}))}setGlow(e,t=!0){t=t?1:0,0==(e.userData.layers=t)?e.layers.set(0):e.layers.enable(1),this.runScene.optionsEx.cb.model.setLayers.cb({model:e,val:t})}beforeLoad(e){return e instanceof Array?e.map((e=>this.beforeLoad(e))):e}}const as=e=>{if(Pa.includes(e)){const t=Ma().model.getModelByType(e);return"Sprite"===t.type&&(t.material.userData.tools=$a.tools),t}throw TypeError("")},ss=(e,t)=>{t=(t||{}).remove;const{geomerty:r,material:n}=e;r&&(null!=r&&r.dispose(),delete e.geometry),n&&(Ya(e.material),e.material.dispose(),delete e.material),!1!==t&&e.parent&&e.parent.remove(e)},ls=(e,t)=>{var{material:r,geometry:n}=e;const i=new vi.InstancedMesh(n,r,t.length+1);return[e,...t].map(((e,t)=>{i.setMatrixAt(t,e.matrix)})),i},us=e=>0!==e.animations.length,cs=e=>{e&&e.userData&&(e.userData.isHelper=!0)};class hs{constructor(e){this.setSize=(e,t)=>{var{w:r,h:n}=this.getDomSize();this.runScene.setSize(e||r,t||n)},this.runScene=e}create(e){let t=new c.WebGLRenderer({antialias:!0,alpha:!0,powerPreference:"high-performance"});return t.domElement.style.position="absolute",t.setPixelRatio(window.devicePixelRatio),t.shadowMap.enabled=!0,t.shadowMap.type=c.PCFSoftShadowMap,t.physicallyCorrectLights=!0,t.localClippingEnabled=!0,e.appendChild(t.domElement),t}getDomSize(){var{clientWidth:e,clientHeight:t}=this.runScene.assetsEx.get().engineDom;return{w:e,h:t}}}const ps=(e,t)=>{t=(t||{}).removeDom,!(e.render=()=>{})!==t&&e.domElement.remove(),e.setAnimationLoop(null),e.dispose(),e.renderLists&&e.renderLists.dispose()};class ds{constructor(e){this.oldFog=null,this.removeMap={light:{valid:e=>this.runScene.lightEx.isLight(e),remove:e=>this.runScene.lightEx.remove(e)}},this.runScene=e}each(e){return this.runScene.assetsEx.get().scene.traverseAncestors(e)}get(){return new Proxy(this.runScene.assetsEx.get().scene,{set:(e,t,r)=>(e[t]=r,!0)})}getNromal(){return this.get().children.filter((e=>!this.runScene.helperEx.isHelper(e)))}remove(e){var t;if(e){if(e instanceof Array){const t=[];return e.map((e=>{for(const r in this.removeMap){const{valid:n,remove:i}=this.removeMap[r];if(n(e))return t.push(...(0,Ea.multiArrToArr)(i(e)))}t.push(new ns({model:e,runScene:this.runScene,parent:e.parent}).execute())})),this.runScene.undoEx.addUndo(t),t}for(const t in this.removeMap){const{valid:r,remove:n}=this.removeMap[t];if(r(e))return n(e)}this.runScene.modelEx.remove(e),null!=(t=this.runScene.helperEx.boxHelper)&&t.setFromObject(this.get())}}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}getClearModels(){return this.get().children.filter((e=>!this.runScene.helperEx.isHelper(e)&&!this.runScene.lightEx.isLight(e)))}getClear(){const e=this.get(),t=new c.Group;return e.children.filter((e=>!this.runScene.helperEx.isHelper(e)&&!this.runScene.lightEx.isLight(e))).map((e=>{const r=e.clone();console.log(r,"nm"),us(e)&&(r.animations=[...e.animations]),t.add(r)})),this.runScene.helperEx.setHelper(t),this.cleanUnlessLevel(t)}cleanNormal(){this.getNromal().map((e=>this.remove(e)))}cleanSceneInfo(e){e.background=null,e.environment=null,e.fog=null}setBackground(e,t=!0){e instanceof c.Texture&&(e.userData.isBackgroud=!0);var r=this.get(),n=new Va({target:r,info:"background",newVal:e,oldVal:r.background,runScene:this.runScene,cb:e=>{this.runScene.bloom.glow.setBackground(e.background)}}).execute();return t&&this.runScene.undoEx.addUndo(n),this.runScene.optionsEx.cb.setScene.cb({scene:r,type:"background"}),this.runScene.bloom.glow.setBackground(e),e}isBackground(e){return e.userData.isBackgroud}clean(){this.runScene.helperEx.unfocus(),this.runScene.anima.reset();const e=this.getClearModels();let t=[];e.map((e=>{e.traverse((e=>t.push(e)))})),t.map((e=>{ss(e,{remove:!1}),this.runScene.optionsEx.cb.model.dispose.cb(e)})),ps(this.runScene.assetsEx.get().renderer),this.runScene.assetsEx.get().controls.dispose(),this.runScene.assetsEx.reset(),this.runScene.modelEx.selectNull(),this.cleanSceneInfo(this.get()),this.runScene.cameraEx.reset(this.runScene.assetsEx.get().camera),this.cleanNormal(),this.runScene.assetsEx.get().renderer.resetState(),this.runScene.assetsEx.get().controls.update(),this.runScene.uniqueEx.dispose(),this.runScene.materialEx.dispose(),this.runScene.undoEx.reset(),this.runScene.timeLineEx.reset(),this.runScene.bloom.glow.dispose(),this.runScene.bloom.glow.init(this.runScene.assetsEx.get()),this.runScene.helperEx.reset(),this.runScene.optionsEx.cb.reset.cb(this.get())}dispose(){const{renderer:e,controls:t}=this.runScene.assetsEx.get();this.clean(),ps(e),t.dispose(),this.runScene.bloom.glow.dispose(),c.Cache.clear()}render(){}create(){return new c.Scene}setEnv(e,t){return function(e,t,r,n){return new(r=r||Promise)((function(t,i){function o(e){try{s(n.next(e))}catch(e){i(e)}}function a(e){try{s(n.throw(e))}catch(e){i(e)}}function s(e){var n;e.done?t(e.value):((n=e.value)instanceof r?n:new r((function(e){e(n)}))).then(o,a)}s((n=n.apply(e,[])).next())}))}(this,0,void 0,(function*(){let r;return t instanceof File&&(r=Ci(yield this.runScene.textureEx.parse(t))),null!=t&&t.isTexture&&(r=Ci(this.runScene.textureEx.clone(t))),this.setNormal({model:e,info:"environment",val:r}),this.runScene.optionsEx.cb.setScene.cb({scene:e,type:"environment"}),r}))}setNormal(e,t=!0){var{model:e,info:r,val:n}=e;e=new Va({target:e,info:r,oldVal:e[r],newVal:n,runScene:this.runScene}).execute(),t&&this.runScene.undoEx.addUndo(e)}setFogShow(e){var{show:e,color:t,scene:r}=e;e?this.setNormal({model:r,info:"fog",val:this.oldFog||new c.Fog(t)}):(this.oldFog=r.fog,this.setNormal({model:r,info:"fog",val:null})),this.runScene.optionsEx.cb.setScene.cb({scene:r,type:"fog"})}setFog(e){var{scene:e,type:t,val:r}=e;e=new Aa({target:e,typeList:["fog",t],newVal:r}).execute(),this.runScene.undoEx.addUndo(e)}sreenShotDefFile(){this.runScene.helperEx.unfocus();var{w:e,h:t}=this.runScene.renderEx.getDomSize();const r=this.runScene.assetsEx.get().renderer.domElement,{renderer:n,scene:i,camera:o}=(r.width=1920,r.height=1080,this.runScene.renderEx.setSize(1920,1080),this.runScene.assetsEx.get());n.render(i,o);var a=r.toDataURL("image/webp",1);return a=(0,Ye.base64ToFile)(a,"screenShot.webp"),r.width=e,r.height=t,this.runScene.renderEx.setSize(),n.render(i,o),a}static toJSON(e){const t=Object.assign({},e.userData.ex);return e.fog&&(t.fog=fs(e.fog)),e.background instanceof c.Color&&(t.backgroundColor=e.background.getHexString()),t}}const fs=e=>{const{color:t,far:r,near:n}=e;return{color:t.getHexString(),far:r,near:n}};var ms=function(e,t,r,n){return new(r=r||Promise)((function(i,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))};class vs{constructor(e){this.materialMap={},this.textureMap={},this.modelType={Sprite:$a};var{type:e,runScene:t,helper:r}=e;this.type=e,this.helper=r,this.runScene=t}parse(e){return ms(this,void 0,void 0,(function*(){const t=new c.Group;t.name="back-texture-ex",t.userData.isHelper=!0,e.add(t),"scene"===this.type&&this.parseScene(t),this.parseModel(e),this.materialMapToJson(),this.setMultipMaterial(t,Object.keys(this.textureMap))}))}parseScene(e){const t=this.runScene.sceneEx.get();if(t.background instanceof c.Texture||t.environment instanceof c.Texture){t.userData.ex={},this.runScene.bloom.glow.setUpdate(!1);const{background:r,environment:n}=t,i=(this.runScene.bloom.glow.setUpdate(!0),as("Box")),o=Xa();i.material=o,e.add(i),e=(0,l.getId)(),t.userData.ex.materialId=e,o.userData.id=e,this.materialMap[e]={material:o},r instanceof c.Texture&&(r.userData.notCompress=!0,303===(o.map=r).mapping&&(t.userData.ex.backgroundMapping=303)),n instanceof c.Texture&&(n.userData.notCompress=!0,o.envMap=n)}}_processMaterial(e){if(e.material&&e.material.userData){var t=this.runScene.materialEx.isBaseMaterial(e.material),r=this.materialMap[e.material.userData.id];return r?(r.normalMaterial&&(e.material=r.normalMaterial),void(null!=(r=r.models)&&r.push(e))):(r=t||this.runScene.optionsEx.exporterOptions.notMaterial?this.runScene.materialEx.defMaterial:this.runScene.materialEx.toNromal(e.material),e.material=r,this.materialMap[r.userData.id]={material:r,normalMaterial:r,models:[e]},r)}}compressLocal(e){var{x:t,y:r,z:n}=e.position;0===t&&0===r&&0===n||(e.position.set(0,0,0),e.userData.local=t+","+r+","+n)}_processModel(e,t){var r;us(e)&&(r=e.animations.map((e=>e.toJSON())),e.userData.animations=r);const n=this.modelType[e.type];if(!n)return e;const i=n.modelTools.toNormal(e);return t&&(i.material=t),e.parent.add(i),e.parent.remove(e),i}parseModel(e){const t=new Set;e.traverse((e=>t.add(e))),t.forEach((e=>{var t=this._processMaterial(e);e=this._processModel(e,t),this.runScene.optionsEx.options.hideLocal&&this.compressLocal(e)}))}materialMapToJson(){return(0,Xe.js)(this.materialMap,((e,t)=>ms(this,void 0,void 0,(function*(){var e=t.material,r=Za(e);return this.helper.material.materialMap[e.userData.id]||(this.helper.material.materialMap[e.userData.id]={normal:e.userData.normal||{},textures:{}}),this.mergeAndRemoveTexture(r,e)}))))}mergeSame(e){var t=e.userData;for(const i in this.textureMap){var{md5:r,texture:n}=this.textureMap[i];if(t.md5===r&&e.mapping===n.mapping)return{isSame:!0,texture:n}}return this.textureMap[e.userData.id]=Object.assign(Object.assign({},t),{texture:e}),{isSame:!1,texture:e}}mergeAndRemoveTexture(e,t){return ms(this,void 0,void 0,(function*(){return e.map((e=>{var{type:e,texture:r}=e;this.runScene.uniqueEx.texture.add(r),t[e]=null;const n=this.mergeSame(r).texture;if(!this.helper.material.textureMap[n.userData.id]){var i,{format:r,repeat:o,center:a,rotation:s,offset:l}=n;const e={format:r};this.runScene.modelEx.isNavieV2(o,1)||(({x:r,y:i}=o),e.repeat=r===i?r:o),this.runScene.modelEx.isNavieV2(a,0)||(({x:i,y:r}=a),e.center=i===r?i:a),this.runScene.modelEx.isNavieV2(l,0)||(({x:o,y:r}=l),e.offset=o===r?o:l),0!==s&&(e.rotation=s),this.helper.material.textureMap[n.userData.id]=e}"normalMap"!==e||n.userData.isNormalMap||(n.userData.isNormalMap=!0),this.helper.material.materialMap[t.userData.id].textures[e]=n.userData.id}))}))}setMultipMaterial(e,t){const r=this.runScene.modelEx.create(),n=Xa();r.material=n,e.add(r);for(const e of yi){if(!t.length)return;var i=t.pop();if(!i)return;n[e]=this.textureMap[i].texture}t.length&&this.setMultipMaterial(e,t)}}class ys{constructor(e){this.materialMap={},this.textureMap={};var{runScene:e,helper:t}=e;this.helper=t,this.runScene=e}parseMaterial(e){const{material:t,materialDef:r}=e;r.id=t.userData.id,this.parseNormal(t)}parseNormal(e){this.materialMap[e.userData.id]||(this.materialMap[e.userData.id]={normal:{},textures:{}}),this.materialMap[e.userData.id].normal=Object.assign(Object.assign({},this.materialMap[e.userData.id].normal),this.runScene.materialEx.getDefNromals(e)),console.log(this.materialMap[e.userData.id].normal," this.materialMap[material.userData.id].normal ")}setMaterialDef(e){const{type:t,data:r,normal:n}=e;n[t]=r}processTexture(e){const{texture:t,textureDef:r}=e;e=t.userData.notCompress;var{width:e,height:n}=(e&&(r.notCompress=!0),r.md5=t.userData.md5,r.id=t.userData.id,r.format=t.userData.format,Di(t));r.size={w:e,h:n}}done(e){var{textureMap:t,materialMap:r}=this;e.asset.ex=Object.assign(Object.assign({},e.asset.ex),{textureMap:t,materialMap:r})}}function gs(e){return(gs="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 bs(e,t){return(bs=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function xs(e){return(xs=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}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");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&bs(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=xs(e);if(r=t?(r=xs(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===gs(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(e,t){if(!(this instanceof n))throw new TypeError("Cannot call a class as a function");var i=new c.BufferGeometry,o=(i.setAttribute("position",new c.Float32BufferAttribute([1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],3)),i.computeBoundingSphere(),new c.LineBasicMaterial({fog:!1}));return((i=r.call(this,i,o)).light=e,i.color=t,i.type="RectAreaLightHelper",o=new c.BufferGeometry).setAttribute("position",new c.Float32BufferAttribute([1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],3)),o.computeBoundingSphere(),i.add(new c.Mesh(o,new c.MeshBasicMaterial({side:c.BackSide,fog:!1}))),i}return 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 r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),n}(c.Line);class Ss{constructor(e){this.runScene=e}}class Ts extends Ss{get(){}static toJSON(e){const{type:t,intensity:r,name:n,visible:i,color:o}=e;return{type:t,intensity:r,name:n,visible:i,color:o.getHexString()}}parseJSON(e){const t=this.runScene.lightEx.get("AmbientLight",{addUndo:!1});var{type:e,intensity:r,name:n,visible:i,color:o}=e;return t.intensity=r,t.type=e,t.name=n,t.visible=i,t.color=new vi.Color("#"+o),t}}class _s extends Ss{get(){throw new Error("Method not implemented.")}static toJSON(e){const{intensity:t,name:r,type:n,position:i,visible:o,color:a,castShadow:s,shadow:l,rotation:u,target:c}=e;var{mapSize:e,camera:h}=l,{scale:h,near:p,far:d}=h;return{type:n,intensity:t,name:r,visible:o,color:a.getHexString(),castShadow:s,shadow:{mapSize:e.x,camera:{near:p,far:d,scale:h.x}},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){const t=this.runScene.lightEx.get("DirectionalLight",{addUndo:!1});var{targetPosition:e,intensity:r,name:n,position:i,visible:o,color:a,castShadow:s,shadow:l,rotation:u,type:c}=e,{mapSize:l,camera:h}=l,{scale:h,near:p,far:d}=h;return t.intensity=r,t.type=c,t.name=n,t.visible=o,t.castShadow=s,t.color=new vi.Color("#"+a),t.position.set(i.x,i.y,i.z),t.rotation.set(u.x,u.y,u.z),t.target.position.set(e.x,e.y,e.z),t.shadow.mapSize.x=l,t.shadow.mapSize.y=l,t.shadow.camera.scale.x=h,t.shadow.camera.scale.y=h,t.shadow.camera.scale.z=h,t.shadow.camera.near=p,t.shadow.camera.far=d,t.shadow.camera.updateProjectionMatrix(),null!=(r=t.cameraHelper)&&r.update(),t}}class Ms extends Ss{get(){throw new Error("Method not implemented.")}static toJSON(e){const{type:t,intensity:r,name:n,visible:i,color:o,groundColor:a,position:s}=e;return{name:n,type:t,intensity:r,visible:i,position:{x:s.x,y:s.y,z:s.z},groundColor:a.getHexString(),color:o.getHexString()}}parseJSON(e){const t=this.runScene.lightEx.get("HemisphereLight",{addUndo:!1});var{type:e,intensity:r,name:n,visible:i,color:o,groundColor:a,position:s}=e;return t.type=e,t.intensity=r,t.name=n,t.visible=i,t.color=new vi.Color("#"+o),t.groundColor=new vi.Color("#"+a),t.position.set(s.x,s.y,s.z),t}}class Es extends Ss{get(){throw new Error("Method not implemented.")}static toJSON(e){const{name:t,type:r,intensity:n,distance:i,decay:o,renderOrder:a,color:s,visible:l,castShadow:u,shadow:c,position:h}=e;var{mapSize:e,camera:p,bias:d,radius:f}=c,{scale:p,near:m,far:v}=p;return{name:t,type:r,intensity:n,visible:l,color:s.getHexString(),castShadow:u,distance:i,decay:o,renderOrder:a,shadow:{mapSize:e.x,camera:{near:m,far:v,scale:p.x},radius:f,bias:d},position:{x:h.x,y:h.y,z:h.z}}}parseJSON(e){const t=this.runScene.lightEx.get("PointLight",{addUndo:!1});var{name:e,type:r,intensity:n,distance:i,decay:o,renderOrder:a,color:s,visible:l,castShadow:u,shadow:c,position:h}=e,{mapSize:c,camera:p,bias:d,radius:f}=c,{scale:p,near:m,far:v}=p;return t.intensity=n,t.type=r,t.name=e,t.visible=l,t.castShadow=u,t.distance=i,t.renderOrder=a,t.color=new vi.Color("#"+s),t.position.set(h.x,h.y,h.z),t.shadow.mapSize.x=c,t.shadow.mapSize.y=c,t.shadow.bias=d,t.decay=o,t.shadow.radius=f,t.shadow.camera.scale.x=p,t.shadow.camera.scale.y=p,t.shadow.camera.scale.z=p,t.shadow.camera.near=m,t.shadow.camera.far=v,t.shadow.camera.updateProjectionMatrix(),t}}class Ps{constructor(e){this.runScene=e}static toJSON(e){const{type:t,intensity:r,name:n,visible:i,color:o,position:a}=e;return{name:n,type:t,intensity:r,visible:i,position:{x:a.x,y:a.y,z:a.z},color:o.getHexString()}}parseJSON(e){const t=this.runScene.lightEx.get("RectAreaLight",{addUndo:!1});var{type:e,intensity:r,name:n,visible:i,color:o,position:a}=e;return t.type=e,t.intensity=r,t.name=n,t.visible=i,t.color=new vi.Color("#"+o),t.position.set(a.x,a.y,a.z),t}}class Os{constructor(e){this.runScene=e}static toJSON(e){const{name:t,type:r,color:n,distance:i,decay:o,intensity:a,angle:s,penumbra:l,visible:u,castShadow:c,shadow:h,renderOrder:p,position:d,target:f}=e;var{bias:e,camera:m,normalBias:v,mapSize:y,radius:g}=h,m=m.near;return{type:r,intensity:a,name:t,visible:u,distance:i,angle:s,decay:o,penumbra:l,renderOrder:p,color:n.getHexString(),castShadow:c,shadow:{bias:e,normalBias:v,mapSize:y.x,camera:{near:m},radius:g},position:{x:d.x,y:d.y,z:d.z},targetPosition:{x:f.position.x,y:f.position.y,z:f.position.z}}}parseJSON(e){const t=this.runScene.lightEx.get("SpotLight",{addUndo:!1});var{name:e,type:r,color:n,distance:i,decay:o,intensity:a,angle:s,penumbra:l,visible:u,castShadow:c,shadow:h,renderOrder:p,position:d,targetPosition:f}=e,{bias:h,camera:m,normalBias:v,mapSize:y,radius:g}=h,m=m.near;return t.intensity=a,t.type=r,t.name=e,t.visible=u,t.distance=i,t.decay=o,t.angle=s,t.penumbra=l,t.renderOrder=p,t.castShadow=c,t.color=new vi.Color("#"+n),t.position.set(d.x,d.y,d.z),t.shadow.mapSize.x=y,t.shadow.mapSize.y=y,t.shadow.camera.near=m,t.target.position.set(f.x,f.y,f.z),t.shadow.bias=h,t.shadow.normalBias=v,t.shadow.radius=g,t.shadow.camera.updateProjectionMatrix(),t}}const Rs={DirectionalLight:_s,PointLight:Es,SpotLight:Os,RectAreaLight:Ps,HemisphereLight:Ms,AmbientLight:Ts};class ks{constructor(e){this.shadowList=["DirectionalLight","PointLight","SpotLight"],this.helperList=["DirectionalLight","PointLight","SpotLight","RectAreaLight","HemisphereLight"],this.lightDom=void 0,this.helperUpdateList=["DirectionalLight","PointLight","SpotLight","HemisphereLight"],this.runScene=e,this.lightExMap={DirectionalLight:new _s(e),PointLight:new Es(e),SpotLight:new Os(e),RectAreaLight:new Ps(e),HemisphereLight:new Ms(e),AmbientLight:new Ts(e)}}getLightsByScene(e=this.runScene.sceneEx.get()){return e.children.filter((e=>e.isLight))}get(e,t){var{isClone:t,id:r,addUndo:n,addToScene:i}=$o({isClone:!1,id:(0,l.getId)(),addUndo:!0,addToScene:!0},t);let o=new vi[e];if(o.position.y=10,o.name=e,o.userData.id=r,this.shadowList.includes(e)&&(o.castShadow=!0),this.setLight(o),!i)return o;if(this.helperList.includes(o.type)){const t=this.setLightHelper(o);t.push({model:o,parent:this.runScene.sceneEx.get(),addTree:!0}),r=t.map((e=>new ts(Object.assign(Object.assign({},e),{runScene:this.runScene})).execute())),n&&this.runScene.undoEx.addUndo(r),null!=(e=null==o?void 0:o.lightHelper)&&e.update()}else this.runScene.modelEx.add(o,void 0,{addUndo:n});return this.runScene.modelEx.setSelectByModel(o,{isClone:t}),o}setNull(e){e.userData.light&&this.setNull(e.userData.light),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.userData.light&&this.setSelect(e.userData.light),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.userData.light&&(e=e.userData.light),this.isLight(e)&&("DirectionalLight"===e.type||"SpotLight"===e.type?(e.helper.update(),null!=(t=e.cameraHelper)&&t.update()):null!=(e=null==(t=e.helper)?void 0:t.update)&&e.call(t))}remove(e,t=!0){let r;return this.runScene.helperEx.unfocus(),r="DirectionalLight"===e.type||"SpotLight"===e.type?[e,e.cameraHelper,e.helper].map((t=>{if(t)return new ns({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 ns({addTree:t===e,runScene:this.runScene,model:t,parent:t.parent||this.runScene.sceneEx.get()}).execute()})).filter((e=>e)),t&&r&&this.runScene.undoEx.addUndo(r),r}getLightHelper(e,t){this.runScene.uniqueEx.model.add(t);const r=this.runScene.uniqueEx.getId(t);let n,i=[];switch(e){case"RectAreaLight":n=new ws(t,16773120);break;case"DirectionalLight":if(n=new vi.DirectionalLightHelper(t,1,16711680),t.children[0])t.target=t.children[0];else{let e=new vi.Object3D;(t.target=e).name="helperModel",e.position.y=-10,t.shadow.autoUpdate=!0,e.userData.isLightTarget=!0,(e.userData.light=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 vi.CameraHelper(t.shadow.camera);t.shadow.camera.matrixWorldNeedsUpdate=!0,this.runScene.helperEx.setHelper(e,!0,(e=>{e.userData.id=r,e.userData.unClick=!0})),e.userData.id=r,e.userData.unClick=!0,t.cameraHelper=e,i.push({model:e,parent:this.runScene.sceneEx.get(),addTree:!1});break;case"PointLight":n=new vi.PointLightHelper(t,1,16711935);break;case"SpotLight":n=new vi.SpotLightHelper(t);let o=new vi.Object3D;(t.target=o).name="helperModel",o.userData.isLightTarget=!0,o.userData.light=t,o.position.y=-10,t.shadow.autoUpdate=!0,t.add(o);const a=new vi.CameraHelper(t.shadow.camera);t.shadow.camera.matrixWorldNeedsUpdate=!0,this.runScene.helperEx.setHelper(a,!0,(e=>{e.userData.id=r})),a.userData.id=r,t.cameraHelper=a,i.push({model:a,parent:this.runScene.sceneEx.get(),addTree:!1});break;case"HemisphereLight":n=new vi.HemisphereLightHelper(t,1,16773135)}return n.name="helperModel",this.runScene.helperEx.setHelper(n,!0,(e=>{e.userData.id=r})),n.userData.id=r,(n.light=t).helper=n,i.push({model:n,parent:this.runScene.sceneEx.get(),addTree:!1}),i}setLightHelper(e){return"editor"!==this.runScene.optionsEx.options.mode?[]: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:r,val:n,cb:i}=e;return new Va({target:e,runScene:this.runScene,info:r,oldVal:e[r],newVal:n,cb:i}).execute()}setMultip(e,t,r=!0,n=!0){if(e instanceof Array)return i=e.map((e=>{var{model:e,typeList:n,newVal:i}=e;const o=new Aa({target:e,typeList:n,newVal:i,cb:t});return r?o.execute():o})),n&&this.runScene.undoEx.addUndo(i),i;{var{model:i,typeList:e,newVal:o}=e;const a=new Aa({target:i,typeList:e,newVal:o,cb:t});return n&&this.runScene.undoEx.addUndo(a),r?a.execute():a}}isLight(e){return null==(e=e.userData)?void 0:e.isLight}setLight(e){e.userData.isLight=!0}isHelperTarget(e){return e.userData.isLightTarget}clone(e){return this.runScene.modelEx.selectNull(),this.get(e.type,{isClone:!0,id:(0,l.getId)()})}static toJSON(e){return e.map((e=>{var t=e.type;return Rs[t].toJSON(e)}))}}class As{constructor(e){this.helperModels=[];var{type:e,runScene:t}=e;this.runScene=t,this.type=e,this.material=new ys({runScene:t,helper:this}),this.before=new vs({helper:this,type:e,runScene:t})}init(e){return this.before.parse(e)}parseNode(e){const{object:t,nodeDef:r}=e;(0,Xe.js)(this.runScene.modelEx.defNodeMap,((e,n)=>{t[e]!==n&&(r[e]=t[e])})),t.material&&t.material.wireframe&&(t.material.wireframe=!1,r.wireframe=!0)}getNodeMapValueWithBone(e,t){for(const r of t.keys())if(r.userData.id===e.userData.id)return t.get(r)}done(e){e.asset.ex||(e.asset.ex={type:this.type}),"scene"===this.type&&(e.asset.ex=this.setSceneEx(e.asset.ex)),this.material.done(e)}setSceneEx(e){var t=this.runScene.sceneEx.get();const{controls:r,camera:n}=this.runScene.assetsEx.get();return Object.assign(Object.assign({},e),{lights:ks.toJSON(this.runScene.lightEx.getLightsByScene()),camera:n.toJSON(),sceneEx:ds.toJSON(t),timeLine:this.runScene.timeLineEx.getSavedData(),controls:Ge.toJSON(r),options:this.runScene.exporter.gltf.options.getOptions(t)})}}class Ls{constructor(){this.optionsConfigs={}}getParse(e){return this.optionsConfigs[e]}addOption(e){var t=e.type;if(this.optionsConfigs[t])throw TypeError("该配置项已被挂载");this.optionsConfigs[t]=e}getOptions(e){return Object.values(this.optionsConfigs).map((t=>{const{process:r,type:n}=t;return{type:n,data:r(e)}}))}}function Cs(){Cs=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=(d="function"==typeof Symbol?Symbol:{}).iterator||"@@iterator",i=d.asyncIterator||"@@asyncIterator",o=d.toStringTag||"@@toStringTag";function a(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{a({},"")}catch(t){a=function(e,t,r){return e[t]=r}}function s(e,t,r,n){var i,o,a,s;return t=t&&t.prototype instanceof c?t:c,t=Object.create(t.prototype),n=new x(n||[]),t._invoke=(i=e,o=r,a=n,s="suspendedStart",function(e,t){if("executing"===s)throw new Error("Generator is already running");if("completed"===s){if("throw"===e)throw t;return{value:void 0,done:!0}}for(a.method=e,a.arg=t;;){var r=a.delegate;if(r&&(r=function e(t,r){var n=t.iterator[r.method];if(void 0===n){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=void 0,e(t,r),"throw"===r.method))return u;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return u}return"throw"===(n=l(n,t.iterator,r.arg)).type?(r.method="throw",r.arg=n.arg,r.delegate=null,u):(n=n.arg)?n.done?(r[t.resultName]=n.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,u):n:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,u)}(r,a),r)){if(r===u)continue;return r}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if("suspendedStart"===s)throw s="completed",a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);if(s="executing","normal"===(r=l(i,o,a)).type){if(s=a.done?"completed":"suspendedYield",r.arg===u)continue;return{value:r.arg,done:a.done}}"throw"===r.type&&(s="completed",a.method="throw",a.arg=r.arg)}}),t}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=s;var u={};function c(){}function h(){}function p(){}var d,f,m=(a(d={},n,(function(){return this})),(f=(f=Object.getPrototypeOf)&&f(f(w([]))))&&f!==t&&r.call(f,n)&&(d=f),p.prototype=c.prototype=Object.create(d));function v(e){["next","throw","return"].forEach((function(t){a(e,t,(function(e){return this._invoke(t,e)}))}))}function y(e,t){var n;this._invoke=function(i,o){function a(){return new t((function(n,a){!function n(i,o,a,s){var u;if("throw"!==(i=l(e[i],e,o)).type)return(o=(u=i.arg).value)&&"object"==Is(o)&&r.call(o,"__await")?t.resolve(o.__await).then((function(e){n("next",e,a,s)}),(function(e){n("throw",e,a,s)})):t.resolve(o).then((function(e){u.value=e,a(u)}),(function(e){return n("throw",e,a,s)}));s(i.arg)}(i,o,n,a)}))}return n=n?n.then(a,a):a()}}function g(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(g,this),this.reset(!0)}function w(e){if(e){var t,i=e[n];if(i)return i.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return t=-1,(i=function n(){for(;++t<e.length;)if(r.call(e,t))return n.value=e[t],n.done=!1,n;return n.value=void 0,n.done=!0,n}).next=i}return{next:S}}function S(){return{value:void 0,done:!0}}return a(m,"constructor",h.prototype=p),a(p,"constructor",h),h.displayName=a(p,o,"GeneratorFunction"),e.isGeneratorFunction=function(e){return!!(e="function"==typeof e&&e.constructor)&&(e===h||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,a(e,o,"GeneratorFunction")),e.prototype=Object.create(m),e},e.awrap=function(e){return{__await:e}},v(y.prototype),a(y.prototype,i,(function(){return this})),e.AsyncIterator=y,e.async=function(t,r,n,i,o){void 0===o&&(o=Promise);var a=new y(s(t,r,n,i),o);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},v(m),a(m,o,"Generator"),a(m,n,(function(){return this})),a(m,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t,r=[];for(t in e)r.push(t);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,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)&&r.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 n(r,n){return a.type="throw",a.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var i=this.tryEntries.length-1;0<=i;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var s=r.call(o,"catchLoc"),l=r.call(o,"finallyLoc");if(s&&l){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;0<=n;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}var a=(o=o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc?null:o)?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,u):this.complete(a)},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 r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),b(r),u}},catch:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var r,n,i=this.tryEntries[t];if(i.tryLoc===e)return"throw"===(r=i.completion).type&&(n=r.arg,b(i)),n}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:w(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),u}},e}function Ds(e,t,r,n,i,o,a){try{var s=e[o](a),l=s.value}catch(e){return void r(e)}s.done?t(l):Promise.resolve(l).then(n,i)}function Is(e){return(Is="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 js(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Us(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Bs(e,t,r){t&&Us(e.prototype,t),r&&Us(e,r),Object.defineProperty(e,"prototype",{writable:!1})}var zs=function(){function e(){js(this,e),this.pluginCallbacks=[],this.register((function(e){return new Js(e)})),this.register((function(e){return new $s(e)})),this.register((function(e){return new el(e)})),this.register((function(e){return new rl(e)})),this.register((function(e){return new nl(e)})),this.register((function(e){return new tl(e)}))}return Bs(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,r,n){"object"===Is(r)&&(console.warn("THREE.GLTFExporter: parse() expects options as the fourth argument now."),n=r);for(var i=new Ks,o=[],a=0,s=this.pluginCallbacks.length;a<s;a++)o.push(this.pluginCallbacks[a](i));i.setPlugins(o),i.write(e,t,n).catch(r)}},{key:"parseAsync",value:function(e,t){var r=this;return new Promise((function(n,i){r.parse(e,n,i,t)}))}}]),e}(),Ns=5121,Fs=5123,Vs=(o=9728,9729),Hs=9984,Gs=9986,Ws={},Xs=(Ws[c.NearestFilter]=o,Ws[c.NearestMipmapNearestFilter]=Hs,Ws[c.NearestMipmapLinearFilter]=Gs,Ws[c.LinearFilter]=Vs,Ws[c.LinearMipmapNearestFilter]=9985,Ws[c.LinearMipmapLinearFilter]=9987,Ws[c.ClampToEdgeWrapping]=33071,Ws[c.RepeatWrapping]=10497,Ws[c.MirroredRepeatWrapping]=33648,{scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"});function qs(e,t){return e.length===t.length&&e.every((function(e,r){return e===t[r]}))}function Ys(e){return 4*Math.ceil(e/4)}function Zs(e,t){var r=1<arguments.length&&void 0!==t?t:0,n=Ys(e.byteLength);if(n===e.byteLength)return e;var i=new Uint8Array(n);if(i.set(new Uint8Array(e)),0!==r)for(var o=e.byteLength;o<n;o++)i[o]=r;return i.buffer}var Qs=null,Ks=function(){function e(){js(this,e),this.plugins=[],this.options={},this.pending=[],this.buffers=[],this.byteOffset=0,this.buffers=[],this.nodeMap=new Map,this.skins=[],this.extensionsUsed={},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,r;return Bs(e,[{key:"setPlugins",value:function(e){this.plugins=e}},{key:"write",value:(t=Cs().mark((function e(t,r,n){var i,o,a,s,l,u,c;return Cs().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.options=Object.assign({},{binary:!1,trs:!1,onlyVisible:!0,truncateDrawRange:!0,embedImages:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},n),0<this.options.animations.length&&(this.options.trs=!0),this.processInput(t),e.next=5,Promise.all(this.pending);case 5:return o=(i=this).buffers,a=i.json,n=i.options,e.next=11,i.options.myOptions.helper.done(a);case 11:l=i.extensionsUsed,s=new Blob(o,{type:"application/octet-stream"}),0<(l=Object.keys(l)).length&&(a.extensionsUsed=l),a.buffers&&0<a.buffers.length&&(a.buffers[0].byteLength=s.size),!0===n.binary?(console.log(a,"json"),(u=new window.FileReader).readAsArrayBuffer(s),u.onloadend=function(){var e=Zs(u.result),t=new DataView(new ArrayBuffer(8)),n=(t.setUint32(0,e.byteLength,!0),t.setUint32(4,5130562,!0),Zs(function(e){if(void 0!==window.TextEncoder)return(new TextEncoder).encode(e).buffer;for(var t=new Uint8Array(new ArrayBuffer(e.length)),r=0,n=e.length;r<n;r++){var i=e.charCodeAt(r);t[r]=255<i?32:i}return t.buffer}(JSON.stringify(a)),32)),i=new DataView(new ArrayBuffer(8)),o=(i.setUint32(0,n.byteLength,!0),i.setUint32(4,1313821514,!0),new ArrayBuffer(12)),s=((l=new DataView(o)).setUint32(0,1179937895,!0),l.setUint32(4,2,!0),12+i.byteLength+n.byteLength+t.byteLength+e.byteLength),l=(l.setUint32(8,s,!0),new Blob([o,i,n,t,e],{type:"application/octet-stream"})),c=new window.FileReader;c.readAsArrayBuffer(l),c.onloadend=function(){r(c.result)}}):a.buffers&&0<a.buffers.length?((c=new window.FileReader).readAsDataURL(s),c.onloadend=function(){var e=c.result;a.buffers[0].uri=e,r(a)}):r(a);case 17:case"end":return e.stop()}}),e,this)})),r=function(){var e=this,r=arguments;return new Promise((function(n,i){var o=t.apply(e,r);function a(e){Ds(o,n,i,a,s,"next",e)}function s(e){Ds(o,n,i,a,s,"throw",e)}a(void 0)}))},function(e,t,n){return r.apply(this,arguments)})},{key:"serializeUserData",value:function(e,t){if(0!==Object.keys(e.userData).length){var r=this.options,n=this.extensionsUsed;try{var i=JSON.parse(JSON.stringify(e.userData));if(r.includeCustomExtensions&&i.gltfExtensions){for(var o in void 0===t.extensions&&(t.extensions={}),i.gltfExtensions)t.extensions[o]=i.gltfExtensions[o],n[o]=!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){return this.uids.has(e)||this.uids.set(e,this.uid++),this.uids.get(e)}},{key:"isNormalizedNormalAttribute",value:function(e){if(this.cache.attributesNormalized.has(e))return!1;for(var t=new c.Vector3,r=0,n=e.count;r<n;r++)if(5e-4<Math.abs(t.fromBufferAttribute(e,r).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 r=e.clone(),n=new c.Vector3,i=0,o=r.count;i<o;i++)n.fromBufferAttribute(r,i),0===n.x&&0===n.y&&0===n.z?n.setX(1):n.normalize(),r.setXYZ(i,n.x,n.y,n.z);return t.attributesNormalized.set(e,r),r}},{key:"applyTextureTransform",value:function(e,t){var r=!1,n={};0===t.offset.x&&0===t.offset.y||(n.offset=t.offset.toArray(),r=!0),0!==t.rotation&&(n.rotation=t.rotation,r=!0),1===t.repeat.x&&1===t.repeat.y||(n.scale=t.repeat.toArray(),r=!0),r&&(e.extensions=e.extensions||{},e.extensions.KHR_texture_transform=n,this.extensionsUsed.KHR_texture_transform=!0)}},{key:"buildORMTexture",value:function(e){var t=null==(t=e.aoMap)?void 0:t.image,r=null==(r=e.roughnessMap)?void 0:r.image,n=null==(n=e.metalnessMap)?void 0:n.image;if(t===r&&r===n)return e.aoMap;if(t||r||n){e=Math.max((null==t?void 0:t.width)||0,(null==r?void 0:r.width)||0,(null==n?void 0:n.width)||0);var i=Math.max((null==t?void 0:t.height)||0,(null==r?void 0:r.height)||0,(null==n?void 0:n.height)||0),o=document.createElement("canvas"),a=(o.width=e,o.height=i,o.getContext("2d")),s=(a.fillStyle="#ffffff",a.fillRect(0,0,e,i),a.getImageData(0,0,e,i));if(t){a.drawImage(t,0,0,e,i);for(var l=a.getImageData(0,0,e,i).data,u=0;u<l.length;u+=4)s.data[u]=l[u]}if(r){a.drawImage(r,0,0,e,i);for(var h=a.getImageData(0,0,e,i).data,p=1;p<h.length;p+=4)s.data[p]=h[p]}if(n){a.drawImage(n,0,0,e,i);for(var d=a.getImageData(0,0,e,i).data,f=2;f<d.length;f+=4)s.data[f]=d[f]}return a.putImageData(s,0,0),new c.Texture(o)}}},{key:"processBuffer",value:function(e){var t=this.json,r=this.buffers;return t.buffers||(t.buffers=[{byteLength:0}]),r.push(e),0}},{key:"processBufferView",value:function(e,t,r,n,i){for(var o,a=this.json,s=(a.bufferViews||(a.bufferViews=[]),o=t===Ns?1:t===Fs?2:4,Ys(n*e.itemSize*o)),l=new DataView(new ArrayBuffer(s)),u=0,c=r;c<r+n;c++)for(var h=0;h<e.itemSize;h++){var p=void 0;4<e.itemSize?p=e.array[c*e.itemSize+h]:0===h?p=e.getX(c):1===h?p=e.getY(c):2===h?p=e.getZ(c):3===h&&(p=e.getW(c)),5126===t?l.setFloat32(u,p,!0):5125===t?l.setUint32(u,p,!0):t===Fs?l.setUint16(u,p,!0):t===Ns&&l.setUint8(u,p),u+=o}var d={buffer:this.processBuffer(l.buffer),byteOffset:this.byteOffset,byteLength:s};return void 0!==i&&(d.target=i),34962===i&&(d.byteStride=e.itemSize*o),this.byteOffset+=s,a.bufferViews.push(d),{id:a.bufferViews.length-1,byteLength:0}}},{key:"processBufferViewImage",value:function(e){var t=this,r=t.json;return r.bufferViews||(r.bufferViews=[]),new Promise((function(n,i){var o=new window.FileReader;if(!(e instanceof Blob))return i();o.readAsArrayBuffer(e),o.onloadend=function(){var e=Zs(o.result),i={buffer:t.processBuffer(e),byteOffset:t.byteOffset,byteLength:e.byteLength};t.byteOffset+=e.byteLength,n(r.bufferViews.push(i)-1)}}))}},{key:"processAccessor",value:function(e,t,r,n){var i,o=this.options,a=this.json;if(e.array.constructor===Float32Array)i=5126;else if(e.array.constructor===Uint32Array)i=5125;else if(e.array.constructor===Uint16Array)i=Fs;else{if(e.array.constructor!==Uint8Array)throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type.");i=Ns}if(void 0===r&&(r=0),void 0===n&&(n=e.count),o.truncateDrawRange&&void 0!==t&&null===t.index&&(o=r+n,l=t.drawRange.count===1/0?e.count:t.drawRange.start+t.drawRange.count,r=Math.max(r,t.drawRange.start),(n=Math.min(o,l)-r)<0&&(n=0)),0===n)return null;o=function(e,t,r){for(var n={min:new Array(e.itemSize).fill(Number.POSITIVE_INFINITY),max:new Array(e.itemSize).fill(Number.NEGATIVE_INFINITY)},i=t;i<t+r;i++)for(var o=0;o<e.itemSize;o++){var a=void 0;4<e.itemSize?a=e.array[i*e.itemSize+o]:0===o?a=e.getX(i):1===o?a=e.getY(i):2===o?a=e.getZ(i):3===o&&(a=e.getW(i)),n.min[o]=Math.min(n.min[o],a),n.max[o]=Math.max(n.max[o],a)}return n}(e,r,n);var s,l=(void 0!==t&&(s=e===t.index?34963:34962),this.processBufferView(e,i,r,n,s));return t={bufferView:l.id,byteOffset:l.byteOffset,componentType:i,count:n,max:o.max,min:o.min,type:{1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",16:"MAT4"}[e.itemSize]},!0===e.normalized&&(t.normalized=!0),a.accessors||(a.accessors=[]),a.accessors.push(t)-1}},{key:"processImage",value:function(e,t,r,n){var i=this,o=i.cache,a=i.json,s=i.options,l=i.pending,u=(o.images.has(e)||o.images.set(e,{}),o=o.images.get(e),"image/png");if(void 0!==o[r=u+":flipY/"+r.toString()])return o[r];a.images||(a.images=[]);var h={mimeType:u};if(!0===s.binary&&null!=n&&null!=(d=n.userData)&&d.blob&&(null==n||null==(d=n.userData)?void 0:d.blob)instanceof Blob)l.push(new Promise((function(e){i.processBufferViewImage(n.userData.blob).then((function(t){h.bufferView=t,e()}))})));else if(s.embedImages){var p=Qs=Qs||document.createElement("canvas"),d=(p.width=Math.min(e.width,s.maxTextureSize),p.height=Math.min(e.height,s.maxTextureSize),p.getContext("2d"));if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap)d.drawImage(e,0,0,p.width,p.height);else{t!==c.RGBAFormat&&console.error("GLTFExporter: Only RGBAFormat is supported."),(e.width>s.maxTextureSize||e.height>s.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];d.putImageData(new ImageData(f,e.width,e.height),0,0)}!0===s.binary?l.push(new Promise((function(e){p.toBlob((function(t){i.processBufferViewImage(t).then((function(t){h.bufferView=t,e()}))}),u)}))):h.uri=p.toDataURL(u)}else h.uri=e.src;return t=a.images.push(h)-1,o[r]=t}},{key:"processSampler",value:function(e){var t=this.json;return t.samplers||(t.samplers=[]),e={magFilter:Ws[e.magFilter],minFilter:Ws[e.minFilter],wrapS:Ws[e.wrapS],wrapT:Ws[e.wrapT]},t.samplers.push(e)-1}},{key:"processTexture",value:function(e){var t=this.cache,r=this.json;if(t.textures.has(e))return t.textures.get(e);r.textures||(r.textures=[]);var n={sampler:this.processSampler(e),source:this.processImage(e.image,e.format,e.flipY,e)};return e.name&&(n.name=e.name),this._invokeAll((function(t){t.writeTexture&&t.writeTexture(e,n)})),r=r.textures.push(n)-1,t.textures.set(e,r),this.options.myOptions.helper.material.processTexture({texture:e,textureDef:n}),r}},{key:"processMaterial",value:function(e){var t=this.cache,r=this.json;if(t.materials.has(e))return t.materials.get(e);if(e.isShaderMaterial)return console.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;r.materials||(r.materials=[]);var n,i={pbrMetallicRoughness:{}},o=(qs((this.options.myOptions.helper.material.parseMaterial({material:e,materialDef:i,options:this}),!0!==e.isMeshStandardMaterial&&!0!==e.isMeshBasicMaterial&&console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results."),o=e.color.toArray().concat([e.opacity])),[1,1,1,1])||(i.pbrMetallicRoughness.baseColorFactor=o),e.isMeshStandardMaterial?(i.pbrMetallicRoughness.metallicFactor=e.metalness,i.pbrMetallicRoughness.roughnessFactor=e.roughness):(i.pbrMetallicRoughness.metallicFactor=.5,i.pbrMetallicRoughness.roughnessFactor=.5),this.buildORMTexture(e));return(e.metalnessMap||e.roughnessMap)&&(o={index:this.processTexture(o)},this.applyTextureTransform(o,e.metalnessMap||e.roughnessMap),i.pbrMetallicRoughness.metallicRoughnessTexture=o),e.map&&(o={index:this.processTexture(e.map)},this.applyTextureTransform(o,e.map),i.pbrMetallicRoughness.baseColorTexture=o),e.emissive&&(o=e.emissive.clone().multiplyScalar(e.emissiveIntensity),1<(n=Math.max(o.r,o.g,o.b))&&(o.multiplyScalar(1/n),console.warn("THREE.GLTFExporter: Some emissive components exceed 1; emissive has been limited")),0<n&&(i.emissiveFactor=o.toArray()),e.emissiveMap&&(n={index:this.processTexture(e.emissiveMap)},this.applyTextureTransform(n,e.emissiveMap),i.emissiveTexture=n)),e.normalMap&&(o={index:this.processTexture(e.normalMap)},e.normalScale&&1!==e.normalScale.x&&(o.scale=e.normalScale.x),this.applyTextureTransform(o,e.normalMap),i.normalTexture=o),e.aoMap&&(n={index:this.processTexture(e.aoMap),texCoord:1},1!==e.aoMapIntensity&&(n.strength=e.aoMapIntensity),this.applyTextureTransform(n,e.aoMap),i.occlusionTexture=n),e.transparent?i.alphaMode="BLEND":0<e.alphaTest&&(i.alphaMode="MASK",i.alphaCutoff=e.alphaTest),e.side===c.DoubleSide&&(i.doubleSided=!0),""!==e.name&&(i.name=e.name),this.serializeUserData(e,i),this._invokeAll((function(t){t.writeMaterial&&t.writeMaterial(e,i)})),o=r.materials.push(i)-1,t.materials.set(e,o),o}},{key:"processMesh",value:function(e){var t=this.cache,r=this.json,n=[e.geometry.uuid];if(Array.isArray(e.material))for(var i=0,o=e.material.length;i<o;i++)n.push(e.material[i].uuid);else n.push(e.material.uuid);var a=n.join(":");if(t.meshes.has(a))return t.meshes.get(a);var s=e.geometry,l=e.isLineSegments?1:e.isLineLoop?2:e.isLine?3:e.isPoints?0:e.material.wireframe?1:4;if(!0!==s.isBufferGeometry)throw new Error("THREE.GLTFExporter: Geometry is not of type THREE.BufferGeometry.");var u,h,p,d={},f={},m=[],v=[],y={uv:"TEXCOORD_0",uv2:"TEXCOORD_1",color:"COLOR_0",skinWeight:"WEIGHTS_0",skinIndex:"JOINTS_0"},g=s.getAttribute("normal"),b=(void 0===g||this.isNormalizedNormalAttribute(g)||(console.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."),s.setAttribute("normal",this.createNormalizedNormalAttribute(g))),null);for(h in s.attributes)"morph"!==h.slice(0,5)&&(u=s.attributes[h],h=y[h]||h.toUpperCase(),/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(h)||(h="_"+h),t.attributes.has(this.getUID(u))?f[h]=t.attributes.get(this.getUID(u)):(b=null,p=u.array,"JOINTS_0"!==h||p instanceof Uint16Array||p instanceof Uint8Array||(console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'),b=new c.BufferAttribute(new Uint16Array(p),u.itemSize,u.normalized)),null!==(p=this.processAccessor(b||u,s))&&(f[h]=p,t.attributes.set(this.getUID(u),p))));if(void 0!==g&&s.setAttribute("normal",g),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 T in e.morphTargetDictionary)S[e.morphTargetDictionary[T]]=T;for(var _=0;_<e.morphTargetInfluences.length;++_){var M,E={},P=!1;for(M in s.morphAttributes)if("position"!==M&&"normal"!==M)P||(console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."),P=!0);else{var O=s.morphAttributes[M][_],R=M.toUpperCase(),k=s.attributes[M];if(t.attributes.has(this.getUID(O)))E[R]=t.attributes.get(this.getUID(O));else{var A=O.clone();if(!s.morphTargetsRelative)for(var L=0,C=O.count;L<C;L++)A.setXYZ(L,O.getX(L)-k.getX(L),O.getY(L)-k.getY(L),O.getZ(L)-k.getZ(L));E[R]=this.processAccessor(A,s),t.attributes.set(this.getUID(k),E[R])}}v.push(E),x.push(e.morphTargetInfluences[_]),void 0!==e.morphTargetDictionary&&w.push(S[_])}d.weights=x,0<w.length&&(d.extras={},d.extras.targetNames=w)}if((g=Array.isArray(e.material))&&0===s.groups.length)return null;for(var D=g?e.material:[e.material],I=g?s.groups:[{materialIndex:0,start:void 0,count:void 0}],j=0,U=I.length;j<U;j++){var B={mode:l,attributes:f},z=(this.serializeUserData(s,B),0<v.length&&(B.targets=v),null!==s.index&&(z=this.getUID(s.index),void 0===I[j].start&&void 0===I[j].count||(z+=":"+I[j].start+":"+I[j].count),t.attributes.has(z)?B.indices=t.attributes.get(z):(B.indices=this.processAccessor(s.index,s,I[j].start,I[j].count),t.attributes.set(z,B.indices)),null===B.indices&&delete B.indices),this.processMaterial(D[I[j].materialIndex]));null!==z&&(B.material=z),m.push(B)}return d.primitives=m,r.meshes||(r.meshes=[]),this._invokeAll((function(t){t.writeMesh&&t.writeMesh(e,d)})),g=r.meshes.push(d)-1,t.meshes.set(a,g),g}},{key:"processCamera",value:function(e){var t=this.json,r=(t.cameras||(t.cameras=[]),e.isOrthographicCamera),n={type:r?"orthographic":"perspective"};return r?n.orthographic={xmag:2*e.right,ymag:2*e.top,zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near}:n.perspective={aspectRatio:e.aspect,yfov:c.MathUtils.degToRad(e.fov),zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near},""!==e.name&&(n.name=e.type),t.cameras.push(n)-1}},{key:"processAnimation",value:function(e,t){for(var r=this.json,n=this.nodeMap,i=(r.animations||(r.animations=[]),(e=zs.Utils.mergeMorphTargetTracks(e.clone(),t)).tracks),o=[],a=[],s=0;s<i.length;++s){var l=i[s],u=c.PropertyBinding.parseTrackName(l.name),h=c.PropertyBinding.findNode(t,u.nodeName),p=Xs[u.propertyName];if(!(h="bones"===u.objectName?!0===h.isSkinnedMesh?h.skeleton.getBoneByName(u.objectIndex):void 0:h)||!p)return console.warn('THREE.GLTFExporter: Could not export animation track "%s".',l.name),null;u=l.values.length/l.times.length;var d=void(p===Xs.morphTargetInfluences&&(u/=h.morphTargetInfluences.length));!0===l.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline?(d="CUBICSPLINE",u/=3):d=l.getInterpolation()===c.InterpolateDiscrete?"STEP":"LINEAR",a.push({input:this.processAccessor(new c.BufferAttribute(l.times,1)),output:this.processAccessor(new c.BufferAttribute(l.values,u)),interpolation:d}),o.push({sampler:a.length-1,target:{node:n.get(h),path:p}})}return r.animations.push({name:e.name||"clip_"+r.animations.length,samplers:a,channels:o}),r.animations.length-1}},{key:"processSkin",value:function(e){var t=this.json,r=this.nodeMap,n=(console.log(r,"nodeMap"),t.nodes[r.get(e)]),i=(console.log(n,e,"node"),e.skeleton);if(void 0===i)return null;var o=e.skeleton.bones[0];if(void 0===o)return null;for(var a=[],s=new Float32Array(16*i.bones.length),l=new c.Matrix4,u=0;u<i.bones.length;++u)console.log(i.bones[u],(r.get(),"(nodeMap.ge)(skeleton.bones[i])")),a.push(r.get(i.bones[u])),l.copy(i.boneInverses[u]),l.multiply(e.bindMatrix).toArray(s,16*u);return void 0===t.skins&&(t.skins=[]),t.skins.push({inverseBindMatrices:this.processAccessor(new c.BufferAttribute(s,16)),joints:a,skeleton:r.get(o)}),n.skin=t.skins.length-1}},{key:"processNode",value:function(e){var t,r,n=this.json,i=this.options,o=this.nodeMap,a=(n.nodes||(n.nodes=[]),{});if(i.myOptions.helper.parseNode({object:e,nodeDef:a,options:this}),i.trs?(r=e.quaternion.toArray(),h=e.position.toArray(),t=e.scale.toArray(),qs(r,[0,0,0,1])||(a.rotation=r),qs(h,[0,0,0])||(a.translation=h),qs(t,[1,1,1])||(a.scale=t)):(e.matrixAutoUpdate&&e.updateMatrix(),!1===qs(e.matrix.elements,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])&&(a.matrix=e.matrix.elements)),""!==e.name&&(a.name=String(e.name)),this.serializeUserData(e,a),e.isMesh||e.isLine||e.isPoints?null!==(r=this.processMesh(e))&&(a.mesh=r):e.isCamera&&(a.camera=this.processCamera(e)),e.isSkinnedMesh&&this.skins.push(e),0<e.children.length){for(var s=[],l=0,u=e.children.length;l<u;l++){var c=e.children[l];!c.visible&&!1!==i.onlyVisible||null!==(c=this.processNode(c))&&s.push(c)}0<s.length&&(a.children=s)}this._invokeAll((function(t){t.writeNode&&t.writeNode(e,a)}));var h=n.nodes.push(a)-1;return console.log(e,h,"object,nodeIndex"),o.set(e,h),h}},{key:"processScene",value:function(e){for(var t=this.json,r=this.options,n=(t.scenes||(t.scenes=[],t.scene=0),{}),i=(""!==e.name&&(n.name=e.name),t.scenes.push(n),[]),o=0,a=e.children.length;o<a;o++){var s=e.children[o];!s.visible&&!1!==r.onlyVisible||null!==(s=this.processNode(s))&&i.push(s)}0<i.length&&(n.nodes=i),this.serializeUserData(e,n)}},{key:"processObjects",value:function(e){console.log(e,"objects");var t=new c.Scene;t.name="AuxScene";for(var r=0;r<e.length;r++)t.children.push(e[r]);this.processScene(t)}},{key:"processInput",value:function(e){for(var t,r,n=this.options,i=(e=e instanceof Array?e:[e],this._invokeAll((function(t){t.beforeParse&&t.beforeParse(e)})),[]),o=0;o<e.length;o++)e[o]instanceof c.Scene?this.processScene(e[o]):i.push(e[o]);1===i.length?(t=i[0],"model"===n.myOptions.helper.type&&((r=new c.Group).name="glb_model",r.add(t),t=r),this.processScene(t)):1<i.length&&this.processObjects(i);for(var a=0;a<this.skins.length;++a)this.processSkin(this.skins[a]);for(var s=0;s<n.animations.length;++s)this.processAnimation(n.animations[s],e[0]);this._invokeAll((function(t){t.afterParse&&t.afterParse(e)}))}},{key:"_invokeAll",value:function(e){for(var t=0,r=this.plugins.length;t<r;t++)e(this.plugins[t])}}]),e}(),Js=function(){function e(t){js(this,e),this.writer=t,this.name="KHR_lights_punctual"}return Bs(e,[{key:"writeNode",value:function(e,t){var r,n,i;e.isLight&&(e.isDirectionalLight||e.isPointLight||e.isSpotLight?(r=(i=this.writer).json,i=i.extensionsUsed,n={},e.name&&(n.name=e.name),n.color=e.color.toArray(),n.intensity=e.intensity,e.isDirectionalLight?n.type="directional":e.isPointLight?(n.type="point",0<e.distance&&(n.range=e.distance)):e.isSpotLight&&(n.type="spot",0<e.distance&&(n.range=e.distance),n.spot={},n.spot.innerConeAngle=(e.penumbra-1)*e.angle*-1,n.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]||(r.extensions=r.extensions||{},r.extensions[this.name]={lights:[]},i[this.name]=!0),(i=r.extensions[this.name].lights).push(n),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}(),$s=function(){function e(t){js(this,e),this.writer=t,this.name="KHR_materials_unlit"}return Bs(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}(),el=function(){function e(t){js(this,e),this.writer=t,this.name="KHR_materials_pbrSpecularGlossiness"}return Bs(e,[{key:"writeMaterial",value:function(e,t){var r,n,i,o;e.isGLTFSpecularGlossinessMaterial&&(n=(r=this.writer).extensionsUsed,i={},t.pbrMetallicRoughness.baseColorFactor&&(i.diffuseFactor=t.pbrMetallicRoughness.baseColorFactor),e.specular.toArray(o=[1,1,1],0),i.specularFactor=o,i.glossinessFactor=e.glossiness,t.pbrMetallicRoughness.baseColorTexture&&(i.diffuseTexture=t.pbrMetallicRoughness.baseColorTexture),e.specularMap&&(o={index:r.processTexture(e.specularMap)},r.applyTextureTransform(o,e.specularMap),i.specularGlossinessTexture=o),t.extensions=t.extensions||{},t.extensions[this.name]=i,n[this.name]=!0)}}]),e}(),tl=function(){function e(t){js(this,e),this.writer=t,this.name="KHR_materials_clearcoat"}return Bs(e,[{key:"writeMaterial",value:function(e,t){var r,n,i,o;e.isMeshPhysicalMaterial&&(n=(r=this.writer).extensionsUsed,(i={}).clearcoatFactor=e.clearcoat,e.clearcoatMap&&(o={index:r.processTexture(e.clearcoatMap)},r.applyTextureTransform(o,e.clearcoatMap),i.clearcoatTexture=o),i.clearcoatRoughnessFactor=e.clearcoatRoughness,e.clearcoatRoughnessMap&&(o={index:r.processTexture(e.clearcoatRoughnessMap)},r.applyTextureTransform(o,e.clearcoatRoughnessMap),i.clearcoatRoughnessTexture=o),e.clearcoatNormalMap&&(o={index:r.processTexture(e.clearcoatNormalMap)},r.applyTextureTransform(o,e.clearcoatNormalMap),i.clearcoatNormalTexture=o),t.extensions=t.extensions||{},t.extensions[this.name]=i,n[this.name]=!0)}}]),e}(),rl=function(){function e(t){js(this,e),this.writer=t,this.name="KHR_materials_transmission"}return Bs(e,[{key:"writeMaterial",value:function(e,t){var r,n,i,o;e.isMeshPhysicalMaterial&&0!==e.transmission&&(n=(r=this.writer).extensionsUsed,(i={}).transmissionFactor=e.transmission,e.transmissionMap&&(o={index:r.processTexture(e.transmissionMap)},r.applyTextureTransform(o,e.transmissionMap),i.transmissionTexture=o),t.extensions=t.extensions||{},t.extensions[this.name]=i,n[this.name]=!0)}}]),e}(),nl=function(){function e(t){js(this,e),this.writer=t,this.name="KHR_materials_volume"}return Bs(e,[{key:"writeMaterial",value:function(e,t){var r,n,i,o;e.isMeshPhysicalMaterial&&0!==e.transmission&&(n=(r=this.writer).extensionsUsed,(i={}).thicknessFactor=e.thickness,e.thicknessMap&&(o={index:r.processTexture(e.thicknessMap)},r.applyTextureTransform(o,e.thicknessMap),i.thicknessTexture=o),i.attenuationDistance=e.attenuationDistance,i.attenuationColor=e.attenuationColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=i,n[this.name]=!0)}}]),e}(),il=(zs.Utils={insertKeyframe:function(e,t){var r,n=e.getValueSize(),i=new e.TimeBufferType(e.times.length+1),o=new e.ValueBufferType(e.values.length+n),a=e.createInterpolant(new e.ValueBufferType(n));if(0===e.times.length){i[0]=t;for(var s=0;s<n;s++)o[s]=0;r=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),o.set(a.evaluate(t),0),o.set(e.values,n),r=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),o.set(e.values,0),o.set(a.evaluate(t),e.values.length),r=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),o.set(e.values.slice(0,(l+1)*n),0),o.set(a.evaluate(t),(l+1)*n),o.set(e.values.slice((l+1)*n),(l+2)*n),r=l+1;break}}return e.times=i,e.values=o,r},mergeMorphTargetTracks:function(e,t){for(var r=[],n={},i=e.tracks,o=0;o<i.length;++o){var a=i[o],s=c.PropertyBinding.parseTrackName(a.name),l=c.PropertyBinding.findNode(t,s.nodeName);if("morphTargetInfluences"!==s.propertyName||void 0===s.propertyIndex)r.push(a);else{if(a.createInterpolant!==a.InterpolantFactoryMethodDiscrete&&a.createInterpolant!==a.InterpolantFactoryMethodLinear){if(a.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."),(a=a.clone()).setInterpolation(c.InterpolateLinear)}var u=l.morphTargetInfluences.length,h=l.morphTargetDictionary[s.propertyIndex];if(void 0===h)throw new Error("THREE.GLTFExporter: Morph target name not found: "+s.propertyIndex);var p=void 0;if(void 0===n[l.uuid]){for(var d=new((p=a.clone()).ValueBufferType)(u*p.times.length),f=0;f<p.times.length;f++)d[f*u+h]=p.values[f];p.name=(s.nodeName||"")+".morphTargetInfluences",p.values=d,n[l.uuid]=p,r.push(p)}else{var m=a.createInterpolant(new a.ValueBufferType(1));p=n[l.uuid];for(var v=0;v<p.times.length;v++)p.values[v*u+h]=m.evaluate(p.times[v]);for(var y=0;y<a.times.length;y++){var g=this.insertKeyframe(p,a.times[y]);p.values[g*u+h]=a.values[y]}}}}return e.tracks=r,e}},function(e,t,r,n){return new(r=r||Promise)((function(i,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))});class ol extends _a{constructor(){super(...arguments),this._gltf=new zs,this.options=new Ls}getArrayBuffer(e=this.runScene.sceneEx.getClear(),t="scene"){return il(this,void 0,void 0,(function*(){const r=new As({type:t,runScene:this.runScene});return yield r.init(e),e.traverse((e=>{console.log(e,"a")})),new Promise((t=>{this._gltf.parse(e,(e=>{t(e)}),{binary:!0,onlyVisible:!1,includeCustomExtensions:!0,myOptions:{helper:r,optionsEx:this.runScene.optionsEx}})}))}))}export(e){return il(this,void 0,void 0,(function*(){var t=yield this.getArrayBuffer(e);(0,Ye.downloadFile)(new Blob([t]),"scene.glb")}))}model(e){return il(this,void 0,void 0,(function*(){const t=e||this.runScene.modelEx.select;var r,n;t&&(r=t.name||t.type,n=yield this.getArrayBuffer(t.clone(),"model"),(0,Ye.downloadFile)(new Blob([n]),r+".glb"))}))}material(e){var t;return il(this,void 0,void 0,(function*(){if(r=e||(null==(t=this.runScene.modelEx.select)?void 0:t.material)){const e=as("Box");var r=(e.material=r).name||"material",n=yield this.getArrayBuffer(e,"material");(0,Ye.downloadFile)(new Blob([n]),r+".glb")}}))}scene(){return il(this,void 0,void 0,(function*(){var e=yield this.getArrayBuffer();(0,Ye.downloadFile)(new Blob([e]),"scene.glb")}))}}class al extends _a{constructor(e){super(e),this.gltf=new ol(e)}}var sl={},ll=function(e){return URL.createObjectURL(new Blob([e],{type:"text/javascript"}))},ul=function(e){return new Worker(e)};try{URL.revokeObjectURL(ll(""))}catch(wl){ll=function(e){return"data:application/javascript;charset=UTF-8,"+encodeURI(e)},ul=function(e){return new Worker(e,{type:"module"})}}for(var cl=Uint8Array,hl=Uint16Array,pl=Uint32Array,dl=new cl([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]),fl=new cl([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]),ml=new cl([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),vl=(o=function(e,t){for(var r=new hl(31),n=0;n<31;++n)r[n]=t+=1<<e[n-1];var i=new pl(r[30]);for(n=1;n<30;++n)for(var o=r[n];o<r[n+1];++o)i[o]=o-r[n]<<5|n;return[r,i]},(Hs=o(dl,2))[0]),yl=Hs[1],gl=(vl[28]=258,yl[258]=28,Gs=o(fl,0))[0],bl=Gs[1],xl=new hl(32768),wl=0;wl<32768;++wl){var Sl=(43690&wl)>>>1|(21845&wl)<<1;xl[wl]=((65280&(Sl=(61680&(Sl=(52428&Sl)>>>2|(13107&Sl)<<2))>>>4|(3855&Sl)<<4))>>>8|(255&Sl)<<8)>>>1}var Tl=function(e,t,r){for(var n=e.length,i=0,o=new hl(t);i<n;++i)++o[e[i]-1];var a=new hl(t);for(i=0;i<t;++i)a[i]=a[i-1]+o[i-1]<<1;if(r){var s=new hl(1<<t),l=15-t;for(i=0;i<n;++i)if(e[i])for(var u=i<<4|e[i],c=t-e[i],h=a[e[i]-1]++<<c,p=h|(1<<c)-1;h<=p;++h)s[xl[h]>>>l]=u}else for(s=new hl(n),i=0;i<n;++i)e[i]&&(s[i]=xl[a[e[i]-1]++]>>>15-e[i]);return s},_l=new cl(288);for(wl=0;wl<144;++wl)_l[wl]=8;for(wl=144;wl<256;++wl)_l[wl]=9;for(wl=256;wl<280;++wl)_l[wl]=7;for(wl=280;wl<288;++wl)_l[wl]=8;var Ml=new cl(32);for(wl=0;wl<32;++wl)Ml[wl]=5;function El(e){return e.ondata=function(e,t){return postMessage([e,t],[e.buffer])},function(t){return e.push(t.data[0],t.data[1])}}function Pl(e,t,r,n,i){var o,a=nu(e,n,i,(function(e,r){e?(a.terminate(),t.ondata.call(t,e)):(r[1]&&a.terminate(),t.ondata.call(t,e,r[0],r[1]))}));a.postMessage(r),t.push=function(e,r){if(o)throw"stream finished";if(!t.ondata)throw"no stream handler";a.postMessage([e,o=r],[e.buffer])},t.terminate=function(){a.terminate()}}function Ol(e,t){return fu(e,t)+4294967296*fu(e,t+4)}var Rl=Tl(_l,9,0),kl=Tl(_l,9,1),Al=Tl(Ml,5,0),Ll=Tl(Ml,5,1),Cl=function(e){for(var t=e[0],r=1;r<e.length;++r)e[r]>t&&(t=e[r]);return t},Dl=function(e,t,r){var n=t/8|0;return(e[n]|e[1+n]<<8)>>(7&t)&r},Il=function(e,t){var r=t/8|0;return(e[r]|e[1+r]<<8|e[2+r]<<16)>>(7&t)},jl=function(e){return(e/8|0)+(7&e&&1)},Ul=function(e,t,r){(null==r||r>e.length)&&(r=e.length);var n=new(e instanceof hl?hl:e instanceof pl?pl:cl)(r-(t=null==t||t<0?0:t));return n.set(e.subarray(t,r)),n},Bl=function(e,t,r){var n=e.length;if(!n||r&&!r.l&&n<5)return t||new cl(0);function i(e){var r=t.length;r<e&&((r=new cl(Math.max(2*r,e))).set(t),t=r)}var o=!t||r,a=!r||r.i,s=(r=r||{},t=t||new cl(3*n),r.f||0),l=r.p||0,u=r.b||0,c=r.l,h=r.d,p=r.m,d=r.n,f=8*n;do{if(!c){r.f=s=Dl(e,l,1);var m=Dl(e,l+1,3);if(l+=3,!m){var v=e[(M=jl(l)+4)-4]|e[M-3]<<8;if(n<(S=M+v)){if(a)throw"unexpected EOF";break}o&&i(u+v),t.set(e.subarray(M,S),u),r.b=u+=v,r.p=l=8*S;continue}if(1==m)c=kl,h=Ll,p=9,d=5;else{if(2!=m)throw"invalid block type";v=Dl(e,l,31)+257;for(var y=Dl(e,l+10,15)+4,g=v+Dl(e,l+5,31)+1,b=(l+=14,new cl(g)),x=new cl(19),w=0;w<y;++w)x[ml[w]]=Dl(e,l+3*w,7);l+=3*y;var S,T=(1<<(S=Cl(x)))-1,_=Tl(x,S,1);for(w=0;w<g;){var M,E=_[Dl(e,l,T)];if(l+=15&E,(M=E>>>4)<16)b[w++]=M;else{var P=0,O=0;for(16==M?(O=3+Dl(e,l,3),l+=2,P=b[w-1]):17==M?(O=3+Dl(e,l,7),l+=3):18==M&&(O=11+Dl(e,l,127),l+=7);O--;)b[w++]=P}}m=b.subarray(0,v);var R=b.subarray(v);p=Cl(m),d=Cl(R),c=Tl(m,p,1),h=Tl(R,d,1)}if(f<l){if(a)throw"unexpected EOF";break}}o&&i(u+131072);for(var k=(1<<p)-1,A=(1<<d)-1,L=l;;L=l){var C=(P=c[Il(e,l)&k])>>>4;if(f<(l+=15&P)){if(a)throw"unexpected EOF";break}if(!P)throw"invalid length/literal";if(C<256)t[u++]=C;else{if(256==C){L=l,c=null;break}var D,I=C-254,j=(264<C&&(D=dl[w=C-257],I=Dl(e,l,(1<<D)-1)+vl[w],l+=D),(C=h[Il(e,l)&A])>>>4);if(!C)throw"invalid distance";if(l+=15&C,R=gl[j],3<j&&(D=fl[j],R+=Il(e,l)&(1<<D)-1,l+=D),f<l){if(a)throw"unexpected EOF";break}o&&i(u+131072);for(var U=u+I;u<U;u+=4)t[u]=t[u-R],t[u+1]=t[u+1-R],t[u+2]=t[u+2-R],t[u+3]=t[u+3-R];u=U}}r.l=c,r.p=L,r.b=u,c&&(s=1,r.m=p,r.d=h,r.n=d)}while(!s);return u==t.length?t:Ul(t,0,u)},zl=function(e,t,r){var n=t/8|0;e[n]|=r<<=7&t,e[1+n]|=r>>>8},Nl=function(e,t,r){var n=t/8|0;e[n]|=r<<=7&t,e[1+n]|=r>>>8,e[2+n]|=r>>>16},Fl=function(e,t){for(var r=[],n=0;n<e.length;++n)e[n]&&r.push({s:n,f:e[n]});var i=r.length,o=r.slice();if(!i)return[Yl,0];if(1==i)return(m=new cl(r[0].s+1))[r[0].s]=1,[m,1];r.sort((function(e,t){return e.f-t.f})),r.push({s:-1,f:25001});var a=r[0],s=r[1],l=0,u=1,c=2;for(r[0]={s:-1,f:a.f+s.f,l:a,r:s};u!=i-1;)a=r[r[l].f<r[c].f?l++:c++],s=r[l!=u&&r[l].f<r[c].f?l++:c++],r[u++]={s:-1,f:a.f+s.f,l:a,r:s};var h=o[0].s;for(n=1;n<i;++n)o[n].s>h&&(h=o[n].s);var p=new hl(h+1),d=Vl(r[u-1],p,0);if(t<d){n=0;var f=0,m=d-t,v=1<<m;for(o.sort((function(e,t){return p[t.s]-p[e.s]||e.f-t.f}));n<i;++n){var y=o[n].s;if(!(p[y]>t))break;f+=v-(1<<d-p[y]),p[y]=t}for(f>>>=m;0<f;){var g=o[n].s;p[g]<t?f-=1<<t-p[g]++-1:++n}for(;0<=n&&f;--n){var b=o[n].s;p[b]==t&&(--p[b],++f)}d=t}return[new cl(p),d]},Vl=function e(t,r,n){return-1==t.s?Math.max(e(t.l,r,n+1),e(t.r,r,n+1)):r[t.s]=n},Hl=function(e){for(var t=e.length;t&&!e[--t];);for(var r=new hl(++t),n=0,i=e[0],o=1,a=function(e){r[n++]=e},s=1;s<=t;++s)if(e[s]==i&&s!=t)++o;else{if(!i&&2<o){for(;138<o;o-=138)a(32754);2<o&&(a(10<o?o-11<<5|28690:o-3<<5|12305),o=0)}else if(3<o){for(a(i),--o;6<o;o-=6)a(8304);2<o&&(a(o-3<<5|8208),o=0)}for(;o--;)a(i);o=1,i=e[s]}return[r.subarray(0,n),t]},Gl=function(e,t){for(var r=0,n=0;n<t.length;++n)r+=e[n]*t[n];return r},Wl=function(e,t,r){var n=r.length,i=jl(t+2);e[i]=255&n,e[i+1]=n>>>8,e[i+2]=255^e[i],e[i+3]=255^e[i+1];for(var o=0;o<n;++o)e[i+o+4]=r[o];return 8*(i+4+n)},Xl=function(e,t,r,n,i,o,a,s,l,u,c){zl(t,c++,r),++i[256];for(var h=(r=Fl(i,15))[0],p=(r=r[1],(d=Fl(o,15))[0]),d=d[1],f=(m=Hl(h))[0],m=m[1],v=(y=Hl(p))[0],y=y[1],g=new hl(19),b=0;b<f.length;++b)g[31&f[b]]++;for(b=0;b<v.length;++b)g[31&v[b]]++;for(var x=(w=Fl(g,7))[0],w=w[1],S=19;4<S&&!x[ml[S-1]];--S);var T,_=u+5<<3,M=Gl(i,_l)+Gl(o,Ml)+a;if(i=Gl(i,h)+Gl(o,p)+a+14+3*S+Gl(g,x)+(2*g[16]+3*g[17]+7*g[18]),_<=M&&_<=i)return Wl(t,c,e.subarray(l,l+u));if(zl(t,c,1+(i<M)),c+=2,i<M){var E=Tl(h,r,0),P=h,O=Tl(p,d,0),R=p,k=Tl(x,w,0);for(zl(t,c,m-257),zl(t,c+5,y-1),zl(t,c+10,S-4),c+=14,b=0;b<S;++b)zl(t,c+3*b,x[ml[b]]);c+=3*S;for(var A=[f,v],L=0;L<2;++L){var C=A[L];for(b=0;b<C.length;++b){var D=31&C[b];zl(t,c,k[D]),c+=x[D],15<D&&(zl(t,c,C[b]>>>5&127),c+=C[b]>>>12)}}}else E=Rl,P=_l,O=Al,R=Ml;for(b=0;b<s;++b)255<n[b]?(D=n[b]>>>18&31,Nl(t,c,E[D+257]),c+=P[D+257],7<D&&(zl(t,c,n[b]>>>23&31),c+=dl[D]),T=31&n[b],Nl(t,c,O[T]),c+=R[T],3<T&&(Nl(t,c,n[b]>>>5&8191),c+=fl[T])):(Nl(t,c,E[n[b]]),c+=P[n[b]]);return Nl(t,c,E[256]),c+P[256]},ql=new pl([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Yl=new cl(0),Zl=function(e,t,r,n,i,o){var a=e.length,s=new cl(n+a+5*(1+Math.ceil(a/7e3))+i),l=s.subarray(n,s.length-i),u=0;if(!t||a<8)for(var c=0;c<=a;c+=65535){var h=c+65535;u=h<a?Wl(l,u,e.subarray(c,h)):(l[c]=o,Wl(l,u,e.subarray(c,a)))}else{for(var p=(t=ql[t-1])>>>13,d=8191&t,f=(1<<r)-1,m=new hl(32768),v=new hl(1+f),y=Math.ceil(r/3),g=2*y,b=function(t){return(e[t]^e[t+1]<<y^e[t+2]<<g)&f},x=new pl(25e3),w=new hl(288),S=new hl(32),T=0,_=0,M=(c=0,0),E=0,P=0;c<a;++c){var O=b(c),R=32767&c,k=v[O];if(m[R]=k,v[O]=R,E<=c){var A=a-c;if((7e3<T||24576<M)&&423<A){u=Xl(e,l,0,x,w,S,_,M,P,c-P,u),M=T=_=0,P=c;for(var L=0;L<286;++L)w[L]=0;for(L=0;L<30;++L)S[L]=0}var C=2,D=0,I=d,j=R-k&32767;if(2<A&&O==b(c-j))for(var U=Math.min(p,A)-1,B=Math.min(32767,c),z=Math.min(258,A);j<=B&&--I&&R!=k;){if(e[c+C]==e[c+C-j]){for(var N=0;N<z&&e[c+N]==e[c+N-j];++N);if(C<N){if(D=j,U<(C=N))break;var F=Math.min(j,N-2),V=0;for(L=0;L<F;++L){var H=c-j+L+32768&32767,G=H-m[H]+32768&32767;V<G&&(V=G,k=H)}}}j+=(R=k)-(k=m[R])+32768&32767}D?(x[M++]=268435456|yl[C]<<18|bl[D],O=31&yl[C],A=31&bl[D],_+=dl[O]+fl[A],++w[257+O],++S[A],E=c+C,++T):(x[M++]=e[c],++w[e[c]])}}u=Xl(e,l,o,x,w,S,_,M,P,c-P,u),!o&&7&u&&(u=Wl(l,u+1,Yl))}return Ul(s,0,n+jl(u)+i)},Ql=function(){for(var e=new pl(256),t=0;t<256;++t){for(var r=t,n=9;--n;)r=(1&r&&3988292384)^r>>>1;e[t]=r}return e}(),Kl=function(){var e=-1;return{p:function(t){for(var r=e,n=0;n<t.length;++n)r=Ql[255&r^t[n]]^r>>>8;e=r},d:function(){return~e}}},Jl=function(){var e=1,t=0;return{p:function(r){for(var n=e,i=t,o=r.length,a=0;a!=o;){for(var s=Math.min(a+2655,o);a<s;++a)i+=n+=r[a];n=(65535&n)+15*(n>>16),i=(65535&i)+15*(i>>16)}e=n,t=i},d:function(){return(255&(e%=65521))<<24|e>>>8<<16|(255&(t%=65521))<<8|t>>>8}}},$l=function(e,t,r,n,i){return Zl(e,null==t.level?6:t.level,null==t.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):12+t.mem,r,n,!i)},eu=function(e,t){var r,n={};for(r in e)n[r]=e[r];for(r in t)n[r]=t[r];return n},tu=function(e,t,r){for(var n=e(),i=(e=e.toString()).slice(e.indexOf("[")+1,e.lastIndexOf("]")).replace(/ /g,"").split(","),o=0;o<n.length;++o){var a=n[o],s=i[o];if("function"==typeof a){t+=";"+s+"=";var l=a.toString();if(a.prototype)if(-1!=l.indexOf("[native code]")){var u=l.indexOf(" ",8)+1;t+=l.slice(u,l.indexOf("(",u))}else for(var c in t+=l,a.prototype)t+=";"+s+".prototype."+c+"="+a.prototype[c].toString();else t+=l}else r[s]=a}return[t,r]},ru=[],nu=function(e,t,r,n){var i;if(!ru[r]){for(var o="",a={},s=e.length-1,l=0;l<s;++l)o=(i=tu(e[l],o,a))[0],a=i[1];ru[r]=tu(e[s],o,a)}var u=eu({},ru[r][1]);return function(e,t,r,n,i){return(t=ul(sl[t]||(sl[t]=ll(e)))).onerror=function(e){return i(e.error,null)},t.onmessage=function(e){return i(null,e.data)},t.postMessage(r,n),t}(ru[r][0]+";onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage="+t.toString()+"}",r,u,function(e){var t,r=[];for(t in e)(e[t]instanceof cl||e[t]instanceof hl||e[t]instanceof pl)&&r.push((e[t]=new e[t].constructor(e[t])).buffer);return r}(u),n)},iu=function(){return[cl,hl,pl,dl,fl,ml,vl,gl,kl,Ll,xl,Tl,Cl,Dl,Il,jl,Ul,Bl,ku,cu,hu]},ou=function(){return[cl,hl,pl,dl,fl,ml,yl,bl,Rl,_l,Al,Ml,xl,ql,Yl,Tl,zl,Nl,Fl,Vl,Hl,Gl,Wl,Xl,jl,Ul,Zl,$l,Eu,cu]},au=function(){return[vu,bu,mu,Kl,Ql]},su=function(){return[yu,gu]},lu=function(){return[xu,mu,Jl]},uu=function(){return[wu]},cu=function(e){return postMessage(e,[e.buffer])},hu=function(e){return e&&e.size&&new cl(e.size)},pu=function(e,t,r,n,i,o){var a=nu(r,n,i,(function(e,t){a.terminate(),o(e,t)}));return a.postMessage([e,t],t.consume?[e.buffer]:[]),function(){a.terminate()}},du=function(e,t){return e[t]|e[t+1]<<8},fu=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},mu=function(e,t,r){for(;r;++t)e[t]=r,r>>>=8},vu=function(e,t){var r=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=t.level<2?4:9==t.level?2:0,e[9]=3,0!=t.mtime&&mu(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),r){e[3]=8;for(var n=0;n<=r.length;++n)e[n+10]=r.charCodeAt(n)}},yu=function(e){if(31!=e[0]||139!=e[1]||8!=e[2])throw"invalid gzip data";var t=e[3],r=10;4&t&&(r+=e[10]|2+(e[11]<<8));for(var n=(t>>3&1)+(t>>4&1);0<n;n-=!e[r++]);return r+(2&t)},gu=function(e){var t=e.length;return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0},bu=function(e){return 10+(e.filename&&e.filename.length+1||0)},xu=function(e,t){t=0==(t=t.level)?0:t<6?1:9==t?3:2,e[0]=120,e[1]=t<<6|(t?32-2*t:1)},wu=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"};function Su(e,t){return t||"function"!=typeof e||(t=e,e={}),this.ondata=t,e}var Tu=function(){function e(e,t){t||"function"!=typeof e||(t=e,e={}),this.ondata=t,this.o=e||{}}return e.prototype.p=function(e,t){this.ondata($l(e,this.o,0,0,!t),t)},e.prototype.push=function(e,t){if(this.d)throw"stream finished";if(!this.ondata)throw"no stream handler";this.d=t,this.p(e,t||!1)},e}(),_u=function(e,t){Pl([ou,function(){return[El,Tu]}],this,Su.call(this,e,t),(function(e){e=new Tu(e.data),onmessage=El(e)}),6)};function Mu(e,t,r){if(r||(r=t,t={}),"function"!=typeof r)throw"no callback";return pu(e,t,[ou],(function(e){return cu(Eu(e.data[0],e.data[1]))}),0,r)}function Eu(e,t){return $l(e,t||{},0,0)}var Pu=function(){function e(e){this.s={},this.p=new cl(0),this.ondata=e}return e.prototype.e=function(e){if(this.d)throw"stream finished";if(!this.ondata)throw"no stream handler";var t=this.p.length,r=new cl(t+e.length);r.set(this.p),r.set(e,t),this.p=r},e.prototype.c=function(e){this.d=this.s.i=e||!1,e=this.s.b;var t=Bl(this.p,this.o,this.s);this.ondata(Ul(t,e,this.s.b),this.d),this.o=Ul(t,this.s.b-32768),this.s.b=this.o.length,this.p=Ul(this.p,this.s.p/8|0),this.s.p&=7},e.prototype.push=function(e,t){this.e(e),this.c(t)},e}(),Ou=function(e){this.ondata=e,Pl([iu,function(){return[El,Pu]}],this,0,(function(){var e=new Pu;onmessage=El(e)}),7)};function Ru(e,t,r){if(r||(r=t,t={}),"function"!=typeof r)throw"no callback";return pu(e,t,[iu],(function(e){return cu(ku(e.data[0],hu(e.data[1])))}),1,r)}function ku(e,t){return Bl(e,t)}var Au=function(){function e(e,t){this.c=Kl(),this.l=0,this.v=1,Tu.call(this,e,t)}return e.prototype.push=function(e,t){Tu.prototype.push.call(this,e,t)},e.prototype.p=function(e,t){this.c.p(e),this.l+=e.length,e=$l(e,this.o,this.v&&bu(this.o),t&&8,!t),this.v&&(vu(e,this.o),this.v=0),t&&(mu(e,e.length-8,this.c.d()),mu(e,e.length-4,this.l)),this.ondata(e,t)},e}(),Lu=function(e,t){Pl([ou,au,function(){return[El,Tu,Au]}],this,Su.call(this,e,t),(function(e){e=new Au(e.data),onmessage=El(e)}),8)};function Cu(e,t,r){if(r||(r=t,t={}),"function"!=typeof r)throw"no callback";return pu(e,t,[ou,au,function(){return[Du]}],(function(e){return cu(Du(e.data[0],e.data[1]))}),2,r)}function Du(e,t){t=t||{};var r=Kl(),n=e.length,i=(r.p(e),e=$l(e,t,bu(t),8)).length;return vu(e,t),mu(e,i-8,r.d()),mu(e,i-4,n),e}var Iu=function(){function e(e){this.v=1,Pu.call(this,e)}return e.prototype.push=function(e,t){if(Pu.prototype.e.call(this,e),this.v){if((e=3<this.p.length?yu(this.p):4)>=this.p.length&&!t)return;this.p=this.p.subarray(e),this.v=0}if(t){if(this.p.length<8)throw"invalid gzip stream";this.p=this.p.subarray(0,-8)}Pu.prototype.c.call(this,t)},e}(),ju=function(e){this.ondata=e,Pl([iu,su,function(){return[El,Pu,Iu]}],this,0,(function(){var e=new Iu;onmessage=El(e)}),9)};function Uu(e,t,r){if(r||(r=t,t={}),"function"!=typeof r)throw"no callback";return pu(e,t,[iu,su,function(){return[Bu]}],(function(e){return cu(Bu(e.data[0]))}),3,r)}function Bu(e,t){return Bl(e.subarray(yu(e),-8),t||new cl(gu(e)))}var zu=function(){function e(e,t){this.c=Jl(),this.v=1,Tu.call(this,e,t)}return e.prototype.push=function(e,t){Tu.prototype.push.call(this,e,t)},e.prototype.p=function(e,t){this.c.p(e),e=$l(e,this.o,this.v&&2,t&&4,!t),this.v&&(xu(e,this.o),this.v=0),t&&mu(e,e.length-4,this.c.d()),this.ondata(e,t)},e}(),Nu=function(e,t){Pl([ou,lu,function(){return[El,Tu,zu]}],this,Su.call(this,e,t),(function(e){e=new zu(e.data),onmessage=El(e)}),10)};function Fu(e,t){t=t||{};var r=Jl();return r.p(e),e=$l(e,t,2,4),xu(e,t),mu(e,e.length-4,r.d()),e}var Vu=function(){function e(e){this.v=1,Pu.call(this,e)}return e.prototype.push=function(e,t){if(Pu.prototype.e.call(this,e),this.v){if(this.p.length<2&&!t)return;this.p=this.p.subarray(2),this.v=0}if(t){if(this.p.length<4)throw"invalid zlib stream";this.p=this.p.subarray(0,-4)}Pu.prototype.c.call(this,t)},e}(),Hu=function(e){this.ondata=e,Pl([iu,uu,function(){return[El,Pu,Vu]}],this,0,(function(){var e=new Vu;onmessage=El(e)}),11)};function Gu(e,t,r){if(r||(r=t,t={}),"function"!=typeof r)throw"no callback";return pu(e,t,[iu,uu,function(){return[Wu]}],(function(e){return cu(Wu(e.data[0],hu(e.data[1])))}),5,r)}function Wu(e,t){return Bl((wu(e),e.subarray(2,-4)),t)}var Xu=function(){function e(e){this.G=Iu,this.I=Pu,this.Z=Vu,this.ondata=e}return e.prototype.push=function(e,t){if(!this.ondata)throw"no stream handler";var r,n;this.s?this.s.push(e,t):(this.p&&this.p.length?((r=new cl(this.p.length+e.length)).set(this.p),r.set(e,this.p.length)):this.p=e,2<this.p.length&&((n=this).s=new(31==this.p[0]&&139==this.p[1]&&8==this.p[2]?this.G:8!=(15&this.p[0])||7<this.p[0]>>4||(this.p[0]<<8|this.p[1])%31?this.I:this.Z)((function(){n.ondata.apply(n,arguments)})),this.s.push(this.p,t),this.p=null))},e}(),qu=function(){function e(e){this.G=ju,this.I=Ou,this.Z=Hu,this.ondata=e}return e.prototype.push=function(e,t){Xu.prototype.push.call(this,e,t)},e}(),Yu=function e(t,r,n,i){for(var o in t){var a=t[o];o=r+o,a instanceof cl?n[o]=[a,i]:Array.isArray(a)?n[o]=[a[0],eu(i,a[1])]:e(a,o+"/",n,i)}},Zu="undefined"!=typeof TextEncoder&&new TextEncoder,Qu="undefined"!=typeof TextDecoder&&new TextDecoder,Ku=0;try{Qu.decode(Yl,{stream:!0}),Ku=1}catch(wl){}var Ju=function(e){for(var t="",r=0;;){var n=e[r++],i=(127<n)+(223<n)+(239<n);if(r+i>e.length)return[t,Ul(e,r-1)];i?3==i?(n=((15&n)<<18|(63&e[r++])<<12|(63&e[r++])<<6|63&e[r++])-65536,t+=String.fromCharCode(55296|n>>10,56320|1023&n)):t+=1&i?String.fromCharCode((31&n)<<6|63&e[r++]):String.fromCharCode((15&n)<<12|(63&e[r++])<<6|63&e[r++]):t+=String.fromCharCode(n)}},$u=function(){function e(e){this.ondata=e,Ku?this.t=new TextDecoder:this.p=Yl}return e.prototype.push=function(e,t){if(!this.ondata)throw"no callback";if(t=!!t,this.t){if(this.ondata(this.t.decode(e,{stream:!0}),t),t){if(this.t.decode().length)throw"invalid utf-8 data";this.t=null}}else{if(!this.p)throw"stream finished";var r=((r=new cl(this.p.length+e.length)).set(this.p),r.set(e,this.p.length),e=Ju(r))[0];if(e=e[1],t){if(e.length)throw"invalid utf-8 data";this.p=null}else this.p=e;this.ondata(r,t)}},e}(),ec=function(){function e(e){this.ondata=e}return e.prototype.push=function(e,t){if(!this.ondata)throw"no callback";if(this.d)throw"stream finished";this.ondata(tc(e),this.d=t||!1)},e}();function tc(e,t){if(t){for(var r=new cl(e.length),n=0;n<e.length;++n)r[n]=e.charCodeAt(n);return r}if(Zu)return Zu.encode(e);var i=e.length,o=new cl(e.length+(e.length>>1)),a=0,s=function(e){o[a++]=e};for(n=0;n<i;++n){a+5>o.length&&((l=new cl(a+8+(i-n<<1))).set(o),o=l);var l=e.charCodeAt(n);l<128||t?s(l):(l<2048?s(192|l>>6):(55295<l&&l<57344?(s(240|(l=65536+(1047552&l)|1023&e.charCodeAt(++n))>>18),s(128|l>>12&63)):s(224|l>>12),s(128|l>>6&63)),s(128|63&l))}return Ul(o,0,a)}function rc(e,t){if(t){for(var r="",n=0;n<e.length;n+=16384)r+=String.fromCharCode.apply(null,e.subarray(n,n+16384));return r}if(Qu)return Qu.decode(e);var i=(t=Ju(e))[0];if(t[1].length)throw"invalid utf-8 data";return i}function nc(e){return 1==e?3:e<6?2:9==e?1:0}var ic=function(e,t){return t+30+du(e,t+26)+du(e,t+28)},oc=function(e,t,r){var n=du(e,t+28),i=rc(e.subarray(t+46,t+46+n),!(2048&du(e,t+8))),o=(n=t+46+n,fu(e,t+20)),a=(o=(r=r&&4294967295==o?ac(e,n):[o,fu(e,t+24),fu(e,t+42)])[0],r[1]);return r=r[2],[du(e,t+10),o,a,i,n+du(e,t+30)+du(e,t+32),r]},ac=function(e,t){for(;1!=du(e,t);t+=4+du(e,t+2));return[Ol(e,t+12),Ol(e,t+4),Ol(e,t+20)]},sc=function(e){var t=0;if(e)for(var r in e){if(65535<(r=e[r].length))throw"extra field too long";t+=r+4}return t},lc=function(e,t,r,n,i,o,a,s){var l=n.length,u=r.extra,c=s&&s.length,h=sc(u),p=(mu(e,t,null!=a?33639248:67324752),t+=4,null!=a&&(e[t++]=20,e[t++]=r.os),e[t]=20,t+=2,e[t++]=r.flag<<1|(null==o&&8),e[t++]=i&&8,e[t++]=255&r.compression,e[t++]=r.compression>>8,i=new Date(null==r.mtime?Date.now():r.mtime)).getFullYear()-1980;if(p<0||119<p)throw"date not in range 1980-2099";if(mu(e,t,p<<25|i.getMonth()+1<<21|i.getDate()<<16|i.getHours()<<11|i.getMinutes()<<5|i.getSeconds()>>>1),t+=4,null!=o&&(mu(e,t,r.crc),mu(e,t+4,o),mu(e,t+8,r.size)),mu(e,t+12,l),mu(e,t+14,h),t+=16,null!=a&&(mu(e,t,c),mu(e,t+6,r.attrs),mu(e,t+10,a),t+=14),e.set(n,t),t+=l,h)for(var d in u){var f=u[d],m=f.length;mu(e,t,+d),mu(e,t+2,m),e.set(f,t+4),t+=4+m}return c&&(e.set(s,t),t+=c),t},uc=function(e,t,r,n,i){mu(e,t,101010256),mu(e,t+8,r),mu(e,t+10,r),mu(e,t+12,n),mu(e,t+16,i)},cc=function(){function e(e){this.filename=e,this.c=Kl(),this.size=0,this.compression=0}return e.prototype.process=function(e,t){this.ondata(null,e,t)},e.prototype.push=function(e,t){if(!this.ondata)throw"no callback - add to ZIP archive before pushing";this.c.p(e),this.size+=e.length,t&&(this.crc=this.c.d()),this.process(e,t||!1)},e}(),hc=function(){function e(e,t){var r=this;t=t||{},cc.call(this,e),this.d=new Tu(t,(function(e,t){r.ondata(null,e,t)})),this.compression=8,this.flag=nc(t.level)}return e.prototype.process=function(e,t){try{this.d.push(e,t)}catch(e){this.ondata(e,null,t)}},e.prototype.push=function(e,t){cc.prototype.push.call(this,e,t)},e}(),pc=function(){function e(e,t){var r=this;t=t||{},cc.call(this,e),this.d=new _u(t,(function(e,t,n){r.ondata(e,t,n)})),this.compression=8,this.flag=nc(t.level),this.terminate=this.d.terminate}return e.prototype.process=function(e,t){this.d.push(e,t)},e.prototype.push=function(e,t){cc.prototype.push.call(this,e,t)},e}(),dc=function(){function e(e){this.ondata=e,this.u=[],this.d=1}return e.prototype.add=function(e){var t=this;if(2&this.d)throw"stream finished";var r=tc(e.filename),n=r.length,i=(o=e.comment)&&tc(o),o=n!=e.filename.length||i&&o.length!=i.length,a=n+sc(e.extra)+30;if(65535<n)throw"filename too long";function s(){for(var e=0,r=l;e<r.length;e++){var n=r[e];t.ondata(null,n,!1)}l=[]}n=new cl(a);var l=(lc(n,0,e,r,o),[n]),u=this.d,c=(this.d=0,this.u.length),h=eu(e,{f:r,u:o,o:i,t:function(){e.terminate&&e.terminate()},r:function(){var e;s(),u&&((e=t.u[c+1])?e.r():t.d=1),u=1}}),p=0;e.ondata=function(r,n,i){r?(t.ondata(r,n,i),t.terminate()):(p+=n.length,l.push(n),i?(r=new cl(16),mu(r,0,134695760),mu(r,4,e.crc),mu(r,8,p),mu(r,12,e.size),l.push(r),h.c=p,h.b=a+p+16,h.crc=e.crc,h.size=e.size,u&&h.r(),u=1):u&&s())},this.u.push(h)},e.prototype.end=function(){var e=this;if(2&this.d){if(1&this.d)throw"stream finishing";throw"stream finished"}this.d?this.e():this.u.push({r:function(){1&e.d&&(e.u.splice(-1,1),e.e())},t:function(){}}),this.d=3},e.prototype.e=function(){for(var e=0,t=0,r=0,n=0,i=this.u;n<i.length;n++)r+=46+(l=i[n]).f.length+sc(l.extra)+(l.o?l.o.length:0);for(var o=new cl(r+22),a=0,s=this.u;a<s.length;a++){var l=s[a];lc(o,e,l,l.f,l.u,l.c,t,l.o),e+=46+l.f.length+sc(l.extra)+(l.o?l.o.length:0),t+=l.b}uc(o,e,this.u.length,r,t),this.ondata(null,o,!0),this.d=2},e.prototype.terminate=function(){for(var e=0,t=this.u;e<t.length;e++)t[e].t();this.d=2},e}(),fc=function(){function e(){}return e.prototype.push=function(e,t){this.ondata(null,e,t)},e.compression=0,e}(),mc=function(){function e(){var e=this;this.i=new Pu((function(t,r){e.ondata(null,t,r)}))}return e.prototype.push=function(e,t){try{this.i.push(e,t)}catch(r){this.ondata(r,e,t)}},e.compression=8,e}(),vc=function(){function e(e,t){var r=this;t<32e4?this.i=new Pu((function(e,t){r.ondata(null,e,t)})):(this.i=new Ou((function(e,t,n){r.ondata(e,t,n)})),this.terminate=this.i.terminate)}return e.prototype.push=function(e,t){this.i.terminate&&(e=Ul(e,0)),this.i.push(e,t)},e.compression=8,e}(),yc=function(){function e(e){this.onfile=e,this.k=[],this.o={0:fc},this.p=Yl}return e.prototype.push=function(e,t){var r=this;if(!this.onfile)throw"no callback";if(!this.p)throw"stream finished";if(0<this.c){var n=Math.min(this.c,e.length),i=e.subarray(0,n);if(this.c-=n,this.d?this.d.push(i,!this.c):this.k[0].push(i),(e=e.subarray(n)).length)return this.push(e,t)}else{for(var o=0,a=0,s=void 0,l=void 0,u=(this.p.length?e.length?((l=new cl(this.p.length+e.length)).set(this.p),l.set(e,this.p.length)):l=this.p:l=e,l.length),c=this.c,h=(i=c&&this.d,this);a<u-4&&"break"!==function(){var e,t,n,i,p,d,f,m,v,y,g,b=fu(l,a);return 67324752==b?(o=1,s=a,h.d=null,h.c=0,n=du(l,a+6),e=du(l,a+8),t=2048&n,n&=8,i=du(l,a+26),p=du(l,a+28),a+30+i+p<u&&(h.k.unshift(d=[]),o=2,f=fu(l,a+18),m=fu(l,a+22),v=rc(l.subarray(a+30,a+=30+i),!t),4294967295==f?(i=n?[-2]:ac(l,a),f=i[0],m=i[1]):n&&(f=-1),a+=p,h.c=f,g={name:v,compression:e,start:function(){if(!g.ondata)throw"no callback";if(f){var t=r.o[e];if(!t)throw"unknown compression type "+e;(y=f<0?new t(v):new t(v,f,m)).ondata=function(e,t,r){g.ondata(e,t,r)};for(var n=0,i=d;n<i.length;n++)y.push(i[n],!1);r.k[0]==d&&r.c?r.d=y:y.push(Yl,!0)}else g.ondata(null,Yl,!0)},terminate:function(){y&&y.terminate&&y.terminate()}},0<=f&&(g.size=f,g.originalSize=m),h.onfile(g)),"break"):c?134695760==b?(s=a+=12+(-2==c&&8),o=3,h.c=0,"break"):33639248==b?(s=a-=4,o=3,h.c=0,"break"):void 0:void 0}();++a);if(this.p=Yl,c<0&&(n=o?l.subarray(0,s-12-(-2==c&&8)-(134695760==fu(l,s-16)&&4)):l.subarray(0,a),i?i.push(n,!!o):this.k[+(2==o)].push(n)),2&o)return this.push(l.subarray(a),t);this.p=l.subarray(a)}if(t){if(this.c)throw"invalid zip file";this.p=null}},e.prototype.register=function(e){this.o[e.compression]=e},e}();function gc(e,t,r){var n=r.length-e-1;if(t>=r[n])return n-1;if(t<=r[e])return e;for(var i=e,o=n,a=Math.floor((i+o)/2);t<r[a]||t>=r[a+1];)t<r[a]?o=a:i=a,a=Math.floor((i+o)/2);return a}function bc(e,t,r,n){for(var i=[],o=[],a=[],s=i[0]=1;s<=r;++s){o[s]=t-n[e+1-s],a[s]=n[e+s]-t;for(var l=0,u=0;u<s;++u){var c=a[u+1],h=o[s-u],p=i[u]/(c+h);i[u]=l+c*p,l=h*p}i[s]=l}return i}function xc(e,t,r,n,i){for(var o=i<e?i:e,a=[],s=gc(e,n,t),l=function(e,t,r,n,i){for(var o=[],a=0;a<=r;++a)o[a]=0;for(var s=[],l=0;l<=n;++l)s[l]=o.slice(0);for(var u=[],c=0;c<=r;++c)u[c]=o.slice(0);u[0][0]=1;for(var h=o.slice(0),p=o.slice(0),d=1;d<=r;++d){h[d]=t-i[e+1-d],p[d]=i[e+d]-t;for(var f=0,m=0;m<d;++m){var v=p[m+1],y=h[d-m],g=(u[d][m]=v+y,u[m][d-1]/u[d][m]);u[m][d]=f+v*g,f=y*g}u[d][d]=f}for(var b=0;b<=r;++b)s[0][b]=u[b][r];for(var x=0;x<=r;++x){for(var w=0,S=1,T=[],_=0;_<=r;++_)T[_]=o.slice(0);for(var M=T[0][0]=1;M<=n;++M){var E=0,P=x-M,O=r-M;M<=x&&(T[S][0]=T[w][0]/u[1+O][P],E=T[S][0]*u[P][O]);for(var R=x-1<=O?M-1:r-x,k=-1<=P?1:-P;k<=R;++k)T[S][k]=(T[w][k]-T[w][k-1])/u[1+O][P+k],E+=T[S][k]*u[P+k][O];x<=O&&(T[S][M]=-T[w][M-1]/u[1+O][x],E+=T[S][M]*u[x][O]),s[M][x]=E;var A=w;w=S,S=A}}for(var L=r,C=1;C<=n;++C){for(var D=0;D<=r;++D)s[C][D]*=L;L*=r-C}return s}(s,n,e,o,t),u=[],h=0;h<r.length;++h){var p=r[h].clone(),d=p.w;p.x*=d,p.y*=d,p.z*=d,u[h]=p}for(var f=0;f<=o;++f){for(var m=u[s-e].clone().multiplyScalar(l[f][0]),v=1;v<=e;++v)m.add(u[s-e+v].clone().multiplyScalar(l[f][v]));a[f]=m}for(var y=o+1;y<=i+1;++y)a[y]=new c.Vector4(0,0,0);return a}function wc(e){for(var t=e.length,r=[],n=[],i=0;i<t;++i){var o=e[i];r[i]=new c.Vector3(o.x,o.y,o.z),n[i]=o.w}for(var a=[],s=0;s<t;++s){for(var l=r[s].clone(),u=1;u<=s;++u)l.sub(a[s-u].clone().multiplyScalar(function(e,t){for(var r=1,n=2;n<=e;++n)r*=n;for(var i=1,o=2;o<=t;++o)i*=o;for(var a=2;a<=e-t;++a)i*=a;return r/i}(s,u)*n[u]));a[s]=l.divideScalar(n[0])}return a}function Sc(e){return(Sc="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 Tc(e,t){return(Tc=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _c(e){return(_c=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Mc,Ec,Pc,Oc=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Tc(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=_c(e);if(r=t?(r=_c(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Sc(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(e,t,i,o,a){var s;if(!(this instanceof n))throw new TypeError("Cannot call a class as a function");(s=r.call(this)).degree=e,s.knots=t,s.controlPoints=[],s.startKnot=o||0,s.endKnot=a||s.knots.length-1;for(var l=0;l<i.length;++l){var u=i[l];s.controlPoints[l]=new c.Vector4(u.x,u.y,u.z,u.w)}return s}return t=n,(e=[{key:"getPoint",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new c.Vector3;return e=this.knots[this.startKnot]+e*(this.knots[this.endKnot]-this.knots[this.startKnot]),e=function(e,t,r,n){for(var i=gc(e,n,t),o=bc(i,n,e,t),a=new c.Vector4(0,0,0,0),s=0;s<=e;++s){var l=r[i-e+s],u=o[s],h=l.w*u;a.x+=l.x*h,a.y+=l.y*h,a.z+=l.z*h,a.w+=l.w*u}return a}(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 c.Vector3,r=(e=this.knots[0]+e*(this.knots[this.knots.length-1]-this.knots[0]),wc(xc(r=this.degree,this.knots,this.controlPoints,e,1)));return t.copy(r[1]).normalize(),t}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),n}(c.Curve);function Rc(e){return(Rc="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 kc(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ac(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Lc(e,t,r){t&&Ac(e.prototype,t),r&&Ac(e,r),Object.defineProperty(e,"prototype",{writable:!1})}function Cc(e,t){return(Cc=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Dc(e){return(Dc=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Ic=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Cc(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Dc(e);if(r=t?(r=Dc(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Rc(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(e){return kc(this,n),r.call(this,e)}return Lc(n,[{key:"load",value:function(e,t,r,n){var i=this,o=""===i.path?c.LoaderUtils.extractUrlBase(e):i.path,a=new c.FileLoader(this.manager);a.setPath(i.path),a.setResponseType("arraybuffer"),a.setRequestHeader(i.requestHeader),a.setWithCredentials(i.withCredentials),a.load(e,(function(r){try{t(i.parse(r,o))}catch(r){n?n(r):console.error(r),i.manager.itemError(e)}}),r,n)}},{key:"parse",value:function(e,t){if(n="Kaydara FBX Binary \0",(r=e).byteLength>=n.length&&n===Jc(r,0,n.length))Mc=(new Nc).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","\\","\\"],r=0,n=0;n<t.length;++n)if(function(t){var n=e[0];return e=e.slice(r+1),r++,n}()===t[n])return;return 1}(r=Jc(e)))throw new Error("THREE.FBXLoader: Unknown format.");if(Hc(r)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+Hc(r));Mc=(new zc).parse(r)}var r,n=new c.TextureLoader(this.manager).setPath(this.resourcePath||t).setCrossOrigin(this.crossOrigin);return new jc(n,this.manager).parse(Mc)}}]),n}(c.Loader),jc=function(){function e(t,r){kc(this,e),this.textureLoader=t,this.manager=r}return Lc(e,[{key:"parse",value:function(){Ec=this.parseConnections();var e=this.parseImages(),t=(e=this.parseTextures(e),e=this.parseMaterials(e),this.parseDeformers()),r=(new Uc).parse(t);return this.parseScene(t,r,e),Pc}},{key:"parseConnections",value:function(){var e=new Map;return"Connections"in Mc&&Mc.Connections.connections.forEach((function(t){var r=t[0],n=t[1],i=(t=t[2],e.has(r)||e.set(r,{parents:[],children:[]}),{ID:n,relationship:t});e.get(r).parents.push(i),e.has(n)||e.set(n,{parents:[],children:[]}),i={ID:r,relationship:t},e.get(n).children.push(i)})),e}},{key:"parseImages",value:function(){var e,t={},r={};if("Video"in Mc.Objects){var n,i=Mc.Objects.Video;for(n in i){var o,a,s=i[n];t[parseInt(n)]=s.RelativeFilename||s.Filename,"Content"in s&&(a=s.Content instanceof ArrayBuffer&&0<s.Content.byteLength,o="string"==typeof s.Content&&""!==s.Content,(a||o)&&(a=this.parseImage(i[n]),r[s.RelativeFilename||s.Filename]=a))}}for(e in t){var l=t[e];void 0!==r[l]?t[e]=r[l]:t[e]=t[e].split("\\").pop()}return t}},{key:"parseImage",value:function(e){var t,r=e.Content,n=e.RelativeFilename||e.Filename,i=n.slice(n.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 ",n),t="image/tga";break;default:return void console.warn('FBXLoader: Image type "'+i+'" is not supported.')}return"string"==typeof r?"data:"+t+";base64,"+r:(e=new Uint8Array(r),window.URL.createObjectURL(new Blob([e],{type:t})))}},{key:"parseTextures",value:function(e){var t=new Map;if("Texture"in Mc.Objects){var r,n=Mc.Objects.Texture;for(r in n){var i=this.parseTexture(n[r],e);t.set(parseInt(r),i)}}return t}},{key:"parseTexture",value:function(e,t){var r=((t=this.loadTexture(e,t)).ID=e.id,t.name=e.attrName,e.WrapModeU),n=e.WrapModeV;return r=void 0!==r?r.value:0,n=void 0!==n?n.value:0,t.wrapS=0===r?c.RepeatWrapping:c.ClampToEdgeWrapping,t.wrapT=0===n?c.RepeatWrapping:c.ClampToEdgeWrapping,"Scaling"in e&&(r=e.Scaling.value,t.repeat.x=r[0],t.repeat.y=r[1]),"Translation"in e&&(n=e.Translation.value,t.offset.x=n[0],t.offset.y=n[1]),t}},{key:"loadTexture",value:function(e,t){var r,n=this.textureLoader.path,i=Ec.get(e.id).children;return i="tga"===(void 0!==i&&0<i.length&&void 0!==t[i[0].ID]&&(0!==(r=t[i[0].ID]).indexOf("blob:")&&0!==r.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 c.Texture):(i.setPath(this.textureLoader.path),i.load(r)):"psd"===t?(console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for",e.RelativeFilename),new c.Texture):this.textureLoader.load(r),this.textureLoader.setPath(n),i}},{key:"parseMaterials",value:function(e){var t=new Map;if("Material"in Mc.Objects){var r,n=Mc.Objects.Material;for(r in n){var i=this.parseMaterial(n[r],e);null!==i&&t.set(parseInt(r),i)}}return t}},{key:"parseMaterial",value:function(e,t){var r,n=e.id,i=e.attrName,o=e.ShadingModel;if("object"===Rc(o)&&(o=o.value),!Ec.has(n))return null;switch(e=this.parseParameters(e,t,n),o.toLowerCase()){case"phong":r=new c.MeshPhongMaterial;break;case"lambert":r=new c.MeshLambertMaterial;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',o),r=new c.MeshPhongMaterial}return r.setValues(e),r.name=i,r}},{key:"parseParameters",value:function(e,t,r){var n={},i=(e.BumpFactor&&(n.bumpScale=e.BumpFactor.value),e.Diffuse?n.color=(new c.Color).fromArray(e.Diffuse.value):!e.DiffuseColor||"Color"!==e.DiffuseColor.type&&"ColorRGB"!==e.DiffuseColor.type||(n.color=(new c.Color).fromArray(e.DiffuseColor.value)),e.DisplacementFactor&&(n.displacementScale=e.DisplacementFactor.value),e.Emissive?n.emissive=(new c.Color).fromArray(e.Emissive.value):!e.EmissiveColor||"Color"!==e.EmissiveColor.type&&"ColorRGB"!==e.EmissiveColor.type||(n.emissive=(new c.Color).fromArray(e.EmissiveColor.value)),e.EmissiveFactor&&(n.emissiveIntensity=parseFloat(e.EmissiveFactor.value)),e.Opacity&&(n.opacity=parseFloat(e.Opacity.value)),n.opacity<1&&(n.transparent=!0),e.ReflectionFactor&&(n.reflectivity=e.ReflectionFactor.value),e.Shininess&&(n.shininess=e.Shininess.value),e.Specular?n.specular=(new c.Color).fromArray(e.Specular.value):e.SpecularColor&&"Color"===e.SpecularColor.type&&(n.specular=(new c.Color).fromArray(e.SpecularColor.value)),this);return Ec.get(r).children.forEach((function(e){var r=e.relationship;switch(r){case"Bump":n.bumpMap=i.getTexture(t,e.ID);break;case"Maya|TEX_ao_map":n.aoMap=i.getTexture(t,e.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":n.map=i.getTexture(t,e.ID),void 0!==n.map&&(n.map.encoding=c.sRGBEncoding);break;case"DisplacementColor":n.displacementMap=i.getTexture(t,e.ID);break;case"EmissiveColor":n.emissiveMap=i.getTexture(t,e.ID),void 0!==n.emissiveMap&&(n.emissiveMap.encoding=c.sRGBEncoding);break;case"NormalMap":case"Maya|TEX_normal_map":n.normalMap=i.getTexture(t,e.ID);break;case"ReflectionColor":n.envMap=i.getTexture(t,e.ID),void 0!==n.envMap&&(n.envMap.mapping=c.EquirectangularReflectionMapping,n.envMap.encoding=c.sRGBEncoding);break;case"SpecularColor":n.specularMap=i.getTexture(t,e.ID),void 0!==n.specularMap&&(n.specularMap.encoding=c.sRGBEncoding);break;case"TransparentColor":case"TransparencyFactor":n.alphaMap=i.getTexture(t,e.ID),n.transparent=!0;break;default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",r)}})),n}},{key:"getTexture",value:function(e,t){return"LayeredTexture"in Mc.Objects&&t in Mc.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),t=Ec.get(t).children[0].ID),e.get(t)}},{key:"parseDeformers",value:function(){var e={},t={};if("Deformer"in Mc.Objects){var r,n=Mc.Objects.Deformer;for(r in n){var i,o=n[r],a=Ec.get(parseInt(r));"Skin"===o.attrType?((i=this.parseSkeleton(a,n)).ID=r,1<a.parents.length&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),i.geometryID=a.parents[0].ID,e[r]=i):"BlendShape"===o.attrType&&((i={id:r}).rawTargets=this.parseMorphTargets(a,n),i.id=r,1<a.parents.length&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),t[r]=i)}}return{skeletons:e,morphTargets:t}}},{key:"parseSkeleton",value:function(e,t){var r=[];return e.children.forEach((function(e){var n=t[e.ID];"Cluster"===n.attrType&&(e={ID:e.ID,indices:[],weights:[],transformLink:(new c.Matrix4).fromArray(n.TransformLink.a)},"Indexes"in n&&(e.indices=n.Indexes.a,e.weights=n.Weights.a),r.push(e))})),{rawBones:r,bones:[]}}},{key:"parseMorphTargets",value:function(e,t){for(var r=[],n=0;n<e.children.length;n++){var i=e.children[n],o=t[i.ID],a={name:o.attrName,initialWeight:o.DeformPercent,id:o.id,fullWeights:o.FullWeights.a};if("BlendShapeChannel"!==o.attrType)return;a.geoID=Ec.get(parseInt(i.ID)).children.filter((function(e){return void 0===e.relationship}))[0].ID,r.push(a)}return r}},{key:"parseScene",value:function(e,t,r){Pc=new c.Group;var n=this.parseModels(e.skeletons,t,r),i=Mc.Objects.Model,o=this;n.forEach((function(e){var t=i[e.ID];o.setLookAtProperties(e,t),Ec.get(e.ID).parents.forEach((function(t){void 0!==(t=n.get(t.ID))&&t.add(e)})),null===e.parent&&Pc.add(e)})),this.bindSkeleton(e.skeletons,t,n),this.createAmbientLight(),Pc.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=Zc(e.userData.transformData),e.applyMatrix4(t),e.updateWorldMatrix())})),r=(new Bc).parse(),1===Pc.children.length&&Pc.children[0].isGroup&&(Pc.children[0].animations=r,Pc=Pc.children[0]),Pc.animations=r}},{key:"parseModels",value:function(e,t,r){var n,i=new Map,o=Mc.Objects.Model;for(n in o){var a=parseInt(n),s=o[n],l=Ec.get(a),u=this.buildSkeleton(l,e,a,s.attrName);if(!u){switch(s.attrType){case"Camera":u=this.createCamera(l);break;case"Light":u=this.createLight(l);break;case"Mesh":u=this.createMesh(l,t,r);break;case"NurbsCurve":u=this.createCurve(l,t);break;case"LimbNode":case"Root":u=new c.Bone;break;default:u=new c.Group}u.name=s.attrName?c.PropertyBinding.sanitizeNodeName(s.attrName):"",u.ID=a}this.getTransformData(u,s),i.set(a,u)}return i}},{key:"buildSkeleton",value:function(e,t,r,n){var i=null;return e.parents.forEach((function(e){for(var o in t)!function(o){var a=t[o];a.rawBones.forEach((function(t,o){var s;t.ID===e.ID&&(s=i,(i=new c.Bone).matrixWorld.copy(t.transformLink),i.name=n?c.PropertyBinding.sanitizeNodeName(n):"",i.ID=r,a.bones[o]=i,null!==s&&i.add(s))}))}(o)})),i}},{key:"createCamera",value:function(e){var t,r;if(e.children.forEach((function(e){void 0!==(e=Mc.Objects.NodeAttribute[e.ID])&&(r=e)})),void 0===r)t=new c.Object3D;else{var n=0,i=(void 0!==r.CameraProjectionType&&1===r.CameraProjectionType.value&&(n=1),1),o=(void 0!==r.NearPlane&&(i=r.NearPlane.value/1e3),1e3),a=(void 0!==r.FarPlane&&(o=r.FarPlane.value/1e3),window.innerWidth),s=window.innerHeight,l=(void 0!==r.AspectWidth&&void 0!==r.AspectHeight&&(a=r.AspectWidth.value,s=r.AspectHeight.value),a/s),u=45,h=(void 0!==r.FieldOfView&&(u=r.FieldOfView.value),r.FocalLength?r.FocalLength.value:null);switch(n){case 0:t=new c.PerspectiveCamera(u,l,i,o),null!==h&&t.setFocalLength(h);break;case 1:t=new c.OrthographicCamera(-a/2,a/2,s/2,-s/2,i,o);break;default:console.warn("THREE.FBXLoader: Unknown camera type "+n+"."),t=new c.Object3D}}return t}},{key:"createLight",value:function(e){var t,r;if(e.children.forEach((function(e){void 0!==(e=Mc.Objects.NodeAttribute[e.ID])&&(r=e)})),void 0===r)t=new c.Object3D;else{e=void 0===r.LightType?0:r.LightType.value;var n=16777215,i=(void 0!==r.Color&&(n=(new c.Color).fromArray(r.Color.value)),void 0===r.Intensity?1:r.Intensity.value/100),o=(void 0!==r.CastLightOnObject&&0===r.CastLightOnObject.value&&(i=0),0);switch(void 0!==r.FarAttenuationEnd&&(o=void 0!==r.EnableFarAttenuation&&0===r.EnableFarAttenuation.value?0:r.FarAttenuationEnd.value),e){case 0:t=new c.PointLight(n,i,o,1);break;case 1:t=new c.DirectionalLight(n,i);break;case 2:var a=Math.PI/3,s=(void 0!==r.InnerAngle&&(a=c.MathUtils.degToRad(r.InnerAngle.value)),0);void 0!==r.OuterAngle&&(s=c.MathUtils.degToRad(r.OuterAngle.value),s=Math.max(s,1)),t=new c.SpotLight(n,i,o,a,s,1);break;default:console.warn("THREE.FBXLoader: Unknown light type "+r.LightType.value+", defaulting to a PointLight."),t=new c.PointLight(n,i)}void 0!==r.CastShadows&&1===r.CastShadows.value&&(t.castShadow=!0)}return t}},{key:"createMesh",value:function(e,t,r){var n,i=null,o=null,a=[];return e.children.forEach((function(e){t.has(e.ID)&&(i=t.get(e.ID)),r.has(e.ID)&&a.push(r.get(e.ID))})),1<a.length?o=a:0<a.length?o=a[0]:(o=new c.MeshPhongMaterial({color:13421772}),a.push(o)),"color"in i.attributes&&a.forEach((function(e){e.vertexColors=!0})),i.FBX_Deformer?(n=new c.SkinnedMesh(i,o)).normalizeSkinWeights():n=new c.Mesh(i,o),n}},{key:"createCurve",value:function(e,t){e=e.children.reduce((function(e,r){return t.has(r.ID)?t.get(r.ID):e}),null);var r=new c.LineBasicMaterial({color:3342591,linewidth:1});return new c.Line(e,r)}},{key:"getTransformData",value:function(e,t){var r={};"InheritType"in t&&(r.inheritType=parseInt(t.InheritType.value)),r.eulerOrder="RotationOrder"in t?Qc(t.RotationOrder.value):"ZYX","Lcl_Translation"in t&&(r.translation=t.Lcl_Translation.value),"PreRotation"in t&&(r.preRotation=t.PreRotation.value),"Lcl_Rotation"in t&&(r.rotation=t.Lcl_Rotation.value),"PostRotation"in t&&(r.postRotation=t.PostRotation.value),"Lcl_Scaling"in t&&(r.scale=t.Lcl_Scaling.value),"ScalingOffset"in t&&(r.scalingOffset=t.ScalingOffset.value),"ScalingPivot"in t&&(r.scalingPivot=t.ScalingPivot.value),"RotationOffset"in t&&(r.rotationOffset=t.RotationOffset.value),"RotationPivot"in t&&(r.rotationPivot=t.RotationPivot.value),e.userData.transformData=r}},{key:"setLookAtProperties",value:function(e,t){"LookAtProperty"in t&&Ec.get(e.ID).children.forEach((function(t){"LookAtProperty"===t.relationship&&"Lcl_Translation"in(t=Mc.Objects.Model[t.ID])&&(t=t.Lcl_Translation.value,void 0!==e.target?(e.target.position.fromArray(t),Pc.add(e.target)):e.lookAt((new c.Vector3).fromArray(t)))}))}},{key:"bindSkeleton",value:function(e,t,r){var n,i=this.parsePoseNodes();for(n in e)!function(n){var o=e[n];Ec.get(parseInt(o.ID)).parents.forEach((function(e){t.has(e.ID)&&(e=e.ID,Ec.get(e).parents.forEach((function(e){r.has(e.ID)&&r.get(e.ID).bind(new c.Skeleton(o.bones),i[e.ID])})))}))}(n)}},{key:"parsePoseNodes",value:function(){var e={};if("Pose"in Mc.Objects){var t,r,n=Mc.Objects.Pose;for(t in n)"BindPose"===n[t].attrType&&0<n[t].NbPoseNodes&&(r=n[t].PoseNode,Array.isArray(r)?r.forEach((function(t){e[t.Node]=(new c.Matrix4).fromArray(t.Matrix.a)})):e[r.Node]=(new c.Matrix4).fromArray(r.Matrix.a))}return e}},{key:"createAmbientLight",value:function(){var e,t,r;"GlobalSettings"in Mc&&"AmbientColor"in Mc.GlobalSettings&&(r=(t=Mc.GlobalSettings.AmbientColor.value)[0],e=t[1],t=t[2],0===r&&0===e&&0===t||(r=new c.Color(r,e,t),Pc.add(new c.AmbientLight(r,1))))}}]),e}(),Uc=function(){function e(){kc(this,e)}return Lc(e,[{key:"parse",value:function(e){var t=new Map;if("Geometry"in Mc.Objects){var r,n=Mc.Objects.Geometry;for(r in n){var i=Ec.get(parseInt(r));i=this.parseGeometry(i,n[r],e),t.set(parseInt(r),i)}}return t}},{key:"parseGeometry",value:function(e,t,r){switch(t.attrType){case"Mesh":return this.parseMeshGeometry(e,t,r);case"NurbsCurve":return this.parseNurbsGeometry(t)}}},{key:"parseMeshGeometry",value:function(e,t,r){var n,i=r.skeletons,o=[],a=e.parents.map((function(e){return Mc.Objects.Model[e.ID]}));if(0!==a.length)return n=e.children.reduce((function(e,t){return void 0!==i[t.ID]?i[t.ID]:e}),null),e.children.forEach((function(e){void 0!==r.morphTargets[e.ID]&&o.push(r.morphTargets[e.ID])})),e=a[0],a={},"RotationOrder"in e&&(a.eulerOrder=Qc(e.RotationOrder.value)),"InheritType"in e&&(a.inheritType=parseInt(e.InheritType.value)),"GeometricTranslation"in e&&(a.translation=e.GeometricTranslation.value),"GeometricRotation"in e&&(a.rotation=e.GeometricRotation.value),"GeometricScaling"in e&&(a.scale=e.GeometricScaling.value),e=Zc(a),this.genGeometry(t,n,o,e)}},{key:"genGeometry",value:function(e,t,r,n){var i,o,a=new c.BufferGeometry,s=(e.attrName&&(a.name=e.attrName),this.parseGeoNode(e,t)),l=this.genBuffers(s),u=new c.Float32BufferAttribute(l.vertex,3);return u.applyMatrix4(n),a.setAttribute("position",u),0<l.colors.length&&a.setAttribute("color",new c.Float32BufferAttribute(l.colors,3)),t&&(a.setAttribute("skinIndex",new c.Uint16BufferAttribute(l.weightsIndices,4)),a.setAttribute("skinWeight",new c.Float32BufferAttribute(l.vertexWeights,4)),a.FBX_Deformer=t),0<l.normal.length&&(u=(new c.Matrix3).getNormalMatrix(n),(t=new c.Float32BufferAttribute(l.normal,3)).applyNormalMatrix(u),a.setAttribute("normal",t)),l.uvs.forEach((function(e,t){var r="uv"+(t+1).toString();a.setAttribute(r=0===t?"uv":r,new c.Float32BufferAttribute(l.uvs[t],2))})),s.material&&"AllSame"!==s.material.mappingType&&(i=l.materialIndex[0],o=0,l.materialIndex.forEach((function(e,t){e!==i&&(a.addGroup(o,t-o,i),i=e,o=t)})),0<a.groups.length&&(t=(u=a.groups[a.groups.length-1]).start+u.count)!==l.materialIndex.length&&a.addGroup(t,l.materialIndex.length-t,i),0===a.groups.length&&a.addGroup(0,l.materialIndex.length,l.materialIndex[0])),this.addMorphTargets(a,e,r,n),a}},{key:"parseGeoNode",value:function(e,t){var r={};if(r.vertexPositions=void 0!==e.Vertices?e.Vertices.a:[],r.vertexIndices=void 0!==e.PolygonVertexIndex?e.PolygonVertexIndex.a:[],e.LayerElementColor&&(r.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&&(r.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&&(r.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){r.uv=[];for(var n=0;e.LayerElementUV[n];)e.LayerElementUV[n].UV&&r.uv.push(this.parseUVs(e.LayerElementUV[n])),n++}return r.weightTable={},null!==t&&(r.skeleton=t).rawBones.forEach((function(e,t){e.indices.forEach((function(n,i){void 0===r.weightTable[n]&&(r.weightTable[n]=[]),r.weightTable[n].push({id:t,weight:e.weights[i]})}))})),r}},{key:"genBuffers",value:function(e){var t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]},r=0,n=0,i=!1,o=[],a=[],s=[],l=[],u=[],c=[],h=this;return e.vertexIndices.forEach((function(p,d){var f,m,v,y,g=!1,b=(p<0&&(p^=-1,g=!0),[]),x=[];if(o.push(3*p,3*p+1,3*p+2),e.color&&(y=Xc(d,r,p,e.color),s.push(y[0],y[1],y[2])),e.skeleton){for(void 0!==e.weightTable[p]&&e.weightTable[p].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],v=[0,0,0,0],x.forEach((function(e,t){var r=e,n=b[t];v.forEach((function(e,t,i){e<r&&(i[t]=r,r=e,i=m[t],m[t]=n,n=i)}))})),b=m,x=v);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&&(y=Xc(d,r,p,e.normal),a.push(y[0],y[1],y[2])),e.material&&"AllSame"!==e.material.mappingType&&(f=Xc(d,r,p,e.material)[0]),e.uv&&e.uv.forEach((function(e,t){e=Xc(d,r,p,e),void 0===l[t]&&(l[t]=[]),l[t].push(e[0]),l[t].push(e[1])})),n++,g&&(h.genFace(t,e,o,f,a,s,l,u,c,n),r++,n=0,o=[],a=[],s=[],l=[],u=[],c=[])})),t}},{key:"genFace",value:function(e,t,r,n,i,o,a,s,l,u){for(var c=2;c<u;c++)!function(u){e.vertex.push(t.vertexPositions[r[0]]),e.vertex.push(t.vertexPositions[r[1]]),e.vertex.push(t.vertexPositions[r[2]]),e.vertex.push(t.vertexPositions[r[3*(u-1)]]),e.vertex.push(t.vertexPositions[r[3*(u-1)+1]]),e.vertex.push(t.vertexPositions[r[3*(u-1)+2]]),e.vertex.push(t.vertexPositions[r[3*u]]),e.vertex.push(t.vertexPositions[r[3*u+1]]),e.vertex.push(t.vertexPositions[r[3*u+2]]),t.skeleton&&(e.vertexWeights.push(s[0]),e.vertexWeights.push(s[1]),e.vertexWeights.push(s[2]),e.vertexWeights.push(s[3]),e.vertexWeights.push(s[4*(u-1)]),e.vertexWeights.push(s[4*(u-1)+1]),e.vertexWeights.push(s[4*(u-1)+2]),e.vertexWeights.push(s[4*(u-1)+3]),e.vertexWeights.push(s[4*u]),e.vertexWeights.push(s[4*u+1]),e.vertexWeights.push(s[4*u+2]),e.vertexWeights.push(s[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(o[0]),e.colors.push(o[1]),e.colors.push(o[2]),e.colors.push(o[3*(u-1)]),e.colors.push(o[3*(u-1)+1]),e.colors.push(o[3*(u-1)+2]),e.colors.push(o[3*u]),e.colors.push(o[3*u+1]),e.colors.push(o[3*u+2])),t.material&&"AllSame"!==t.material.mappingType&&(e.materialIndex.push(n),e.materialIndex.push(n),e.materialIndex.push(n)),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,r){void 0===e.uvs[r]&&(e.uvs[r]=[]),e.uvs[r].push(a[r][0]),e.uvs[r].push(a[r][1]),e.uvs[r].push(a[r][2*(u-1)]),e.uvs[r].push(a[r][2*(u-1)+1]),e.uvs[r].push(a[r][2*u]),e.uvs[r].push(a[r][2*u+1])}))}(c)}},{key:"addMorphTargets",value:function(e,t,r,n){var i;0!==r.length&&(e.morphTargetsRelative=!0,e.morphAttributes.position=[],i=this,r.forEach((function(r){r.rawTargets.forEach((function(r){var o=Mc.Objects.Geometry[r.geoID];void 0!==o&&i.genMorphGeometry(e,t,o,n,r.name)}))})))}},{key:"genMorphGeometry",value:function(e,t,r,n,i){t=void 0!==t.PolygonVertexIndex?t.PolygonVertexIndex.a:[];for(var o=void 0!==r.Vertices?r.Vertices.a:[],a=void 0!==r.Indexes?r.Indexes.a:[],s=3*e.attributes.position.count,l=new Float32Array(s),u=0;u<a.length;u++){var h=3*a[u];l[h]=o[3*u],l[1+h]=o[3*u+1],l[2+h]=o[3*u+2]}s=this.genBuffers({vertexIndices:t,vertexPositions:l}),(t=new c.Float32BufferAttribute(s.vertex,3)).name=i||r.attrName,t.applyMatrix4(n),e.morphAttributes.position.push(t)}},{key:"parseNormals",value:function(e){var t=e.MappingInformationType,r=e.ReferenceInformationType,n=e.Normals.a,i=[];return"IndexToDirect"===r&&("NormalIndex"in e?i=e.NormalIndex.a:"NormalsIndex"in e&&(i=e.NormalsIndex.a)),{dataSize:3,buffer:n,indices:i,mappingType:t,referenceType:r}}},{key:"parseUVs",value:function(e){var t=e.MappingInformationType,r=e.ReferenceInformationType,n=[];return{dataSize:2,buffer:e.UV.a,indices:n="IndexToDirect"===r?e.UVIndex.a:n,mappingType:t,referenceType:r}}},{key:"parseVertexColors",value:function(e){var t=e.MappingInformationType,r=e.ReferenceInformationType,n=[];return{dataSize:4,buffer:e.Colors.a,indices:n="IndexToDirect"===r?e.ColorIndex.a:n,mappingType:t,referenceType:r}}},{key:"parseMaterialIndices",value:function(e){var t=e.MappingInformationType,r=e.ReferenceInformationType;if("NoMappingInformation"===t)return{dataSize:1,buffer:[0],indices:[0],mappingType:"AllSame",referenceType:r};for(var n=e.Materials.a,i=[],o=0;o<n.length;++o)i.push(o);return{dataSize:1,buffer:n,indices:i,mappingType:t,referenceType:r}}},{key:"parseNurbsGeometry",value:function(e){if(void 0===Oc)return console.error("THREE.FBXLoader: The loader relies on NURBSCurve for any nurbs present in the model. Nurbs will show up as empty geometry."),new c.BufferGeometry;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 c.BufferGeometry;for(var r=t-1,n=(t=e.KnotVector.a,[]),i=e.Points.a,o=0,a=i.length;o<a;o+=4)n.push((new c.Vector4).fromArray(i,o));if("Closed"===e.Form)n.push(n[0]);else if("Periodic"===e.Form)for(var s=r,l=t.length-1-s,u=0;u<r;++u)n.push(n[u]);return e=new Oc(r,t,n,s,l).getPoints(12*n.length),(new c.BufferGeometry).setFromPoints(e)}}]),e}(),Bc=function(){function e(){kc(this,e)}return Lc(e,[{key:"parse",value:function(){var e=[],t=this.parseClips();if(void 0!==t)for(var r in t)r=t[r],r=this.addClip(r),e.push(r);return e}},{key:"parseClips",value:function(){var e;if(void 0!==Mc.Objects.AnimationCurve)return e=this.parseAnimationCurveNodes(),this.parseAnimationCurves(e),e=this.parseAnimationLayers(e),this.parseAnimStacks(e)}},{key:"parseAnimationCurveNodes",value:function(){var e,t=Mc.Objects.AnimationCurveNode,r=new Map;for(e in t){var n=t[e];null!==n.attrName.match(/S|R|T|DeformPercent/)&&(n={id:n.id,attr:n.attrName,curves:{}},r.set(n.id,n))}return r}},{key:"parseAnimationCurves",value:function(e){var t,r=Mc.Objects.AnimationCurve;for(t in r){var n,i={id:r[t].id,times:r[t].KeyTime.a.map(Gc),values:r[t].KeyValueFloat.a},o=Ec.get(i.id);void 0!==o&&(n=o.parents[0].ID,(o=o.parents[0].relationship).match(/X/)?e.get(n).curves.x=i:o.match(/Y/)?e.get(n).curves.y=i:o.match(/Z/)?e.get(n).curves.z=i:o.match(/d|DeformPercent/)&&e.has(n)&&(e.get(n).curves.morph=i))}}},{key:"parseAnimationLayers",value:function(e){var t,r=Mc.Objects.AnimationLayer,n=new Map;for(t in r)!function(t){var r=[],i=Ec.get(parseInt(t));void 0!==i&&(i.children.forEach((function(t,n){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===r[n]){var o=Ec.get(t.ID).parents.filter((function(e){return void 0!==e.relationship}))[0].ID;if(void 0!==o){var a=Mc.Objects.Model[o.toString()];if(void 0===a)return void console.warn("THREE.FBXLoader: Encountered a unused curve.",t);var s={modelName:a.attrName?c.PropertyBinding.sanitizeNodeName(a.attrName):"",ID:a.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1]};Pc.traverse((function(e){e.ID===a.id&&(s.transform=e.matrix,e.userData.transformData&&(s.eulerOrder=e.userData.transformData.eulerOrder))})),s.transform||(s.transform=new c.Matrix4),"PreRotation"in a&&(s.preRotation=a.PreRotation.value),"PostRotation"in a&&(s.postRotation=a.PostRotation.value),r[n]=s}}r[n]&&(r[n][i.attr]=i)}else void 0!==i.curves.morph&&(void 0===r[n]&&(o=Ec.get(t.ID).parents.filter((function(e){return void 0!==e.relationship}))[0].ID,t=Ec.get(o).parents[0].ID,t=Ec.get(t).parents[0].ID,t=Ec.get(t).parents[0].ID,t={modelName:(t=Mc.Objects.Model[t]).attrName?c.PropertyBinding.sanitizeNodeName(t.attrName):"",morphName:Mc.Objects.Deformer[o].attrName},r[n]=t),r[n][i.attr]=i)}})),n.set(parseInt(t),r))}(t);return n}},{key:"parseAnimStacks",value:function(e){var t,r=Mc.Objects.AnimationStack,n={};for(t in r){var i=(1<(i=Ec.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));n[t]={name:r[t].attrName,layer:i}}return n}},{key:"addClip",value:function(e){var t=[],r=this;return e.layer.forEach((function(e){t=t.concat(r.generateTracks(e))})),new c.AnimationClip(e.name,-1,t)}},{key:"generateTracks",value:function(e){var t=[],r=new c.Vector3,n=new c.Quaternion,i=new c.Vector3;return e.transform&&e.transform.decompose(r,n,i),r=r.toArray(),n=(new c.Euler).setFromQuaternion(n,e.eulerOrder).toArray(),i=i.toArray(),void 0!==e.T&&0<Object.keys(e.T.curves).length&&void 0!==(r=this.generateVectorTrack(e.modelName,e.T.curves,r,"position"))&&t.push(r),void 0!==e.R&&0<Object.keys(e.R.curves).length&&void 0!==(r=this.generateRotationTrack(e.modelName,e.R.curves,n,e.preRotation,e.postRotation,e.eulerOrder))&&t.push(r),void 0!==e.S&&0<Object.keys(e.S.curves).length&&void 0!==(n=this.generateVectorTrack(e.modelName,e.S.curves,i,"scale"))&&t.push(n),void 0!==e.DeformPercent&&void 0!==(r=this.generateMorphTrack(e))&&t.push(r),t}},{key:"generateVectorTrack",value:function(e,t,r,n){var i=this.getTimesForAllAxes(t);return t=this.getKeyframeTrackValues(i,t,r),new c.VectorKeyframeTrack(e+"."+n,i,t)}},{key:"generateRotationTrack",value:function(e,t,r,n,i,o){void 0!==t.x&&(this.interpolateRotations(t.x),t.x.values=t.x.values.map(c.MathUtils.degToRad)),void 0!==t.y&&(this.interpolateRotations(t.y),t.y.values=t.y.values.map(c.MathUtils.degToRad)),void 0!==t.z&&(this.interpolateRotations(t.z),t.z.values=t.z.values.map(c.MathUtils.degToRad));for(var a=this.getTimesForAllAxes(t),s=this.getKeyframeTrackValues(a,t,r),l=(void 0!==n&&((n=n.map(c.MathUtils.degToRad)).push(o),n=(new c.Euler).fromArray(n),n=(new c.Quaternion).setFromEuler(n)),void 0!==i&&((i=i.map(c.MathUtils.degToRad)).push(o),i=(new c.Euler).fromArray(i),i=(new c.Quaternion).setFromEuler(i).invert()),new c.Quaternion),u=new c.Euler,h=[],p=0;p<s.length;p+=3)u.set(s[p],s[p+1],s[p+2],o),l.setFromEuler(u),void 0!==n&&l.premultiply(n),void 0!==i&&l.multiply(i),l.toArray(h,p/3*4);return new c.QuaternionKeyframeTrack(e+".quaternion",a,h)}},{key:"generateMorphTrack",value:function(e){var t=e.DeformPercent.curves.morph,r=t.values.map((function(e){return e/100})),n=Pc.getObjectByName(e.modelName).morphTargetDictionary[e.morphName];return new c.NumberKeyframeTrack(e.modelName+".morphTargetInfluences["+n+"]",t.times,r)}},{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 r=1,n=t[0],i=1;i<t.length;i++){var o=t[i];o!==n&&(n=t[r]=o,r++)}t=t.slice(0,r)}return t}},{key:"getKeyframeTrackValues",value:function(e,t,r){var n=r,i=[],o=-1,a=-1,s=-1;return e.forEach((function(e){t.x&&(o=t.x.times.indexOf(e)),t.y&&(a=t.y.times.indexOf(e)),t.z&&(s=t.z.times.indexOf(e)),-1!==o?(e=t.x.values[o],i.push(e),n[0]=e):i.push(n[0]),-1!==a?(e=t.y.values[a],i.push(e),n[1]=e):i.push(n[1]),-1!==s?(e=t.z.values[s],i.push(e),n[2]=e):i.push(n[2])})),i}},{key:"interpolateRotations",value:function(e){for(var t=1;t<e.values.length;t++){var r=e.values[t-1],n=e.values[t]-r;if(180<=(i=Math.abs(n))){for(var i,o=n/(i/=180),a=r+o,s=(n=e.times[t-1],(e.times[t]-n)/i),l=n+s,u=[],c=[];l<e.times[t];)u.push(l),l+=s,c.push(a),a+=o;e.times=$c(e.times,t,u),e.values=$c(e.values,t,c)}}}}]),e}(),zc=function(){function e(){kc(this,e)}return Lc(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 Vc,this.nodeStack=[],this.currentProp=[],this.currentPropName="";var t=this,r=e.split(/[\r\n]+/);return r.forEach((function(e,n){var i,o=e.match(/^[\s\t]*;/),a=e.match(/^[\s\t]*$/);o||a||(o=e.match("^\\t{"+t.currentIndent+"}(\\w+):(.*){",""),a=e.match("^\\t{"+t.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),i=e.match("^\\t{"+(t.currentIndent-1)+"}}"),o?t.parseNodeBegin(e,o):a?t.parseNodeProperty(e,a,r[++n]):i?t.popStack():e.match(/^[^\s\t}]/)&&t.parseNodePropertyContinued(e))})),this.allNodes}},{key:"parseNodeBegin",value:function(e,t){var r=t[1].trim().replace(/^"/,"").replace(/"$/,""),n=(t=t[2].split(",").map((function(e){return e.trim().replace(/^"/,"").replace(/"$/,"")})),{name:r}),i=(t=this.parseNodeAttr(t),this.getCurrentNode());0===this.currentIndent?this.allNodes.add(r,n):r in i?("PoseNode"===r?i.PoseNode.push(n):void 0!==i[r].id&&(i[r]={},i[r][i[r].id]=i[r]),""!==t.id&&(i[r][t.id]=n)):"number"==typeof t.id?(i[r]={},i[r][t.id]=n):"Properties70"!==r&&(i[r]="PoseNode"===r?[n]:n),"number"==typeof t.id&&(n.id=t.id),""!==t.name&&(n.attrName=t.name),""!==t.type&&(n.attrType=t.type),this.pushStack(n)}},{key:"parseNodeAttr",value:function(e){var t=e[0],r=(""!==e[0]&&(t=parseInt(e[0]),isNaN(t)&&(t=e[0])),""),n="";return 1<e.length&&(r=e[1].replace(/^(\w+)::/,""),n=e[2]),{id:t,name:r,type:n}}},{key:"parseNodeProperty",value:function(e,t,r){var n=t[1].replace(/^"/,"").replace(/"$/,"").trim();if(t=t[2].replace(/^"/,"").replace(/"$/,"").trim(),"Properties70"===("Content"===n&&","===t&&(t=r.replace(/"/g,"").replace(/,$/,"").trim()),r=this.getCurrentNode()).name)this.parseNodeSpecialProperty(e,n,t);else{if("C"===n){e=t.split(",").slice(1);for(var i=parseInt(e[0]),o=(e=parseInt(e[1]),(o=t.split(",").slice(3)).map((function(e){return e.trim().replace(/^"/,"")}))),a=(n="connections",t=[i,e]),s=o,l=0,u=a.length,c=s.length;l<c;l++,u++)a[u]=s[l];void 0===r[n]&&(r[n]=[])}"Node"===n&&(r.id=t),n in r&&Array.isArray(r[n])?r[n].push(t):"a"!==n?r[n]=t:r.a=t,this.setCurrentProp(r,n),"a"===n&&","!==t.slice(-1)&&(r.a=Kc(t))}}},{key:"parseNodePropertyContinued",value:function(e){var t=this.getCurrentNode();t.a+=e,","!==e.slice(-1)&&(t.a=Kc(t.a))}},{key:"parseNodeSpecialProperty",value:function(e,t,r){r=r.split('",').map((function(e){return e.trim().replace(/^\"/,"").replace(/\s/,"_")}));var n=r[0],i=r[1],o=r[2],a=r[3],s=r[4];switch(i){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":s=parseFloat(s);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":s=Kc(s)}this.getPrevNode()[n]={type:i,type2:o,flag:a,value:s},this.setCurrentProp(this.getPrevNode(),n)}}]),e}(),Nc=function(){function e(){kc(this,e)}return Lc(e,[{key:"parse",value:function(e){var t=new Fc(e),r=(t.skip(23),t.getUint32());if(r<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+r);for(var n=new Vc;!this.endOfContent(t);){var i=this.parseNode(t,r);null!==i&&n.add(i.name,i)}return n}},{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 r={},n=7500<=t?e.getUint64():e.getUint32(),i=7500<=t?e.getUint64():e.getUint32(),o=(7500<=t?e.getUint64():e.getUint32(),e.getUint8()),a=e.getString(o);if(0===n)return null;for(var s=[],l=0;l<i;l++)s.push(this.parseProperty(e));o=0<s.length?s[0]:"";var u=1<s.length?s[1]:"",c=2<s.length?s[2]:"";for(r.singleProperty=1===i&&e.getOffset()===n;n>e.getOffset();){var h=this.parseNode(e,t);null!==h&&this.parseSubNode(a,r,h)}return r.propertyList=s,"number"==typeof o&&(r.id=o),""!==u&&(r.attrName=u),""!==c&&(r.attrType=c),""!==a&&(r.name=a),r}},{key:"parseSubNode",value:function(e,t,r){var n,i,o,a,s;!0===r.singleProperty?(i=r.propertyList[0],Array.isArray(i)?(t[r.name]=r).a=i:t[r.name]=i):"Connections"===e&&"C"===r.name?(n=[],r.propertyList.forEach((function(e,t){0!==t&&n.push(e)})),void 0===t.connections&&(t.connections=[]),t.connections.push(n)):"Properties70"===r.name?Object.keys(r).forEach((function(e){t[e]=r[e]})):"Properties70"===e&&"P"===r.name?(i=r.propertyList[0],e=r.propertyList[1],o=r.propertyList[2],a=r.propertyList[3],0===i.indexOf("Lcl ")&&(i=i.replace("Lcl ","Lcl_")),s="Color"===(e=0===e.indexOf("Lcl ")?e.replace("Lcl ","Lcl_"):e)||"ColorRGB"===e||"Vector"===e||"Vector3D"===e||0===e.indexOf("Lcl_")?[r.propertyList[4],r.propertyList[5],r.propertyList[6]]:r.propertyList[4],t[i]={type:e,type2:o,flag:a,value:s}):void 0===t[r.name]?"number"==typeof r.id?(t[r.name]={},t[r.name][r.id]=r):t[r.name]=r:"PoseNode"===r.name?(Array.isArray(t[r.name])||(t[r.name]=[t[r.name]]),t[r.name].push(r)):void 0===t[r.name][r.id]&&(t[r.name][r.id]=r)}},{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 n=e.getUint32(),e.getArrayBuffer(n);case"S":return n=e.getUint32(),e.getString(n);case"Y":return e.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":var r=e.getUint32(),n=e.getUint32(),o=e.getUint32();if(0===n)switch(t){case"b":case"c":return e.getBooleanArray(r);case"d":return e.getFloat64Array(r);case"f":return e.getFloat32Array(r);case"i":return e.getInt32Array(r);case"l":return e.getInt64Array(r)}void 0===i&&console.error("THREE.FBXLoader: External library fflate.min.js required."),n=Wu(new Uint8Array(e.getArrayBuffer(o)));var a=new Fc(n.buffer);switch(t){case"b":case"c":return a.getBooleanArray(r);case"d":return a.getFloat64Array(r);case"f":return a.getFloat32Array(r);case"i":return a.getInt32Array(r);case"l":return a.getInt64Array(r)}default:throw new Error("THREE.FBXLoader: Unknown property type "+t)}}}]),e}(),Fc=function(){function e(t,r){kc(this,e),this.dv=new DataView(t),this.offset=0,this.littleEndian=void 0===r||r}return Lc(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=[],r=0;r<e;r++)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=[],r=0;r<e;r++)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=[],r=0;r<e;r++)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=[],r=0;r<e;r++)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=[],r=0;r<e;r++)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){for(var t=[],r=0;r<e;r++)t[r]=this.getUint8();var n=t.indexOf(0);return 0<=n&&(t=t.slice(0,n)),c.LoaderUtils.decodeText(new Uint8Array(t))}}]),e}(),Vc=function(){function e(){kc(this,e)}return Lc(e,[{key:"add",value:function(e,t){this[e]=t}}]),e}();function Hc(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 Gc(e){return e/46186158e3}var Wc=[];function Xc(e,t,r,n){var i;switch(n.mappingType){case"ByPolygonVertex":i=e;break;case"ByPolygon":i=t;break;case"ByVertice":i=r;break;case"AllSame":i=n.indices[0];break;default:console.warn("THREE.FBXLoader: unknown attribute mapping type "+n.mappingType)}for(var o=(i="IndexToDirect"===n.referenceType?n.indices[i]:i)*n.dataSize,a=o+n.dataSize,s=Wc,l=n.buffer,u=a,c=o,h=0;c<u;c++,h++)s[h]=l[c];return s}var qc=new c.Euler,Yc=new c.Vector3;function Zc(e){var t=new c.Matrix4,r=new c.Matrix4,n=new c.Matrix4,i=new c.Matrix4,o=new c.Matrix4,a=new c.Matrix4,s=new c.Matrix4,l=new c.Matrix4,u=new c.Matrix4,h=new c.Matrix4,p=new c.Matrix4,d=new c.Matrix4,f=e.inheritType||0,m=(e.translation&&t.setPosition(Yc.fromArray(e.translation)),e.preRotation&&((m=e.preRotation.map(c.MathUtils.degToRad)).push(e.eulerOrder),r.makeRotationFromEuler(qc.fromArray(m))),e.rotation&&((m=e.rotation.map(c.MathUtils.degToRad)).push(e.eulerOrder),n.makeRotationFromEuler(qc.fromArray(m))),e.postRotation&&((m=e.postRotation.map(c.MathUtils.degToRad)).push(e.eulerOrder),i.makeRotationFromEuler(qc.fromArray(m)),i.invert()),e.scale&&o.scale(Yc.fromArray(e.scale)),e.scalingOffset&&s.setPosition(Yc.fromArray(e.scalingOffset)),e.scalingPivot&&a.setPosition(Yc.fromArray(e.scalingPivot)),e.rotationOffset&&l.setPosition(Yc.fromArray(e.rotationOffset)),e.rotationPivot&&u.setPosition(Yc.fromArray(e.rotationPivot)),e.parentMatrixWorld&&(p.copy(e.parentMatrix),h.copy(e.parentMatrixWorld)),r.clone().multiply(n).multiply(i)),v=(((e=new c.Matrix4).extractRotation(h),v=new c.Matrix4).copyPosition(h),v.clone().invert().multiply(h)),y=(v=e.clone().invert().multiply(v),o),g=new c.Matrix4;return 0===f?g.copy(e).multiply(m).multiply(v).multiply(y):1===f?g.copy(e).multiply(v).multiply(m).multiply(y):(f=(new c.Matrix4).scale((new c.Vector3).setFromMatrixScale(p)).clone().invert(),p=v.clone().multiply(f),g.copy(e).multiply(m).multiply(p).multiply(y)),v=u.clone().invert(),f=a.clone().invert(),e=t.clone().multiply(l).multiply(u).multiply(r).multiply(n).multiply(i).multiply(v).multiply(s).multiply(a).multiply(o).multiply(f),m=(new c.Matrix4).copyPosition(e),p=h.clone().multiply(m),d.copyPosition(p),(e=d.clone().multiply(g)).premultiply(h.invert()),e}function Qc(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 Kc(e){return e.split(",").map((function(e){return parseFloat(e)}))}function Jc(e,t,r){return void 0===t&&(t=0),void 0===r&&(r=e.byteLength),c.LoaderUtils.decodeText(new Uint8Array(e,t,r))}function $c(e,t,r){return e.slice(0,t).concat(r).concat(e.slice(t))}function eh(e){return(eh="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 th(e,t){return(th=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function rh(e){return(rh=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var nh=/^[og]\s*(.+)?/,ih=/^mtllib /,oh=/^usemtl /,ah=/^usemap /,sh=new c.Vector3,lh=new c.Vector3,uh=new c.Vector3,ch=new c.Vector3,hh=new c.Vector3,ph=new c.Color;function dh(){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 r=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 r=this._finalize(!1);return r&&(r.inherited||r.groupCount<=0)&&this.materials.splice(r.index,1),e={index:this.materials.length,name:e||"",mtllib:Array.isArray(t)&&0<t.length?t[t.length-1]:"",smooth:(void 0!==r?r:this).smooth,groupStart:void 0!==r?r.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 r=this.materials.length-1;0<=r;r--)this.materials[r].groupCount<=0&&this.materials.splice(r,1);return e&&0===this.materials.length&&this.materials.push({name:"",smooth:this.smooth}),t}},r&&r.name&&"function"==typeof r.clone&&((e=r.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,r){var n=this.vertices,i=this.object.geometry.vertices;i.push(n[e+0],n[e+1],n[e+2]),i.push(n[t+0],n[t+1],n[t+2]),i.push(n[r+0],n[r+1],n[r+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,r){var n=this.normals,i=this.object.geometry.normals;i.push(n[e+0],n[e+1],n[e+2]),i.push(n[t+0],n[t+1],n[t+2]),i.push(n[r+0],n[r+1],n[r+2])},addFaceNormal:function(e,t,r){var n=this.vertices,i=this.object.geometry.normals;sh.fromArray(n,e),lh.fromArray(n,t),uh.fromArray(n,r),hh.subVectors(uh,lh),ch.subVectors(sh,lh),hh.cross(ch),hh.normalize(),i.push(hh.x,hh.y,hh.z),i.push(hh.x,hh.y,hh.z),i.push(hh.x,hh.y,hh.z)},addColor:function(e,t,r){var n=this.colors,i=this.object.geometry.colors;void 0!==n[e]&&i.push(n[e+0],n[e+1],n[e+2]),void 0!==n[t]&&i.push(n[t+0],n[t+1],n[t+2]),void 0!==n[r]&&i.push(n[r+0],n[r+1],n[r+2])},addUV:function(e,t,r){var n=this.uvs,i=this.object.geometry.uvs;i.push(n[e+0],n[e+1]),i.push(n[t+0],n[t+1]),i.push(n[r+0],n[r+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,r,n,i,o,a,s,l){var u=this.vertices.length;e=this.parseVertexIndex(e,u),t=this.parseVertexIndex(t,u),r=this.parseVertexIndex(r,u),this.addVertex(e,t,r),this.addColor(e,t,r),void 0!==a&&""!==a?(u=this.normals.length,e=this.parseNormalIndex(a,u),t=this.parseNormalIndex(s,u),r=this.parseNormalIndex(l,u),this.addNormal(e,t,r)):this.addFaceNormal(e,t,r),void 0!==n&&""!==n?(a=this.uvs.length,e=this.parseUVIndex(n,a),t=this.parseUVIndex(i,a),r=this.parseUVIndex(o,a),this.addUV(e,t,r),this.object.geometry.hasUVIndices=!0):this.addDefaultUV()},addPointGeometry:function(e){this.object.geometry.type="Points";for(var t=this.vertices.length,r=0,n=e.length;r<n;r++){var i=this.parseVertexIndex(e[r],t);this.addVertexPoint(i),this.addColor(i)}},addLineGeometry:function(e,t){this.object.geometry.type="Line";for(var r=this.vertices.length,n=this.uvs.length,i=0,o=e.length;i<o;i++)this.addVertexLine(this.parseVertexIndex(e[i],r));for(var a=0,s=t.length;a<s;a++)this.addUVLine(this.parseUVIndex(t[a],n))}};return e.startObject("",!1),e}var fh=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&th(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=rh(e);if(r=t?(r=rh(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===eh(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(e){if(this instanceof n)return(e=r.call(this,e)).materials=null,e;throw new TypeError("Cannot call a class as a function")}return t=n,(e=[{key:"load",value:function(e,t,r,n){var i=this,o=new c.FileLoader(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,(function(r){try{t(i.parse(r))}catch(r){n?n(r):console.error(r),i.manager.itemError(e)}}),r,n)}},{key:"setMaterials",value:function(e){return this.materials=e,this}},{key:"parse",value:function(e){for(var t,r,n,i=new dh,o=(e=-1!==(e=-1!==e.indexOf("\r\n")?e.replace(/\r\n/g,"\n"):e).indexOf("\\\n")?e.replace(/\\\n/g,""):e).split("\n"),a="",s=[],l="function"==typeof"".trimLeft,u=0,h=o.length;u<h;u++)if(a=o[u],0!==(a=l?a.trimLeft():a.trim()).length&&"#"!==(t=a.charAt(0)))if("v"===t){var p=a.split(/\s+/);switch(p[0]){case"v":i.vertices.push(parseFloat(p[1]),parseFloat(p[2]),parseFloat(p[3])),7<=p.length?(ph.setRGB(parseFloat(p[4]),parseFloat(p[5]),parseFloat(p[6])).convertSRGBToLinear(),i.colors.push(ph.r,ph.g,ph.b)):i.colors.push(void 0,void 0,void 0);break;case"vn":i.normals.push(parseFloat(p[1]),parseFloat(p[2]),parseFloat(p[3]));break;case"vt":i.uvs.push(parseFloat(p[1]),parseFloat(p[2]))}}else if("f"===t){for(var d=a.slice(1).trim().split(/\s+/),f=[],m=0,v=d.length;m<v;m++){var y=d[m];0<y.length&&(y=y.split("/"),f.push(y))}for(var g=f[0],b=1,x=f.length-1;b<x;b++){var w=f[b],S=f[b+1];i.addFace(g[0],w[0],S[0],g[1],w[1],S[1],g[2],w[2],S[2])}}else if("l"===t){var T=a.substring(1).trim().split(" "),_=[],M=[];if(-1===a.indexOf("/"))_=T;else for(var E=0,P=T.length;E<P;E++){var O=T[E].split("/");""!==O[0]&&_.push(O[0]),""!==O[1]&&M.push(O[1])}i.addLineGeometry(_,M)}else"p"===t?(r=a.slice(1).trim().split(" "),i.addPointGeometry(r)):null!==(s=nh.exec(a))?(r=(" "+s[0].slice(1).trim()).slice(1),i.startObject(r)):oh.test(a)?i.object.startMaterial(a.substring(7).trim(),i.materialLibraries):ih.test(a)?i.materialLibraries.push(a.substring(7).trim()):ah.test(a)?console.warn('THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.'):"s"===t?(1<(s=a.split(" ")).length?(n=s[1].trim().toLowerCase(),i.object.smooth="0"!==n&&"off"!==n):i.object.smooth=!0,(n=i.object.currentMaterial())&&(n.smooth=i.object.smooth)):"\0"!==a&&console.warn('THREE.OBJLoader: Unexpected line: "'+a+'"');i.finalize();var R,k=new c.Group;if(1==(k.materialLibraries=[].concat(i.materialLibraries),e=!(1===i.objects.length&&0===i.objects[0].geometry.vertices.length)))for(var A=0,L=i.objects.length;A<L;A++){var C=i.objects[A],D=C.geometry,I=C.materials,j="Line"===D.type,U="Points"===D.type,B=!1;if(0!==D.vertices.length){for(var z=new c.BufferGeometry,N=(z.setAttribute("position",new c.Float32BufferAttribute(D.vertices,3)),0<D.normals.length&&z.setAttribute("normal",new c.Float32BufferAttribute(D.normals,3)),0<D.colors.length&&(B=!0,z.setAttribute("color",new c.Float32BufferAttribute(D.colors,3))),!0===D.hasUVIndices&&z.setAttribute("uv",new c.Float32BufferAttribute(D.uvs,2)),[]),F=0,V=I.length;F<V;F++){var H,G=I[F],W=G.name+"_"+G.smooth+"_"+B,X=i.materials[W];null!==this.materials&&(X=this.materials.create(G.name),!j||!X||X instanceof c.LineBasicMaterial?!U||!X||X instanceof c.PointsMaterial||(H=new c.PointsMaterial({size:10,sizeAttenuation:!1}),c.Material.prototype.copy.call(H,X),H.color.copy(X.color),H.map=X.map,X=H):(H=new c.LineBasicMaterial,c.Material.prototype.copy.call(H,X),H.color.copy(X.color),X=H)),void 0===X&&((X=j?new c.LineBasicMaterial:U?new c.PointsMaterial({size:1,sizeAttenuation:!1}):new c.MeshPhongMaterial).name=G.name,X.flatShading=!G.smooth,X.vertexColors=B,i.materials[W]=X),N.push(X)}if(D=void 0,1<N.length){for(var q=0,Y=I.length;q<Y;q++){var Z=I[q];z.addGroup(Z.groupStart,Z.groupCount,q)}D=new(j?c.LineSegments:U?c.Points:c.Mesh)(z,N)}else D=new(j?c.LineSegments:U?c.Points:c.Mesh)(z,N[0]);D.name=C.name,k.add(D)}}else 0<i.vertices.length&&(e=new c.PointsMaterial({size:1,sizeAttenuation:!1}),(R=new c.BufferGeometry).setAttribute("position",new c.Float32BufferAttribute(i.vertices,3)),0<i.colors.length&&void 0!==i.colors[0]&&(R.setAttribute("color",new c.Float32BufferAttribute(i.colors,3)),e.vertexColors=!0),R=new c.Points(R,e),k.add(R));return k}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),n}(c.Loader),mh=function(e,t,r,n){return new(r=r||Promise)((function(i,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))};class vh{constructor(e){this.parses={fbx:new Ic,obj:new fh,object:new c.ObjectLoader},this.runScene=e}getBack(e){return e.name.substring(e.name.lastIndexOf(".")+1).toLowerCase()}parse(e){return mh(this,void 0,void 0,(function*(){if(console.log(e,"file"),e instanceof Array)return Promise.all(e.map((e=>this.parse(e))));let t;switch(this.getBack(e).toLowerCase()){case"gltf":case"glb":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)}return this.runScene.modelEx.beforeLoad(yield t)}))}img(e){console.log(e,"file")}glb(e){return mh(this,void 0,void 0,(function*(){var t=yield(0,Ye.toResult)(e,"arrayBuffer");return this.runScene.loaderer.gltf.parse(t,{addToScene:!1})}))}fbx(e){return mh(this,void 0,void 0,(function*(){var t=e instanceof ArrayBuffer?e:yield(0,Ye.toResult)(e,"arrayBuffer");const r=this.parses.fbx.parse(t,"");return r.traverse((e=>{e.material&&(e.material=this.runScene.materialEx.create())})),this.runScene.sceneEx.cleanUnlessLevel(r)}))}obj(e){return mh(this,void 0,void 0,(function*(){var t=e instanceof File?yield(0,Ye.toResult)(e,"text"):e;const r=this.parses.obj.parse(t);return r.traverse((e=>{e.material&&(e.material=this.runScene.materialEx.create())})),this.runScene.sceneEx.cleanUnlessLevel(r)}))}json(e){return mh(this,void 0,void 0,(function*(){var t=e instanceof File?yield(0,Ye.toResult)(e,"text"):e;const r=yield this.parses.object.parseAsync(JSON.parse(t));return r.traverse((e=>{this.runScene.uniqueEx.material.add(e.material)})),this.runScene.sceneEx.cleanUnlessLevel(r)}))}}function yh(e){return(yh="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 gh(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function bh(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function xh(e,t,r){t&&bh(e.prototype,t),r&&bh(e,r),Object.defineProperty(e,"prototype",{writable:!1})}function wh(){return(wh="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=Eh(e)););return e}(e,t);if(n)return(n=Object.getOwnPropertyDescriptor(n,t)).get?n.get.call(arguments.length<3?e:r):n.value}).apply(this,arguments)}function Sh(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&&Th(e,t)}function Th(e,t){return(Th=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _h(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Eh(e);if(r=t?(r=Eh(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===yh(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return Mh(n)}}function Mh(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Eh(e){return(Eh=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Ph=new c.Raycaster,Oh=new c.Vector3,Rh=new c.Vector3,kh=new c.Quaternion,Ah={X:new c.Vector3(1,0,0),Y:new c.Vector3(0,1,0),Z:new c.Vector3(0,0,1)},Lh={type:"change"},Ch={type:"mouseDown"},Dh={type:"mouseUp",mode:null},Ih={type:"objectChange"};function jh(e,t,r){for(var n=t.intersectObject(e,!0),i=0;i<n.length;i++)if(n[i].object.visible||r)return n[i];return!1}Vs=function(){Sh(t,c.Object3D);var e=_h(t);function t(r,n){gh(this,t),i=e.call(this),void 0===n&&(console.warn('THREE.TransformControls: The second parameter "domElement" is now mandatory.'),n=document),i.visible=!1,i.domElement=n,i.domElement.style.touchAction="none";var i,o=new Kh,a=(i._gizmo=o,i.add(o),new Jh),s=(i._plane=a,i.add(a),Mh(i));function l(e,t){var r=t;Object.defineProperty(s,e,{get:function(){return void 0!==r?r:t},set:function(t){r!==t&&(r=t,a[e]=t,o[e]=t,s.dispatchEvent({type:e+"-changed",value:t}),s.dispatchEvent(Lh))}}),s[e]=t,a[e]=t,o[e]=t}l("camera",r),l("object",void 0),l("enabled",!0),l("axis",null),l("mode","translate"),l("translationSnap",null),l("rotationSnap",null),l("scaleSnap",null),l("space","world"),l("size",1),l("dragging",!1),l("showX",!0),l("showY",!0),l("showZ",!0),n=new c.Vector3,r=new c.Vector3;var u=new c.Quaternion,h=new c.Quaternion,p=new c.Vector3,d=new c.Quaternion,f=new c.Vector3,m=new c.Vector3,v=new c.Vector3,y=new c.Vector3;return l("worldPosition",n),l("worldPositionStart",r),l("worldQuaternion",u),l("worldQuaternionStart",h),l("cameraPosition",p),l("cameraQuaternion",d),l("pointStart",f),l("pointEnd",m),l("rotationAxis",v),l("rotationAngle",0),l("eye",y),i._offset=new c.Vector3,i._startNorm=new c.Vector3,i._endNorm=new c.Vector3,i._cameraScale=new c.Vector3,i._parentPosition=new c.Vector3,i._parentQuaternion=new c.Quaternion,i._parentQuaternionInv=new c.Quaternion,i._parentScale=new c.Vector3,i._worldScaleStart=new c.Vector3,i._worldQuaternionInv=new c.Quaternion,i._worldScale=new c.Vector3,i._positionStart=new c.Vector3,i._quaternionStart=new c.Quaternion,i._scaleStart=new c.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(Mh(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(Mh(i)),i._onPointerHover=function(e){if(this.enabled)switch(e.pointerType){case"mouse":case"pen":this.pointerHover(this._getPointer(e))}}.bind(Mh(i)),i._onPointerMove=function(e){this.enabled&&this.pointerMove(this._getPointer(e))}.bind(Mh(i)),i._onPointerUp=function(e){this.enabled&&(this.domElement.releasePointerCapture(e.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.pointerUp(this._getPointer(e)))}.bind(Mh(i)),i.domElement.addEventListener("pointerdown",i._onPointerDown),i.domElement.addEventListener("pointermove",i._onPointerHover),i.domElement.addEventListener("pointerup",i._onPointerUp),i}return xh(t,[{key:"updateMatrixWorld",value:function(){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.eye.copy(this.cameraPosition).sub(this.worldPosition).normalize(),wh(Eh(t.prototype),"updateMatrixWorld",this).call(this,this)}},{key:"pointerHover",value:function(e){void 0!==this.object&&!0!==this.dragging&&(Ph.setFromCamera(e,this.camera),e=jh(this._gizmo.picker[this.mode],Ph),this.axis=e?e.object.name:null)}},{key:"pointerDown",value:function(e){void 0!==this.object&&!0!==this.dragging&&0===e.button&&null!==this.axis&&(Ph.setFromCamera(e,this.camera),(e=jh(this._plane,Ph,!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,Ch.mode=this.mode,this.dispatchEvent(Ch))}},{key:"pointerMove",value:function(e){var t=this.axis,r=this.mode,n=this.object,i=this.space;"scale"===r?i="local":"E"!==t&&"XYZE"!==t&&"XYZ"!==t||(i="world"),void 0!==n&&null!==t&&!1!==this.dragging&&-1===e.button&&(Ph.setFromCamera(e,this.camera),(e=jh(this._plane,Ph,!0))&&(this.pointEnd.copy(e.point).sub(this.worldPositionStart),"translate"===r?(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),n.position.copy(this._offset).add(this._positionStart),this.translationSnap&&("local"===i&&(n.position.applyQuaternion(kh.copy(this._quaternionStart).invert()),-1!==t.search("X")&&(n.position.x=Math.round(n.position.x/this.translationSnap)*this.translationSnap),-1!==t.search("Y")&&(n.position.y=Math.round(n.position.y/this.translationSnap)*this.translationSnap),-1!==t.search("Z")&&(n.position.z=Math.round(n.position.z/this.translationSnap)*this.translationSnap),n.position.applyQuaternion(this._quaternionStart)),"world"===i&&(n.parent&&n.position.add(Oh.setFromMatrixPosition(n.parent.matrixWorld)),-1!==t.search("X")&&(n.position.x=Math.round(n.position.x/this.translationSnap)*this.translationSnap),-1!==t.search("Y")&&(n.position.y=Math.round(n.position.y/this.translationSnap)*this.translationSnap),-1!==t.search("Z")&&(n.position.z=Math.round(n.position.z/this.translationSnap)*this.translationSnap),n.parent&&n.position.sub(Oh.setFromMatrixPosition(n.parent.matrixWorld))))):"scale"===r?(-1!==t.search("XYZ")?(e=this.pointEnd.length()/this.pointStart.length(),this.pointEnd.dot(this.pointStart)<0&&(e*=-1),Rh.set(e,e,e)):(Oh.copy(this.pointStart),Rh.copy(this.pointEnd),Oh.applyQuaternion(this._worldQuaternionInv),Rh.applyQuaternion(this._worldQuaternionInv),Rh.divide(Oh),-1===t.search("X")&&(Rh.x=1),-1===t.search("Y")&&(Rh.y=1),-1===t.search("Z")&&(Rh.z=1)),n.scale.copy(this._scaleStart).multiply(Rh),this.scaleSnap&&(-1!==t.search("X")&&(n.scale.x=Math.round(n.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),-1!==t.search("Y")&&(n.scale.y=Math.round(n.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),-1!==t.search("Z")&&(n.scale.z=Math.round(n.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))):"rotate"===r&&(this._offset.copy(this.pointEnd).sub(this.pointStart),e=20/this.worldPosition.distanceTo(Oh.setFromMatrixPosition(this.camera.matrixWorld)),"E"===t?(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):"XYZE"===t?(this.rotationAxis.copy(this._offset).cross(this.eye).normalize(),this.rotationAngle=this._offset.dot(Oh.copy(this.rotationAxis).cross(this.eye))*e):"X"!==t&&"Y"!==t&&"Z"!==t||(this.rotationAxis.copy(Ah[t]),Oh.copy(Ah[t]),"local"===i&&Oh.applyQuaternion(this.worldQuaternion),this.rotationAngle=this._offset.dot(Oh.cross(this.eye).normalize())*e),this.rotationSnap&&(this.rotationAngle=Math.round(this.rotationAngle/this.rotationSnap)*this.rotationSnap),"local"===i&&"E"!==t&&"XYZE"!==t?(n.quaternion.copy(this._quaternionStart),n.quaternion.multiply(kh.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this._parentQuaternionInv),n.quaternion.copy(kh.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),n.quaternion.multiply(this._quaternionStart).normalize())),this.dispatchEvent(Lh),this.dispatchEvent(Ih)))}},{key:"pointerUp",value:function(e){0===e.button&&(this.dragging&&null!==this.axis&&(Dh.mode=this.mode,this.dispatchEvent(Dh)),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(Lh),this.dispatchEvent(Ih),this.pointStart.copy(this.pointEnd))}},{key:"getRaycaster",value:function(){return Ph}},{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}},{key:"update",value:function(){console.warn("THREE.TransformControls: update function has no more functionality and therefore has been deprecated.")}}]),t}(),Vs.prototype.isTransformControls=!0;var Uh=new c.Euler,Bh=new c.Vector3(0,1,0),zh=new c.Vector3(0,0,0),Nh=new c.Matrix4,Fh=new c.Quaternion,Vh=new c.Quaternion,Hh=new c.Vector3,Gh=new c.Matrix4,Wh=new c.Vector3(1,0,0),Xh=new c.Vector3(0,1,0),qh=new c.Vector3(0,0,1),Yh=new c.Vector3,Zh=new c.Vector3,Qh=new c.Vector3,Kh=function(){Sh(t,c.Object3D);var e=_h(t);function t(){gh(this,t),(r=e.call(this)).type="TransformControlsGizmo";var r,n=new c.MeshBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),i=new c.LineBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),o=n.clone(),a=((((o.opacity=.15,i=i.clone()).opacity=.5,x=n.clone()).color.setHex(16711680),w=n.clone()).color.setHex(65280),n.clone()),s=(a.color.setHex(255),n.clone()),l=(s.color.setHex(16711680),s.opacity=.5,n.clone()),u=(l.color.setHex(65280),l.opacity=.5,n.clone()),h=(u.color.setHex(255),u.opacity=.5,n.clone());(h.opacity=.25,g=n.clone()).color.setHex(16776960),g.opacity=.25,n.clone().color.setHex(16776960);var p=(((n=n.clone()).color.setHex(7895160),m=new c.CylinderGeometry(0,.04,.1,12)).translate(0,.05,0),new c.BoxGeometry(.08,.08,.08)),d=(p.translate(0,.04,0),new c.BufferGeometry);function f(e,t){return(e=new c.TorusGeometry(e,.0075,3,64,t*Math.PI*2)).rotateY(Math.PI/2),e.rotateX(Math.PI/2),e}(d.setAttribute("position",new c.Float32BufferAttribute([0,0,0,1,0,0],3)),S=new c.CylinderGeometry(.0075,.0075,.5,3)).translate(0,.25,0);var m={X:[[new c.Mesh(m,x),[.5,0,0],[0,0,-Math.PI/2]],[new c.Mesh(m,x),[-.5,0,0],[0,0,Math.PI/2]],[new c.Mesh(S,x),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new c.Mesh(m,w),[0,.5,0]],[new c.Mesh(m,w),[0,-.5,0],[Math.PI,0,0]],[new c.Mesh(S,w)]],Z:[[new c.Mesh(m,a),[0,0,.5],[Math.PI/2,0,0]],[new c.Mesh(m,a),[0,0,-.5],[-Math.PI/2,0,0]],[new c.Mesh(S,a),null,[Math.PI/2,0,0]]],XYZ:[[new c.Mesh(new c.OctahedronGeometry(.1,0),h.clone()),[0,0,0]]],XY:[[new c.Mesh(new c.BoxGeometry(.15,.15,.01),u.clone()),[.15,.15,0]]],YZ:[[new c.Mesh(new c.BoxGeometry(.15,.15,.01),s.clone()),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new c.Mesh(new c.BoxGeometry(.15,.15,.01),l.clone()),[.15,0,.15],[-Math.PI/2,0,0]]]},v={X:[[new c.Mesh(new c.CylinderGeometry(.2,0,.6,4),o),[.3,0,0],[0,0,-Math.PI/2]],[new c.Mesh(new c.CylinderGeometry(.2,0,.6,4),o),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new c.Mesh(new c.CylinderGeometry(.2,0,.6,4),o),[0,.3,0]],[new c.Mesh(new c.CylinderGeometry(.2,0,.6,4),o),[0,-.3,0],[0,0,Math.PI]]],Z:[[new c.Mesh(new c.CylinderGeometry(.2,0,.6,4),o),[0,0,.3],[Math.PI/2,0,0]],[new c.Mesh(new c.CylinderGeometry(.2,0,.6,4),o),[0,0,-.3],[-Math.PI/2,0,0]]],XYZ:[[new c.Mesh(new c.OctahedronGeometry(.2,0),o)]],XY:[[new c.Mesh(new c.BoxGeometry(.2,.2,.01),o),[.15,.15,0]]],YZ:[[new c.Mesh(new c.BoxGeometry(.2,.2,.01),o),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new c.Mesh(new c.BoxGeometry(.2,.2,.01),o),[.15,0,.15],[-Math.PI/2,0,0]]]},y={START:[[new c.Mesh(new c.OctahedronGeometry(.01,2),i),null,null,null,"helper"]],END:[[new c.Mesh(new c.OctahedronGeometry(.01,2),i),null,null,null,"helper"]],DELTA:[[new c.Line(((y=new c.BufferGeometry).setAttribute("position",new c.Float32BufferAttribute([0,0,0,1,1,1],3)),y),i),null,null,null,"helper"]],X:[[new c.Line(d,i.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new c.Line(d,i.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new c.Line(d,i.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},g=(n={XYZE:[[new c.Mesh(f(.5,1),n),null,[0,Math.PI/2,0]]],X:[[new c.Mesh(f(.5,.5),x)]],Y:[[new c.Mesh(f(.5,.5),w),null,[0,0,-Math.PI/2]]],Z:[[new c.Mesh(f(.5,.5),a),null,[0,Math.PI/2,0]]],E:[[new c.Mesh(f(.75,1),g),null,[0,Math.PI/2,0]]]},{AXIS:[[new c.Line(d,i.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]}),b={XYZE:[[new c.Mesh(new c.SphereGeometry(.25,10,8),o)]],X:[[new c.Mesh(new c.TorusGeometry(.5,.1,4,24),o),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new c.Mesh(new c.TorusGeometry(.5,.1,4,24),o),[0,0,0],[Math.PI/2,0,0]]],Z:[[new c.Mesh(new c.TorusGeometry(.5,.1,4,24),o),[0,0,0],[0,0,-Math.PI/2]]],E:[[new c.Mesh(new c.TorusGeometry(.75,.1,2,24),o)]]},x={X:[[new c.Mesh(p,x),[.5,0,0],[0,0,-Math.PI/2]],[new c.Mesh(S,x),[0,0,0],[0,0,-Math.PI/2]],[new c.Mesh(p,x),[-.5,0,0],[0,0,Math.PI/2]]],Y:[[new c.Mesh(p,w),[0,.5,0]],[new c.Mesh(S,w)],[new c.Mesh(p,w),[0,-.5,0],[0,0,Math.PI]]],Z:[[new c.Mesh(p,a),[0,0,.5],[Math.PI/2,0,0]],[new c.Mesh(S,a),[0,0,0],[Math.PI/2,0,0]],[new c.Mesh(p,a),[0,0,-.5],[-Math.PI/2,0,0]]],XY:[[new c.Mesh(new c.BoxGeometry(.15,.15,.01),u),[.15,.15,0]]],YZ:[[new c.Mesh(new c.BoxGeometry(.15,.15,.01),s),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new c.Mesh(new c.BoxGeometry(.15,.15,.01),l),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new c.Mesh(new c.BoxGeometry(.1,.1,.1),h.clone())]]},w={X:[[new c.Mesh(new c.CylinderGeometry(.2,0,.6,4),o),[.3,0,0],[0,0,-Math.PI/2]],[new c.Mesh(new c.CylinderGeometry(.2,0,.6,4),o),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new c.Mesh(new c.CylinderGeometry(.2,0,.6,4),o),[0,.3,0]],[new c.Mesh(new c.CylinderGeometry(.2,0,.6,4),o),[0,-.3,0],[0,0,Math.PI]]],Z:[[new c.Mesh(new c.CylinderGeometry(.2,0,.6,4),o),[0,0,.3],[Math.PI/2,0,0]],[new c.Mesh(new c.CylinderGeometry(.2,0,.6,4),o),[0,0,-.3],[-Math.PI/2,0,0]]],XY:[[new c.Mesh(new c.BoxGeometry(.2,.2,.01),o),[.15,.15,0]]],YZ:[[new c.Mesh(new c.BoxGeometry(.2,.2,.01),o),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new c.Mesh(new c.BoxGeometry(.2,.2,.01),o),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new c.Mesh(new c.BoxGeometry(.2,.2,.2),o),[0,0,0]]]},S={X:[[new c.Line(d,i.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new c.Line(d,i.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new c.Line(d,i.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]};function T(e){var t,r=new c.Object3D;for(t in e)for(var n=e[t].length;n--;){var i=e[t][n][0].clone(),o=e[t][n][1],a=e[t][n][2],s=e[t][n][3],l=e[t][n][4];(i.name=t,i.tag=l,o&&i.position.set(o[0],o[1],o[2]),a&&i.rotation.set(a[0],a[1],a[2]),s&&i.scale.set(s[0],s[1],s[2]),i.updateMatrix(),l=i.geometry.clone()).applyMatrix4(i.matrix),i.geometry=l,i.renderOrder=1/0,i.position.set(0,0,0),i.rotation.set(0,0,0),i.scale.set(1,1,1),r.add(i)}return r}return r.gizmo={},r.picker={},r.helper={},r.add(r.gizmo.translate=T(m)),r.add(r.gizmo.rotate=T(n)),r.add(r.gizmo.scale=T(x)),r.add(r.picker.translate=T(v)),r.add(r.picker.rotate=T(b)),r.add(r.picker.scale=T(w)),r.add(r.helper.translate=T(y)),r.add(r.helper.rotate=T(g)),r.add(r.helper.scale=T(S)),r.picker.translate.visible=!1,r.picker.rotate.visible=!1,r.picker.scale.visible=!1,r}return xh(t,[{key:"updateMatrixWorld",value:function(e){var r=this,n="local"===("scale"===this.mode?"local":this.space)?this.worldQuaternion:Vh,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 o=0;o<i.length;o++)!function(e){var t=i[e];if(t.visible=!0,t.rotation.set(0,0,0),e=void t.position.copy(r.worldPosition),e=r.camera.isOrthographicCamera?(r.camera.top-r.camera.bottom)/r.camera.zoom:r.worldPosition.distanceTo(r.cameraPosition)*Math.min(1.9*Math.tan(Math.PI*r.camera.fov/360)/r.camera.zoom,7),t.scale.set(1,1,1).multiplyScalar(e*r.size/4),"helper"===t.tag)return t.visible=!1,"AXIS"===t.name?(t.position.copy(r.worldPositionStart),t.visible=!!r.axis,"X"===r.axis&&(kh.setFromEuler(Uh.set(0,0,0)),t.quaternion.copy(n).multiply(kh),.9<Math.abs(Bh.copy(Wh).applyQuaternion(n).dot(r.eye))&&(t.visible=!1)),"Y"===r.axis&&(kh.setFromEuler(Uh.set(0,0,Math.PI/2)),t.quaternion.copy(n).multiply(kh),.9<Math.abs(Bh.copy(Xh).applyQuaternion(n).dot(r.eye))&&(t.visible=!1)),"Z"===r.axis&&(kh.setFromEuler(Uh.set(0,Math.PI/2,0)),t.quaternion.copy(n).multiply(kh),.9<Math.abs(Bh.copy(qh).applyQuaternion(n).dot(r.eye))&&(t.visible=!1)),"XYZE"===r.axis&&(kh.setFromEuler(Uh.set(0,Math.PI/2,0)),Bh.copy(r.rotationAxis),t.quaternion.setFromRotationMatrix(Nh.lookAt(zh,Bh,Xh)),t.quaternion.multiply(kh),t.visible=r.dragging),"E"===r.axis&&(t.visible=!1)):"START"===t.name?(t.position.copy(r.worldPositionStart),t.visible=r.dragging):"END"===t.name?(t.position.copy(r.worldPosition),t.visible=r.dragging):"DELTA"===t.name?(t.position.copy(r.worldPositionStart),t.quaternion.copy(r.worldQuaternionStart),Oh.set(1e-10,1e-10,1e-10).add(r.worldPositionStart).sub(r.worldPosition).multiplyScalar(-1),Oh.applyQuaternion(r.worldQuaternionStart.clone().invert()),t.scale.copy(Oh),t.visible=r.dragging):(t.quaternion.copy(n),r.dragging?t.position.copy(r.worldPositionStart):t.position.copy(r.worldPosition),r.axis&&(t.visible=-1!==r.axis.search(t.name)));t.quaternion.copy(n),"translate"===r.mode||"scale"===r.mode?("X"===t.name&&.99<Math.abs(Bh.copy(Wh).applyQuaternion(n).dot(r.eye))&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"Y"===t.name&&.99<Math.abs(Bh.copy(Xh).applyQuaternion(n).dot(r.eye))&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"Z"===t.name&&.99<Math.abs(Bh.copy(qh).applyQuaternion(n).dot(r.eye))&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"XY"===t.name&&Math.abs(Bh.copy(qh).applyQuaternion(n).dot(r.eye))<.2&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"YZ"===t.name&&Math.abs(Bh.copy(Wh).applyQuaternion(n).dot(r.eye))<.2&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"XZ"===t.name&&Math.abs(Bh.copy(Xh).applyQuaternion(n).dot(r.eye))<.2&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1)):"rotate"===r.mode&&(Fh.copy(n),Bh.copy(r.eye).applyQuaternion(kh.copy(n).invert()),-1!==t.name.search("E")&&t.quaternion.setFromRotationMatrix(Nh.lookAt(r.eye,zh,Xh)),"X"===t.name&&(kh.setFromAxisAngle(Wh,Math.atan2(-Bh.y,Bh.z)),kh.multiplyQuaternions(Fh,kh),t.quaternion.copy(kh)),"Y"===t.name&&(kh.setFromAxisAngle(Xh,Math.atan2(Bh.x,Bh.z)),kh.multiplyQuaternions(Fh,kh),t.quaternion.copy(kh)),"Z"===t.name&&(kh.setFromAxisAngle(qh,Math.atan2(Bh.y,Bh.x)),kh.multiplyQuaternions(Fh,kh),t.quaternion.copy(kh))),t.visible=t.visible&&(-1===t.name.indexOf("X")||r.showX),t.visible=t.visible&&(-1===t.name.indexOf("Y")||r.showY),t.visible=t.visible&&(-1===t.name.indexOf("Z")||r.showZ),t.visible=t.visible&&(-1===t.name.indexOf("E")||r.showX&&r.showY&&r.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,r.enabled&&r.axis&&(t.name===r.axis||r.axis.split("").some((function(e){return t.name===e})))&&(t.material.color.setHex(16776960),t.material.opacity=1)}(o);wh(Eh(t.prototype),"updateMatrixWorld",this).call(this,e)}}]),t}(),Jh=(Kh.prototype.isTransformControlsGizmo=!0,function(){Sh(t,c.Mesh);var e=_h(t);function t(){var r;return gh(this,t),(r=e.call(this,new c.PlaneGeometry(1e5,1e5,2,2),new c.MeshBasicMaterial({visible:!1,wireframe:!0,side:c.DoubleSide,transparent:!0,opacity:.1,toneMapped:!1}))).type="TransformControlsPlane",r}return xh(t,[{key:"updateMatrixWorld",value:function(e){var r=this.space;switch(this.position.copy(this.worldPosition),"scale"===this.mode&&(r="local"),Yh.copy(Wh).applyQuaternion("local"===r?this.worldQuaternion:Vh),Zh.copy(Xh).applyQuaternion("local"===r?this.worldQuaternion:Vh),Qh.copy(qh).applyQuaternion("local"===r?this.worldQuaternion:Vh),Bh.copy(Zh),this.mode){case"translate":case"scale":switch(this.axis){case"X":Bh.copy(this.eye).cross(Yh),Hh.copy(Yh).cross(Bh);break;case"Y":Bh.copy(this.eye).cross(Zh),Hh.copy(Zh).cross(Bh);break;case"Z":Bh.copy(this.eye).cross(Qh),Hh.copy(Qh).cross(Bh);break;case"XY":Hh.copy(Qh);break;case"YZ":Hh.copy(Yh);break;case"XZ":Bh.copy(Qh),Hh.copy(Zh);break;case"XYZ":case"E":Hh.set(0,0,0)}break;default:Hh.set(0,0,0)}0===Hh.length()?this.quaternion.copy(this.cameraQuaternion):(Gh.lookAt(Oh.set(0,0,0),Hh,Bh),this.quaternion.setFromRotationMatrix(Gh)),wh(Eh(t.prototype),"updateMatrixWorld",this).call(this,e)}}]),t}());Jh.prototype.isTransformControlsPlane=!0;class $h extends Vs{constructor(e,t){super(e,t),this.transGizmo=this.children[0],this.scaleCoefficient=new c.Vector3,this.beginScale=new c.Vector3,this.posStart=new c.Vector2,this.posEnd=new c.Vector2,this.deleteRedundantParts()}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),super.pointerDown(e))}pointerMove(e){if(super.pointerMove(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)}}}class ep{constructor(e){this.grid=null,this.transContro=null,this.boxHelper=null,this.deepIsHelper=e=>"Scene"===e.type||!this.isHelper(e)&&!!e.parent&&this.deepIsHelper(e.parent),this.getBoxHelper=e=>(e=new c.BoxHelper(e),this.setHelper(e),this.runScene.assetsEx.get().scene.add(e),e),this.runScene=e,"running"!==this.runScene.optionsEx.options.mode&&(this.transContro=new class{constructor(e){this.tansControls=null,this.controlsMode="position",this.isDraggingChange=!1,this.modelNewVal=new vi.Vector3,this.transControlsStatusMap={position:"translate",rotation:"rotate",scale:"scale"},this.multipObj=null,this.worldOldVal=new vi.Vector3,this.draggingChanged=e=>{const t=this.runScene.assetsEx.get().controls;var r=this.controlsMode;let n=this.runScene.modelEx.select;if(e.value){if(!this.runScene.multipSelector.isEmpty()){t.enabled=!1;const e=this.runScene.multipSelector.getLast();this.multipSelectLast=e,this.worldOldVal=Mo(e,this.runScene.sceneEx.get())}}else if(!t.enabled&&!this.runScene.multipSelector.isEmpty()&&this.multipSelectLast){const e=this.multipSelectLast;this.multipObj=e,this.runScene.events.mouse.enableUp=!1,this.runScene.helperEx.boxHelper.setFromObject(this.runScene.assetsEx.get().scene);var i=Mo(e,this.runScene.sceneEx.get());this.runScene.multipSelector.setInfo(e,r,this.modelNewVal,e[r],i,this.worldOldVal),this.runScene.modelEx.selectNull(),this.multipSelectLast=void 0}if(this.runScene.multipSelector.isEmpty()?this.runScene.events.mouse.enableUp=!0:this.runScene.events.mouse.enableUp=!1,!n){if(this.runScene.multipSelector.isEmpty())return;n=this.runScene.multipSelector.getLast()}t.enabled?(this.modelNewVal=this.runScene.modelEx.cloneV3(n[r]),this.isDraggingChange=!0,this.worldOldVal=Mo(n,this.runScene.sceneEx.get())):(this.runScene.multipSelector.isEmpty()?this.runScene.modelEx.setV3({model:n,info:r,newV3:this.runScene.modelEx.cloneV3(n[r]),oldV3:this.modelNewVal},!0,!1):(this.multipObj=n,this.runScene.events.mouse.enableUp=!1,this.runScene.helperEx.boxHelper.setFromObject(this.runScene.assetsEx.get().scene),i=Mo(n,this.runScene.sceneEx.get()),this.runScene.multipSelector.setInfo(n,r,this.modelNewVal,n[r],i,this.worldOldVal)),this.isDraggingChange=!1),this.runScene.assetsEx.get().controls.enabled=!e.value},this.runScene=e}init(){const{camera:e,renderer:t,scene:r}=this.runScene.assetsEx;this.tansControls=new $h(e,t.domElement),this.tansControls.addEventListener("dragging-changed",this.draggingChanged),this.tansControls.addEventListener("change",this.transChangeFn.bind(this)),this.tansControls.name="helper",r.add(this.tansControls),this.tansControls.traverse((e=>e.isHelper=!0))}changeMode(e){this.controlsMode=e,this.tansControls.setMode(this.transControlsStatusMap[e])}transControSize(e){this.tansControls.setSize(e?this.tansControls.size+.1:Math.max(this.tansControls.size-.1,.1))}changeState(e){this.tansControls.enabled=e}addObject(e){this.removeFocus(),this.tansControls.attach(e)}removeFocus(){this.tansControls.detach()}changeSpaceState(){this.tansControls.setSpace("local"===this.tansControls.space?"world":"local"),this.tansControls.detach()}transChangeFn(e){var t=this.runScene.modelEx.select;t&&(this.runScene.lightEx.update(t),this.runScene.helperEx.boxHelper.setFromObject(t))}close(){this.tansControls.enabled=!1}open(){this.tansControls.enabled=!0}reset(){this.dispose(),this.init()}dispose(){this.tansControls&&(this.tansControls.removeEventListener("dragging-changed",this.draggingChanged),this.tansControls.removeEventListener("change",this.transChangeFn),this.tansControls.dispose(),this.runScene.assetsEx.get().scene.remove(this.tansControls))}}(e),this.grid=this.createGrid(),this.init())}init(){this.transContro.init(),this.runScene.assetsEx.get().scene.add(this.grid)}createGrid(){const e=new vi.GridHelper(20,10);return e.name="helper",e.position.y=0,e.material instanceof c.Material&&(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,r){return e.userData.isHelper=!0,t&&e.traverse((e=>{e.userData.isHelper=!0,r&&r(e)})),e}focus(e){"running"!==this.runScene.optionsEx.options.mode&&(this.boxHelper||(this.boxHelper=this.getBoxHelper(e)),this.transContro.addObject(e),this.boxHelper.setFromObject(e),this.focusModelId=this.runScene.uniqueEx.getId(e))}unfocus(){var e;"running"!==this.runScene.optionsEx.options.mode&&(this.transContro.removeFocus(),null!=(e=this.boxHelper)&&e.setFromObject(this.runScene.assetsEx.get().scene),this.focusModelId=void 0)}}function tp(e){return(tp="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 rp(e,t){return(rp=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function np(e){return(np=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var ip=new WeakMap,op=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&rp(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=np(e);if(r=t?(r=np(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===tp(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(e){if(this instanceof n)return(e=r.call(this,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=n,(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,r,n){var i=this,o=new c.FileLoader(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,(function(e){var r={attributeIDs:i.defaultAttributeIDs,attributeTypes:i.defaultAttributeTypes,useUniqueIDs:!1};i.decodeGeometry(e,r).then(t).catch(n)}),r,n)}},{key:"decodeDracoFile",value:function(e,t,r,n){n={attributeIDs:r||this.defaultAttributeIDs,attributeTypes:n||this.defaultAttributeTypes,useUniqueIDs:!!r},this.decodeGeometry(e,n).then(t)}},{key:"decodeGeometry",value:function(e,t){var r,n=this;for(r in t.attributeTypes){var i=t.attributeTypes[r];void 0!==i.BYTES_PER_ELEMENT&&(t.attributeTypes[r]=i.name)}var o,a=JSON.stringify(t);if(ip.has(e)){if((l=ip.get(e)).key===a)return l.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 s=this.workerNextTaskID++,l=e.byteLength;return l=this._getWorker(s,l).then((function(r){return o=r,new Promise((function(r,n){o._callbacks[s]={resolve:r,reject:n},o.postMessage({type:"decode",id:s,taskConfig:t,buffer:e},[e])}))})).then((function(e){return n._createGeometry(e.geometry)})),l.catch((function(){return!0})).then((function(){o&&s&&n._releaseTask(o,s)})),ip.set(e,{key:a,promise:l}),l}},{key:"_createGeometry",value:function(e){var t=new c.BufferGeometry;e.index&&t.setIndex(new c.BufferAttribute(e.index.array,1));for(var r=0;r<e.attributes.length;r++){var n=(o=e.attributes[r]).name,i=o.array,o=o.itemSize;t.setAttribute(n,new c.BufferAttribute(i,o))}return t}},{key:"_loadLibrary",value:function(e,t){var r=new c.FileLoader(this.manager);return r.setPath(this.decoderPath),r.setResponseType(t),r.setWithCredentials(this.withCredentials),new Promise((function(t,n){r.load(e,t,void 0,n)}))}},{key:"preload",value:function(){return this._initDecoder(),this}},{key:"_initDecoder",value:function(){var e=this;if(this.decoderPending)return this.decoderPending;var t="object"!==("undefined"==typeof WebAssembly?"undefined":tp(WebAssembly))||"js"===this.decoderConfig.type,r=[];return t?r.push(this._loadLibrary("draco_decoder.js","text")):(r.push(this._loadLibrary("draco_wasm_wrapper.js","text")),r.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(r).then((function(r){var n=r[0];t||(e.decoderConfig.wasmBinary=r[1]),r=function(){var e,t;onmessage=function(r){var n=r.data;switch(n.type){case"init":e=n.decoderConfig,t=new Promise((function(t){e.onModuleLoaded=function(e){t({draco:e})},DracoDecoderModule(e)}));break;case"decode":var i=n.buffer,o=n.taskConfig;t.then((function(e){var t=new(e=e.draco).Decoder,r=new e.DecoderBuffer;r.Init(new Int8Array(i),i.byteLength);try{var a=function(e,t,r,n){var i,o=n.attributeIDs,a=n.attributeTypes,s=t.GetEncodedGeometryType(r);if(s===e.TRIANGULAR_MESH)i=new e.Mesh,y=t.DecodeBufferToMesh(r,i);else{if(s!==e.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");i=new e.PointCloud,y=t.DecodeBufferToPointCloud(r,i)}if(!y.ok()||0===i.ptr)throw new Error("THREE.DRACOLoader: Decoding failed: "+y.error_msg());var l,u,c,h,p,d,f,m,v,y,g,b,x,w={index:null,attributes:[]};for(l in o){var S=self[a[l]],T=void 0,_=void 0;if(n.useUniqueIDs)_=o[l],T=t.GetAttributeByUniqueId(i,_);else{if(-1===(_=t.GetAttributeId(i,e[o[l]])))continue;T=t.GetAttribute(i,_)}w.attributes.push((_=e,u=t,c=i,h=l,p=T.num_components(),f=(d=c.num_points()*p)*S.BYTES_PER_ELEMENT,m=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}}(_,S),v=_._malloc(f),u.GetAttributeDataArrayForAllPoints(c,T,m,f,v),u=new S(_.HEAPF32.buffer,v,d).slice(),_._free(v),{name:h,array:u,itemSize:p}))}return s===e.TRIANGULAR_MESH&&(w.index=(r=e,y=t,b=4*(g=3*(s=i).num_faces()),x=r._malloc(b),y.GetTrianglesUInt32Array(s,b,x),y=new Uint32Array(r.HEAPF32.buffer,x,g).slice(),r._free(x),{array:y,itemSize:1})),e.destroy(i),w}(e,t,r,o),s=a.attributes.map((function(e){return e.array.buffer}));a.index&&s.push(a.index.array.buffer),self.postMessage({type:"decode",id:n.id,geometry:a},s)}catch(e){console.error(e),self.postMessage({type:"error",id:n.id,error:e.message})}finally{e.destroy(r),e.destroy(t)}}))}}}.toString(),n=["/* draco decoder */",n,"","/* worker */",r.substring(r.indexOf("{")+1,r.lastIndexOf("}"))].join("\n"),e.workerSourceURL=URL.createObjectURL(new Blob([n]))})),this.decoderPending}},{key:"_getWorker",value:function(e,t){var r=this;return this._initDecoder().then((function(){r.workerPool.length<r.workerLimit?((n=new Worker(r.workerSourceURL))._callbacks={},n._taskCosts={},n._taskLoad=0,n.postMessage({type:"init",decoderConfig:r.decoderConfig}),n.onmessage=function(e){var t=e.data;switch(t.type){case"decode":n._callbacks[t.id].resolve(t);break;case"error":n._callbacks[t.id].reject(t);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+t.type+'"')}},r.workerPool.push(n)):r.workerPool.sort((function(e,t){return e._taskLoad>t._taskLoad?-1:1}));var n,i=r.workerPool[r.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}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),n}(c.Loader),ap={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 sp=new(function(e,t,r){return Object.defineProperty(e,"prototype",{writable:!1}),e}((function e(t,r,n){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");var i=this,o=!1,a=0,s=0,l=void 0,u=[];this.onStart=void 0,this.onLoad=t,this.onProgress=r,this.onError=n,this.itemStart=function(e){s++,!1===o&&void 0!==i.onStart&&i.onStart(e,a,s),o=!0},this.itemEnd=function(e){a++,void 0!==i.onProgress&&i.onProgress(e,a,s),a===s&&(o=!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,r=u.length;t<r;t+=2){var n=u[t],i=u[t+1];if(n.global&&(n.lastIndex=0),n.test(e))return i}return null}})));var lp=function(){function e(t){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");this.manager=void 0!==t?t:sp,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}var t,r;return t=e,(r=[{key:"load",value:function(){}},{key:"loadAsync",value:function(e,t){var r=this;return new Promise((function(n,i){r.load(e,n,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 r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,r),Object.defineProperty(t,"prototype",{writable:!1}),e}();function up(e){return(up="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 cp(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function hp(e,t){return(hp=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function pp(e){return(pp=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var dp=function(){var e=n,t=lp;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&&hp(e,t);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=pp(e);if(r=t?(r=pp(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===up(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(e){if(this instanceof n)return e=r.call(this,e),"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=n,(t=[{key:"setOptions",value:function(e){return this.options=e,this}},{key:"load",value:function(e,t,r,n,i){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var o=this,a=ap.get(e);if(void 0!==a)return o.manager.itemStart(e),setTimeout((function(){t&&t(a),o.manager.itemEnd(e)}),0),a;var s={};s.credentials="anonymous"===this.crossOrigin?"same-origin":"include",s.headers=this.requestHeader,fetch(e,s).then((function(e){return e.blob()})).then((function(e){return Promise.all([new Promise((function(t){var r,n=o.options.textureQuality,a=i.notCompress;t(i.size&&1!==n?(r=(t=i.size).w,t=t.h,a=a?1:n,createImageBitmap(e,Object.assign(o.options,{imageOrientation:"flipY",resizeHeight:t*a,resizeWidth:r*a}))):createImageBitmap(e,Object.assign(o.options,{imageOrientation:"flipY"})))})),Promise.resolve(e)])})).then((function(r){r=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o=[],a=!0,s=!1;try{for(r=r.call(e);!(a=(n=r.next()).done)&&(o.push(n.value),2!==o.length);a=!0);}catch(e){s=!0,i=e}finally{try{a||null==r.return||r.return()}finally{if(s)throw i}}return o}}(e)||function(e,t){if(e){if("string"==typeof e)return cp(e,2);var r=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(r="Object"===r&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?cp(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.")}()}(r);var n=r[0];r=r[1],ap.add(e,n),t&&t(n,r),o.manager.itemEnd(e)})).catch((function(t){n&&n(t),o.manager.itemError(e),o.manager.itemEnd(e)})),o.manager.itemStart(e)}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),n}();function fp(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o=[],a=!0,s=!1;try{for(r=r.call(e);!(a=(n=r.next()).done)&&(o.push(n.value),!t||o.length!==t);a=!0);}catch(e){s=!0,i=e}finally{try{a||null==r.return||r.return()}finally{if(s)throw i}}return o}}(e,t)||vp(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 mp(e,t){var r,n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=vp(e))||t&&e&&"number"==typeof e.length)return n&&(e=n),r=0,{s:t=function(){},n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},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,o=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){a=!0,i=e},f:function(){try{o||null==n.return||n.return()}finally{if(a)throw i}}}}function vp(e,t){if(e){if("string"==typeof e)return yp(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(r="Object"===r&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?yp(e,t):void 0}}function yp(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function gp(e){return(gp="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 bp(){return(bp="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=Pp(e)););return e}(e,t);if(n)return(n=Object.getOwnPropertyDescriptor(n,t)).get?n.get.call(arguments.length<3?e:r):n.value}).apply(this,arguments)}function xp(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function wp(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Sp(e,t,r){return t&&wp(e.prototype,t),r&&wp(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Tp(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)}function Mp(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Pp(e);if(r=t?(r=Pp(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===gp(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return Ep(n)}}function Ep(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Pp(e){return(Pp=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}dp.prototype.isImageBitmapLoader=!0;var Op=function(){Tp(t,c.Loader);var e=Mp(t);function t(r){return xp(this,t),(r=e.call(this,r)).dracoLoader=null,r.ktx2Loader=null,r.meshoptDecoder=null,r.pluginCallbacks=[],r.register((function(e){return new Cp(e)})),r.register((function(e){return new zp(e)})),r.register((function(e){return new Np(e)})),r.register((function(e){return new Dp(e)})),r.register((function(e){return new Ip(e)})),r.register((function(e){return new jp(e)})),r.register((function(e){return new Up(e)})),r.register((function(e){return new Bp(e)})),r.register((function(e){return new Ap(e)})),r.register((function(e){return new Fp(e)})),r}return Sp(t,[{key:"load",value:function(e,t,r,n){function i(t){n?n(t):console.error(t),o.manager.itemError(e),o.manager.itemEnd(e)}var o=this,a=""!==this.resourcePath?this.resourcePath:""!==this.path?this.path:c.LoaderUtils.extractUrlBase(e),s=(this.manager.itemStart(e),new c.FileLoader(this.manager));s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,(function(r){try{o.parse(r,a,(function(r){t(r),o.manager.itemEnd(e)}),i)}catch(r){i(r)}}),r,i)}},{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,r,n,i){var o,a={},s={};if("string"==typeof e)o=e;else if(c.LoaderUtils.decodeText(new Uint8Array(e,0,4))===Vp){try{a[kp.KHR_BINARY_GLTF]=new Hp(e)}catch(e){return void(n&&n(e))}o=a[kp.KHR_BINARY_GLTF].content}else o=c.LoaderUtils.decodeText(new Uint8Array(e));var l=JSON.parse(o);if(void 0===l.asset||l.asset.version[0]<2)n&&n(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));else{i.helper.beforeLoader(l);var u=new ud(l,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder,myOptions:i});u.fileLoader.setRequestHeader(this.requestHeader);for(var h=0;h<this.pluginCallbacks.length;h++){var p=this.pluginCallbacks[h](u);a[(s[p.name]=p).name]=!0}if(l.extensionsUsed)for(var d=0;d<l.extensionsUsed.length;++d){var f=l.extensionsUsed[d],m=l.extensionsRequired||[];switch(f){case kp.KHR_MATERIALS_UNLIT:a[f]=new Lp;break;case kp.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:a[f]=new qp;break;case kp.KHR_DRACO_MESH_COMPRESSION:a[f]=new Gp(l,this.dracoLoader);break;case kp.KHR_TEXTURE_TRANSFORM:a[f]=new Wp;break;case kp.KHR_MESH_QUANTIZATION:a[f]=new Yp;break;default:0<=m.indexOf(f)&&void 0===s[f]&&console.warn('THREE.GLTFLoader: Unknown extension "'+f+'".')}}u.setExtensions(a),u.setPlugins(s),u.parse(r,n)}}},{key:"parseAsync",value:function(e,t){var r=this;return new Promise((function(n,i){r.parse(e,t,n,i)}))}}]),t}();function Rp(){var e={};return{get:function(t){return e[t]},add:function(t,r){e[t]=r},remove:function(t){delete e[t]},removeAll:function(){e={}}}}var kp={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_PBR_SPECULAR_GLOSSINESS:"KHR_materials_pbrSpecularGlossiness",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",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",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression"},Ap=function(){function e(t){xp(this,e),this.parser=t,this.name=kp.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}return Sp(e,[{key:"_markDefs",value:function(){for(var e=this.parser,t=this.parser.json.nodes||[],r=0,n=t.length;r<n;r++){var i=t[r];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,r="light:"+e,n=t.cache.get(r);if(n)return n;var i,o=t.json,a=((o.extensions&&o.extensions[this.name]||{}).lights||[])[e],s=new c.Color(16777215),l=(void 0!==a.color&&s.fromArray(a.color),void 0!==a.range?a.range:0);switch(a.type){case"directional":(i=new c.DirectionalLight(s)).target.position.set(0,0,-1),i.add(i.target);break;case"point":(i=new c.PointLight(s)).distance=l;break;case"spot":(i=new c.SpotLight(s)).distance=l,a.spot=a.spot||{},a.spot.innerConeAngle=void 0!==a.spot.innerConeAngle?a.spot.innerConeAngle:0,a.spot.outerConeAngle=void 0!==a.spot.outerConeAngle?a.spot.outerConeAngle:Math.PI/4,i.angle=a.spot.outerConeAngle,i.penumbra=1-a.spot.innerConeAngle/a.spot.outerConeAngle,i.target.position.set(0,0,-1),i.add(i.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+a.type)}return i.position.set(0,0,0),i.decay=2,void 0!==a.intensity&&(i.intensity=a.intensity),i.name=t.createUniqueName(a.name||"light_"+e),n=Promise.resolve(i),t.cache.add(r,n),n}},{key:"createNodeAttachment",value:function(e){var t=this,r=this.parser,n=((e=r.json.nodes[e]).extensions&&e.extensions[this.name]||{}).light;return void 0===n?null:this._loadLight(n).then((function(e){return r._getNodeRef(t.cache,n,e)}))}}]),e}(),Lp=function(){function e(){xp(this,e),this.name=kp.KHR_MATERIALS_UNLIT}return Sp(e,[{key:"getMaterialType",value:function(){return c.MeshBasicMaterial}},{key:"extendParams",value:function(e,t,r){var n,i=[];return e.color=new c.Color(1,1,1),e.opacity=1,(t=t.pbrMetallicRoughness)&&(Array.isArray(t.baseColorFactor)&&(n=t.baseColorFactor,e.color.fromArray(n),e.opacity=n[3]),void 0!==t.baseColorTexture&&i.push(r.assignTexture(e,"map",t.baseColorTexture))),Promise.all(i)}}]),e}(),Cp=function(){function e(t){xp(this,e),this.parser=t,this.name=kp.KHR_MATERIALS_CLEARCOAT}return Sp(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?c.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){var r=this.parser;if(!(e=r.json.materials[e]).extensions||!e.extensions[this.name])return Promise.resolve();var n=[];return void 0!==(e=e.extensions[this.name]).clearcoatFactor&&(t.clearcoat=e.clearcoatFactor),void 0!==e.clearcoatTexture&&n.push(r.assignTexture(t,"clearcoatMap",e.clearcoatTexture)),void 0!==e.clearcoatRoughnessFactor&&(t.clearcoatRoughness=e.clearcoatRoughnessFactor),void 0!==e.clearcoatRoughnessTexture&&n.push(r.assignTexture(t,"clearcoatRoughnessMap",e.clearcoatRoughnessTexture)),void 0!==e.clearcoatNormalTexture&&(n.push(r.assignTexture(t,"clearcoatNormalMap",e.clearcoatNormalTexture)),void 0!==e.clearcoatNormalTexture.scale&&(r=e.clearcoatNormalTexture.scale,t.clearcoatNormalScale=new c.Vector2(r,r))),Promise.all(n)}}]),e}(),Dp=function(){function e(t){xp(this,e),this.parser=t,this.name=kp.KHR_MATERIALS_SHEEN}return Sp(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?c.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){var r=this.parser;if(!(e=r.json.materials[e]).extensions||!e.extensions[this.name])return Promise.resolve();var n=[];return void 0!==(t.sheenColor=new c.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&&n.push(r.assignTexture(t,"sheenColorMap",e.sheenColorTexture)),void 0!==e.sheenRoughnessTexture&&n.push(r.assignTexture(t,"sheenRoughnessMap",e.sheenRoughnessTexture)),Promise.all(n)}}]),e}(),Ip=function(){function e(t){xp(this,e),this.parser=t,this.name=kp.KHR_MATERIALS_TRANSMISSION}return Sp(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?c.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){var r=this.parser;if(!(e=r.json.materials[e]).extensions||!e.extensions[this.name])return Promise.resolve();var n=[];return void 0!==(e=e.extensions[this.name]).transmissionFactor&&(t.transmission=e.transmissionFactor),void 0!==e.transmissionTexture&&n.push(r.assignTexture(t,"transmissionMap",e.transmissionTexture)),Promise.all(n)}}]),e}(),jp=function(){function e(t){xp(this,e),this.parser=t,this.name=kp.KHR_MATERIALS_VOLUME}return Sp(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?c.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){if(!(e=(n=this.parser).json.materials[e]).extensions||!e.extensions[this.name])return Promise.resolve();var r=[],n=(e=e.extensions[this.name],t.thickness=void 0!==e.thicknessFactor?e.thicknessFactor:0,void 0!==e.thicknessTexture&&r.push(n.assignTexture(t,"thicknessMap",e.thicknessTexture)),t.attenuationDistance=e.attenuationDistance||0,e.attenuationColor||[1,1,1]);return t.attenuationColor=new c.Color(n[0],n[1],n[2]),Promise.all(r)}}]),e}(),Up=function(){function e(t){xp(this,e),this.parser=t,this.name=kp.KHR_MATERIALS_IOR}return Sp(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?c.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}(),Bp=function(){function e(t){xp(this,e),this.parser=t,this.name=kp.KHR_MATERIALS_SPECULAR}return Sp(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?c.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){var r=this.parser;if(!(e=r.json.materials[e]).extensions||!e.extensions[this.name])return Promise.resolve();var n=[],i=(e=e.extensions[this.name],t.specularIntensity=void 0!==e.specularFactor?e.specularFactor:1,void 0!==e.specularTexture&&n.push(r.assignTexture(t,"specularIntensityMap",e.specularTexture)),e.specularColorFactor||[1,1,1]);return t.specularColor=new c.Color(i[0],i[1],i[2]),void 0!==e.specularColorTexture&&n.push(r.assignTexture(t,"specularColorMap",e.specularColorTexture).then((function(e){e.encoding=c.sRGBEncoding}))),Promise.all(n)}}]),e}(),zp=function(){function e(t){xp(this,e),this.parser=t,this.name=kp.KHR_TEXTURE_BASISU}return Sp(e,[{key:"loadTexture",value:function(e){var t=this.parser,r=t.json;if(!(n=r.textures[e]).extensions||!n.extensions[this.name])return null;var n=n.extensions[this.name],i=t.options.ktx2Loader;if(i)return t.loadTextureImage(e,n.source,i);if(r.extensionsRequired&&0<=r.extensionsRequired.indexOf(this.name))throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}}]),e}(),Np=function(){function e(t){xp(this,e),this.parser=t,this.name=kp.EXT_TEXTURE_WEBP,this.isSupported=null}return Sp(e,[{key:"loadTexture",value:function(e){var t=this.name,r=this.parser,n=r.json;if(!(i=n.textures[e]).extensions||!i.extensions[t])return null;var i=i.extensions[t],o=n.images[i.source],a=r.textureLoader;return o.uri&&null!==(i=r.options.manager.getHandler(o.uri))&&(a=i),this.detectSupport().then((function(i){if(i)return r.loadTextureImage(e,o,a);if(n.extensionsRequired&&0<=n.extensionsRequired.indexOf(t))throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return r.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}(),Fp=function(){function e(t){xp(this,e),this.name=kp.EXT_MESHOPT_COMPRESSION,this.parser=t}return Sp(e,[{key:"loadBufferView",value:function(e){var t=this.parser.json;if((e=t.bufferViews[e]).extensions&&e.extensions[this.name]){var r=e.extensions[this.name],n=(e=this.parser.getDependency("buffer",r.buffer),this.parser.options.meshoptDecoder);if(n&&n.supported)return Promise.all([e,n.ready]).then((function(e){var t=r.byteOffset||0,i=r.byteLength||0,o=r.count,a=r.byteStride,s=new ArrayBuffer(o*a);return e=new Uint8Array(e[0],t,i),n.decodeGltfBuffer(new Uint8Array(s),o,a,e,r.mode,r.filter),s}));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}(),Vp="glTF",Hp=Sp((function e(t){xp(this,e),this.name=kp.KHR_BINARY_GLTF,this.content=null,this.body=null;var r=new DataView(t,0,12);if(this.header={magic:c.LoaderUtils.decodeText(new Uint8Array(t.slice(0,4))),version:r.getUint32(4,!0),length:r.getUint32(8,!0)},this.header.magic!==Vp)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 n=this.header.length-12,i=new DataView(t,12),o=0;o<n;){var a,s=i.getUint32(o,!0),l=(o+=4,i.getUint32(o,!0));o+=4,1313821514===l?(a=new Uint8Array(t,12+o,s),this.content=c.LoaderUtils.decodeText(a)):5130562===l&&(this.body=t.slice(a=12+o,a+s)),o+=s}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")})),Gp=function(){function e(t,r){if(xp(this,e),!r)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=kp.KHR_DRACO_MESH_COMPRESSION,this.json=t,this.dracoLoader=r,this.dracoLoader.preload()}return Sp(e,[{key:"decodePrimitive",value:function(e,t){var r,n,i=this.json,o=this.dracoLoader,a=e.extensions[this.name].bufferView,s=e.extensions[this.name].attributes,l={},u={},c={};for(r in s){var h=rd[r]||r.toLowerCase();l[h]=s[r]}for(n in e.attributes){var p,d,f=rd[n]||n.toLowerCase();void 0!==s[n]&&(p=i.accessors[e.attributes[n]],d=Jp[p.componentType],c[f]=d,u[f]=!0===p.normalized)}return t.getDependency("bufferView",a).then((function(e){return new Promise((function(t){o.decodeDracoFile(e,(function(e){for(var r in e.attributes){var n=e.attributes[r];void 0!==(r=u[r])&&(n.normalized=r)}t(e)}),l,c)}))}))}}]),e}(),Wp=function(){function e(){xp(this,e),this.name=kp.KHR_TEXTURE_TRANSFORM}return Sp(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}(),Xp=function(){Tp(t,c.MeshStandardMaterial);var e=Mp(t);function t(r){xp(this,t),(n=e.call(this)).isGLTFSpecularGlossinessMaterial=!0;var n,i=["#ifdef USE_SPECULARMAP","\tuniform sampler2D specularMap;","#endif"].join("\n"),o=["#ifdef USE_GLOSSINESSMAP","\tuniform sampler2D glossinessMap;","#endif"].join("\n"),a=["vec3 specularFactor = specular;","#ifdef USE_SPECULARMAP","\tvec4 texelSpecular = texture2D( specularMap, vUv );","\t// reads channel RGB, compatible with a glTF Specular-Glossiness (RGBA) texture","\tspecularFactor *= texelSpecular.rgb;","#endif"].join("\n"),s=["float glossinessFactor = glossiness;","#ifdef USE_GLOSSINESSMAP","\tvec4 texelGlossiness = texture2D( glossinessMap, vUv );","\t// reads channel A, compatible with a glTF Specular-Glossiness (RGBA) texture","\tglossinessFactor *= texelGlossiness.a;","#endif"].join("\n"),l=["PhysicalMaterial material;","material.diffuseColor = diffuseColor.rgb * ( 1. - max( specularFactor.r, max( specularFactor.g, specularFactor.b ) ) );","vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );","float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );","material.roughness = max( 1.0 - glossinessFactor, 0.0525 ); // 0.0525 corresponds to the base mip of a 256 cubemap.","material.roughness += geometryRoughness;","material.roughness = min( material.roughness, 1.0 );","material.specularColor = specularFactor;"].join("\n"),u={specular:{value:(new c.Color).setHex(16777215)},glossiness:{value:1},specularMap:{value:null},glossinessMap:{value:null}};return n._extraUniforms=u,n.onBeforeCompile=function(e){for(var t in u)e.uniforms[t]=u[t];e.fragmentShader=e.fragmentShader.replace("uniform float roughness;","uniform vec3 specular;").replace("uniform float metalness;","uniform float glossiness;").replace("#include <roughnessmap_pars_fragment>",i).replace("#include <metalnessmap_pars_fragment>",o).replace("#include <roughnessmap_fragment>",a).replace("#include <metalnessmap_fragment>",s).replace("#include <lights_physical_fragment>",l)},Object.defineProperties(Ep(n),{specular:{get:function(){return u.specular.value},set:function(e){u.specular.value=e}},specularMap:{get:function(){return u.specularMap.value},set:function(e){(u.specularMap.value=e)?this.defines.USE_SPECULARMAP="":delete this.defines.USE_SPECULARMAP}},glossiness:{get:function(){return u.glossiness.value},set:function(e){u.glossiness.value=e}},glossinessMap:{get:function(){return u.glossinessMap.value},set:function(e){(u.glossinessMap.value=e)?(this.defines.USE_GLOSSINESSMAP="",this.defines.USE_UV=""):(delete this.defines.USE_GLOSSINESSMAP,delete this.defines.USE_UV)}}}),delete n.metalness,delete n.roughness,delete n.metalnessMap,delete n.roughnessMap,n.setValues(r),n}return Sp(t,[{key:"copy",value:function(e){return bp(Pp(t.prototype),"copy",this).call(this,e),this.specularMap=e.specularMap,this.specular.copy(e.specular),this.glossinessMap=e.glossinessMap,this.glossiness=e.glossiness,delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this}}]),t}(),qp=function(){function e(){xp(this,e),this.name=kp.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS,this.specularGlossinessParams=["color","map","lightMap","lightMapIntensity","aoMap","aoMapIntensity","emissive","emissiveIntensity","emissiveMap","bumpMap","bumpScale","normalMap","normalMapType","displacementMap","displacementScale","displacementBias","specularMap","specular","glossinessMap","glossiness","alphaMap","envMap","envMapIntensity","refractionRatio"]}return Sp(e,[{key:"getMaterialType",value:function(){return Xp}},{key:"extendParams",value:function(e,t,r){t=t.extensions[this.name];var n,i=(e.color=new c.Color(1,1,1),e.opacity=1,[]);return Array.isArray(t.diffuseFactor)&&(n=t.diffuseFactor,e.color.fromArray(n),e.opacity=n[3]),void 0!==t.diffuseTexture&&i.push(r.assignTexture(e,"map",t.diffuseTexture)),e.emissive=new c.Color(0,0,0),e.glossiness=void 0!==t.glossinessFactor?t.glossinessFactor:1,e.specular=new c.Color(1,1,1),Array.isArray(t.specularFactor)&&e.specular.fromArray(t.specularFactor),void 0!==t.specularGlossinessTexture&&(n=t.specularGlossinessTexture,i.push(r.assignTexture(e,"glossinessMap",n)),i.push(r.assignTexture(e,"specularMap",n))),Promise.all(i)}},{key:"createMaterial",value:function(e){var t=new Xp(e);return t.fog=!0,t.color=e.color,t.map=void 0===e.map?null:e.map,t.lightMap=null,t.lightMapIntensity=1,t.aoMap=void 0===e.aoMap?null:e.aoMap,t.aoMapIntensity=1,t.emissive=e.emissive,t.emissiveIntensity=1,t.emissiveMap=void 0===e.emissiveMap?null:e.emissiveMap,t.bumpMap=void 0===e.bumpMap?null:e.bumpMap,t.bumpScale=1,t.normalMap=void 0===e.normalMap?null:e.normalMap,t.normalMapType=c.TangentSpaceNormalMap,e.normalScale&&(t.normalScale=e.normalScale),t.displacementMap=null,t.displacementScale=1,t.displacementBias=0,t.specularMap=void 0===e.specularMap?null:e.specularMap,t.specular=e.specular,t.glossinessMap=void 0===e.glossinessMap?null:e.glossinessMap,t.glossiness=e.glossiness,t.alphaMap=null,t.envMap=void 0===e.envMap?null:e.envMap,t.envMapIntensity=1,t.refractionRatio=.98,t}}]),e}(),Yp=Sp((function e(){xp(this,e),this.name=kp.KHR_MESH_QUANTIZATION})),Zp=function(){Tp(t,c.Interpolant);var e=Mp(t);function t(r,n,i,o){return xp(this,t),e.call(this,r,n,i,o)}return Sp(t,[{key:"copySampleValue_",value:function(e){for(var t=this.resultBuffer,r=this.sampleValues,n=this.valueSize,i=e*n*3+n,o=0;o!==n;o++)t[o]=r[i+o];return t}}]),t}(),Qp=(Zp.prototype.beforeStart_=Zp.prototype.copySampleValue_,Zp.prototype.afterEnd_=Zp.prototype.copySampleValue_,Zp.prototype.interpolate_=function(e,t,r,n){for(var i=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=2*a,l=3*a,u=n-t,c=e*l,h=c-l,p=-2*(t=(r=(n=(r-t)/u)*n)*n)+3*r,d=t-r,f=1-p,m=d-r+n,v=0;v!==a;v++){var y=o[h+v+a],g=o[h+v+s]*u,b=o[c+v+a],x=o[c+v]*u;i[v]=f*y+m*g+p*b+d*x}return i},new c.Quaternion),Kp=function(){Tp(t,Zp);var e=Mp(t);function t(){return xp(this,t),e.apply(this,arguments)}return Sp(t,[{key:"interpolate_",value:function(e,r,n,i){return e=bp(Pp(t.prototype),"interpolate_",this).call(this,e,r,n,i),Qp.fromArray(e).normalize().toArray(e),e}}]),t}(),Jp={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},$p={9728:c.NearestFilter,9729:c.LinearFilter,9984:c.NearestMipmapNearestFilter,9985:c.LinearMipmapNearestFilter,9986:c.NearestMipmapLinearFilter,9987:c.LinearMipmapLinearFilter},ed={33071:c.ClampToEdgeWrapping,33648:c.MirroredRepeatWrapping,10497:c.RepeatWrapping},td={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},rd={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},nd={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},id={CUBICSPLINE:void 0,LINEAR:c.InterpolateLinear,STEP:c.InterpolateDiscrete};function od(e,t,r){for(var n in r.extensions)void 0===e[n]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[n]=r.extensions[n])}function ad(e,t){void 0!==t.extras&&("object"===gp(t.extras)?Object.assign(e.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function sd(e){for(var t="",r=Object.keys(e).sort(),n=0,i=r.length;n<i;n++)t+=r[n]+":"+e[r[n]]+";";return t}function ld(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 ud=function(){function e(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};xp(this,e),this.json=t,this.extensions={},this.plugins={},this.options=r,this.cache=new Rp,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 createImageBitmap&&!1===/Firefox|^((?!chrome|android).)*safari/i.test(navigator.userAgent)?this.textureLoader=new dp(this.options.manager):this.textureLoader=new c.TextureLoader(this.options.manager),this.options.myOptions.helper.options.setTextureLoader(this.textureLoader),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new c.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}return Sp(e,[{key:"setExtensions",value:function(e){this.extensions=e}},{key:"setPlugins",value:function(e){this.plugins=e}},{key:"parse",value:function(e,t){var r=this,n=this.json,i=this.extensions;this.cache.removeAll(),this._invokeAll((function(e){return e._markDefs&&e._markDefs()})),Promise.all([this.options.myOptions.helper.processInput(n,this)].concat(function(e){return function(e){if(Array.isArray(e))return yp(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||vp(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.")}()}(this._invokeAll((function(e){return e.beforeRoot&&e.beforeRoot()}))))).then((function(){return Promise.all([r.getDependencies("scene"),r.getDependencies("animation"),r.getDependencies("camera")])})).then((function(t){var o={scene:t[0][n.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:n.asset,parser:r,userData:{}};od(i,o,n),ad(o,n),Promise.all(r._invokeAll((function(e){return e.afterRoot&&e.afterRoot(o)}))).then((function(){e(o)}))})).catch(t)}},{key:"_markDefs",value:function(){for(var e=this.json.nodes||[],t=this.json.skins||[],r=this.json.meshes||[],n=0,i=t.length;n<i;n++)for(var o=t[n].joints,a=0,s=o.length;a<s;a++)e[o[a]].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&&(r[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,r){var n=this;if(e.refs[t]<=1)return r;var i=r.clone();return function e(t,r){var i,o=n.associations.get(t),a=(null!=o&&n.associations.set(r,o),mp(t.children.entries()));try{for(a.s();!(i=a.n()).done;){var s=fp(i.value,2),l=s[0];e(s[1],r.children[l])}}catch(e){a.e(e)}finally{a.f()}}(r,i),i.name+="_instance_"+e.uses[t]++,i}},{key:"_invokeOne",value:function(e){var t=Object.values(this.plugins);t.push(this);for(var r=0;r<t.length;r++){var n=e(t[r]);if(n)return n}return null}},{key:"_invokeAll",value:function(e){for(var t=Object.values(this.plugins),r=(t.unshift(this),[]),n=0;n<t.length;n++){var i=e(t[n]);i&&r.push(i)}return r}},{key:"getDependency",value:function(e,t){var r=e+":"+t,n=this.cache.get(r);if(!n){switch(e){case"scene":n=this.loadScene(t);break;case"node":n=this.loadNode(t);break;case"mesh":n=this._invokeOne((function(e){return e.loadMesh&&e.loadMesh(t)}));break;case"accessor":n=this.loadAccessor(t);break;case"bufferView":n=this._invokeOne((function(e){return e.loadBufferView&&e.loadBufferView(t)}));break;case"buffer":n=this.loadBuffer(t);break;case"material":n=this._invokeOne((function(e){return e.loadMaterial&&e.loadMaterial(t)}));break;case"texture":n=this._invokeOne((function(e){return e.loadTexture&&e.loadTexture(t)}));break;case"skin":n=this.loadSkin(t);break;case"animation":n=this.loadAnimation(t);break;case"camera":n=this.loadCamera(t);break;default:throw new Error("Unknown type: "+e)}this.cache.add(r,n)}return n}},{key:"getDependencies",value:function(e){var t,r,n=this.cache.get(e);return n||(r=(t=this).json[e+("mesh"===e?"es":"s")]||[],n=Promise.all(r.map((function(r,n){return t.getDependency(e,n)}))),this.cache.add(e,n)),n}},{key:"loadBuffer",value:function(e){var t=this.json.buffers[e],r=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[kp.KHR_BINARY_GLTF].body);var n=this.options;return new Promise((function(e,i){r.load(c.LoaderUtils.resolveURL(t.uri,n.path),e,void 0,(function(){i(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 r=t.byteLength||0,n=t.byteOffset||0;return e.slice(n,n+r)}))}},{key:"loadAccessor",value:function(e){var t=this,r=this.json,n=this.json.accessors[e];return void 0===n.bufferView&&void 0===n.sparse?Promise.resolve(null):(e=[],void 0!==n.bufferView?e.push(this.getDependency("bufferView",n.bufferView)):e.push(null),void 0!==n.sparse&&(e.push(this.getDependency("bufferView",n.sparse.indices.bufferView)),e.push(this.getDependency("bufferView",n.sparse.values.bufferView))),Promise.all(e).then((function(e){var i,o=e[0],a=td[n.type],s=Jp[n.componentType],l=s.BYTES_PER_ELEMENT,u=n.byteOffset||0,h=void 0!==n.bufferView?r.bufferViews[n.bufferView].byteStride:void 0,p=!0===n.normalized,d=h&&h!==l*a?(f=Math.floor(u/h),m="InterleavedBuffer:"+n.bufferView+":"+n.componentType+":"+f+":"+n.count,(v=t.cache.get(m))||(i=new s(o,f*h,n.count*h/l),v=new c.InterleavedBuffer(i,h/l),t.cache.add(m,v)),new c.InterleavedBufferAttribute(v,a,u%h/l,p)):(i=null===o?new s(n.count*a):new s(o,u,n.count*a),new c.BufferAttribute(i,a,p));if(void 0!==n.sparse){var f=Jp[n.sparse.indices.componentType],m=n.sparse.indices.byteOffset||0,v=n.sparse.values.byteOffset||0,y=new f(e[1],m,n.sparse.count*td.SCALAR),g=new s(e[2],v,n.sparse.count*a);null!==o&&(d=new c.BufferAttribute(d.array.slice(),d.itemSize,d.normalized));for(var b=0,x=y.length;b<x;b++){var w=y[b];if(d.setX(w,g[b*a]),2<=a&&d.setY(w,g[b*a+1]),3<=a&&d.setZ(w,g[b*a+2]),4<=a&&d.setW(w,g[b*a+3]),5<=a)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return d})))}},{key:"loadTexture",value:function(e){var t=this.json,r=this.options,n=t.textures[e].source,i=(t=t.images[n],this.textureLoader);return t.uri&&null!==(r=r.manager.getHandler(t.uri))&&(i=r),this.loadTextureImage(e,n,i)}},{key:"loadTextureImage",value:function(e,t,r){var n=this,i=this.json,o=i.textures[e],a=((a=i.images[t]).uri||a.bufferView)+":"+o.sampler;return this.textureCache[a]?this.textureCache[a]:(t=this.loadImageSource(t,r,e).then((function(t){t.flipY=!1,o.name&&(t.name=o.name);var r=(i.samplers||{})[o.sampler]||{};return t.magFilter=$p[r.magFilter]||c.LinearFilter,t.minFilter=$p[r.minFilter]||c.LinearMipmapLinearFilter,t.wrapS=ed[r.wrapS]||c.RepeatWrapping,t.wrapT=ed[r.wrapT]||c.RepeatWrapping,n.associations.set(t,{textures:e}),n.options.myOptions.helper.material.processTexture({texture:t,textureDef:o}),t})).catch((function(){return null})),this.textureCache[a]=t)}},{key:"loadImageSource",value:function(e,t,r){var n=this.json,i=this.options,o=n.textures[r];if(void 0!==this.sourceCache[e])return this.sourceCache[e].then((function(e){return e.clone()})).catch((function(e){throw e}));var a=n.images[e],s=self.URL||self.webkitURL,l=a.uri||"";if(void 0!==a.bufferView)l=this.getDependency("bufferView",a.bufferView).then((function(e){return e=new Blob([e],{type:a.mimeType}),l=s.createObjectURL(e)}));else if(void 0===a.uri)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");return r=Promise.resolve(l).then((function(e){return new Promise((function(r,n){var a=r;!0===t.isImageBitmapLoader&&(a=function(e,t){(e=new c.Texture(e)).needsUpdate=!0,r({texture:e,blob:t})}),t.load(c.LoaderUtils.resolveURL(e,i.path),a,void 0,n,o)}))})).then((function(e){var r=(e=t.isImageBitmapLoader?e:{texture:e,blob:null}).texture;return e=e.blob,!0===t.isImageBitmapLoader?(r.userData.url=l,r.userData.blob=e):(r.flipY=!1,r.needsUpdate=!0),r.url=l,r})).catch((function(e){throw console.log(e,"error"),console.error("THREE.GLTFLoader: Couldn't load texture",l),e})),this.sourceCache[e]=r}},{key:"assignTexture",value:function(e,t,r){var n=this;return this.getDependency("texture",r.index).then((function(i){var o,a;return void 0===r.texCoord||0==r.texCoord||"aoMap"===t&&1==r.texCoord||console.warn("THREE.GLTFLoader: Custom UV set "+r.texCoord+" for texture "+t+" not yet supported."),n.extensions[kp.KHR_TEXTURE_TRANSFORM]&&(o=void 0!==r.extensions?r.extensions[kp.KHR_TEXTURE_TRANSFORM]:void 0)&&(a=n.associations.get(i),i=n.extensions[kp.KHR_TEXTURE_TRANSFORM].extendTexture(i,o),n.associations.set(i,a)),e[t]=i}))}},{key:"assignFinalMaterial",value:function(e){var t,r,n=e.geometry,i=e.material,o=void 0===n.attributes.tangent,a=void 0!==n.attributes.color,s=void 0===n.attributes.normal;e.isPoints?(t="PointsMaterial:"+i.uuid,(r=this.cache.get(t))||(r=new c.PointsMaterial,c.Material.prototype.copy.call(r,i),r.color.copy(i.color),r.map=i.map,r.sizeAttenuation=!1,this.cache.add(t,r)),i=r):e.isLine&&(t="LineBasicMaterial:"+i.uuid,(r=this.cache.get(t))||(r=new c.LineBasicMaterial,c.Material.prototype.copy.call(r,i),r.color.copy(i.color),this.cache.add(t,r)),i=r),(o||a||s)&&(t="ClonedMaterial:"+i.uuid+":",i.isGLTFSpecularGlossinessMaterial&&(t+="specular-glossiness:"),o&&(t+="derivative-tangents:"),a&&(t+="vertex-colors:"),s&&(t+="flat-shading:"),(r=this.cache.get(t))||(r=i.clone(),a&&(r.vertexColors=!0),s&&(r.flatShading=!0),o&&(r.normalScale&&(r.normalScale.y*=-1),r.clearcoatNormalScale&&(r.clearcoatNormalScale.y*=-1)),this.cache.add(t,r),this.associations.set(r,this.associations.get(i))),i=r),i.aoMap&&void 0===n.attributes.uv2&&void 0!==n.attributes.uv&&n.setAttribute("uv2",n.attributes.uv),this.options.myOptions.helper.material.process({material:i,materialDef:i.userData,model:e}),e.material=i}},{key:"getMaterialType",value:function(){return c.MeshStandardMaterial}},{key:"loadMaterial",value:function(e){var t,r=this,n=this.json,i=this.extensions,o=n.materials[e],a={},s=[],l=((n=o.extensions||{})[kp.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]?(l=i[kp.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS],t=l.getMaterialType(),s.push(l.extendParams(a,o,r))):n[kp.KHR_MATERIALS_UNLIT]?(l=i[kp.KHR_MATERIALS_UNLIT],t=l.getMaterialType(),s.push(l.extendParams(a,o,r))):(n=o.pbrMetallicRoughness||{},a.color=new c.Color(1,1,1),a.opacity=1,Array.isArray(n.baseColorFactor)&&(l=n.baseColorFactor,a.color.fromArray(l),a.opacity=l[3]),void 0!==n.baseColorTexture&&s.push(r.assignTexture(a,"map",n.baseColorTexture)),a.metalness=void 0!==n.metallicFactor?n.metallicFactor:1,a.roughness=void 0!==n.roughnessFactor?n.roughnessFactor:1,void 0!==n.metallicRoughnessTexture&&(s.push(r.assignTexture(a,"metalnessMap",n.metallicRoughnessTexture)),s.push(r.assignTexture(a,"roughnessMap",n.metallicRoughnessTexture))),t=this._invokeOne((function(t){return t.getMaterialType&&t.getMaterialType(e)})),s.push(Promise.all(this._invokeAll((function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,a)}))))),!0===o.doubleSided&&(a.side=c.DoubleSide),o.alphaMode||"OPAQUE");return"BLEND"===l?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,"MASK"===l&&(a.alphaTest=void 0!==o.alphaCutoff?o.alphaCutoff:.5)),void 0!==o.normalTexture&&t!==c.MeshBasicMaterial&&(s.push(r.assignTexture(a,"normalMap",o.normalTexture)),a.normalScale=new c.Vector2(1,1),void 0!==o.normalTexture.scale&&(n=o.normalTexture.scale,a.normalScale.set(n,n))),void 0!==o.occlusionTexture&&t!==c.MeshBasicMaterial&&(s.push(r.assignTexture(a,"aoMap",o.occlusionTexture)),void 0!==o.occlusionTexture.strength&&(a.aoMapIntensity=o.occlusionTexture.strength)),void 0!==o.emissiveFactor&&t!==c.MeshBasicMaterial&&(a.emissive=(new c.Color).fromArray(o.emissiveFactor)),void 0!==o.emissiveTexture&&t!==c.MeshBasicMaterial&&s.push(r.assignTexture(a,"emissiveMap",o.emissiveTexture)),Promise.all(s).then((function(){var n=t===Xp?i[kp.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(a):new t(a);return o.name&&(n.name=o.name),n.map&&(n.map.encoding=c.sRGBEncoding),n.emissiveMap&&(n.emissiveMap.encoding=c.sRGBEncoding),ad(n,o),r.associations.set(n,{materials:e}),o.extensions&&od(i,n,o),n}))}},{key:"createUniqueName",value:function(e){for(var t=c.PropertyBinding.sanitizeNodeName(e||""),r=t,n=1;this.nodeNamesUsed[r];++n)r=t+"_"+n;return this.nodeNamesUsed[r]=!0,r}},{key:"loadGeometries",value:function(e){for(var t=this,r=this.extensions,n=this.primitiveCache,i=[],o=0,a=e.length;o<a;o++){var s=e[o],l=(u=void 0,u=(u=(l=s).extensions&&l.extensions[kp.KHR_DRACO_MESH_COMPRESSION])?"draco:"+u.bufferView+":"+u.indices+":"+sd(u.attributes):l.indices+":"+sd(l.attributes)+":"+l.mode),u=n[l];u?i.push(u.promise):(u=void 0,u=s.extensions&&s.extensions[kp.KHR_DRACO_MESH_COMPRESSION]?function(e){return r[kp.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then((function(r){return cd(r,e,t)}))}(s):cd(new c.BufferGeometry,s,t),n[l]={primitive:s,promise:u},i.push(u))}return Promise.all(i)}},{key:"loadMesh",value:function(e){for(var t=this,r=this.json,n=this.extensions,i=r.meshes[e],o=i.primitives,a=[],s=0,l=o.length;s<l;s++){var u=void 0===o[s].material?(void 0===(u=this.cache).DefaultMaterial&&(u.DefaultMaterial=new c.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:c.FrontSide})),u.DefaultMaterial):this.getDependency("material",o[s].material);u.then((function(e){})),a.push(u)}return a.push(t.loadGeometries(o)),Promise.all(a).then((function(r){for(var a=r.slice(0,r.length-1),s=r[r.length-1],l=[],u=0,h=s.length;u<h;u++){var p=s[u],d=o[u],f=void 0,m=a[u];if(4===d.mode||5===d.mode||6===d.mode||void 0===d.mode)!0!==(f=new(!0===i.isSkinnedMesh?c.SkinnedMesh:c.Mesh)(p,m)).isSkinnedMesh||f.geometry.attributes.skinWeight.normalized||f.normalizeSkinWeights(),5===d.mode?f.geometry=hd(f.geometry,c.TriangleStripDrawMode):6===d.mode&&(f.geometry=hd(f.geometry,c.TriangleFanDrawMode));else if(1===d.mode)f=new c.LineSegments(p,m);else if(3===d.mode)f=new c.Line(p,m);else if(2===d.mode)f=new c.LineLoop(p,m);else{if(0!==d.mode)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+d.mode);f=new c.Points(p,m)}if(0<Object.keys(f.geometry.morphAttributes).length){S=w=x=b=g=v=void 0;var v=f,y=i;if(v.updateMorphTargets(),void 0!==y.weights)for(var g=0,b=y.weights.length;g<b;g++)v.morphTargetInfluences[g]=y.weights[g];if(y.extras&&Array.isArray(y.extras.targetNames)){var x=y.extras.targetNames;if(v.morphTargetInfluences.length===x.length){v.morphTargetDictionary={};for(var w=0,S=x.length;w<S;w++)v.morphTargetDictionary[x[w]]=w}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}f.name=t.createUniqueName(i.name||"mesh_"+e),ad(f,i),d.extensions&&od(n,f,d),t.assignFinalMaterial(f),l.push(f)}for(var T=0,_=l.length;T<_;T++)t.associations.set(l[T],{meshes:e,primitives:T});if(1===l.length)return l[0];var M=new c.Group;t.associations.set(M,{meshes:e});for(var E=0,P=l.length;E<P;E++)M.add(l[E]);return M}))}},{key:"loadCamera",value:function(e){var t,r=(e=this.json.cameras[e])[e.type];if(r)return"perspective"===e.type?t=new c.PerspectiveCamera(c.MathUtils.radToDeg(r.yfov),r.aspectRatio||1,r.znear||1,r.zfar||2e6):"orthographic"===e.type&&(t=new c.OrthographicCamera(-r.xmag,r.xmag,r.ymag,-r.ymag,r.znear,r.zfar)),e.name&&(t.name=this.createUniqueName(e.name)),ad(t,e),Promise.resolve(t);console.warn("THREE.GLTFLoader: Missing camera parameters.")}},{key:"loadSkin",value:function(e){var t={joints:(e=this.json.skins[e]).joints};return void 0===e.inverseBindMatrices?Promise.resolve(t):this.getDependency("accessor",e.inverseBindMatrices).then((function(e){return t.inverseBindMatrices=e,t}))}},{key:"loadAnimation",value:function(e){for(var t=this.json.animations[e],r=[],n=[],i=[],o=[],a=[],s=0,l=t.channels.length;s<l;s++){var u=t.channels[s],h=t.samplers[u.sampler],p=void 0!==(u=u.target).node?u.node:u.id,d=void 0!==t.parameters?t.parameters[h.input]:h.input,f=void 0!==t.parameters?t.parameters[h.output]:h.output;r.push(this.getDependency("node",p)),n.push(this.getDependency("accessor",d)),i.push(this.getDependency("accessor",f)),o.push(h),a.push(u)}return Promise.all([Promise.all(r),Promise.all(n),Promise.all(i),Promise.all(o),Promise.all(a)]).then((function(r){for(var n=r[0],i=r[1],o=r[2],a=r[3],s=r[4],l=[],u=0,h=n.length;u<h;u++)!function(e){var t=n[e],r=i[e],u=o[e],h=a[e],p=s[e];if(void 0!==t){t.updateMatrix(),t.matrixAutoUpdate=!0;var d=void 0;switch(nd[p.path]){case nd.weights:d=c.NumberKeyframeTrack;break;case nd.rotation:d=c.QuaternionKeyframeTrack;break;default:d=c.VectorKeyframeTrack}e=t.name||t.uuid;var f=void 0!==h.interpolation?id[h.interpolation]:c.InterpolateLinear,m=[],v=(nd[p.path]===nd.weights?t.traverse((function(e){e.morphTargetInfluences&&m.push(e.name||e.uuid)})):m.push(e),u.array);if(u.normalized){for(var y=ld(v.constructor),g=new Float32Array(v.length),b=0,x=v.length;b<x;b++)g[b]=v[b]*y;v=g}for(var w=0,S=m.length;w<S;w++){var T=new d(m[w]+"."+nd[p.path],r.array,v,f);"CUBICSPLINE"===h.interpolation&&(T.createInterpolant=function(e){return new(this instanceof c.QuaternionKeyframeTrack?Kp:Zp)(this.times,this.values,this.getValueSize()/3,e)},T.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0),l.push(T)}}}(u);return r=t.name||"animation_"+e,new c.AnimationClip(r,void 0,l)}))}},{key:"createNodeMesh",value:function(e){var t=this.json,r=this,n=t.nodes[e];return void 0===n.mesh?null:r.getDependency("mesh",n.mesh).then((function(e){return e=r._getNodeRef(r.meshCache,n.mesh,e),void 0!==n.weights&&e.traverse((function(e){if(e.isMesh)for(var t=0,r=n.weights.length;t<r;t++)e.morphTargetInfluences[t]=n.weights[t]})),e}))}},{key:"loadNode",value:function(e){var t,r=this.json,n=this.extensions,i=this,o=r.nodes[e],a=o.name?i.createUniqueName(o.name):"";return t=[],(r=i._invokeOne((function(t){return t.createNodeMesh&&t.createNodeMesh(e)})))&&t.push(r),void 0!==o.camera&&t.push(i.getDependency("camera",o.camera).then((function(e){return i._getNodeRef(i.cameraCache,o.camera,e)}))),i._invokeAll((function(t){return t.createNodeAttachment&&t.createNodeAttachment(e)})).forEach((function(e){t.push(e)})),Promise.all(t).then((function(t){var r,s=!0===o.isBone?new c.Bone:1<t.length?new c.Group:1===t.length?t[0]:new c.Object3D;if(s!==t[0])for(var l=0,u=t.length;l<u;l++)s.add(t[l]);return o.name&&(s.userData.name=o.name,s.name=a),ad(s,o),o.extensions&&od(n,s,o),void 0!==o.matrix?((r=new c.Matrix4).fromArray(o.matrix),s.applyMatrix4(r)):(void 0!==o.translation&&s.position.fromArray(o.translation),void 0!==o.rotation&&s.quaternion.fromArray(o.rotation),void 0!==o.scale&&s.scale.fromArray(o.scale)),i.associations.has(s)||i.associations.set(s,{}),i.associations.get(s).nodes=e,i.options.myOptions.helper.processNode({node:s,nodeDef:o})||s}))}},{key:"loadScene",value:function(e){for(var t=this.json,r=this.extensions,n=(e=this.json.scenes[e],this),i=new c.Group,o=(i.isLoadScene=!0,e.name&&(i.name=n.createUniqueName(e.name)),ad(i,e),e.extensions&&od(r,i,e),e.nodes||[]),a=[],s=0,l=o.length;s<l;s++)a.push(function e(t,r,n,i){var o=n.nodes[t];return i.getDependency("node",t).then((function(e){return void 0===o.skin?e:i.getDependency("skin",o.skin).then((function(e){for(var r=[],n=0,o=(t=e).joints.length;n<o;n++)r.push(i.getDependency("node",t.joints[n]));return Promise.all(r)})).then((function(r){return e.traverse((function(e){if(e.isMesh){for(var n=[],i=[],o=0,a=r.length;o<a;o++){var s=r[o];s?(n.push(s),s=new c.Matrix4,void 0!==t.inverseBindMatrices&&s.fromArray(t.inverseBindMatrices.array,16*o),i.push(s)):console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[o])}e.bind(new c.Skeleton(n,i),e.matrixWorld)}})),e}));var t})).then((function(t){r.isLoadScene&&null!=(a=n.asset.ex)&&a.type,r.add(t);var a,s=[];if(o.children)for(var l=o.children,u=0,c=l.length;u<c;u++){var h=l[u];s.push(e(h,t,n,i))}return Promise.all(s)}))}(o[s],i,t,n));return Promise.all(a).then((function(){return n.options.myOptions&&n.options.myOptions.models.push(i),n.associations=function(e){var t,r=new Map,i=mp(n.associations);try{for(i.s();!(t=i.n()).done;){var o=fp(t.value,2),a=o[0],s=o[1];(a instanceof c.Material||a instanceof c.Texture)&&r.set(a,s)}}catch(e){i.e(e)}finally{i.f()}return e.traverse((function(e){var t=n.associations.get(e);null!=t&&r.set(e,t)})),r}(i),i}))}}]),e}();function cd(e,t,r){var n,i=t.attributes,o=[];for(n in i){var a=rd[n]||n.toLowerCase();a in e.attributes||o.push(function(t,n){return r.getDependency("accessor",t).then((function(t){e.setAttribute(n,t)}))}(i[n],a))}void 0===t.indices||e.index||(s=r.getDependency("accessor",t.indices).then((function(t){e.setIndex(t)})),o.push(s)),ad(e,t);var s=e,l=t,u=r,h=l.attributes,p=new c.Box3;if(void 0!==h.POSITION){var d=(h=u.json.accessors[h.POSITION]).min,f=h.max;if(void 0===d||void 0===f)console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");else{p.set(new c.Vector3(d[0],d[1],d[2]),new c.Vector3(f[0],f[1],f[2])),h.normalized&&(d=ld(Jp[h.componentType]),p.min.multiplyScalar(d),p.max.multiplyScalar(d));var m=l.targets;if(void 0!==m){for(var v=new c.Vector3,y=new c.Vector3,g=0,b=m.length;g<b;g++){var x,w,S=m[g];void 0!==S.POSITION&&(w=(S=u.json.accessors[S.POSITION]).min,x=S.max,void 0!==w&&void 0!==x?(y.setX(Math.max(Math.abs(w[0]),Math.abs(x[0]))),y.setY(Math.max(Math.abs(w[1]),Math.abs(x[1]))),y.setZ(Math.max(Math.abs(w[2]),Math.abs(x[2]))),S.normalized&&(w=ld(Jp[S.componentType]),y.multiplyScalar(w)),v.max(y)):console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION."))}p.expandByVector(v)}s.boundingBox=p,f=new c.Sphere,p.getCenter(f.center),f.radius=p.min.distanceTo(p.max)/2,s.boundingSphere=f}}return Promise.all(o).then((function(){if(void 0===t.targets)return e;for(var n=e,i=t.targets,o=r,a=!1,s=!1,l=!1,u=0,c=i.length;u<c;u++){var h=i[u];if(void 0!==h.POSITION&&(a=!0),void 0!==h.NORMAL&&(s=!0),void 0!==h.COLOR_0&&(l=!0),a&&s&&l)break}if(!a&&!s&&!l)return Promise.resolve(n);for(var p=[],d=[],f=[],m=0,v=i.length;m<v;m++){var y,g=i[m];a&&(y=void 0!==g.POSITION?o.getDependency("accessor",g.POSITION):n.attributes.position,p.push(y)),s&&(y=void 0!==g.NORMAL?o.getDependency("accessor",g.NORMAL):n.attributes.normal,d.push(y)),l&&(g=void 0!==g.COLOR_0?o.getDependency("accessor",g.COLOR_0):n.attributes.color,f.push(g))}return Promise.all([Promise.all(p),Promise.all(d),Promise.all(f)]).then((function(e){var t=e[0],r=e[1];return e=e[2],a&&(n.morphAttributes.position=t),s&&(n.morphAttributes.normal=r),l&&(n.morphAttributes.color=e),n.morphTargetsRelative=!0,n}))}))}function hd(e,t){var r=e.getIndex();if(null===r){var n=[],i=e.getAttribute("position");if(void 0===i)return console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(var o=0;o<i.count;o++)n.push(o);e.setIndex(n),r=e.getIndex()}var a=r.count-2,s=[];if(t===c.TriangleFanDrawMode)for(var l=1;l<=a;l++)s.push(r.getX(0)),s.push(r.getX(l)),s.push(r.getX(l+1));else for(var u=0;u<a;u++)u%2==0?(s.push(r.getX(u)),s.push(r.getX(u+1)),s.push(r.getX(u+2))):(s.push(r.getX(u+2)),s.push(r.getX(u+1)),s.push(r.getX(u)));return s.length/3!=a&&console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Unable to generate correct amount of triangles."),(t=e.clone()).setIndex(s),t}class pd{constructor(e,t){this.materialMap={},this.textureMap={},this.materialIns={},this.textureIns={},this.pending=[],this.parser=null,this.processTextureMap=(()=>{const e=e=>{const{target:t,data:r}=e;var n;r&&(({x:e,y:n}="object"==typeof r?r:{x:r,y:r}),t.x=e,t.y=n)};return t=>{(0,Xe.js)(t,((t,r)=>{var{format:r,center:n,rotation:i,offset:o,repeat:a}=r;const s=this.textureIns[t];s&&(s.format=r,e({target:s.repeat,data:a}),e({target:s.center,data:n}),e({target:s.offset,data:o}),i&&(s.rotation=i),this.runScene.textureEx.initTextureAndAddtoAll(s))}))}})(),this.processMaterialMap=(()=>{const e=e=>{const{textures:t,normal:r,models:n,material:i}=e;this.runScene.optionsEx.options.texture.load&&this.processBaseMaterialTextures({material:i,textures:t}),this.runScene.materialEx.parseNromals(r,i),n.map((e=>e.material=i))},t=e=>{const{textures:t,normal:r,models:n,material:i}=e;e=(0,Xe.js)(t,((e,t)=>({type:e,texture:this.textureIns[t]})));const o=this.runScene.materialEx.getDataByType(r.type,{normal:r,textures:e,models:n,material:i});this.runScene.materialEx.parseNromals(r,o),o&&n.map((e=>e.material=o))};return r=>{(0,Xe.js)(r,((r,n)=>{const{material:i,models:o}=this.materialIns[r];i&&(({normal:r,textures:n}=n),(r.type?t:e)({textures:n,models:o,material:i,normal:r}),i.needsUpdate=!0)}))}})(),this.baseMaterialTextures=[],this.processBaseMaterialTextures=e=>{const{textures:t,material:r}=e;(0,Xe.js)(t,((e,t)=>{var n;(t=this.textureIns[t])&&(this.runScene.optionsEx.options.texture.lazyLoad.open&&"scene"===(null==(n=this.parser)?void 0:n.json.asset.ex.type)&&(null==(n=this.parser)?void 0:n.json.asset.ex.sceneEx.materialId)!==r.userData.id?this.baseMaterialTextures.push({material:r,type:e,texture:t}):(this.runScene.uniqueEx.texture.addMaterial(t,{material:r,type:e}),Ka({material:r,type:e,texture:t})))}))},this.lazyLoad=(()=>{const e=()=>{this.loadConfig.triggerCb&&this.runScene.optionsEx.cb.load.lazyLoadedTexture.cb(""),this.runScene.optionsEx.log("贴图懒加载完毕","base","success")},t=(r,n)=>{var i=this.baseMaterialTextures[r];if(!i)return n(),e();const{texture:o,type:a,material:s}=i;this.runScene.uniqueEx.texture.addMaterial(o,{material:s,type:a}),Ka({material:s,type:a,texture:o}),s.needsUpdate=!0,setTimeout((()=>t(++r,n)),this.runScene.optionsEx.options.texture.lazyLoad.intervalTime)};return()=>new Promise((r=>{if(!this.runScene.optionsEx.options.texture.lazyLoad.open)return r(0),e();t(0,r)}))})(),this.runScene=e}processInput(e,t){return function(e,t,r,n){return new(r=r||Promise)((function(t,i){function o(e){try{s(n.next(e))}catch(e){i(e)}}function a(e){try{s(n.throw(e))}catch(e){i(e)}}function s(e){var n;e.done?t(e.value):((n=e.value)instanceof r?n:new r((function(e){e(n)}))).then(o,a)}s((n=n.apply(e,[])).next())}))}(this,0,void 0,(function*(){this.parser=t}))}processTexture(e){const{textureDef:t,texture:r}=e;var{md5:e,format:n,size:i}=t;r.userData.md5=e,n&&(r.format=n,r.userData.format=n),r.userData.size=i,this.textureIns[t.id]=this.runScene.textureEx.getSameTexture(e,r)||r}process(e){var{materialDef:e,material:t,model:r}=e;Ja(t),this.materialIns[e.id]||(this.materialIns[e.id]={material:t,models:[]}),this.materialIns[e.id].models.push(r)}done(e){var{materialMap:e,textureMap:t}=e.asset.ex||{};return this.processTextureMap(t||{}),this.processMaterialMap(e||{}),this.pending.push(this.lazyLoad()),Promise.all(this.pending)}}class dd{constructor(e,t){this.runScene=e}done(e){var t,r,n,i;e.asset.ex&&(({camera:e,lights:t,sceneEx:r,options:n,controls:i}=e.asset.ex),this.camera(e),this.controls(i),this.lights(t),this.ex(r),this.options(n))}controls(e){var t,r;e&&(({x:e,y:t,z:r}=e),this.runScene.assetsEx.controls.target.set(e,t,r),this.runScene.assetsEx.controls.update())}camera(e){var{position:e,far:t,near:r,fov:n,name:i,userData:o}=this.runScene.loaderer.object.parse(e);const a=this.runScene.assetsEx.get().camera;a.position.copy(e),a.far=t,a.near=r,a.fov=n,a.name=i,a.updateProjectionMatrix(),a.userData.id=o.id,this.runScene.uniqueEx.model.add(a),this.runScene.assetsEx.get().controls.update()}lights(e){e.map((e=>{var t=e.type;(t=this.runScene.lightEx.lightExMap[t].parseJSON(e)).target&&this.runScene.modelEx.setSelectByModel(t.target),this.runScene.lightEx.setNull(t)}))}ex(e){var t,r;e=e.fog;const n=this.runScene.sceneEx.get();e&&(({color:e,near:t,far:r}=e),n.fog=new c.Fog(e,t,r),this.runScene.optionsEx.cb.setScene.cb({scene:n,type:"fog"}))}options(e){e.map((e=>{var{type:e,data:t}=e;const r=this.runScene.exporter.gltf.options.getParse(e);null!=r&&r.parse(t)}))}}class fd{constructor(e,t){this.runScene=e}setTextureLoader(e){this.textureLoader=e,this.initTextureLoader(e)}initTextureLoader(e){e instanceof dp&&e.setOptions({textureQuality:this.runScene.optionsEx.options.texture.quality})}}class md{constructor(e,t){this.helperModels=[],this.pending=[],this.nodeType={MySpriteMaterial:$a},this.cloneMap={},this.runScene=e,this.material=new pd(e,t),this.scene=new dd(e,t),this.options=new fd(e,t)}processInput(e,t){return function(e,t,r,n){return new(r=r||Promise)((function(t,i){function o(e){try{s(n.next(e))}catch(e){i(e)}}function a(e){try{s(n.throw(e))}catch(e){i(e)}}function s(e){var n;e.done?t(e.value):((n=e.value)instanceof r?n:new r((function(e){e(n)}))).then(o,a)}s((n=n.apply(e,[])).next())}))}(this,0,void 0,(function*(){this.material.processInput(e,t)}))}beforeLoader(e){this.runScene.loaderer.gltf.beforeParse(null==(e=null==(e=e.asset)?void 0:e.ex)?void 0:e.type)}processNode(e){var t;let{node:r,nodeDef:n}=e;if((0,Xe.js)(this.runScene.modelEx.defNodeMap,((e,t)=>{var i=n[e];null!=i&&(r[e]=i)})),n.extras){const{layers:o,normal:a,local:s,cloneId:l,id:u,animations:c}=n.extras;if(c&&this.runScene.anima.parse(r,c),l&&(this.cloneMap[l]||(this.cloneMap[l]=new Set),u&&this.cloneMap[l].add(u)),s&&([e,t,i]=s.split(","),r.position.set(e,t,i)),o&&(r.layers.enable(1),this.runScene.optionsEx.cb.model.setLayers.cb({model:r,val:1})),n.extras.isHelper&&this.helperModels.push(r),a){const n=this.nodeType[null==a?void 0:a.type].modelTools.parseData(r,a);var i=null==(t=null==(e=null==r?void 0:r.material)?void 0:e.userData)?void 0:t.id;if(i){const e=this.material.materialIns[i];if(e){const t=[];e.models.map((e=>{e===r?t.push(n):t.push(e)})),e.models=t}}r=n}}return n.wireframe&&(r.material.wireframe=!0),r}done(e){var t;return this.pending.push(this.material.done(e)),"scene"===(null==(t=e.asset.ex)?void 0:t.type)&&(this.scene.done(e),this.sceneEx(e)),this.removeHelperModel(),Promise.all(this.pending)}mergeGeometry(){}mergeClone(){this.runScene.optionsEx.options.instanceClone&&(0,Xe.js)(this.cloneMap,((e,t)=>{const r=this.runScene.uniqueEx.model.get(e);(e=[...t].map((e=>{if((null==(e=this.runScene.uniqueEx.model.get(e))?void 0:e.material)===r.material)return this.runScene.modelEx.remove(e,!1),e})).filter((e=>e))).length&&(t=ls(r,e),this.runScene.modelEx.add(t,r.parent),this.runScene.modelEx.remove(r,!1))}))}sceneEx(e){const t=this.runScene.sceneEx.get();var r=this.material.materialIns,{materialId:e,backgroundMapping:n,backgroundColor:i,fog:o}=e.asset.ex.sceneEx;if(e&&(e=null==(r=r[e])?void 0:r.material)){const{map:r,envMap:i}=e;r&&(r.mapping=n||300,r.needsUpdate=!0,this.runScene.sceneEx.setBackground(r,!1),r.userData.isBackgroud=!0),i&&(t.environment=Ci(i))}i&&(t.background=new c.Color("#"+i)),o&&(({color:r,far:e,near:n}=o),t.fog=new c.Fog("#"+r,n,e),t.fog.open="true"),this.runScene.optionsEx.cb.setScene.cb({scene:t,type:"any"})}removeHelperModel(){this.helperModels.map((e=>{var t;return null==(t=e.parent)?void 0:t.remove(e)}))}}class vd{constructor(e){this.dracoPath="./draco/",this._gltf=new Op,this.runScene=e;const t=new op;t.setDecoderPath(this.runScene.optionsEx.options.decodePath),this._gltf.setDRACOLoader(t)}load(e,t){return function(e,t,r,n){return new(r=r||Promise)((function(t,i){function o(e){try{s(n.next(e))}catch(e){i(e)}}function a(e){try{s(n.throw(e))}catch(e){i(e)}}function s(e){var n;e.done?t(e.value):((n=e.value)instanceof r?n:new r((function(e){e(n)}))).then(o,a)}s((n=n.apply(e,[])).next())}))}(this,0,void 0,(function*(){var r=yield Jo(e);return r?this.parse(r,t):Promise.resolve()}))}parse(e,t){const r=$o({addToScene:!0,cleanJSON:!0,triggerCb:!1},t||{});return new Promise((t=>{try{e instanceof ArrayBuffer&&this._gltf.parse(e,"",(e=>{e=this.afterParse(e.parser.options.myOptions,e,r),t(e)}),(e=>{console.log(e,"_a")}),{rootModel:this.runScene.assetsEx.get().scene,models:[],helper:new md(this.runScene,r),runScene:this.runScene})}catch(e){throw this.runScene.optionsEx.log("加载场景出错:"+e),TypeError(e)}}))}beforeParse(e){"scene"===e&&this.runScene.optionsEx.sceneOptions.loaded&&this.runScene.sceneEx.clean()}afterParse(e,t,r){var n;const i=e.helper.done(t),{addToScene:o,cleanJSON:a,triggerCb:s}=r;var l=e.models;let u=[];return"material"===(null==(n=t.asset.ex)?void 0:n.type)?this.parseMaterial(l):(u="model"===(null==(n=t.asset.ex)?void 0:n.type)?this.parseModel(l[0],o):this.parseScene({model:l[0],json:t,config:r}),this.runScene.modelEx.selectNull(),e.helper.mergeClone(),this.runScene.optionsEx.log(t,"detail"),i.then((()=>{s&&this.runScene.optionsEx.cb.load.complete.cb("")}))),!1!==a&&this.disposeJSON(t),this.runScene.optionsEx.sceneOptions.loaded=!0,u}parseMaterial(e){var t,[e]=e;(e=this.runScene.sceneEx.cleanUnlessLevel(e).material)&&(this.runScene.materialEx.add(e),(t=this.runScene.modelEx.select)&&this.runScene.materialEx.resetMaterial(t,e))}parseModel(e,t){return e="glb_model"===e.name&&(null==e?void 0:e.children[0])||e,t&&this.runScene.modelEx.add(e,void 0,{addUndo:!1,select:!1,isClone:!0}),[e]}parseScene(e){const{model:t,json:r,config:n}=e;var{addToScene:e,triggerCb:i}=n,o=t.children.filter((e=>this.runScene.modelEx.isUnless(e)?void 0:e));return!1!==e&&this.runScene.modelEx.add(o,void 0,{addUndo:!1,select:!1}),this.runScene.timeLineEx.parseSavedGroupMap(r.asset.ex.timeLine||{}),i&&this.runScene.optionsEx.cb.load.loaded.cb(""),o}disposeJSON(e){(0,Xe.js)(e,(t=>delete e[t])),e=null}}class yd{constructor(e){this.imgBitMap=new c.ImageBitmapLoader,this.object=new c.ObjectLoader,this.runScene=e,this.gltf=new vd(e)}}const gd=new class{constructor(){this.load=new c.AnimationLoader}parse(e){return this.load.parse(e)}};var bd=a(185);class xd{constructor(e){this.selectors={},this.boxHelperMap={},(this.runScene=e).events.mouse.bindEvent({type:"up",local:"local",name:"MultipSelector",fn:t=>{e.events.key.ctrl||this.setEmpty()}})}add(e,t=!1){if("array"===(0,bd.getType)(e))return e.map((e=>this.add(e)));var r=this.runScene.modelEx.select;if(r&&(this.runScene.modelEx.selectNull(),delete this.selectors[e.uuid],this.add(r)),"BoxHelper"!==e.type){if(this.selectors[e.uuid]){if(this.remove(e),this.removeBoxHelper(e),!t)return;this.add(e)}this.addBoxHelper(e),this.selectors[e.uuid]=e,this.runScene.optionsEx.cb.model.focus.cb({model:e,status:!0,domActive:!0}),this.runScene.helperEx.focus(e)}}setInfo(e,t,r,n,i,o){"position"!==t&&(i=n,o=r);const a=this.getSelectedList("value");var{x:i,y:s,z:l}=i;const u=i-o.x,c=s-o.y,h=l-o.z,p=[new is({target:e,info:t,oldV3:this.runScene.modelEx.cloneV3(r),newV3:n,runScene:this.runScene}).execute()];a.map((r=>{if(r!==e){var{x:n,y:i,z:o}=r[t],n=n+=u,i=i+=c,o=o+=h;let e=r[t].clone();e.x=n,e.y=i,e.z=o,n=new is({target:r,info:t,oldV3:this.runScene.modelEx.cloneV3(r[t]),newV3:e,runScene:this.runScene}).execute(),p.push(n),this.boxHelperMap[r.uuid].setFromObject(r)}})),this.runScene.undoEx.addUndo(p)}getLast(){var e=this.getSelectedList("value");return e[e.length-1]}addBoxHelper(e){var t=this.runScene.helperEx.getBoxHelper(e);this.boxHelperMap[e.uuid]=t}removeBoxHelper(e){this.runScene.assetsEx.get().scene.remove(this.boxHelperMap[e.uuid]),this.boxHelperMap[e.uuid]=null,delete this.selectors[e.uuid]}remove(e){if(e instanceof Array)return e.map((e=>this.remove(e)));this.runScene.optionsEx.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(){var e=Object.values(this.boxHelperMap);this.runScene.assetsEx.get().scene.remove(...e),this.boxHelperMap={}}setEmpty(){this.getSelectedList("value").map((e=>{this.runScene.optionsEx.cb.model.unFocus.cb(e)})),this.setBoxHelperEmpty(),this.selectors={}}createGroup(){this.runScene.helperEx.unfocus(),this.runScene.modelEx.selectNull();var e=new c.Group;const t=new c.Group;this.runScene.modelEx.add(e,void 0,{addUndo:!1}),this.runScene.modelEx.add(t);var r=[...this.getSelectedList("value")],n=(this.runScene.optionsEx.cb.model.multipDrop.cb(this.getSelectedList("value"),e),Ma().group.getCenter(e));t.position.copy(n),this.runScene.optionsEx.cb.model.multipDrop.cb(r,t),this.runScene.modelEx.remove(e,!1),this.runScene.modelEx.select=t}getSelectorGroup(){const e=this.getSelectedList("value"),t=new c.Group;return e.forEach((e=>t.add(e.clone()))),this.setEmpty(),t}}function wd(){var e=0,t=document.createElement("div");function r(e){return t.appendChild(e.dom),e}function n(r){for(var n=0;n<t.children.length;n++)t.children[n].style.display=n===r?"block":"none";e=r}t.style.cssText="position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000",t.addEventListener("click",(function(r){r.preventDefault(),n(++e%t.children.length)}),!1);var i,o=(performance||Date).now(),a=o,s=0,l=r(new wd.Panel("FPS","#0ff","#002")),u=r(new wd.Panel("MS","#0f0","#020"));return self.performance&&self.performance.memory&&(i=r(new wd.Panel("MB","#f08","#201"))),n(0),{REVISION:16,dom:t,addPanel:r,showPanel:n,begin:function(){o=(performance||Date).now()},end:function(){s++;var e,t=(performance||Date).now();return u.update(t-o,200),a+1e3<=t&&(l.update(1e3*s/(t-a),100),a=t,s=0,i&&(e=performance.memory,i.update(e.usedJSHeapSize/1048576,e.jsHeapSizeLimit/1048576))),t},update:function(){o=this.end()},domElement:t,setMode:n}}wd.Panel=function(e,t,r){var n=1/0,i=0,o=Math.round,a=o(window.devicePixelRatio||1),s=80*a,l=48*a,u=3*a,c=2*a,h=3*a,p=15*a,d=74*a,f=30*a,m=document.createElement("canvas"),v=(m.width=s,m.height=l,m.style.cssText="width:80px;height:48px",m.getContext("2d"));return v.font="bold "+9*a+"px Helvetica,Arial,sans-serif",v.textBaseline="top",v.fillStyle=r,v.fillRect(0,0,s,l),v.fillStyle=t,v.fillText(e,u,c),v.fillRect(h,p,d,f),v.fillStyle=r,v.globalAlpha=.9,v.fillRect(h,p,d,f),{dom:m,update:function(l,y){n=Math.min(n,l),i=Math.max(i,l),v.fillStyle=r,v.globalAlpha=1,v.fillRect(0,0,s,p),v.fillStyle=t,v.fillText(o(l)+" "+e+" ("+o(n)+"-"+o(i)+")",u,c),v.drawImage(m,h+a,p,d-a,f,h,p,d-a,f),v.fillRect(h+d-a,p,a,f),v.fillStyle=r,v.globalAlpha=.9,v.fillRect(h+d-a,p,a,o((1-l/y)*f))}}};const Sd=wd;class Td{constructor(e){this.options={msg:{show:!1,level:"base"},run:!0,decodePath:"./draco/",showFps:!1,loadInterval:2e3,mode:"running",hideLocal:!1,instanceClone:!1,render2:!1,render3:!1,texture:{load:!0,lazyLoad:{open:!1,intervalTime:16.6},quality:1}},this.exporterOptions={compressTexture:!1,notMaterial:!1},this.sceneOptions={loaded:!1},this.setLoadInterval=(()=>{let e=null;return t=>{const{inputInterval:r,cb:n}=t;e&&clearTimeout(e),e=setTimeout((()=>{n(),e=null,clearTimeout(e)}),r)}})(),this.runScene=e,this.cb=e.cb}init(e){this.options=ba(this.options,e||{}),this.options.showFps&&(this.addFps(),this.cb.render.add("optionx-ex-render",this.render.bind(this)))}addFps(){this.stats=Sd(),this.stats.showPanel(0),this.runScene.assetsEx.engineDom.appendChild(this.stats.dom)}render(){var e;null!=(e=this.stats)&&e.update()}log(e,t="detail",r="success"){var n;null!=(n=null==(n=this.options)?void 0:n.msg)&&n.show&&("base"===this.options.msg.level&&"base"===t&&this.cb.baseLog.cb(e,r),console.log(e))}}class _d{constructor(e,t){this.showTransform=!1,this.data=new Proxy({},{set:(e,t,r)=>(e[t]=r,!0)}),this.uuid="",this.getAnimaByModelData=(()=>{const e=(e,t,r,n)=>{const i={},o={};if(e=_d.isNotNow(e)?this.getAllData():e,(0,Xe.js)(n,((r,n)=>{void 0!==e[r]&&("number"===(n=n.type)?(i[r]=t[r],o[r]=e[r]):"color"===n&&(0,Xe.js)(e[r],((e,n)=>{var a=r+e;i[a]=t[r][e],o[a]=n})))})),!(0,Xe.CV)(i))return{begin:i,end:o}};return(t,r,n,i=!1,o)=>{let a=i?n.time:0;const s=Object.keys(t).sort(((e,t)=>i?Number(t)-Number(e):Number(e)-Number(t)));var l=(0,Ea.lastArrayEle)(s),u=i?"0.00":String(n.time);return l!==u&&(t[u]=Object.assign({},l),s.push(u)),s.map((s=>{var l=t[String(s)],u=.001*((u=i?a-s:s-a)<=0?.001:u)*n.speed;a=s;{var c=r,h=l,p=u,d=o;const t={color(e){const{animaData:t,defType:r}=e,n={};(0,Xe.js)(t,(e=>{var i;-1!==e.indexOf(r)&&(i=e.substring(r.length),["r","g","b"].includes(i)&&(n[i]=t[e]))}));var{r:e,g:i,b:o}=n;if((0,bd.isTrue)(e)&&(0,bd.isTrue)(i)&&(0,bd.isTrue)(o))return n}};return()=>{let r;return{promise:new Promise((n=>{var i;if(!(i=e(h,c,0,d)))return n(0);var{begin:i,end:o}=i;return r=_o(i,o,p,(e=>{(0,Xe.js)(d,((r,n)=>{n=n.type;var i,o=e[r];"number"===n?c[r]=o:"color"===n&&(o=t.color({animaData:e,defType:r}))&&(({r:n,g:o,b:i}=o),c[r].setRGB(n,o,i))}))}),n)})),anima:r}}}}))}})(),this.runScene=t,this.target=e,this.target.userData.isTimeLineUsed=!0,this.uuid=this.getId(e)}toJSON(){var{data:e,type:t}=this;return{data:e,type:t}}addData(e,t,r=!1){return 1e3<Number(e)&&(e="1000.00"),r?this.data[e]=this.getAllData():(this.data[e]||(this.data[e]={}),this.data[e][t]=this.getData(t)),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,r=!1){const n={};return(0,Xe.js)(e,(i=>{n[i]=r?"notNow":_d.getValByType(t,i,e)})),n}static getValByType(e,t,r){var n,i;return r=r[t].type,e=e[t],"number"===r?e:"color"===r?(({r:t,g:n,b:i}=e),{r:t,g:n,b:i}):"V3"===r?Ma().model.v3ToMap(e):""}static SetTargetByData(e){const{baseType:t,data:r,defType:n,target:i}=e;var o,a;"number"===t?i[n]=r:"color"===t&&(({r:e,g:o,b:a}=r),i[n].setRGB(e,o,a))}getAllData(e=!1){return _d.getAllDefValByType(this.defOptions,this.target,e)}getData(e){return _d.getValByType(this.target,e,this.defOptions)}static getTarget(e,t){}getAnima(e,t){return this.getAnimaByModelData(this.data,this.target,e,t,this.defOptions)}setTargetByBetween(e,t,r){_d.setTargetByBetween(e,t,r,this.defOptions,this.target)}clone(e){var{data:t,type:r}=this;const n=new(0,Ed[r])(e);return n.data=t,n}reset(){(0,Xe.js)(this.defOptions,((e,t)=>{_d.SetTargetByData({baseType:t.type,data:_d.getValByType(this.beginData,e,this.defOptions),target:this.target,defType:e})}))}remove(){delete this.target.userData.isTimeLineUsed}}_d.setTargetByBetween=(()=>{const e=(e,t,r)=>e!==t?(t-e)*r+e:e;return(t,r,n,i,o)=>{(0,Xe.js)(i,((i,a)=>{var s,l,u,c,h,p;a=a.type,void 0!==t[i]&&void 0!==r[i]&&_d.SetTargetByData({baseType:a,data:(s=t[i],l=r[i],u=n,"number"===a?e(s,l,u):"color"===a?(({r:a,g:s,b:c}=s),({r:l,g:h,b:p}=l),{r:e(a,l,u),g:e(s,h,u),b:e(c,p,u)}):void 0),defType:i,target:o})}))}})();const Md=_d,Ed={model:class extends Md{constructor(e,t){super(e,t),this.type="model",this.defOptions={position:{type:"V3"},scale:{type:"V3"},rotation:{type:"V3"}},this.setTargetByBetween=(()=>{const e=(e,t,r)=>{var{x:e,y:n,z:i}=e,{x:t,y:o,z:a}=t;return{x:e!==t?(t-e)*r+e:e,y:n!==o?(o-n)*r+n:n,z:i!==a?(a-i)*r+i:i}};return(t,r,n)=>{var i,{position:t,scale:o,rotation:a}=t,{position:r,scale:s,rotation:l}=r;t&&r&&(({x:t,y:r,z:i}=e(t,r,n)),this.target.position.set(t,r,i)),o&&s&&(({x:t,y:r,z:i}=e(o,s,n)),this.target.scale.set(t,r,i)),a&&l&&(({x:o,y:s,z:t}=e(a,l,n)),this.target.rotation.set(o,s,t))}})(),this.getAnimaByModelData=(()=>{const e=(e,t,r)=>{var{position:t,scale:n,rotation:i}=t,{position:e,scale:o,rotation:a}=Md.isNotNow(e)?this.getAllData():e;return{begin:Object.assign({},e?{px:t.x,py:t.y,pz:t.z}:{},o?{sx:n.x,sy:n.y,sz:n.z}:{},a?{rx:i.x,ry:i.y,rz:i.z}:{}),end:Object.assign({},r.curve?{ease:"none"}:{},e?{px:e.x,py:e.y,pz:e.z}:{},o?{sx:o.x,sy:o.y,sz:o.z}:{},a?{rx:a.x,ry:a.y,rz:a.z}:{})}};return(t,r,n,i=!1)=>{let o=i?n.time:0;const a=Object.keys(t).sort(((e,t)=>i?Number(t)-Number(e):Number(e)-Number(t)));var s=(0,Ea.lastArrayEle)(a),l=i?"0.00":String(n.time)+".00";return s!==l&&(t[l]={position:"notNow",rotation:"notNow",scale:"notNow"},a.push(l)),a.map((a=>{var s,l,u,c,h=t[String(a)],p=.001*((p=i?o-a:a-o)<=0?.001:p)*n.speed;return o=a,s=r,l=h,u=p,c=n,()=>{let t;return{promise:new Promise((r=>{var{begin:n,end:i}=e(l,s,c);return t=_o(n,i,u,(e=>{var{px:e,py:t,pz:r,sx:n,sy:i,sz:o,rx:a,ry:u,rz:c}=e;l.position&&s.position.set(e,t,r),l.scale&&s.scale.set(n,i,o),l.rotation&&s.rotation.set(a,u,c)}),r)})),anima:t}}}))}})(),this.beginData=this.getAllData()}static getTarget(e,t){return t.uniqueEx.model.get(e)}isRemoved(){return!(this.target&&this.target.parent)}getAnima(e,t=!1){return this.getAnimaByModelData(this.data,this.target,e,t)}getId(){return this.runScene.uniqueEx.getId(this.target)}reset(){var{position:e,scale:t,rotation: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(r.x,r.y,r.z)}},camera:class extends Md{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,r)=>{var{x:e,y:n,z:i}=e,{x:t,y:o,z:a}=t;return{x:e!==t?(t-e)*r+e:e,y:n!==o?(o-n)*r+n:n,z:i!==a?(a-i)*r+i:i}};return(t,r,n)=>{var i,{position:t,scale:o,rotation:a,target:s}=t,{position:r,scale:l,rotation:u,target:c}=r;t&&r&&(({x:t,y:r,z:i}=e(t,r,n)),this.target.position.set(t,r,i)),o&&l&&(({x:t,y:r,z:i}=e(o,l,n)),this.target.scale.set(t,r,i)),a&&u&&(({x:o,y:l,z:t}=e(a,u,n)),this.target.rotation.set(o,l,t)),s&&c&&(({x:r,y:i,z:a}=e(s,c,n)),this.controls.target.set(r,i,a))}})(),this.getAnimaByModelData=(()=>{const e=(e,t,r)=>{var{position:t,scale:n,rotation:i}=t,{position:e,scale:o,rotation:a,target:s}=Md.isNotNow(e)?this.getAllData():e;return{begin:Object.assign({},e?{px:t.x,py:t.y,pz:t.z}:{},o?{sx:n.x,sy:n.y,sz:n.z}:{},a?{rx:i.x,ry:i.y,rz:i.z}:{},s?{tx:this.controls.target.x,ty:this.controls.target.y,tz:this.controls.target.z}:{}),end:Object.assign({},r.curve?{ease:"none"}:{},e?{px:e.x,py:e.y,pz:e.z}:{},o?{sx:o.x,sy:o.y,sz:o.z}:{},a?{rx:a.x,ry:a.y,rz:a.z}:{},s?{tx:s.x,ty:s.y,tz:s.z}:{})}},t=(t,r,n,i)=>()=>{let o;return{promise:new Promise((a=>{var{begin:s,end:l}=e(r,t,i);return o=_o(s,l,n,(e=>{var{px:e,py:n,pz:i,sx:o,sy:a,sz:s,rx:l,ry:u,rz:c,tx:h,ty:p,tz:d}=e;r.position&&t.position.set(e,n,i),r.scale&&t.scale.set(o,a,s),r.rotation&&t.rotation.set(l,u,c),r.target&&this.controls.target.set(h,p,d)}),a)})),anima:_o}};return(e,r,n,i=!1)=>{let o=i?n.time:0;const a=Object.keys(e).sort(((e,t)=>i?Number(t)-Number(e):Number(e)-Number(t)));var s=(0,Ea.lastArrayEle)(a),l=i?"0.00":String(n.time);return s!==l&&(e[l]=Object.assign({},s),a.push(l)),a.map((a=>{var s=e[String(a)],l=.001*((l=i?o-a:a-o)<=0?.001:l)*n.speed;return o=a,t(r,s,l,n)}))}})(),this.controls=this.runScene.assetsEx.get().controls,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:r,rotation:n}=this.target;return{position:e?"notNow":Ma().model.v3ToMap(t),scale:e?"notNow":Ma().model.v3ToMap(r),rotation:e?"notNow":Ma().model.v3ToMap(n),target:e?"notNow":Ma().model.v3ToMap(this.controls.target)}}getData(e){var{position:t,scale:r,rotation:n}=this.target;let i;if("position"===e)i=Ma().model.v3ToMap(t);else if("scale"===e)i=Ma().model.v3ToMap(r);else if("rotation"===e)i=Ma().model.v3ToMap(n);else{if("target"!==e)throw TypeError("输入值不存在");i=Ma().model.v3ToMap(this.controls.target)}return i}getAnima(e,t=!1){return this.getAnimaByModelData(this.data,this.target,e,t)}getId(){return this.runScene.uniqueEx.getId(this.target)}reset(){var{position:e,scale:t,rotation:r,target:n}=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(r.x,r.y,r.z),this.controls.target.set(n.x,n.y,n.z)}},material:class extends Md{constructor(e,t){super(e,t),this.type="material",this.defOptions={roughness:{type:"number"},metalness:{type:"number"},opacity:{type:"number"},emissive:{type:"color"},color:{type:"color"}},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)}}};class Pd{constructor(e){this.map={},this.removes=[],this.unique=e}add(e,t,r){if(e&&e.userData){let n=e.userData.id;n||(n=(0,l.getId)(),e.userData.id=n),this.map[n]||(this.map[n]={material:e,models:new Set},this.unique.runScene.optionsEx.cb.unique.material.add.cb(e),t&&this.addModel(t,e,r))}}addModel(e,t,r){t&&t.userData&&(t=t.userData.id,null!=(t=this.map[t])&&t.models.add(e)),r&&null!=(t=this.map[r.userData.id])&&t.models.delete(e)}get(e){return null==(e=this.map[e])?void 0:e.material}remove(e){delete this.map[e]}addRemoved(e){this.map[e.uuid]&&this.removes.push(e.uuid)}dispose(){(0,Xe.js)(this.map,((e,t)=>{t.material.dispose()})),this.map={}}}var Od=a(1);class Rd extends class{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,l.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]}}{constructor(){super(...arguments),this.nameMap={},this.parseName=(()=>{const e=e=>{var t=e.lastIndexOf("_");return-1===t?-1:(e=e.slice(t+1),Od.type.isNumber(e)?Number.parseInt(e):-1)},t=(r,n)=>{var i=(t=>{if(-1===e(t))return t;var r=t.lastIndexOf("_");return-1===r?t:t.slice(0,r)})(r)+"_"+n++;return this.nameMap[i]?t(r,n):i},r=e=>Object.keys(this.nameMap).find((t=>this.nameMap[t]===e)),n=["PerspectiveCamera"];return i=>{if(n.includes(i.type))return i.name=i.type;let o=i.name;if(Od.valid.isTrue(o)||(o=i.type),!this.nameMap[o])return a=this.unique.getId(i),(s=r(a))&&delete this.nameMap[s],void(this.nameMap[o]=a);var a,s=this.nameMap[o];return this.unique.model.get(s)!==i?(a=e(o),a=t(o,s=-1===a?0:a),this.nameMap[a]=this.unique.getId(i),i.name=a):void 0}})()}add(e,t){var{reset:r,hasReset:n}=t||{};if(e instanceof Array)return e.map((e=>this.add(e,t)));if(e){let i=e.userData.id;if(i&&!r||(i=(0,l.getId)(),e.userData.id=i),this.map[i]){if(!n)return;i=(0,l.getId)(),e.userData.id=i}return this.map[i]=e,this.parseName(e),e.material&&this.unique.material.add(e.material,e),e.children.length?this.add(e.children,t):i}}get(e){return this.map[e]}getByName(e){return this.nameMap[e]}remove(e){if(e instanceof Array)return e.map((e=>this.remove(e)));e.traverse((e=>{delete this.nameMap[e.name]})),delete this.map[e.userData.id]}dispose(){this.map={},this.nameMap={}}}class kd{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,l.getId)(),e.userData.id=t),this.map[t]?void 0:(this.map[t]={texture:e,materialMap:{}},t)}getLength(){return Object.keys(this.map).length}addMaterial(e,t,r){var n=e.userData.id;this.map[n]||this.add(e),t&&(({material:e,type:t}=t),this.map[n].materialMap[e.userData.id]||(this.map[n].materialMap[e.userData.id]=new Set),this.map[n].materialMap[e.userData.id].add(t)),r&&(({material:e,type:t}=r),this.map[n].materialMap[e.userData.id]&&this.map[n].materialMap[e.userData.id].delete(t))}get(e){return null==(e=this.map[e])?void 0:e.texture}getMaterials(e){return null==(e=this.map[e])?void 0:e.materialMap}remove(e){if(e instanceof Array)return e.map((e=>this.remove(e)));delete this.map[e.userData.id]}dispose(){(0,Xe.js)(this.map,((e,t)=>{t.texture.dispose()})),this.map={}}}class Ad{constructor(e){this.runScene=e,this.model=new Rd(this),this.material=new Pd(this),this.texture=new kd(this)}getId(e){return e.userData.id}dispose(){this.material.dispose(),this.model.dispose(),this.texture.dispose()}}class Ld extends _a{constructor(e){super(e),this.map={},this.clock=new c.Clock,this.tickIndex=void 0,this.playings=new Set,this.updates={},this.setModelAnimaNames=(e,t)=>{0!==e.animations.length&&e.animations.map(((e,r)=>{(r=t[r])&&e&&(e.name=r)}))},e.optionsEx.cb.model.add.add("anima-parse",(({model:e})=>{this.parses(e)}))}parses(e){e.traverse((e=>this.parse(e)))}parse(e,t){if(0!==e.animations.length||t){const n=e.animations.length?e.animations:gd.parse(t);for(const t of n){var r=this.map[t.name];if(r&&e!==r.model)return void this.runScene.optionsEx.log("该动画已存在","base","info");const n=new c.AnimationMixer(e);r=n.clipAction(t);const i={finished:()=>{},loop:()=>{}};n.addEventListener("finished",(()=>i.finished())),n.addEventListener("loop",(()=>i.loop())),this.map[t.name]={mixer:n,action:r,model:e,time:0,clip:t,eventMap:i}}n.map((t=>{e.animations.find((e=>e.uuid===t.uuid))||e.animations.push(t)}))}}play(e,t){const r=this.map[e];if(r&&!this.playings.has(r)){t=$o({onLoop:()=>{},onProgress:()=>{},onFinished:()=>{},loop:!1,lastFrame:!0,reset:!1},t);const{onProgress:n,onLoop:i,onFinished:o,lastFrame:a,loop:s,reset:l}=t,{action:u,clip:c,eventMap:h}=(this.map[e].options=t,r);u.stop(),t=l?0:r.time,u.time=t,this.setPlayState(r,!0),u.play(),this.setUpdates(e,(()=>{n(wa(u.time,c.duration,!0))})),s?(u.loop=vi.LoopRepeat,h.loop=i):(a&&(u.clampWhenFinished=!0),u.loop=vi.LoopOnce,h.finished=()=>{this.setPlayState(r,!1),n(100),o()})}}pause(e){(e=this.map[e])&&this.playings.has(e)&&(this.updateTime(e),this.setPlayState(e,!1))}resume(e){this.play(e,null==(e=this.map[e])?void 0:e.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((r=>{const{mixer:n,action:i}=this.map[r];i.play(),i.time=e,n.update(t)}))}getDetal(){return this.clock.getDelta()}update(e){const t=e||this.getDetal();(0,Xe.js)(this.updates,((e,r)=>r(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:r}=e;r.reset(),r.stop(),t.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.name],0===this.playings.size&&this.closeAnima())}close(e){const t=this.map[e];t&&this.playings.has(t)&&(this.resetItem(t),this.updateTime(t,0),this.setPlayState(t,!1),t.options={})}setUpdates(e,t){this.updates[e]=t}}class Cd{constructor(){this.cbs=[]}cb(e,t){return Promise.all(this.cbs.map((r=>{var n;return null==(n=r.fn)?void 0:n.call(r,e,t)})))}add(e,t){return this.cbs.push({fn:t,name: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)}}class Dd{constructor(){this.resize=new Cd,this.setSelectMaterial=new Cd,this.setScene=new Cd,this.reset=new Cd,this.render=new Cd,this.baseLog=new Cd,this.inited=new Cd,this.texture={add:new Cd,remove:new Cd},this.model={setSelect:new Cd,add:new Cd,remove:new Cd,multipDrop:new Cd,focus:new Cd,unFocus:new Cd,changeName:new Cd,setOpen:new Cd,setMainStatue:new Cd,setVisible:new Cd,setParent:new Cd,setLayers:new Cd,clone:new Cd,dispose:new Cd},this.material={add:new Cd,dispose:new Cd,setName:new Cd},this.unique={material:{add:new Cd}},this.undo={addUndos:new Cd,removeUndos:new Cd,undoByIndex:new Cd,reset:new Cd},this.scene={save:new Cd,saveNet:new Cd},this.timeLine={setProgress:new Cd,playGroup:new Cd,setGroupMap:new Cd,reset:new Cd,closeGroup:new Cd},this.events={key:{g:new Cd},mouse:{move:new Cd,down:new Cd,up:new Cd},pointer:{down:new Cd,up:new Cd}},this.bloom={glow:{setData:new Cd,setStatus:new Cd}},this.load={lazyLoadedTexture:new Cd,loaded:new Cd,models:new Cd,progress:new Cd,getArrayBuffer:new Cd,complete:new Cd}}}const Id={RunScene:class{constructor(e){this.cb=new Dd,this.uniqueEx=new Ad(this),this.fileEx=new vh(this),this.optionsEx=new Td(this),this.undoEx=new Ra(this),this.textureEx=new Si(this),this.controlsEx=new Ge,this.assetsEx=new V(this),this.renderEx=new hs(this),this.events=new class{constructor(e){this.key=new Sa(this),this.mouse=new Ta(this),this.drag=new We(this),this.mouseEventMap={move:{timeLineMove:e=>{}},down:{},up:{timeLineUp:e=>{}}},this.mouseDown=e=>{},this.mouseUp=e=>{this.runScene.optionsEx.cb.events.mouse.up.cb(e),Object.values(this.mouseEventMap.up).map((t=>t(e)))},this.mouseMove=e=>{this.runScene.optionsEx.cb.events.mouse.move.cb(e),Object.values(this.mouseEventMap.move).map((t=>t(e)))},this.runScene=e}init(e){this.key.init(e),this.mouse.init(e),window.addEventListener("resize",(()=>{this.runScene.renderEx.setSize(),this.runScene.optionsEx.cb.resize.cb("")})),window.addEventListener("mousemove",this.mouseMove),window.addEventListener("mousedown",this.mouseDown),window.addEventListener("mouseup",this.mouseUp)}}(this),this.multipSelector=new xd(this),this.helperEx=null,this.materialEx=new Wa(this),this.cameraEx=new De(this),this.sceneEx=new ds(this),this.modelEx=new os(this),this.loaderer=new yd(this),this.exporter=new al(this),this.lightEx=new ks(this),this.timeLineEx=new class{constructor(e){this.timerMap={},this.animaMap={},this.groupMap={},this.setModelLocal=(e,t)=>{Object.values(e.data).map((e=>{var r,n,i=((e,t)=>{let r=-1,n=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<n&&(n=e,r=i)})),-1!==r)){var o=i[r],a=i[r+1],s=e[o];if(e=e[a],s&&e){var l=Object.values(s)[0],u=Object.values(e)[0];if("notNow"!==l&&"notNow"!==u)return{left:s,right:e,progress:(t-Number(o))/(Number(a)-Number(o))}}}})(e.data,t);i&&(({left:i,right:r,progress:n}=i),e.setTargetByBetween(i,r,n))}))},this.runScene=e}reset(){this.timerMap={},this.animaMap={},this.groupMap={},this.runScene.optionsEx.cb.timeLine.reset.cb("")}closeGroup(e){var t,r;this.timerMap[e]&&(({setProgressTime:t,awaitRuned:r}=this.timerMap[e]),t&&clearInterval(t),r&&clearInterval(r)),this.groupMap[e].run=!1,this.runScene.optionsEx.cb.timeLine.closeGroup.cb(e);const n=this.animaMap[e];n&&n.length&&n.map((e=>{e.controls.clean=!0}))}resetGroup(e){var t=this.groupMap[e];t&&(this.closeGroup(e),this.runScene.optionsEx.cb.timeLine.setProgress.cb(0),Object.values(t.data).map((e=>e.reset())))}getSavedData(){return(0,Xe.js)(this.groupMap,((e,t)=>{t.run=!1})),this.groupMap}parseSavedGroupMap(e){Object.keys(e).map((t=>{const r=e[t],n={};(0,Xe.js)(r.data,((e,t)=>{var{type:t,data:r}=t;const i=Ed[t];if(t=i.getTarget(e,this.runScene)){const o=new i(t,this.runScene);o.data=r,n[e]=o}})),r.data=n,this.groupMap[t]=r,this.runScene.optionsEx.cb.timeLine.setGroupMap.cb({group:r,groupName:t})}))}playGroup(e){this.runScene.helperEx.unfocus();const t=this.groupMap[e];if(t&&!t.run){t.run=!0;const n=Object.keys(t.data).map((e=>{const r=t.data[e],n=(r.data=new Proxy(r.data,{set:(e,t,r)=>(e[t]=r,!0)}),r.getAnima(t));return t.reverse&&(e=r.getAnima(t,!0),n.push(...e)),n})),i=(this.animaMap[e]||(this.animaMap[e]=[]),this.animaMap[e]=n.map((e=>(0,Ea.eachTriggerArrGetControls)(e))),t.time*t.speed*(t.reverse?2:1)),o=(new Date).valueOf(),a=i;var r=setInterval((()=>{var t=((new Date).valueOf()-o)/a;this.runScene.optionsEx.cb.timeLine.playGroup.cb({groupName:e,progress:t})}),16.6);let s;const l=new Promise((e=>s=setTimeout(e,i)));return this.timerMap[e]={setProgressTime:r,awaitRuned:s},l.then((()=>{if(clearInterval(this.timerMap[e].setProgressTime),t.run)return t.run=!1,t.loop?this.playGroup(e):void 0}))}}}(this),this.anima=new Ld(this),this.bloom={glow:new Ce(this)};var{rootDom:t,options:r}=e;if(!t)throw TypeError("根节点或路径不可为空");this.optionsEx.init(r),(t=(r||{}).loadInterval)?this.optionsEx.setLoadInterval({inputInterval:t,cb:this.load.bind(this,e)}):this.load(e)}load(e){var{path:e,rootDom:t}=e;this.events.init(t),this.assetsEx.init(t),this.helperEx=new ep(this);const{camera:r,controls:n}=this.assetsEx.get();this.uniqueEx.model.add(r),this.renderEx.setSize(),n.update(),this.bloom.glow.init(this.assetsEx.get()),this.optionsEx.cb.inited.cb(0),this.cameraEx.reset(r),this.loadScene(e)}loadScene(e){return function(e,t,r,n){return new(r=r||Promise)((function(t,i){function o(e){try{s(n.next(e))}catch(e){i(e)}}function a(e){try{s(n.throw(e))}catch(e){i(e)}}function s(e){var n;e.done?t(e.value):((n=e.value)instanceof r?n:new r((function(e){e(n)}))).then(o,a)}s((n=n.apply(e,[])).next())}))}(this,0,void 0,(function*(){if(e instanceof ArrayBuffer)return this.optionsEx.log("正在解析二进制文件","base","info"),this.loaderer.gltf.parse(e,{triggerCb:!0});this.optionsEx.log("正在拉取场景","base","info");var t=yield s().get(e,{responseType:"arraybuffer",onUploadProgress:e=>{var{total:e,loaded:t}=e;let r=t/e;1<(r=r<0?0:r)&&(r=1),t=100*Number(r.toFixed(2)),this.optionsEx.log("下载场景进度:"+t,"detail"),this.optionsEx.cb.load.progress.cb(t)}}).then((e=>e.data)).catch((e=>{this.optionsEx.log("下载场景失败:",e)}));return t?(this.optionsEx.cb.load.getArrayBuffer.cb(t),this.optionsEx.log("拉取场景成功、正在解析","base","success"),this.loaderer.gltf.parse(t,{triggerCb:!0})):void 0}))}render(){var e;if(null!=(e=this.optionsEx.options)&&e.run){const{render2:e,render3:t,scene:r,camera:n}=this.assetsEx;this.optionsEx.cb.render.cb(""),this.bloom.glow.update(),null!=t&&t.render(r,n),null!=e&&e.render(r,n)}}dispose(){this.assetsEx.dispose(),this.sceneEx.clean()}on(e,t){return null!=(e=this.optionsEx.cb.load[e])&&e.add("load-callback"+(0,l.getId)(),t),this}setSize(e,t){const{camera:r,render3:n,render2:i,renderer:o}=this.assetsEx;r.aspect=e/t,r.updateProjectionMatrix(),null!=n&&n.setSize(e,t),null!=i&&i.setSize(e,t),o.setSize(e,t),this.bloom.glow.setSize(e,t)}},Utils:t,ModelEx:n,MaterialEx:r,TextureEx:e}})(),u.default;function a(e){var t=l[e];return void 0!==t||(t=l[e]={exports:{}},s[e].call(t.exports,t,t.exports,a)),t.exports}var s,l,u}));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("axios"),require("uuid1"),require("three"),require("@allex/md5"),require("js-funcs-three"),require("js-funcs")):"function"==typeof define&&define.amd?define(["axios","uuid1","three","@allex/md5","js-funcs-three","js-funcs"],t):"object"==typeof exports?exports.RunScene=t(require("axios"),require("uuid1"),require("three"),require("@allex/md5"),require("js-funcs-three"),require("js-funcs")):e.RunScene=t(e.axios,e.uuid1,e.three,e["@allex/md5"],e["js-funcs-three"],e["js-funcs"])}(self,((e,t,r,n,i,o)=>{return s={3685:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},i=(Object.defineProperty(t,"__esModule",{value:!0}),t.downloadFile=t.getFileName=t.urlToBase64=t.toResult=t.getPrefixWord=t.getBackWord=t.bToMB=t.arrayBufferToStr=t.strToArrayBuffer=t.toUrl=t.blobToDataUrl=t.bufferToArrayBuffer=t.base64ToFile=void 0,n(r(3300)));t.base64ToFile=function(e,t){for(var r=(e=e.split(","))[0].match(/:(.*?);/)[1],n=atob(e[1]),i=n.length,o=new Uint8Array(i);i--;)o[i]=n.charCodeAt(i);return new File([o],t,{type:r})},t.bufferToArrayBuffer=function(e){for(var t=new ArrayBuffer(e.length),r=new Uint8Array(t),n=0;n<e.length;++n)r[n]=e[n];return t},t.blobToDataUrl=function(e){return i.default.get(e,{baseURL:"",responseType:"blob",timeout:5e3}).then((function(e){return(0,t.toResult)(e.data)})).catch((function(e){return!1}))},t.toUrl=function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"any.json";return e=e instanceof File?e:(e=JSON.stringify(e),new File([e],t)),window.URL.createObjectURL(e)},t.strToArrayBuffer=function(e){for(var t="",r=0;r<e.length;r++)""===t?t=e.charCodeAt(r).toString(16):t+=","+e.charCodeAt(r).toString(16);return new Uint8Array(t.match(/[\da-f]{2}/gi).map((function(e){return parseInt(e,16)}))).buffer},t.arrayBufferToStr=function(e){return new Promise((function(t){var r=new Blob([e]),n=new FileReader;n.readAsText(r,"utf-8"),n.onload=function(){t(n.result)}}))},t.bToMB=function(e){return e=e/1024/1024,1<arguments.length&&void 0!==arguments[1]&&arguments[1]?e:e.toFixed(2)+"MB"},t.getBackWord=function(e){return e.substr(e.lastIndexOf(".")+1).toLowerCase()},t.getPrefixWord=function(e){return e.substr(0,e.lastIndexOf("."))},t.toResult=function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"text",r=new FileReader;return"text"===t?r.readAsText(e):"arrayBuffer"===t?r.readAsArrayBuffer(e):"base64"===t&&r.readAsDataURL(e),new Promise((function(e){r.onload=function(t){return e(t.target.result)}}))},t.urlToBase64=function(e){return i.default.get(e,{responseType:"arraybuffer"}).then((function(e){var t=e.headers["content-type"];return e=new Buffer(e.data,"binary").toString("base64"),"data:".concat(t,";base64,")+e}))},t.getFileName=function(e){return e.substring(e.lastIndexOf("-")+1)},t.downloadFile=function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"any.text",r=document.createElement("a");e instanceof File||e instanceof Blob?r.setAttribute("href",window.URL.createObjectURL(e)):r.setAttribute("href",e),r.setAttribute("download",t),document.body.insertAdjacentElement("beforeend",r),r.click(),r.remove()}},4298:function(e,t,r){"use strict";function n(e){return(n="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 i(){i=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,o=(m="function"==typeof Symbol?Symbol:{}).iterator||"@@iterator",a=m.asyncIterator||"@@asyncIterator",s=m.toStringTag||"@@toStringTag";function u(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(t){u=function(e,t,r){return e[t]=r}}function l(e,t,r,n){var i,o,a,s;return t=t&&t.prototype instanceof f?t:f,t=Object.create(t.prototype),n=new S(n||[]),t._invoke=(i=e,o=r,a=n,s="suspendedStart",function(e,t){if("executing"===s)throw new Error("Generator is already running");if("completed"===s){if("throw"===e)throw t;return{value:void 0,done:!0}}for(a.method=e,a.arg=t;;){var r=a.delegate;if(r&&(r=function e(t,r){var n=t.iterator[r.method];if(void 0===n){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=void 0,e(t,r),"throw"===r.method))return h;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}return"throw"===(n=c(n,t.iterator,r.arg)).type?(r.method="throw",r.arg=n.arg,r.delegate=null,h):(n=n.arg)?n.done?(r[t.resultName]=n.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,h):n:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,h)}(r,a),r)){if(r===h)continue;return r}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if("suspendedStart"===s)throw s="completed",a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);if(s="executing","normal"===(r=c(i,o,a)).type){if(s=a.done?"completed":"suspendedYield",r.arg===h)continue;return{value:r.arg,done:a.done}}"throw"===r.type&&(s="completed",a.method="throw",a.arg=r.arg)}}),t}function c(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=l;var h={};function f(){}function p(){}function d(){}var m,y,v=(u(m={},o,(function(){return this})),(y=(y=Object.getPrototypeOf)&&y(y(_([]))))&&y!==t&&r.call(y,o)&&(m=y),d.prototype=f.prototype=Object.create(m));function g(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function b(e,t){var i;this._invoke=function(o,a){function s(){return new t((function(i,s){!function i(o,a,s,u){var l;if("throw"!==(o=c(e[o],e,a)).type)return(a=(l=o.arg).value)&&"object"==n(a)&&r.call(a,"__await")?t.resolve(a.__await).then((function(e){i("next",e,s,u)}),(function(e){i("throw",e,s,u)})):t.resolve(a).then((function(e){l.value=e,s(l)}),(function(e){return i("throw",e,s,u)}));u(o.arg)}(o,a,i,s)}))}return i=i?i.then(s,s):s()}}function w(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 x(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function S(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(w,this),this.reset(!0)}function _(e){if(e){var t,n=e[o];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return t=-1,(n=function n(){for(;++t<e.length;)if(r.call(e,t))return n.value=e[t],n.done=!1,n;return n.value=void 0,n.done=!0,n}).next=n}return{next:T}}function T(){return{value:void 0,done:!0}}return u(v,"constructor",p.prototype=d),u(d,"constructor",p),p.displayName=u(d,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){return!!(e="function"==typeof e&&e.constructor)&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,u(e,s,"GeneratorFunction")),e.prototype=Object.create(v),e},e.awrap=function(e){return{__await:e}},g(b.prototype),u(b.prototype,a,(function(){return this})),e.AsyncIterator=b,e.async=function(t,r,n,i,o){void 0===o&&(o=Promise);var a=new b(l(t,r,n,i),o);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},g(v),u(v,s,"Generator"),u(v,o,(function(){return this})),u(v,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t,r=[];for(t in e)r.push(t);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=_,S.prototype={constructor:S,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(x),!e)for(var t in this)"t"===t.charAt(0)&&r.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 n(r,n){return a.type="throw",a.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var i=this.tryEntries.length-1;0<=i;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var s=r.call(o,"catchLoc"),u=r.call(o,"finallyLoc");if(s&&u){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;0<=n;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}var a=(o=o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc?null:o)?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,h):this.complete(a)},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),h},finish:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),x(r),h}},catch:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var r,n,i=this.tryEntries[t];if(i.tryLoc===e)return"throw"===(r=i.completion).type&&(n=r.arg,x(i)),n}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:_(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),h}},e}function o(e){return function(e){if(Array.isArray(e))return a(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 a(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(r="Object"===r&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?a(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 a(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var s=this&&this.__awaiter||function(e,t,r,n){return new(r=r||Promise)((function(i,o){function a(e){try{u(n.next(e))}catch(e){o(e)}}function s(e){try{u(n.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(a,s)}u((n=n.apply(e,t||[])).next())}))},u=(Object.defineProperty(t,"__esModule",{value:!0}),t.deepArrByMaps=t.map=t.multiArrToArr=t.eachTriggerArray=t.eachTriggerArrGetControls=t.emptyArray=t.delArrEle=t.lastArrayEle=void 0,r(3185));function l(e,t,r,n){return s(void 0,void 0,void 0,i().mark((function o(){var a,s,u;return i().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(a=e[t++]){i.next=3;break}return i.abrupt("return",r());case 3:if((s=a())instanceof Promise)return i.next=7,s;i.next=11;break;case 7:u=i.sent,null!=n&&n.eachCb(u,t),i.next=18;break;case 11:if(s.promise&&s.promise instanceof Promise)return null!=n&&n.eachCb(s,t),i.next=15,s.promise;i.next=17;break;case 15:i.next=18;break;case 17:null!=n&&n.eachCb(s,t);case 18:l(e,t,r,n);case 19:case"end":return i.stop()}}),o)})))}function c(e,t){e.map((function(e){if("array"===(0,u.getType)(e))return c(e,t);t.push(e)}))}t.lastArrayEle=function(e){return e.slice(-1)[0]},t.delArrEle=function(e,t){var r=e.slice(0,t);return e=e.slice(t+1),[].concat(o(r),o(e))},t.emptyArray=function(e){return 0===e.length},t.eachTriggerArrGetControls=function(e){var r=new Proxy({run:!0,clean:!1,target:e,index:0,runningAnima:null,eachCb:function(e,t){e.anima&&(r.runningAnima=e.anima),r.index=t}},{set:function(e,t,n){return"clean"===t&&!0===n&&!1===e[t]&&(r.run=!1,r.target.splice(0)),"run"===t&&!1===n&&!0===e[t]&&(console.log(r,"controls"),r.runningAnima&&r.runningAnima.pause()),"run"===t&&!0===n&&!1===e[t]&&r.runningAnima&&r.runningAnima.resume(),e[t]=n,!0}});return e=(0,t.eachTriggerArray)(e,r),{controls:r,promise:e}},t.eachTriggerArray=function(e,t){return new Promise((function(r){return l(e,0,r,t)}))},t.multiArrToArr=function(e){var t=[];return c(e,t),t},t.map=function(e,t){return e.map((function(r,n){return t(r,n,e)})).filter((function(e){return e}))},t.deepArrByMaps=function(e){var r=e.arr,n=e.typeList,i=e.findType;if(e=e.mapType,!r||!n||!i)return r;var a=o(n),s=r.find((function(e){return e[i]===n[0]}));return s?1!==n.length&&s[e]instanceof Array?(a.shift(),(0,t.deepArrByMaps)({arr:s[e],typeList:a,findType:i,mapType:e})):s:r}},9594:(e,t,r)=>{"use strict";t.qR=t.js=t.CV=void 0,r(3185),t.CV=function(e){return 0===Object.values(e).length},t.js=function(e,t){return Object.keys(e).map((function(r,n){var i=e[r];return t(r,i,n)}))},t.qR=function(e,t){var r=-1;return function e(n){return r++,t.length===r+1?n:e(n[t[r]])}(e)}},9251:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},i=(Object.defineProperty(t,"__esModule",{value:!0}),t.getId=t.getMacro=t.getUuid=void 0,n(r(7937))),o=n(r(181));t.getUuid=function(){return i.default.UUID1()},t.getMacro=function(e){var t=setTimeout((function(){return clearTimeout(t),t=null,e()}),1<arguments.length&&void 0!==arguments[1]?arguments[1]:0)},t.getId=function(){return(0,o.default)()}},3185:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isTrue=t.getType=void 0,t.getType=function(e){if(void 0!==e){if(null===e)return null;var t;switch(e.constructor){case Array:t="Array";break;case Object:t="Object";break;case String:t="String";break;case Number:t="Number";break;case Boolean:t="Boolean";break;case Function:t="Function"}return t&&t.toLowerCase()||"Object"}},t.isTrue=function(e){return!(null==e||!1===e)}},2773:(e,t,r)=>{r=r(4362).Symbol,e.exports=r},8083:(e,t,r)=>{var n=r(5094),i=r(9246),o=r(3670),a=r(2343),s=r(4782),u=r(1589),l=Object.prototype.hasOwnProperty;e.exports=function(e,t){var r,c=o(e),h=!c&&i(e),f=!c&&!h&&a(e),p=!c&&!h&&!f&&u(e),d=c||h||f||p,m=d?n(e.length,String):[],y=m.length;for(r in e)!t&&!l.call(e,r)||d&&("length"==r||f&&("offset"==r||"parent"==r)||p&&("buffer"==r||"byteLength"==r||"byteOffset"==r)||s(r,y))||m.push(r);return m}},9258:e=>{e.exports=function(e,t){for(var r=-1,n=null==e?0:e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}},5170:(e,t,r)=>{var n=r(1322);e.exports=function(e){var t=e.length;return t?e[n(0,t-1)]:void 0}},1185:(e,t,r)=>{var n=r(2773),i=r(3888),o=r(2299),a=n?n.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":(a&&a in Object(e)?i:o)(e)}},9582:(e,t,r)=>{var n=r(1185),i=r(4939);e.exports=function(e){return i(e)&&"[object Arguments]"==n(e)}},3638:(e,t,r)=>{var n=r(1185),i=r(7100),o=r(4939),a={};a["[object Float32Array]"]=a["[object Float64Array]"]=a["[object Int8Array]"]=a["[object Int16Array]"]=a["[object Int32Array]"]=a["[object Uint8Array]"]=a["[object Uint8ClampedArray]"]=a["[object Uint16Array]"]=a["[object Uint32Array]"]=!0,a["[object Arguments]"]=a["[object Array]"]=a["[object ArrayBuffer]"]=a["[object Boolean]"]=a["[object DataView]"]=a["[object Date]"]=a["[object Error]"]=a["[object Function]"]=a["[object Map]"]=a["[object Number]"]=a["[object Object]"]=a["[object RegExp]"]=a["[object Set]"]=a["[object String]"]=a["[object WeakMap]"]=!1,e.exports=function(e){return o(e)&&i(e.length)&&!!a[n(e)]}},7521:(e,t,r)=>{var n=r(2803),i=r(3865),o=Object.prototype.hasOwnProperty;e.exports=function(e){if(!n(e))return i(e);var t,r=[];for(t in Object(e))o.call(e,t)&&"constructor"!=t&&r.push(t);return r}},1322:e=>{var t=Math.floor,r=Math.random;e.exports=function(e,n){return e+t(r()*(n-e+1))}},4154:(e,t,r)=>{var n=r(5170),i=r(6748);e.exports=function(e){return n(i(e))}},5094:e=>{e.exports=function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}},9081:e=>{e.exports=function(e){return function(t){return e(t)}}},2572:(e,t,r)=>{var n=r(9258);e.exports=function(e,t){return n(t,(function(t){return e[t]}))}},8556:(e,t,r)=>{function n(e){return(n="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)}r="object"==(void 0===r.g?"undefined":n(r.g))&&r.g&&r.g.Object===Object&&r.g,e.exports=r},3888:(e,t,r)=>{r=r(2773);var n=Object.prototype,i=n.hasOwnProperty,o=n.toString,a=r?r.toStringTag:void 0;e.exports=function(e){var t=i.call(e,a),r=e[a];try{var n=!(e[a]=void 0)}catch(e){}var s=o.call(e);return n&&(t?e[a]=r:delete e[a]),s}},4782:e=>{function t(e){return(t="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 r=/^(?:0|[1-9]\d*)$/;e.exports=function(e,n){var i=t(e);return!!(n=null==n?9007199254740991:n)&&("number"==i||"symbol"!=i&&r.test(e))&&-1<e&&e%1==0&&e<n}},2803:e=>{var t=Object.prototype;e.exports=function(e){var r=e&&e.constructor;return e===("function"==typeof r&&r.prototype||t)}},3865:(e,t,r)=>{r=r(5290)(Object.keys,Object),e.exports=r},1985:(e,t,r)=>{function n(e){return(n="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)}e=r.nmd(e),r=r(8556);var i=(t="object"==n(t)&&t&&!t.nodeType&&t)&&"object"==n(e)&&e&&!e.nodeType&&e,o=i&&i.exports===t&&r.process;t=function(){try{return i&&i.require&&i.require("util").types||o&&o.binding&&o.binding("util")}catch(e){}}(),e.exports=t},2299:e=>{var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},5290:e=>{e.exports=function(e,t){return function(r){return e(t(r))}}},4362:(e,t,r)=>{function n(e){return(n="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)}r=r(8556);var i="object"==("undefined"==typeof self?"undefined":n(self))&&self&&self.Object===Object&&self;r=r||i||Function("return this")(),e.exports=r},9246:(e,t,r)=>{var n=r(9582),i=r(4939),o=(r=Object.prototype).hasOwnProperty,a=r.propertyIsEnumerable;r=n(function(){return arguments}())?n:function(e){return i(e)&&o.call(e,"callee")&&!a.call(e,"callee")},e.exports=r},3670:e=>{var t=Array.isArray;e.exports=t},6175:(e,t,r)=>{var n=r(3626),i=r(7100);e.exports=function(e){return null!=e&&i(e.length)&&!n(e)}},2343:(e,t,r)=>{function n(e){return(n="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)}e=r.nmd(e);var i,o=r(4362);r=r(3444),t=(i=(i=(t="object"==n(t)&&t&&!t.nodeType&&t)&&"object"==n(e)&&e&&!e.nodeType&&e)&&i.exports===t?o.Buffer:void 0)?i.isBuffer:void 0,e.exports=t||r},3626:(e,t,r)=>{var n=r(1185),i=r(71);e.exports=function(e){return!!i(e)&&("[object Function]"==(e=n(e))||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e)}},7100:e=>{e.exports=function(e){return"number"==typeof e&&-1<e&&e%1==0&&e<=9007199254740991}},7451:(e,t,r)=>{var n=r(1185),i=r(4939);e.exports=function(e){return"number"==typeof e||i(e)&&"[object Number]"==n(e)}},71:e=>{function t(e){return(t="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)}e.exports=function(e){var r=t(e);return null!=e&&("object"==r||"function"==r)}},4939:e=>{function t(e){return(t="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)}e.exports=function(e){return null!=e&&"object"==t(e)}},1589:(e,t,r)=>{var n=r(3638),i=r(9081);i=(r=(r=r(1985))&&r.isTypedArray)?i(r):n,e.exports=i},3225:(e,t,r)=>{var n=r(8083),i=r(7521),o=r(6175);e.exports=function(e){return(o(e)?n:i)(e)}},5689:(e,t,r)=>{var n=r(5170),i=r(4154),o=r(3670);e.exports=function(e){return(o(e)?n:i)(e)}},3444:e=>{e.exports=function(){return!1}},6748:(e,t,r)=>{var n=r(2572),i=r(3225);e.exports=function(e){return null==e?[]:n(e,i(e))}},4326:e=>{e.exports=function(e,t,r){for(var n=(2<<Math.log(t.length-1)/Math.LN2)-1,i=-~(1.6*n*r/t.length),o="";;)for(var a=e(i),s=i;s--;)if((o+=t[a[s]&n]||"").length===+r)return o}},181:(e,t,r)=>{"use strict";e.exports=r(1882)},488:(e,t,r)=>{"use strict";var n,i,o,a=r(87),s="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-";function u(){o=!1}function l(e){if(e){if(e!==n){if(e.length!==s.length)throw new Error("Custom alphabet for shortid must be "+s.length+" unique characters. You submitted "+e.length+" characters: "+e);var t=e.split("").filter((function(e,t,r){return t!==r.lastIndexOf(e)}));if(t.length)throw new Error("Custom alphabet for shortid must be "+s.length+" unique characters. These characters were not unique: "+t.join(", "));n=e,u()}}else n!==s&&(n=s,u())}function c(){return o=o||function(){n||l(s);var e,t=n.split(""),r=[];for(a.nextValue();0<t.length;)e=a.nextValue(),e=Math.floor(e*t.length),r.push(t.splice(e,1)[0]);return r.join("")}()}e.exports={get:function(){return n||s},characters:function(e){return l(e),n},seed:function(e){a.seed(e),i!==e&&(u(),i=e)},lookup:function(e){return c()[e]},shuffled:c}},6239:(e,t,r)=>{"use strict";var n,i,o=r(5253);r(488),e.exports=function(e){var t="",r=Math.floor(.001*(Date.now()-1567752802062));return r===i?n++:(n=0,i=r),t=(t+=o(7))+o(e),0<n&&(t+=o(n)),t+o(r)}},5253:(e,t,r)=>{"use strict";var n=r(488),i=r(2019),o=r(4326);e.exports=function(e){for(var t,r=0,a="";!t;)a+=o(i,n.get(),1),t=e<Math.pow(16,r+1),r++;return a}},1882:(e,t,r)=>{"use strict";var n=r(488),i=r(6239),o=r(2040),a=r(3595)||0;function s(){return i(a)}e.exports=s,e.exports.generate=s,e.exports.seed=function(t){return n.seed(t),e.exports},e.exports.worker=function(t){return a=t,e.exports},e.exports.characters=function(e){return void 0!==e&&n.characters(e),n.shuffled()},e.exports.isValid=o},2040:(e,t,r)=>{"use strict";var n=r(488);e.exports=function(e){return!(!e||"string"!=typeof e||e.length<6||new RegExp("[^"+n.get().replace(/[|\\{}()[\]^$+*?.-]/g,"\\$&")+"]").test(e))}},2019:e=>{"use strict";function t(e){return(t="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 r="object"===("undefined"==typeof window?"undefined":t(window))&&(window.crypto||window.msCrypto),n=r&&r.getRandomValues?function(e){return r.getRandomValues(new Uint8Array(e))}:function(e){for(var t=[],r=0;r<e;r++)t.push(Math.floor(256*Math.random()));return t};e.exports=n},87:e=>{"use strict";var t=1;e.exports={nextValue:function(){return(t=(9301*t+49297)%233280)/233280},seed:function(e){t=e}}},3595:e=>{"use strict";e.exports=0},5459:e=>{for(var t=[],r=0;r<256;++r)t[r]=(r+256).toString(16).substr(1);e.exports=function(e,r){r=r||0;var n=t;return[n[e[r++]],n[e[r++]],n[e[r++]],n[e[r++]],"-",n[e[r++]],n[e[r++]],"-",n[e[r++]],n[e[r++]],"-",n[e[r++]],n[e[r++]],"-",n[e[r++]],n[e[r++]],n[e[r++]],n[e[r++]],n[e[r++]],n[e[+r]]].join("")}},7019:e=>{var t,r,n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);n?(t=new Uint8Array(16),e.exports=function(){return n(t),t}):(r=new Array(16),e.exports=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),r[t]=e>>>((3&t)<<3)&255;return r})},652:(e,t,r)=>{var n,i,o=r(7019),a=r(5459),s=0,u=0;e.exports=function(e,t,r){var l=t&&r||0,c=t||[],h=(e=e||{}).node||n,f=(r=void 0!==e.clockseq?e.clockseq:i,null!=h&&null!=r||(f=o(),null==h&&(h=n=[1|f[0],f[1],f[2],f[3],f[4],f[5]]),null==r&&(r=i=16383&(f[6]<<8|f[7]))),void 0!==e.msecs?e.msecs:(new Date).getTime()),p=void 0!==e.nsecs?e.nsecs:u+1,d=f-s+(p-u)/1e4;if(d<0&&void 0===e.clockseq&&(r=r+1&16383),1e4<=(p=(d<0||s<f)&&void 0===e.nsecs?0:p))throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");s=f,i=r,d=(1e4*(268435455&(f+=122192928e5))+(u=p))%4294967296,c[l++]=d>>>24&255,c[l++]=d>>>16&255,c[l++]=d>>>8&255,c[l++]=255&d,e=f/4294967296*1e4&268435455,c[l++]=e>>>8&255,c[l++]=255&e,c[l++]=e>>>24&15|16,c[l++]=e>>>16&255,c[l++]=r>>>8|128,c[l++]=255&r;for(var m=0;m<6;++m)c[l+m]=h[m];return t||a(c)}},1129:e=>{"use strict";e.exports=n},3300:t=>{"use strict";t.exports=e},6001:e=>{"use strict";e.exports=o},4356:e=>{"use strict";e.exports=i},8881:e=>{"use strict";e.exports=r},7937:e=>{"use strict";e.exports=t}},u={},a.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return a.d(t,{a:t}),t},a.d=(e,t)=>{for(var r in t)a.o(t,r)&&!a.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},a.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),a.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),l={},(()=>{"use strict";a.d(l,{default:()=>gb});var e={},t=(a.r(e),a.d(e,{bindTextureBaseData:()=>Di,default:()=>Ri,disposeTexture:()=>Ci,getBlobByTexture:()=>Li,getMimeByTexture:()=>ji,getSizeByTexture:()=>Fi,getTextureGpuMemory:()=>Ai,getUrlByTexture:()=>Ui,initTexture:()=>zi,loadTexture:()=>Bi,parseImageBitMapByBlob:()=>Ii,setTextureMapping:()=>Ni,textureNameMap:()=>ki}),{}),r=(a.r(t),a.d(t,{angleToNum:()=>Ta,anima:()=>jo,arrayBufferToBase64:()=>Fo,arrayBufferToBlobUr:()=>Uo,arrayToVector3:()=>xa,base64ToArrayBuffer:()=>Io,base64ToBlob:()=>Ho,bitMapToCanvas:()=>Qo,blobToFile:()=>Wo,canvasToBlob:()=>na,changeModelOpc:()=>da,changeModelOpcs:()=>ma,clone:()=>pa,compressImgToUrl:()=>Ko,deepMergeObject:()=>Oa,domTo2Dui:()=>ca,domTo3DSprite:()=>ha,domTo3Dui:()=>la,fileAndBlobToCanvas:()=>Zo,fileToBlob:()=>Go,getArrIndexByItem:()=>Ma,getCamAnimaData:()=>ua,getCurve:()=>wa,getDistance:()=>sa,getFilesByDataTransfer:()=>ra,getImg:()=>Ra,getImgPixels:()=>ta,getImgPixels1:()=>ea,getLine2:()=>Sa,getMacro:()=>fa,getMd5:()=>Yo,getNamesByNum:()=>ya,getProgress:()=>Pa,getRes:()=>oa,getTruthBase64:()=>Bo,getType:()=>Ea,getTypeByBase64:()=>Xo,getVideoTexture:()=>ba,getWorldLocal:()=>Ao,hslToRgb:()=>$o,imgArrayBufferToBlobUrl:()=>No,imgBitMapToBase64:()=>Co,imgBitMapToBlob:()=>Do,imgBitMapToBlobAndBase64:()=>zo,mergeObject:()=>aa,removeUnLess:()=>ga,reverseImg:()=>Lo,rgbToHsl:()=>Jo,setDynamic:()=>_a,textureToThreeD:()=>va,transByte:()=>qo,urlToBlob:()=>Vo,urlToCanvas:()=>ka,vector:()=>ia}),{}),n=(a.r(r),a.d(r,{createDefMaterial:()=>ts,defAllMaterialMap:()=>$a,defBaseMaterialMap:()=>Ja,default:()=>es,disposeMaterial:()=>ns,getTextures:()=>os,getTexturesByMaterial:()=>is,initMaterial:()=>ss,mergeMaterial:()=>rs,setMaterialTexture:()=>as}),{}),i=(a.r(n),a.d(n,{createDefModel:()=>ms,default:()=>ds,disposeModel:()=>ys,instanceModel:()=>vs,setHelper:()=>bs,withAnima:()=>gs}),{}),o=(a.r(i),a.d(i,{AsyncCompress:()=>Xl,AsyncDecompress:()=>sc,AsyncDeflate:()=>Bl,AsyncGunzip:()=>Ql,AsyncGzip:()=>Xl,AsyncInflate:()=>Vl,AsyncUnzipInflate:()=>kc,AsyncUnzlib:()=>nc,AsyncZipDeflate:()=>Oc,AsyncZlib:()=>ec,Compress:()=>Wl,DecodeUTF8:()=>pc,Decompress:()=>ac,Deflate:()=>Il,EncodeUTF8:()=>dc,Gunzip:()=>Zl,Gzip:()=>Wl,Inflate:()=>Fl,Unzip:()=>jc,UnzipInflate:()=>Rc,UnzipPassThrough:()=>Pc,Unzlib:()=>rc,Zip:()=>Mc,ZipDeflate:()=>Ec,ZipPassThrough:()=>Tc,Zlib:()=>$l,compress:()=>ql,compressSync:()=>Yl,decompress:()=>function(e,t,r){if(r||(r=t,t={}),"function"!=typeof r)throw"no callback";return(31==e[0]&&139==e[1]&&8==e[2]?Kl:8!=(15&e[0])||7<e[0]>>4||(e[0]<<8|e[1])%31?Hl:ic)(e,t,r)},decompressSync:()=>function(e,t){return(31==e[0]&&139==e[1]&&8==e[2]?Jl:8!=(15&e[0])||7<e[0]>>4||(e[0]<<8|e[1])%31?Gl:oc)(e,t)},deflate:()=>Ul,deflateSync:()=>Nl,gunzip:()=>Kl,gunzipSync:()=>Jl,gzip:()=>ql,gzipSync:()=>Yl,inflate:()=>Hl,inflateSync:()=>Gl,strFromU8:()=>yc,strToU8:()=>mc,unzip:()=>function(e,t){if("function"!=typeof t)throw"no callback";for(var r=[],n=function(){for(var e=0;e<r.length;++e)r[e]()},i={},o=e.length-22;101010256!=Pl(e,o);--o)if(!o||65558<e.length-o)return void t("invalid zip file",null);var a=Ml(e,o+8);a||t(null,{});var s=a,u=Pl(e,o+16),l=4294967295==u;if(l){if(o=Pl(e,o-12),101075792!=Pl(e,o))return void t("invalid zip file",null);s=a=Pl(e,o+32),u=Pl(e,o+48)}for(var c=function(o){function s(e,r){e?(n(),t(e,null)):(i[p]=r,--a||t(null,i))}var c=(m=bc(e,u,l))[0],h=m[1],f=m[2],p=m[3],d=m[4],m=m[5];if(m=gc(e,m),u=d,c)if(8==c)if(d=e.subarray(m,m+h),h<32e4)try{s(null,Gl(d,new Tu(f)))}catch(o){s(o,null)}else r.push(Hl(d,{size:f},s));else s("unknown compression type "+c,null);else s(null,Ku(e,m,m+h))},h=0;h<s;++h)c();return n},unzipSync:()=>function(e){for(var t={},r=e.length-22;101010256!=Pl(e,r);--r)if(!r||65558<e.length-r)throw"invalid zip file";var n=Ml(e,r+8);if(!n)return{};var i=Pl(e,r+16),o=4294967295==i;if(o){if(r=Pl(e,r-12),101075792!=Pl(e,r))throw"invalid zip file";n=Pl(e,r+32),i=Pl(e,r+48)}for(var a=0;a<n;++a){var s=(f=bc(e,i,o))[0],u=f[1],l=f[2],c=f[3],h=f[4],f=f[5];if(f=gc(e,f),i=h,s){if(8!=s)throw"unknown compression type "+s;t[c]=Gl(e.subarray(f,f+u),new Tu(l))}else t[c]=Ku(e,f,f+u)}return t},unzlib:()=>ic,unzlibSync:()=>oc,zip:()=>function(e,t,r){if(r||(r=t,t={}),"function"!=typeof r)throw"no callback";function n(){for(var e=0;e<f.length;++e)f[e]()}function i(){for(var e=new Tu(l+22),t=u,n=l-u,i=l=0;i<c;++i){var o=h[i];try{var a=o.c.length,s=(Sc(e,l,o,o.f,o.u,a),30+o.f.length+xc(o.extra)),f=l+s;e.set(o.c,f),Sc(e,u,o,o.f,o.u,a,l,o.m),u+=16+s+(o.m?o.m.length:0),l=f+a}catch(e){return r(e,null)}}_c(e,u,h.length,n,t),r(null,e)}var o={},a=(uc(e,"",o,t),Object.keys(o)),s=a.length,u=0,l=0,c=s,h=new Array(s),f=[];s||i();for(var p=function(e){function t(t,o){t?(n(),r(t,null)):(t=o.length,h[e]=dl(m,{size:v,crc:y.d(),c:o,f:g,m:x,u:b!=c.length||x&&w.length!=S,compression:T}),u+=30+b+_+t,l+=76+2*(b+_)+(S||0)+t,--s||i())}var c=a[e],p=o[c],d=p[0],m=p[1],y=hl(),v=d.length,g=(y.p(d),mc(c)),b=g.length,w=m.comment,x=w&&mc(w),S=x&&x.length,_=xc(m.extra),T=0==m.level?0:8;if(65535<b&&t("filename too long",null),T)if(v<16e4)try{t(null,Nl(d,m))}catch(p){t(p,null)}else f.push(Ul(d,m,t));else t(null,d)},d=0;d<c;++d)p(d);return n},zipSync:()=>function(e,t){var r,n={},i=[],o=(uc(e,"",n,t=t||{}),0),a=0;for(r in n){var s,u=(s=n[r])[0],l=0==(s=s[1]).level?0:8,c=(w=mc(r)).length,h=s.comment,f=h&&mc(h),p=f&&f.length,d=xc(s.extra);if(65535<c)throw"filename too long";var m=l?Nl(u,s):u,y=m.length,v=hl();v.p(u),i.push(dl(s,{size:u.length,crc:v.d(),c:m,f:w,m:f,u:c!=r.length||f&&h.length!=p,o,compression:l})),o+=30+c+d+y,a+=76+2*(c+d)+(p||0)+y}for(var g=new Tu(a+22),b=(e=o,t=a-o,0);b<i.length;++b){var w=i[b],x=(Sc(g,w.o,w,w.f,w.u,w.c.length),30+w.f.length+xc(w.extra));g.set(w.c,w.o+x),Sc(g,o,w,w.f,w.u,w.c.length,w.o,w.m),o+=16+x+(w.m?w.m.length:0)}return _c(g,o,i.length,t,e),g},zlib:()=>function(e,t,r){if(r||(r=t,t={}),"function"!=typeof r)throw"no callback";return Ol(e,t,[bl,Sl,function(){return[tc]}],(function(e){return Tl(tc(e.data[0],e.data[1]))}),4,r)},zlibSync:()=>tc}),{}),s=(a.r(o),a.d(o,{BoxZone:()=>Xp,LineZone:()=>Qp,MeshZone:()=>ed,PointZone:()=>id,ScreenZone:()=>hd,SphereZone:()=>xd}),{}),u=(a.r(s),a.d(s,{Body:()=>vp,BodySprite:()=>Rp,InitializerUtil:()=>jp,Life:()=>zp,Mass:()=>Fp,PolarVelocity:()=>sm,Position:()=>Ad,RadialVelocity:()=>fm,Radius:()=>Id,Rate:()=>Vd,Texture:()=>Zd,VectorVelocity:()=>vm}),{}),c=(a.r(u),a.d(u,{Alpha:()=>jm,Attraction:()=>Im,Behaviour:()=>Em,Collision:()=>Vm,Color:()=>Ym,CrossZone:()=>ny,Force:()=>uy,Gravity:()=>py,RandomDrift:()=>by,Repulsion:()=>Ey,Rotate:()=>jy,Scale:()=>Iy,Spring:()=>Hy}),a(3300)),h=a.n(c),f=a(9251),p=a(8881);function d(e){return(d="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,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function y(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function v(e,t,r){return t&&y(e.prototype,t),r&&y(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function g(){return(g="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=S(e)););return e}(e,t);if(n)return(n=Object.getOwnPropertyDescriptor(n,t)).get?n.get.call(arguments.length<3?e:r):n.value}).apply(this,arguments)}function b(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&&w(e,t)}function w(e,t){return(w=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function x(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=S(e);if(r=t?(r=S(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===d(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function S(e){return(S=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var _=new p.Vector3,T=new p.Quaternion,E=new p.Vector3,O=function(){b(t,p.Object3D);var e=x(t);function t(){var r,n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:document.createElement("div");return m(this,t),(r=e.call(this)).element=n,r.element.style.position="absolute",r.element.style.pointerEvents="auto",r.element.style.userSelect="none",r.element.setAttribute("draggable",!1),r.addEventListener("removed",(function(){this.traverse((function(e){e.element instanceof Element&&null!==e.element.parentNode&&e.element.parentNode.removeChild(e.element)}))})),r}return v(t,[{key:"copy",value:function(e,r){return g(S(t.prototype),"copy",this).call(this,e,r),this.element=e.element.cloneNode(!0),this}}]),t}(),M=(O.prototype.isCSS3DObject=!0,function(){b(t,O);var e=x(t);function t(r){return m(this,t),(r=e.call(this,r)).rotation2D=0,r}return v(t,[{key:"copy",value:function(e,r){return g(S(t.prototype),"copy",this).call(this,e,r),this.rotation2D=e.rotation2D,this}}]),t}()),P=(M.prototype.isCSS3DSprite=!0,new p.Matrix4),R=new p.Matrix4,k=v((function e(){var t,r,n,i,o=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},a=(m(this,e),this),s={camera:{fov:0,style:""},objects:new WeakMap},u=void 0!==o.element?o.element:document.createElement("div"),l=(u.style.overflow="hidden",this.domElement=u,document.createElement("div"));function c(e){return Math.abs(e)<1e-10?0:e}function h(e){return"matrix3d("+c((e=e.elements)[0])+","+c(-e[1])+","+c(e[2])+","+c(e[3])+","+c(e[4])+","+c(-e[5])+","+c(e[6])+","+c(e[7])+","+c(e[8])+","+c(-e[9])+","+c(e[10])+","+c(e[11])+","+c(e[12])+","+c(-e[13])+","+c(e[14])+","+c(e[15])+")"}function f(e){return"translate(-50%,-50%)matrix3d("+c((e=e.elements)[0])+","+c(e[1])+","+c(e[2])+","+c(e[3])+","+c(-e[4])+","+c(-e[5])+","+c(-e[6])+","+c(-e[7])+","+c(e[8])+","+c(e[9])+","+c(e[10])+","+c(e[11])+","+c(e[12])+","+c(e[13])+","+c(e[14])+","+c(e[15])+")"}l.style.transformStyle="preserve-3d",l.style.pointerEvents="none",u.appendChild(l),this.getSize=function(){return{width:t,height:r}},this.render=function(e,t){var r=t.projectionMatrix.elements[5]*i,o=(s.camera.fov!==r&&(u.style.perspective=t.isPerspectiveCamera?r+"px":"",s.camera.fov=r),!0===e.autoUpdate&&e.updateMatrixWorld(),null===t.parent&&t.updateMatrixWorld(),t.isOrthographicCamera&&(o=-(t.right+t.left)/2,p=(t.top+t.bottom)/2),t.isOrthographicCamera?"scale("+r+")translate("+c(o)+"px,"+c(p)+"px)"+h(t.matrixWorldInverse):"translateZ("+r+"px)"+h(t.matrixWorldInverse)),p=o+"translate("+n+"px,"+i+"px)";s.camera.style!==p&&(l.style.transform=p,s.camera.style=p),function e(t,r,n,i){var o,u,c;t.isCSS3DObject&&(o=!0===t.visible&&!0===t.layers.test(n.layers),t.element.style.display=1==o?"":"none",1==o&&(t.onBeforeRender(a,r,n),o=t.isCSS3DSprite?(P.copy(n.matrixWorldInverse),P.transpose(),0!==t.rotation2D&&P.multiply(R.makeRotationZ(t.rotation2D)),t.matrixWorld.decompose(_,T,E),P.setPosition(_),P.scale(E),P.elements[3]=0,P.elements[7]=0,P.elements[11]=0,P.elements[15]=1,f(P)):f(t.matrixWorld),u=t.element,void 0!==(c=s.objects.get(t))&&c.style===o||(c={style:u.style.transform=o},s.objects.set(t,c)),u.parentNode!==l&&l.appendChild(u),t.onAfterRender(a,r,n)));for(var h=0,p=t.children.length;h<p;h++)e(t.children[h],r,n,i)}(e,e,t,o)},this.setSize=function(e,o){n=(t=e)/2,i=(r=o)/2,u.style.width=e+"px",u.style.height=o+"px",l.style.width=e+"px",l.style.height=o+"px"}}));function j(e){return(j="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 C(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function D(e,t,r){return t&&C(e.prototype,t),r&&C(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function L(){return(L="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=I(e)););return e}(e,t);if(n)return(n=Object.getOwnPropertyDescriptor(n,t)).get?n.get.call(arguments.length<3?e:r):n.value}).apply(this,arguments)}function z(e,t){return(z=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function I(e){return(I=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var B=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&z(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=I(e);if(r=t?(r=I(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===j(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(){var e,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:document.createElement("div");return A(this,n),(e=r.call(this)).element=t,e.element.style.position="absolute",e.element.style.userSelect="none",e.element.setAttribute("draggable",!1),e.addEventListener("removed",(function(){this.traverse((function(e){e.element instanceof Element&&null!==e.element.parentNode&&e.element.parentNode.removeChild(e.element)}))})),e}return D(n,[{key:"copy",value:function(e,t){return L(I(n.prototype),"copy",this).call(this,e,t),this.element=e.element.cloneNode(!0),this}}]),n}(p.Object3D),U=(B.prototype.isCSS2DObject=!0,new p.Vector3),N=new p.Matrix4,F=new p.Matrix4,V=new p.Vector3,H=new p.Vector3,G=D((function e(){var t,r,n,i,o=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},a=(A(this,e),this),s={objects:new WeakMap},u=void 0!==o.element?o.element:document.createElement("div");function l(e,t){return V.setFromMatrixPosition(e.matrixWorld),H.setFromMatrixPosition(t.matrixWorld),V.distanceToSquared(H)}u.style.overflow="hidden",this.domElement=u,this.getSize=function(){return{width:t,height:r}},this.render=function(e,t){!0===e.autoUpdate&&e.updateMatrixWorld(),null===t.parent&&t.updateMatrixWorld(),N.copy(t.matrixWorldInverse),F.multiplyMatrices(t.projectionMatrix,N),function e(t,r,o){var c;t.isCSS2DObject&&(U.setFromMatrixPosition(t.matrixWorld),U.applyMatrix4(F),c=!0===t.visible&&-1<=U.z&&U.z<=1&&!0===t.layers.test(o.layers),t.element.style.display=1==c?"":"none",1==c&&(t.onBeforeRender(a,r,o),c=t.element,/apple/i.test(navigator.vendor)?c.style.transform="translate(-50%,-50%) translate("+Math.round(U.x*n+n)+"px,"+Math.round(-U.y*i+i)+"px)":c.style.transform="translate(-50%,-50%) translate("+(U.x*n+n)+"px,"+(-U.y*i+i)+"px)",c.parentNode!==u&&u.appendChild(c),t.onAfterRender(a,r,o)),c={distanceToCameraSquared:l(o,t)},s.objects.set(t,c));for(var h=0,f=t.children.length;h<f;h++)e(t.children[h],r,o)}(e,e,t);for(var r=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:s.objects.get(e).distanceToCameraSquared-s.objects.get(t).distanceToCameraSquared})),o=r.length,c=0,h=r.length;c<h;c++)r[c].element.style.zIndex=o-c},this.setSize=function(e,o){n=(t=e)/2,i=(r=o)/2,u.style.width=e+"px",u.style.height=o+"px"}}));class W{constructor(e){this.scene=null,this.camera=null,this.controls=null,this.renderer=null,this.engineDom=null,this.disposeRender=e=>{e&&(e.render=()=>{},e.domElement.remove())},this.runScene=e}initRender3(){const e=new k;return e.setSize(this.engineDom.clientWidth,this.engineDom.clientHeight),e.domElement.style.position="absolute",e.domElement.style.top=String(0),e.domElement.className="css3dRenderer",this.engineDom.appendChild(e.domElement),e}initRender2(){const e=new G;return e.setSize(this.engineDom.clientWidth,this.engineDom.clientHeight),e.domElement.style.position="absolute",e.domElement.classList.add("css2dRenderer"),e.domElement.style.top="0px",e.domElement.style.left="0px",this.engineDom.insertBefore(e.domElement,this.engineDom.childNodes[0]),e}reset(){this.renderer=this.runScene.renderEx.create(this.engineDom),this.runScene.renderEx.setSize(),this.renderer.setAnimationLoop(this.runScene.render.bind(this.runScene));var e=this.camera;this.controls=this.runScene.controlsEx.create(e,this.renderer.domElement)}dispose(){this.disposeRender(this.render2),this.disposeRender(this.render3)}init(e){var t=this.runScene.sceneEx.create(),r=this.runScene.cameraEx.create();const n=this.runScene.renderEx.create(e);var i=this.runScene.controlsEx.create(r,e),{render2:o,render3:a}=this.runScene.optionsEx.options;return this.camera=r,this.scene=t,this.renderer=n,this.controls=i,this.engineDom=e,this.runScene.renderEx.setSize(),o&&(this.render2=this.initRender2()),a&&(this.render3=this.initRender3()),n.setAnimationLoop(this.runScene.render.bind(this.runScene)),{scene:t,camera:r,render:n,controls:i,engineDom:e}}get(){var{scene:e,camera:t,renderer:r,controls:n,engineDom:i}=this;return{scene:e,camera:t,renderer:r,controls:n,engineDom:i}}}var X={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\tgl_FragColor = texture2D( tDiffuse, vUv );\n\t\t\tgl_FragColor.a *= opacity;\n\n\n\t\t}"};function q(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Y(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Z(e,t,r){t&&Y(e.prototype,t),r&&Y(e,r),Object.defineProperty(e,"prototype",{writable:!1})}var Q=function(){function e(){q(this,e),this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}return Z(e,[{key:"setSize",value:function(){}},{key:"render",value:function(){console.error("THREE.Pass: .render() must be implemented in derived pass.")}}]),e}(),K=new p.OrthographicCamera(-1,1,1,-1,0,1),J=new p.BufferGeometry,$=(J.setAttribute("position",new p.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3)),J.setAttribute("uv",new p.Float32BufferAttribute([0,2,0,0,2,0],2)),function(){function e(t){q(this,e),this._mesh=new p.Mesh(J,t)}return Z(e,[{key:"dispose",value:function(){this._mesh.geometry.dispose()}},{key:"render",value:function(e){e.render(this._mesh,K)}},{key:"material",get:function(){return this._mesh.material},set:function(e){this._mesh.material=e}}]),e}());function ee(e){return(ee="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 te(e,t){return(te=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function re(e){return(re=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var ne=function(){var e=n,t=Q;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&&te(e,t);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=re(e);if(r=t?(r=re(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===ee(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(e,t){var i;if(this instanceof n)return(i=r.call(this)).textureID=void 0!==t?t:"tDiffuse",e instanceof p.ShaderMaterial?(i.uniforms=e.uniforms,i.material=e):e&&(i.uniforms=p.UniformsUtils.clone(e.uniforms),i.material=new p.ShaderMaterial({defines:Object.assign({},e.defines),uniforms:i.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),i.fsQuad=new $(i.material),i;throw new TypeError("Cannot call a class as a function")}return e=n,(t=[{key:"render",value:function(e,t,r){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=r.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)}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),n}();function ie(e){return(ie="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 oe(e,t){return(oe=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ae(e){return(ae=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var se=function(){var e=n,t=Q;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&&oe(e,t);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=ae(e);if(r=t?(r=ae(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===ie(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(e,t,i,o,a){var s;if(this instanceof n)return(s=r.call(this)).scene=e,s.camera=t,s.overrideMaterial=i,s.clearColor=o,s.clearAlpha=void 0!==a?a:0,s.clear=!0,s.clearDepth=!1,s.needsSwap=!1,s._oldClearColor=new p.Color,s;throw new TypeError("Cannot call a class as a function")}return e=n,(t=[{key:"render",value:function(e,t,r){var n,i,o=e.autoClear;e.autoClear=!1,void 0!==this.overrideMaterial&&(i=this.scene.overrideMaterial,this.scene.overrideMaterial=this.overrideMaterial),this.clearColor&&(e.getClearColor(this._oldClearColor),n=e.getClearAlpha(),e.setClearColor(this.clearColor,this.clearAlpha)),this.clearDepth&&e.clearDepth(),e.setRenderTarget(this.renderToScreen?null:r),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),e.render(this.scene,this.camera),this.clearColor&&e.setClearColor(this._oldClearColor,n),void 0!==this.overrideMaterial&&(this.scene.overrideMaterial=i),e.autoClear=o}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),n}(),ue={shaderID:"luminosityHighPass",uniforms:{tDiffuse:{value:null},luminosityThreshold:{value:1},smoothWidth:{value:1},defaultColor:{value:new p.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 le(e){return(le="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 ce(e,t){return(ce=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function he(e){return(he=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var fe=function(){var e=n,t=Q;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&&ce(e,t);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=he(e);if(r=t?(r=he(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===le(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(e,t,i,o){var a;if(!(this instanceof n))throw new TypeError("Cannot call a class as a function");(a=r.call(this)).strength=void 0!==t?t:1,a.radius=i,a.threshold=o,a.resolution=void 0!==e?new p.Vector2(e.x,e.y):new p.Vector2(256,256),a.clearColor=new p.Color(0,0,0),a.renderTargetsHorizontal=[],a.renderTargetsVertical=[],a.nMips=5;var s=Math.round(a.resolution.x/2),u=Math.round(a.resolution.y/2);a.renderTargetBright=new p.WebGLRenderTarget(s,u),a.renderTargetBright.texture.name="UnrealBloomPass.bright",a.renderTargetBright.texture.generateMipmaps=!1;for(var l=0;l<a.nMips;l++){var c;((c=new p.WebGLRenderTarget(s,u)).texture.name="UnrealBloomPass.h"+l,c.texture.generateMipmaps=!1,a.renderTargetsHorizontal.push(c),c=new p.WebGLRenderTarget(s,u)).texture.name="UnrealBloomPass.v"+l,c.texture.generateMipmaps=!1,a.renderTargetsVertical.push(c),s=Math.round(s/2),u=Math.round(u/2)}i=ue;for(var h=(a.highPassUniforms=p.UniformsUtils.clone(i.uniforms),a.highPassUniforms.luminosityThreshold.value=o,a.highPassUniforms.smoothWidth.value=.01,a.materialHighPassFilter=new p.ShaderMaterial({uniforms:a.highPassUniforms,vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,defines:{}}),a.separableBlurMaterials=[],[3,5,7,9,11]),f=(s=Math.round(a.resolution.x/2),u=Math.round(a.resolution.y/2),0);f<a.nMips;f++)a.separableBlurMaterials.push(a.getSeperableBlurMaterial(h[f])),a.separableBlurMaterials[f].uniforms.texSize.value=new p.Vector2(s,u),s=Math.round(s/2),u=Math.round(u/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.needsUpdate=!0,a.compositeMaterial.uniforms.bloomFactors.value=[1,.8,.6,.4,.2],a.bloomTintColors=[new p.Vector3(1,1,1),new p.Vector3(1,1,1),new p.Vector3(1,1,1),new p.Vector3(1,1,1),new p.Vector3(1,1,1)],a.compositeMaterial.uniforms.bloomTintColors.value=a.bloomTintColors,e=X,a.copyUniforms=p.UniformsUtils.clone(e.uniforms),a.copyUniforms.opacity.value=1,a.materialCopy=new p.ShaderMaterial({uniforms:a.copyUniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader,blending:p.AdditiveBlending,depthTest:!1,depthWrite:!1,transparent:!0}),a.enabled=!0,a.needsSwap=!1,a._oldClearColor=new p.Color,a.oldClearAlpha=1,a.basic=new p.MeshBasicMaterial,a.fsQuad=new $(null),a}return e=n,(t=[{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()}},{key:"setSize",value:function(e,t){var r=Math.round(e/2),n=Math.round(t/2);this.renderTargetBright.setSize(r,n);for(var i=0;i<this.nMips;i++)this.renderTargetsHorizontal[i].setSize(r,n),this.renderTargetsVertical[i].setSize(r,n),this.separableBlurMaterials[i].uniforms.texSize.value=new p.Vector2(r,n),r=Math.round(r/2),n=Math.round(n/2)}},{key:"render",value:function(e,t,r,i,o){e.getClearColor(this._oldClearColor),this.oldClearAlpha=e.getClearAlpha();for(var a=e.autoClear,s=(e.autoClear=!1,e.setClearColor(this.clearColor,0),o&&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),u=0;u<this.nMips;u++)this.fsQuad.material=this.separableBlurMaterials[u],this.separableBlurMaterials[u].uniforms.colorTexture.value=s.texture,this.separableBlurMaterials[u].uniforms.direction.value=n.BlurDirectionX,e.setRenderTarget(this.renderTargetsHorizontal[u]),e.clear(),this.fsQuad.render(e),this.separableBlurMaterials[u].uniforms.colorTexture.value=this.renderTargetsHorizontal[u].texture,this.separableBlurMaterials[u].uniforms.direction.value=n.BlurDirectionY,e.setRenderTarget(this.renderTargetsVertical[u]),e.clear(),this.fsQuad.render(e),s=this.renderTargetsVertical[u];this.fsQuad.material=this.compositeMaterial,this.compositeMaterial.uniforms.bloomStrength.value=this.strength,this.compositeMaterial.uniforms.bloomRadius.value=this.radius,this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors,e.setRenderTarget(this.renderTargetsHorizontal[0]),e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.materialCopy,this.copyUniforms.tDiffuse.value=this.renderTargetsHorizontal[0].texture,o&&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=a}},{key:"getSeperableBlurMaterial",value:function(e){return new p.ShaderMaterial({defines:{KERNEL_RADIUS:e,SIGMA:e},uniforms:{colorTexture:{value:null},texSize:{value:new p.Vector2(.5,.5)},direction:{value:new p.Vector2(.5,.5)}},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 texSize;\n\t\t\t\tuniform vec2 direction;\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\t\t\t\tvoid main() {\n\t\t\t\t\tvec2 invSize = 1.0 / texSize;\n\t\t\t\t\tfloat fSigma = float(SIGMA);\n\t\t\t\t\tfloat weightSum = gaussianPdf(0.0, fSigma);\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 = gaussianPdf(x, fSigma);\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 p.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 r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),n}();function pe(e){return(pe="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 de(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function me(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function ye(e,t,r){t&&me(e.prototype,t),r&&me(e,r),Object.defineProperty(e,"prototype",{writable:!1})}function ve(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&&ge(e,t)}function ge(e,t){return(ge=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function be(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=we(e);if(r=t?(r=we(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===pe(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function we(e){return(we=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}fe.BlurDirectionX=new p.Vector2(1,0),fe.BlurDirectionY=new p.Vector2(0,1);var xe=function(){ve(t,Q);var e=be(t);function t(r,n){var i;return de(this,t),(i=e.call(this)).scene=r,i.camera=n,i.clear=!0,i.needsSwap=!1,i.inverse=!1,i}return ye(t,[{key:"render",value:function(e,t,r){var n,i,o=e.getContext(),a=e.state;a.buffers.color.setMask(!1),a.buffers.depth.setMask(!1),a.buffers.color.setLocked(!0),a.buffers.depth.setLocked(!0),i=this.inverse?(n=0,1):(n=1,0),a.buffers.stencil.setTest(!0),a.buffers.stencil.setOp(o.REPLACE,o.REPLACE,o.REPLACE),a.buffers.stencil.setFunc(o.ALWAYS,n,4294967295),a.buffers.stencil.setClear(i),a.buffers.stencil.setLocked(!0),e.setRenderTarget(r),this.clear&&e.clear(),e.render(this.scene,this.camera),e.setRenderTarget(t),this.clear&&e.clear(),e.render(this.scene,this.camera),a.buffers.color.setLocked(!1),a.buffers.depth.setLocked(!1),a.buffers.stencil.setLocked(!1),a.buffers.stencil.setFunc(o.EQUAL,1,4294967295),a.buffers.stencil.setOp(o.KEEP,o.KEEP,o.KEEP),a.buffers.stencil.setLocked(!0)}}]),t}(),Se=function(){ve(t,Q);var e=be(t);function t(){var r;return de(this,t),(r=e.call(this)).needsSwap=!1,r}return ye(t,[{key:"render",value:function(e){e.state.buffers.stencil.setLocked(!1),e.state.buffers.stencil.setTest(!1)}}]),t}();function _e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var Te=function(){function e(t,r){var n;(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,e),this.renderer=t,void 0===r?(n=t.getSize(new p.Vector2),this._pixelRatio=t.getPixelRatio(),this._width=n.width,this._height=n.height,(r=new p.WebGLRenderTarget(this._width*this._pixelRatio,this._height*this._pixelRatio)).texture.name="EffectComposer.rt1"):(this._pixelRatio=1,this._width=r.width,this._height=r.height),this.renderTarget1=r,this.renderTarget2=r.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,this.passes=[],void 0===ne&&console.error("THREE.EffectComposer relies on ShaderPass"),this.copyPass=new ne(X),this.clock=new p.Clock}return function(e,t,r){t&&_e(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1})}(e,[{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(),r=!1,n=0,i=this.passes.length;n<i;n++){var o,a,s=this.passes[n];!1!==s.enabled&&(s.renderToScreen=this.renderToScreen&&this.isLastEnabledPass(n),s.render(this.renderer,this.writeBuffer,this.readBuffer,e,r),s.needsSwap&&(r&&(o=this.renderer.getContext(),(a=this.renderer.state.buffers.stencil).setFunc(o.NOTEQUAL,1,4294967295),this.copyPass.render(this.renderer,this.writeBuffer,this.readBuffer,e),a.setFunc(o.EQUAL,1,4294967295)),this.swapBuffers()),void 0!==xe&&(s instanceof xe?r=!0:s instanceof Se&&(r=!1)))}this.renderer.setRenderTarget(t)}},{key:"reset",value:function(e){var t;void 0===e&&(t=this.renderer.getSize(new p.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 r=this._width*this._pixelRatio,n=this._height*this._pixelRatio;this.renderTarget1.setSize(r,n),this.renderTarget2.setSize(r,n);for(var i=0;i<this.passes.length;i++)this.passes[i].setSize(r,n)}},{key:"setPixelRatio",value:function(e){this._pixelRatio=e,this.setSize(this._width,this._height)}}]),e}();function Ee(e){return(Ee="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 Oe(e,t){return(Oe=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Me(e){return(Me=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}new p.OrthographicCamera(-1,1,1,-1,0,1),(c=new p.BufferGeometry).setAttribute("position",new p.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3)),c.setAttribute("uv",new p.Float32BufferAttribute([0,2,0,0,2,0],2));var Pe=function(){var e=n,t=Q;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&&Oe(e,t);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Me(e);if(r=t?(r=Me(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Ee(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(e,t,i,o){var a;if(!(this instanceof n))throw new TypeError("Cannot call a class as a function");return(a=r.call(this)).scene=e,a.camera=t,a.sampleLevel=4,a.unbiased=!0,a.clearColor=void 0!==i?i:0,a.clearAlpha=void 0!==o?o:0,a._oldClearColor=new p.Color,e=X,a.copyUniforms=p.UniformsUtils.clone(e.uniforms),a.copyMaterial=new p.ShaderMaterial({uniforms:a.copyUniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader,transparent:!0,blending:p.AdditiveBlending,depthTest:!1,depthWrite:!1}),a.fsQuad=new $(a.copyMaterial),a}return e=n,(t=[{key:"dispose",value:function(){this.sampleRenderTarget&&(this.sampleRenderTarget.dispose(),this.sampleRenderTarget=null)}},{key:"setSize",value:function(e,t){this.sampleRenderTarget&&this.sampleRenderTarget.setSize(e,t)}},{key:"render",value:function(e,t,r){this.sampleRenderTarget||(this.sampleRenderTarget=new p.WebGLRenderTarget(r.width,r.height),this.sampleRenderTarget.texture.name="SSAARenderPass.sample");var n=Re[Math.max(0,Math.min(this.sampleLevel,5))],i=e.autoClear,o=(e.autoClear=!1,e.getClearColor(this._oldClearColor),e.getClearAlpha()),a=1/n.length,s=(this.copyUniforms.tDiffuse.value=this.sampleRenderTarget.texture,{fullWidth:r.width,fullHeight:r.height,offsetX:0,offsetY:0,width:r.width,height:r.height});(r=Object.assign({},this.camera.view)).enabled&&Object.assign(s,r);for(var u=0;u<n.length;u++){var l=n[u];this.camera.setViewOffset&&this.camera.setViewOffset(s.fullWidth,s.fullHeight,s.offsetX+.0625*l[0],s.offsetY+.0625*l[1],s.width,s.height),l=a,this.unbiased&&(l+=1/32*((u+.5)/n.length-.5)),this.copyUniforms.opacity.value=l,e.setClearColor(this.clearColor,this.clearAlpha),e.setRenderTarget(this.sampleRenderTarget),e.clear(),e.render(this.scene,this.camera),e.setRenderTarget(this.renderToScreen?null:t),0===u&&(e.setClearColor(0,0),e.clear()),this.fsQuad.render(e)}this.camera.setViewOffset&&r.enabled?this.camera.setViewOffset(r.fullWidth,r.fullHeight,r.offsetX,r.offsetY,r.width,r.height):this.camera.clearViewOffset&&this.camera.clearViewOffset(),e.autoClear=i,e.setClearColor(this._oldClearColor,o)}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),n}(),Re=[[[0,0]],[[4,4],[-4,-4]],[[-2,-6],[6,-2],[-6,2],[2,6]],[[1,-3],[-1,3],[5,1],[-3,-5],[-5,5],[-7,-1],[3,7],[7,-7]],[[1,1],[-1,-3],[-3,2],[4,-1],[-5,-2],[2,5],[5,3],[3,-5],[-2,6],[0,-7],[-4,-6],[-6,4],[-8,0],[7,-4],[6,7],[-7,-8]],[[-4,-7],[-7,-5],[-3,-5],[-5,-4],[-1,-4],[-2,-2],[-6,-1],[-4,0],[-7,1],[-1,2],[-6,3],[-3,3],[-7,6],[-3,6],[-5,7],[-1,7],[5,-7],[1,-6],[6,-5],[4,-4],[2,-3],[7,-2],[1,-1],[4,-1],[2,1],[6,2],[0,4],[4,4],[2,5],[7,5],[5,6],[3,7]]];function ke(e){return(ke="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 je(){return(je="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=Ce(e)););return e}(e,t);if(n)return(n=Object.getOwnPropertyDescriptor(n,t)).get?n.get.call(arguments.length<3?e:r):n.value}).apply(this,arguments)}function Ae(e,t){return(Ae=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Ce(e){return(Ce=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var De=function(){var e=n,t=Pe;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&&Ae(e,t);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Ce(e);if(r=t?(r=Ce(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===ke(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(e,t,i,o){if(this instanceof n)return(e=r.call(this,e,t,i,o)).sampleLevel=0,e.accumulate=!1,e;throw new TypeError("Cannot call a class as a function")}return e=n,(t=[{key:"render",value:function(e,t,r,i){if(!1===this.accumulate)return je(Ce(n.prototype),"render",this).call(this,e,t,r,i),void(this.accumulateIndex=-1);var o=Le[5],a=(void 0===this.sampleRenderTarget&&(this.sampleRenderTarget=new p.WebGLRenderTarget(r.width,r.height,this.params),this.sampleRenderTarget.texture.name="TAARenderPass.sample"),void 0===this.holdRenderTarget&&(this.holdRenderTarget=new p.WebGLRenderTarget(r.width,r.height,this.params),this.holdRenderTarget.texture.name="TAARenderPass.hold"),-1===this.accumulateIndex&&(je(Ce(n.prototype),"render",this).call(this,e,this.holdRenderTarget,r,i),this.accumulateIndex=0),i=e.autoClear,e.autoClear=!1,1/o.length);if(0<=this.accumulateIndex&&this.accumulateIndex<o.length){this.copyUniforms.opacity.value=a,this.copyUniforms.tDiffuse.value=t.texture;for(var s=Math.pow(2,this.sampleLevel),u=0;u<s;u++){var l=o[this.accumulateIndex];if(this.camera.setViewOffset&&this.camera.setViewOffset(r.width,r.height,.0625*l[0],.0625*l[1],r.width,r.height),e.setRenderTarget(t),e.clear(),e.render(this.scene,this.camera),e.setRenderTarget(this.sampleRenderTarget),0===this.accumulateIndex&&e.clear(),this.fsQuad.render(e),this.accumulateIndex++,this.accumulateIndex>=o.length)break}this.camera.clearViewOffset&&this.camera.clearViewOffset()}0<(a=this.accumulateIndex*a)&&(this.copyUniforms.opacity.value=1,this.copyUniforms.tDiffuse.value=this.sampleRenderTarget.texture,e.setRenderTarget(t),e.clear(),this.fsQuad.render(e)),a<1&&(this.copyUniforms.opacity.value=1-a,this.copyUniforms.tDiffuse.value=this.holdRenderTarget.texture,e.setRenderTarget(t),0==a&&e.clear(),this.fsQuad.render(e)),e.autoClear=i}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),n}(),Le=[[[0,0]],[[4,4],[-4,-4]],[[-2,-6],[6,-2],[-6,2],[2,6]],[[1,-3],[-1,3],[5,1],[-3,-5],[-5,5],[-7,-1],[3,7],[7,-7]],[[1,1],[-1,-3],[-3,2],[4,-1],[-5,-2],[2,5],[5,3],[3,-5],[-2,6],[0,-7],[-4,-6],[-6,4],[-8,0],[7,-4],[6,7],[-7,-8]],[[-4,-7],[-7,-5],[-3,-5],[-5,-4],[-1,-4],[-2,-2],[-6,-1],[-4,0],[-7,1],[-1,2],[-6,3],[-3,3],[-7,6],[-3,6],[-5,7],[-1,7],[5,-7],[1,-6],[6,-5],[4,-4],[2,-3],[7,-2],[1,-1],[4,-1],[2,1],[6,2],[0,4],[4,4],[2,5],[7,5],[5,6],[3,7]]],ze={uniforms:{tDiffuse:{value:null},resolution:{value:new p.Vector2(1/1024,1/512)}},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\tprecision highp float;\n\n\tuniform sampler2D tDiffuse;\n\n\tuniform vec2 resolution;\n\n\tvarying vec2 vUv;\n\n\t// FXAA 3.11 implementation by NVIDIA, ported to WebGL by Agost Biro (biro@archilogic.com)\n\n\t//----------------------------------------------------------------------------------\n\t// File: es3-keplerFXAAassetsshaders/FXAA_DefaultES.frag\n\t// SDK Version: v3.00\n\t// Email: gameworks@nvidia.com\n\t// Site: http://developer.nvidia.com/\n\t//\n\t// Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.\n\t//\n\t// Redistribution and use in source and binary forms, with or without\n\t// modification, are permitted provided that the following conditions\n\t// are met:\n\t// * Redistributions of source code must retain the above copyright\n\t// notice, this list of conditions and the following disclaimer.\n\t// * Redistributions in binary form must reproduce the above copyright\n\t// notice, this list of conditions and the following disclaimer in the\n\t// documentation and/or other materials provided with the distribution.\n\t// * Neither the name of NVIDIA CORPORATION nor the names of its\n\t// contributors may be used to endorse or promote products derived\n\t// from this software without specific prior written permission.\n\t//\n\t// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY\n\t// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n\t// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n\t// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR\n\t// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n\t// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n\t// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n\t// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY\n\t// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n\t// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n\t// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\t//\n\t//----------------------------------------------------------------------------------\n\n\t#ifndef FXAA_DISCARD\n\t\t\t//\n\t\t\t// Only valid for PC OpenGL currently.\n\t\t\t// Probably will not work when FXAA_GREEN_AS_LUMA = 1.\n\t\t\t//\n\t\t\t// 1 = Use discard on pixels which don't need AA.\n\t\t\t// For APIs which enable concurrent TEX+ROP from same surface.\n\t\t\t// 0 = Return unchanged color on pixels which don't need AA.\n\t\t\t//\n\t\t\t#define FXAA_DISCARD 0\n\t#endif\n\n\t/*--------------------------------------------------------------------------*/\n\t#define FxaaTexTop(t, p) texture2D(t, p, -100.0)\n\t#define FxaaTexOff(t, p, o, r) texture2D(t, p + (o * r), -100.0)\n\t/*--------------------------------------------------------------------------*/\n\n\t#define NUM_SAMPLES 5\n\n\t// assumes colors have premultipliedAlpha, so that the calculated color contrast is scaled by alpha\n\tfloat contrast( vec4 a, vec4 b ) {\n\t\t\tvec4 diff = abs( a - b );\n\t\t\treturn max( max( max( diff.r, diff.g ), diff.b ), diff.a );\n\t}\n\n\t/*============================================================================\n\n\t\t\t\t\t\t\t\t\tFXAA3 QUALITY - PC\n\n\t============================================================================*/\n\n\t/*--------------------------------------------------------------------------*/\n\tvec4 FxaaPixelShader(\n\t\t\tvec2 posM,\n\t\t\tsampler2D tex,\n\t\t\tvec2 fxaaQualityRcpFrame,\n\t\t\tfloat fxaaQualityEdgeThreshold,\n\t\t\tfloat fxaaQualityinvEdgeThreshold\n\t) {\n\t\t\tvec4 rgbaM = FxaaTexTop(tex, posM);\n\t\t\tvec4 rgbaS = FxaaTexOff(tex, posM, vec2( 0.0, 1.0), fxaaQualityRcpFrame.xy);\n\t\t\tvec4 rgbaE = FxaaTexOff(tex, posM, vec2( 1.0, 0.0), fxaaQualityRcpFrame.xy);\n\t\t\tvec4 rgbaN = FxaaTexOff(tex, posM, vec2( 0.0,-1.0), fxaaQualityRcpFrame.xy);\n\t\t\tvec4 rgbaW = FxaaTexOff(tex, posM, vec2(-1.0, 0.0), fxaaQualityRcpFrame.xy);\n\t\t\t// . S .\n\t\t\t// W M E\n\t\t\t// . N .\n\n\t\t\tbool earlyExit = max( max( max(\n\t\t\t\t\tcontrast( rgbaM, rgbaN ),\n\t\t\t\t\tcontrast( rgbaM, rgbaS ) ),\n\t\t\t\t\tcontrast( rgbaM, rgbaE ) ),\n\t\t\t\t\tcontrast( rgbaM, rgbaW ) )\n\t\t\t\t\t< fxaaQualityEdgeThreshold;\n\t\t\t// . 0 .\n\t\t\t// 0 0 0\n\t\t\t// . 0 .\n\n\t\t\t#if (FXAA_DISCARD == 1)\n\t\t\t\t\tif(earlyExit) FxaaDiscard;\n\t\t\t#else\n\t\t\t\t\tif(earlyExit) return rgbaM;\n\t\t\t#endif\n\n\t\t\tfloat contrastN = contrast( rgbaM, rgbaN );\n\t\t\tfloat contrastS = contrast( rgbaM, rgbaS );\n\t\t\tfloat contrastE = contrast( rgbaM, rgbaE );\n\t\t\tfloat contrastW = contrast( rgbaM, rgbaW );\n\n\t\t\tfloat relativeVContrast = ( contrastN + contrastS ) - ( contrastE + contrastW );\n\t\t\trelativeVContrast *= fxaaQualityinvEdgeThreshold;\n\n\t\t\tbool horzSpan = relativeVContrast > 0.;\n\t\t\t// . 1 .\n\t\t\t// 0 0 0\n\t\t\t// . 1 .\n\n\t\t\t// 45 deg edge detection and corners of objects, aka V/H contrast is too similar\n\t\t\tif( abs( relativeVContrast ) < .3 ) {\n\t\t\t\t\t// locate the edge\n\t\t\t\t\tvec2 dirToEdge;\n\t\t\t\t\tdirToEdge.x = contrastE > contrastW ? 1. : -1.;\n\t\t\t\t\tdirToEdge.y = contrastS > contrastN ? 1. : -1.;\n\t\t\t\t\t// . 2 . . 1 .\n\t\t\t\t\t// 1 0 2 ~= 0 0 1\n\t\t\t\t\t// . 1 . . 0 .\n\n\t\t\t\t\t// tap 2 pixels and see which ones are \"outside\" the edge, to\n\t\t\t\t\t// determine if the edge is vertical or horizontal\n\n\t\t\t\t\tvec4 rgbaAlongH = FxaaTexOff(tex, posM, vec2( dirToEdge.x, -dirToEdge.y ), fxaaQualityRcpFrame.xy);\n\t\t\t\t\tfloat matchAlongH = contrast( rgbaM, rgbaAlongH );\n\t\t\t\t\t// . 1 .\n\t\t\t\t\t// 0 0 1\n\t\t\t\t\t// . 0 H\n\n\t\t\t\t\tvec4 rgbaAlongV = FxaaTexOff(tex, posM, vec2( -dirToEdge.x, dirToEdge.y ), fxaaQualityRcpFrame.xy);\n\t\t\t\t\tfloat matchAlongV = contrast( rgbaM, rgbaAlongV );\n\t\t\t\t\t// V 1 .\n\t\t\t\t\t// 0 0 1\n\t\t\t\t\t// . 0 .\n\n\t\t\t\t\trelativeVContrast = matchAlongV - matchAlongH;\n\t\t\t\t\trelativeVContrast *= fxaaQualityinvEdgeThreshold;\n\n\t\t\t\t\tif( abs( relativeVContrast ) < .3 ) { // 45 deg edge\n\t\t\t\t\t\t\t// 1 1 .\n\t\t\t\t\t\t\t// 0 0 1\n\t\t\t\t\t\t\t// . 0 1\n\n\t\t\t\t\t\t\t// do a simple blur\n\t\t\t\t\t\t\treturn mix(\n\t\t\t\t\t\t\t\t\trgbaM,\n\t\t\t\t\t\t\t\t\t(rgbaN + rgbaS + rgbaE + rgbaW) * .25,\n\t\t\t\t\t\t\t\t\t.4\n\t\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\thorzSpan = relativeVContrast > 0.;\n\t\t\t}\n\n\t\t\tif(!horzSpan) rgbaN = rgbaW;\n\t\t\tif(!horzSpan) rgbaS = rgbaE;\n\t\t\t// . 0 . 1\n\t\t\t// 1 0 1 -> 0\n\t\t\t// . 0 . 1\n\n\t\t\tbool pairN = contrast( rgbaM, rgbaN ) > contrast( rgbaM, rgbaS );\n\t\t\tif(!pairN) rgbaN = rgbaS;\n\n\t\t\tvec2 offNP;\n\t\t\toffNP.x = (!horzSpan) ? 0.0 : fxaaQualityRcpFrame.x;\n\t\t\toffNP.y = ( horzSpan) ? 0.0 : fxaaQualityRcpFrame.y;\n\n\t\t\tbool doneN = false;\n\t\t\tbool doneP = false;\n\n\t\t\tfloat nDist = 0.;\n\t\t\tfloat pDist = 0.;\n\n\t\t\tvec2 posN = posM;\n\t\t\tvec2 posP = posM;\n\n\t\t\tint iterationsUsed = 0;\n\t\t\tint iterationsUsedN = 0;\n\t\t\tint iterationsUsedP = 0;\n\t\t\tfor( int i = 0; i < NUM_SAMPLES; i++ ) {\n\t\t\t\t\titerationsUsed = i;\n\n\t\t\t\t\tfloat increment = float(i + 1);\n\n\t\t\t\t\tif(!doneN) {\n\t\t\t\t\t\t\tnDist += increment;\n\t\t\t\t\t\t\tposN = posM + offNP * nDist;\n\t\t\t\t\t\t\tvec4 rgbaEndN = FxaaTexTop(tex, posN.xy);\n\t\t\t\t\t\t\tdoneN = contrast( rgbaEndN, rgbaM ) > contrast( rgbaEndN, rgbaN );\n\t\t\t\t\t\t\titerationsUsedN = i;\n\t\t\t\t\t}\n\n\t\t\t\t\tif(!doneP) {\n\t\t\t\t\t\t\tpDist += increment;\n\t\t\t\t\t\t\tposP = posM - offNP * pDist;\n\t\t\t\t\t\t\tvec4 rgbaEndP = FxaaTexTop(tex, posP.xy);\n\t\t\t\t\t\t\tdoneP = contrast( rgbaEndP, rgbaM ) > contrast( rgbaEndP, rgbaN );\n\t\t\t\t\t\t\titerationsUsedP = i;\n\t\t\t\t\t}\n\n\t\t\t\t\tif(doneN || doneP) break;\n\t\t\t}\n\n\n\t\t\tif ( !doneP && !doneN ) return rgbaM; // failed to find end of edge\n\n\t\t\tfloat dist = min(\n\t\t\t\t\tdoneN ? float( iterationsUsedN ) / float( NUM_SAMPLES - 1 ) : 1.,\n\t\t\t\t\tdoneP ? float( iterationsUsedP ) / float( NUM_SAMPLES - 1 ) : 1.\n\t\t\t);\n\n\t\t\t// hacky way of reduces blurriness of mostly diagonal edges\n\t\t\t// but reduces AA quality\n\t\t\tdist = pow(dist, .5);\n\n\t\t\tdist = 1. - dist;\n\n\t\t\treturn mix(\n\t\t\t\t\trgbaM,\n\t\t\t\t\trgbaN,\n\t\t\t\t\tdist * .5\n\t\t\t);\n\t}\n\n\tvoid main() {\n\t\t\tconst float edgeDetectionQuality = .2;\n\t\t\tconst float invEdgeDetectionQuality = 1. / edgeDetectionQuality;\n\n\t\t\tgl_FragColor = FxaaPixelShader(\n\t\t\t\t\tvUv,\n\t\t\t\t\ttDiffuse,\n\t\t\t\t\tresolution,\n\t\t\t\t\tedgeDetectionQuality, // [0,1] contrast needed, otherwise early discard\n\t\t\t\t\tinvEdgeDetectionQuality\n\t\t\t);\n\n\t}\n\t"};class Ie extends Q{constructor(e,t,r){super(),this.baseTextureID=void 0!==t?t:"tDiffuse",this.effectTextureID=void 0!==r?r:"tDiffuse",e instanceof p.ShaderMaterial?(this.uniforms=e.uniforms,this.material=e):e&&(this.uniforms=p.UniformsUtils.clone(e.uniforms),this.material=new p.ShaderMaterial({defines:Object.assign({},e.defines),uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),this.fsQuad=new $(this.material)}render(e,t,r){this.uniforms[this.baseTextureID]&&(this.uniforms[this.baseTextureID].value=t.texture),this.uniforms[this.effectTextureID]&&(this.uniforms[this.effectTextureID].value=r.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 Be extends Q{constructor(e,t,r,n,i){super(),this.scene=e,this.camera=t,this.layerIndex=0,this.overrideMaterial=r,this.clearColor=n,this.clearAlpha=void 0!==i?i:0,this.clear=!0,this.clearDepth=!1,this.needsSwap=!1,this.oldClearColor=new p.Color,this.oldCameraLayer=t.layers.mask}render(e,t,r){var n=e.autoClear;let i,o;e.autoClear=!1,void 0!==this.overrideMaterial&&(o=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:r),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.clearColor&&e.setClearColor(this.oldClearColor,i),void 0!==this.overrideMaterial&&(this.scene.overrideMaterial=o),this.scene.background=this.sceneBg,e.autoClear=n}}const Ue={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 Ne{constructor(e){this.modelLength=new Set,this.runScene=e,this.init()}init(){const{setLayers:e,add:t,remove:r}=this.runScene.optionsEx.cb.model;e.add("glow-set-layers",(e=>{var{model:e,val:t}=e;0===t&&0===this.modelLength.size||this[0===t?"remove":"add"](e)})),r.add("glow-set-layers",(({model:e})=>{1!==e.layers.mask&&this.remove(e)})),t.add("glow-set-layers",(({model:e})=>{1!==e.layers.mask&&this.add(e)}))}add(e){this.modelLength.add(e.userData.id),0<this.modelLength.size&&(this.runScene.optionsEx.cb.bloom.glow.setStatus.cb(!0),this.runScene.bloom.glow.bloomParams.isBloom=!0)}remove(e){this.modelLength.delete(e.userData.id),this.modelLength.size<=0&&(this.runScene.optionsEx.cb.bloom.glow.setStatus.cb(!1),this.runScene.bloom.glow.bloomParams.isBloom=!1)}}class Fe{constructor(e){this.bloomParams={isBloom:!1,bloomStrength:2,bloomThreshold:0,bloomRadius:0},this.runScene=e,this.info=new Ne(this.runScene),this.ENTIRE_SCENE=0,this.BLOOM_SCENE=1,this.bloomParams.isBloom=!1,this.bloomLayer=new p.Layers,this.bloomLayer.set(this.BLOOM_SCENE),this.darkMaterial=new p.MeshBasicMaterial({color:"black"}),this.materials={},this.isUpdate=!0,this.sceneFog=null,this.sceneBackground=null,this.runScene.exporter.gltf.options.addOption({type:"bloom-glow",process:e=>this.toJSON(),parse:e=>{e=JSON.parse(e),this.setData(e)}});const t=navigator.userAgent;this.isSafari=-1<t.indexOf("Safari")&&-1==t.indexOf("Chrome")}static getInstance(e){return Fe.instance||(Fe.instance=new Fe(e)),Fe.instance}set rendererTone(e){this.renderer&&(this.renderer.toneMapping=e?p.ACESFilmicToneMapping:p.NoToneMapping)}init(e){var{camera:e,scene:t,renderer:r}=e;this.mainScene=t,this.mainCamera=e,this.renderer=r,this.sceneFog=this.mainScene.fog,this.renderer&&(t=this.renderer.getDrawingBufferSize(new p.Vector2),this.rtSize={width:t.width,height:t.height},this.isSafari?this.postProcessingTraverse():this.postProcessing())}setData(e){e=e.bloomParams;var{bloomRadius:e,bloomStrength:t,bloomThreshold:r,isBloom:n}=e;this.bloomParams.isBloom=n,this.bloomParams.bloomRadius=e,this.bloomParams.bloomStrength=t,this.bloomParams.bloomThreshold=r,this.bloomPass&&(this.bloomPass.strength=t,this.bloomPass.radius=e,this.bloomPass.threshold=r),this.runScene.optionsEx.cb.bloom.glow.setData.cb(this.bloomParams)}setSize(e,t){this.renderer&&(this.rtSize={width:e,height:t},this.effectComposer&&this.effectComposer.setSize(this.rtSize.width,this.rtSize.height))}setBackground(e){this.sceneBackground&&this.sceneBackground instanceof p.Texture&&this.sceneBackground.dispose(),this.sceneBackground=e,this.bloomRenderPass&&(this.bloomRenderPass.sceneBg=this.sceneBackground)}setUpdate(e){this.isUpdate=e}postProcessing(){this.renderer&&(this.renderer.autoClear=!1),this.effectRT?(this.effectRT.setSize(this.rtSize.width,this.rtSize.height),this.effectRT.depthTexture.dispose()):(this.effectRT=new p.WebGLRenderTarget(this.rtSize.width,this.rtSize.height),this.effectRT.texture.name="EffectComposer.pass",this.effectRT.texture.type=p.FloatType,this.effectRT.texture.format=p.RGBAFormat,this.effectRT.texture.encoding=p.sRGBEncoding,this.effectRT.texture.minFilter=p.LinearFilter,this.effectRT.texture.magFilter=p.LinearFilter),this.effectRT.depthTexture=new p.DepthTexture(this.rtSize.width,this.rtSize.height),this.effectRT.depthTexture.format=p.DepthFormat,this.effectRT.depthTexture.type=p.UnsignedIntType,this.taaRenderPass?(this.taaRenderPass.scene=this.mainScene,this.taaRenderPass.camera=this.mainCamera):(this.taaRenderPass=new De(this.mainScene,this.mainCamera,0,0),this.taaRenderPass.unbiased=!1,this.taaRenderPass.sampleLevel=1,this.taaRenderPass.accumulate=!1),this.sampleRT?this.sampleRT.setSize(this.rtSize.width,this.rtSize.height):(this.sampleRT=new p.WebGLRenderTarget(this.rtSize.width,this.rtSize.height),this.sampleRT.texture.name="TAARenderPass.sample",this.sampleRT.texture.type=p.FloatType,this.sampleRT.texture.format=p.RGBAFormat,this.sampleRT.texture.encoding=p.sRGBEncoding,this.sampleRT.texture.minFilter=p.LinearFilter,this.sampleRT.texture.magFilter=p.LinearFilter,this.sampleRT.depthTexture=this.effectRT.depthTexture,this.taaRenderPass.sampleRenderTarget=this.sampleRT),this.holdRT?this.holdRT.setSize(this.rtSize.width,this.rtSize.height):(this.holdRT=new p.WebGLRenderTarget(this.rtSize.width,this.rtSize.height),this.holdRT.texture.name="TAARenderPass.hold",this.holdRT.texture.type=p.FloatType,this.holdRT.texture.format=p.RGBAFormat,this.holdRT.texture.encoding=p.sRGBEncoding,this.holdRT.texture.minFilter=p.LinearFilter,this.holdRT.texture.magFilter=p.LinearFilter,this.holdRT.depthTexture=this.effectRT.depthTexture,this.taaRenderPass.holdRenderTarget=this.holdRT),this.bloomRenderPass?(this.bloomRenderPass.scene=this.mainScene,this.bloomRenderPass.camera=this.mainCamera):(this.bloomRenderPass=new Be(this.mainScene,this.mainCamera),this.bloomRenderPass.layerIndex=this.BLOOM_SCENE,this.bloomRenderPass.clearDepth=!1,this.bloomRenderPass.sceneBg=this.sceneBackground),this.bloomPass?this.bloomPass.setSize(this.rtSize.width,this.rtSize.height):this.bloomPass=new fe(new p.Vector2(this.rtSize.width,this.rtSize.height),1.5,.4,.85),this.bloomPass.strength=this.bloomParams.bloomStrength,this.bloomPass.radius=this.bloomParams.bloomRadius,this.bloomPass.threshold=this.bloomParams.bloomThreshold,this.mixingPass||(this.mixingPass=new Ie(Ue,"baseTexture","bloomTexture"),this.mixingPass.renderToScreen=!1),this.effectCopy||(this.effectCopy=new ne(X),this.effectCopy.clear=!1,this.effectCopy.renderToScreen=!1,this.effectCopy.needsSwap=!1,this.effectCopy.material.depthWrite=!1),this.effectComposer?this.effectComposer.renderer=this.renderer:(this.effectComposer=new Te(this.renderer,this.effectRT),this.effectComposer.addPass(this.taaRenderPass),this.effectComposer.addPass(this.effectCopy),this.effectComposer.addPass(this.bloomRenderPass),this.effectComposer.addPass(this.bloomPass),this.effectComposer.addPass(this.mixingPass))}postProcessingTraverse(){this.renderScene?(this.renderScene.scene=this.mainScene,this.renderScene.camera=this.mainCamera):this.renderScene=new se(this.mainScene,this.mainCamera);var e=this.renderer.getPixelRatio();this.fxaaPass=new ne(ze),this.fxaaPass.material.uniforms.resolution.value.x=1/(this.rtSize.width*e),this.fxaaPass.material.uniforms.resolution.value.y=1/(this.rtSize.height*e),this.bloomPass?this.bloomPass.setSize(this.rtSize.width,this.rtSize.height):this.bloomPass=new fe(new p.Vector2(this.rtSize.width,this.rtSize.height),1.5,.4,.85),this.bloomPass.strength=this.bloomParams.bloomStrength,this.bloomPass.radius=this.bloomParams.bloomRadius,this.bloomPass.threshold=this.bloomParams.bloomThreshold,this.bloomComposer=new Te(this.renderer),this.bloomComposer.renderToScreen=!1,this.bloomComposer.addPass(this.renderScene),this.bloomComposer.addPass(this.bloomPass);const t=new ne(new p.ShaderMaterial({uniforms:{baseTexture:{value:null},bloomTexture:{value:this.bloomComposer.renderTarget2.texture}},vertexShader:Ue.vertexShader,fragmentShader:Ue.fragmentShader,defines:{}}),"baseTexture");t.needsSwap=!0,this.finalComposer=new Te(this.renderer),this.finalComposer.addPass(this.renderScene),this.finalComposer.addPass(this.fxaaPass),this.finalComposer.addPass(t)}dispose(){this.mainScene=null,this.mainCamera=null,this.setBackground(null),this.effectRT&&(this.effectRT.depthTexture.dispose(),this.effectRT.depthTexture=null,this.effectRT.dispose(),this.effectRT=null),this.sampleRT&&(this.sampleRT.depthTexture.dispose(),this.sampleRT.depthTexture=null,this.sampleRT.dispose(),this.sampleRT=null),this.holdRT&&(this.holdRT.depthTexture.dispose(),this.holdRT.depthTexture=null,this.holdRT.dispose(),this.holdRT=null),this.taaRenderPass&&(this.taaRenderPass.dispose(),this.taaRenderPass=null),this.bloomPass&&(this.bloomPass.dispose(),this.bloomPass=null),this.mixingPass=null,this.effectCopy=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)}update(){this.isUpdate&&this.mainCamera&&this.mainScene&&this.renderer&&(this.renderer.clear(),this.bloomParams.isBloom?this.isSafari?(this.renderBloom(!0),this.finalComposer.render()):this.effectComposer.render():this.renderer.render(this.mainScene,this.mainCamera))}renderBloom(e){this.sceneFog&&(this.mainScene.fog=null),this.sceneBackground&&(this.mainScene.background=null),e?(null!=(e=this.mainScene)&&e.traverse((e=>{e.isMesh&&!this.bloomLayer.test(e.layers)&&(this.materials[e.uuid]=e.material,e.material=this.darkMaterial)})),this.bloomComposer.render(),null!=(e=this.mainScene)&&e.traverse((e=>{this.materials[e.uuid]&&(e.material=this.materials[e.uuid],delete this.materials[e.uuid])}))):(null!=(e=this.mainCamera)&&e.layers.set(this.BLOOM_SCENE),this.bloomComposer.render(),null!=(e=this.mainCamera)&&e.layers.set(this.ENTIRE_SCENE)),this.sceneFog&&(this.mainScene.fog=this.sceneFog),this.sceneBackground&&(this.mainScene.background=this.sceneBackground)}toJSON(){const e={};var t=this.bloomParams;return e.bloomParams=Object.assign({},t),JSON.stringify(e)}reset(){this.bloomParams.isBloom=!1,this.rendererTone=!1,this.setBackground(null)}}class Ve{constructor(e){this.runScene=e}create(){return new p.PerspectiveCamera}reset(e){e.position.set(0,20,20);const t=this.runScene.assetsEx.get().controls;t.target.set(0,0,0),t.update()}get(){return this.runScene.assetsEx.get().camera}}function He(e){return(He="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 Ge(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&&We(e,t)}function We(e,t){return(We=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Xe(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function qe(e){return(qe=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Ye={type:"change"},Ze={type:"start"},Qe={type:"end"},Ke=function(){Ge(t,p.EventDispatcher);var e=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=qe(e);if(r=t?(r=qe(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===He(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return Xe(n)}}(t);function t(r,n){(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,t),i=e.call(this),void 0===n&&console.warn('THREE.OrbitControls: The second parameter "domElement" is now mandatory.'),n===document&&console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),i.object=r,i.domElement=n,i.domElement.style.touchAction="none",i.enabled=!0,i.target=new p.Vector3,i.minDistance=0,i.maxDistance=1/0,i.minZoom=0,i.maxZoom=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.autoRotate=!1,i.autoRotateSpeed=2,i.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},i.mouseButtons={LEFT:p.MOUSE.ROTATE,MIDDLE:p.MOUSE.DOLLY,RIGHT:p.MOUSE.PAN},i.touches={ONE:p.TOUCH.ROTATE,TWO:p.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 y.phi},i.getAzimuthalAngle=function(){return y.theta},i.getDistance=function(){return this.object.position.distanceTo(this.target)},i.listenToKeyEvents=function(e){e.addEventListener("keydown",re),this._domElementKeyEvents=e},i.saveState=function(){h.target0.copy(h.target),h.position0.copy(h.object.position),h.zoom0=h.object.zoom},i.reset=function(){h.target.copy(h.target0),h.object.position.copy(h.position0),h.object.zoom=h.zoom0,h.object.updateProjectionMatrix(),h.dispatchEvent(Ye),h.update(),d=f.NONE},i.update=(o=new p.Vector3,a=(new p.Quaternion).setFromUnitVectors(r.up,new p.Vector3(0,1,0)),s=a.clone().invert(),u=new p.Vector3,l=new p.Quaternion,c=2*Math.PI,function(){var e=h.object.position,t=(o.copy(e).sub(h.target),o.applyQuaternion(a),y.setFromVector3(o),h.autoRotate&&d===f.NONE&&C(2*Math.PI/60/60*h.autoRotateSpeed),h.enableDamping?(y.theta+=v.theta*h.dampingFactor,y.phi+=v.phi*h.dampingFactor):(y.theta+=v.theta,y.phi+=v.phi),h.minAzimuthAngle),r=h.maxAzimuthAngle;return isFinite(t)&&isFinite(r)&&(t<-Math.PI?t+=c:t>Math.PI&&(t-=c),r<-Math.PI?r+=c:r>Math.PI&&(r-=c),y.theta=t<=r?Math.max(t,Math.min(r,y.theta)):y.theta>(t+r)/2?Math.max(t,y.theta):Math.min(r,y.theta)),y.phi=Math.max(h.minPolarAngle,Math.min(h.maxPolarAngle,y.phi)),y.makeSafe(),y.radius*=g,y.radius=Math.max(h.minDistance,Math.min(h.maxDistance,y.radius)),!0===h.enableDamping?h.target.addScaledVector(b,h.dampingFactor):h.target.add(b),o.setFromSpherical(y),o.applyQuaternion(s),e.copy(h.target).add(o),h.object.lookAt(h.target),!0===h.enableDamping?(v.theta*=1-h.dampingFactor,v.phi*=1-h.dampingFactor,b.multiplyScalar(1-h.dampingFactor)):(v.set(0,0,0),b.set(0,0,0)),g=1,!(!(w||u.distanceToSquared(h.object.position)>m||8*(1-l.dot(h.object.quaternion))>m)||(h.dispatchEvent(Ye),u.copy(h.object.position),l.copy(h.object.quaternion),w=!1))}),i.dispose=function(){h.domElement.removeEventListener("contextmenu",ne),h.domElement.removeEventListener("pointerdown",K),h.domElement.removeEventListener("pointercancel",ee),h.domElement.removeEventListener("wheel",te),h.domElement.removeEventListener("pointermove",J),h.domElement.removeEventListener("pointerup",$),null!==h._domElementKeyEvents&&h._domElementKeyEvents.removeEventListener("keydown",re)};var i,o,a,s,u,l,c,h=Xe(i),f={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},d=f.NONE,m=1e-6,y=new p.Spherical,v=new p.Spherical,g=1,b=new p.Vector3,w=!1,x=new p.Vector2,S=new p.Vector2,_=new p.Vector2,T=new p.Vector2,E=new p.Vector2,O=new p.Vector2,M=new p.Vector2,P=new p.Vector2,R=new p.Vector2,k=[],j={};function A(){return Math.pow(.95,h.zoomSpeed)}function C(e){v.theta-=e}function D(e){v.phi-=e}L=new p.Vector3;var L,z,I,B=function(e,t){L.setFromMatrixColumn(t,0),L.multiplyScalar(-e),b.add(L)},U=(z=new p.Vector3,function(e,t){!0===h.screenSpacePanning?z.setFromMatrixColumn(t,1):(z.setFromMatrixColumn(t,0),z.crossVectors(h.object.up,z)),z.multiplyScalar(e),b.add(z)}),N=(I=new p.Vector3,function(e,t){var r,n=h.domElement;h.object.isPerspectiveCamera?(r=h.object.position,I.copy(r).sub(h.target),r=I.length(),r*=Math.tan(h.object.fov/2*Math.PI/180),B(2*e*r/n.clientHeight,h.object.matrix),U(2*t*r/n.clientHeight,h.object.matrix)):h.object.isOrthographicCamera?(B(e*(h.object.right-h.object.left)/h.object.zoom/n.clientWidth,h.object.matrix),U(t*(h.object.top-h.object.bottom)/h.object.zoom/n.clientHeight,h.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),h.enablePan=!1)});function F(e){h.object.isPerspectiveCamera?g/=e:h.object.isOrthographicCamera?(h.object.zoom=Math.max(h.minZoom,Math.min(h.maxZoom,h.object.zoom*e)),h.object.updateProjectionMatrix(),w=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),h.enableZoom=!1)}function V(e){h.object.isPerspectiveCamera?g*=e:h.object.isOrthographicCamera?(h.object.zoom=Math.max(h.minZoom,Math.min(h.maxZoom,h.object.zoom/e)),h.object.updateProjectionMatrix(),w=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),h.enableZoom=!1)}function H(e){x.set(e.clientX,e.clientY)}function G(e){T.set(e.clientX,e.clientY)}function W(){var e,t;1===k.length?x.set(k[0].pageX,k[0].pageY):(e=.5*(k[0].pageX+k[1].pageX),t=.5*(k[0].pageY+k[1].pageY),x.set(e,t))}function X(){var e,t;1===k.length?T.set(k[0].pageX,k[0].pageY):(e=.5*(k[0].pageX+k[1].pageX),t=.5*(k[0].pageY+k[1].pageY),T.set(e,t))}function q(){var e=k[0].pageX-k[1].pageX,t=k[0].pageY-k[1].pageY;e=Math.sqrt(e*e+t*t),M.set(0,e)}function Y(e){1==k.length?S.set(e.pageX,e.pageY):(r=ae(e),t=.5*(e.pageX+r.x),e=.5*(e.pageY+r.y),S.set(t,e)),_.subVectors(S,x).multiplyScalar(h.rotateSpeed);var t,r=h.domElement;C(2*Math.PI*_.x/r.clientHeight),D(2*Math.PI*_.y/r.clientHeight),x.copy(S)}function Z(e){var t,r;1===k.length?E.set(e.pageX,e.pageY):(t=ae(e),r=.5*(e.pageX+t.x),e=.5*(e.pageY+t.y),E.set(r,e)),O.subVectors(E,T).multiplyScalar(h.panSpeed),N(O.x,O.y),T.copy(E)}function Q(e){var t=ae(e),r=e.pageX-t.x;e=e.pageY-t.y,t=Math.sqrt(r*r+e*e),P.set(0,t),R.set(0,Math.pow(P.y/M.y,h.zoomSpeed)),F(R.y),M.copy(P)}function K(e){if(!1!==h.enabled)if(0===k.length&&(h.domElement.setPointerCapture(e.pointerId),h.domElement.addEventListener("pointermove",J),h.domElement.addEventListener("pointerup",$)),k.push(e),"touch"===e.pointerType){switch(oe(e),k.length){case 1:switch(h.touches.ONE){case p.TOUCH.ROTATE:if(!1===h.enableRotate)return;W(),d=f.TOUCH_ROTATE;break;case p.TOUCH.PAN:if(!1===h.enablePan)return;X(),d=f.TOUCH_PAN;break;default:d=f.NONE}break;case 2:switch(h.touches.TWO){case p.TOUCH.DOLLY_PAN:if(!1===h.enableZoom&&!1===h.enablePan)return;h.enableZoom&&q(),h.enablePan&&X(),d=f.TOUCH_DOLLY_PAN;break;case p.TOUCH.DOLLY_ROTATE:if(!1===h.enableZoom&&!1===h.enableRotate)return;h.enableZoom&&q(),h.enableRotate&&W(),d=f.TOUCH_DOLLY_ROTATE;break;default:d=f.NONE}break;default:d=f.NONE}d!==f.NONE&&h.dispatchEvent(Ze)}else{var t,r=e;switch(r.button){case 0:t=h.mouseButtons.LEFT;break;case 1:t=h.mouseButtons.MIDDLE;break;case 2:t=h.mouseButtons.RIGHT;break;default:t=-1}switch(t){case p.MOUSE.DOLLY:if(!1===h.enableZoom)return;!function(e){M.set(e.clientX,e.clientY)}(r),d=f.DOLLY;break;case p.MOUSE.ROTATE:if(r.ctrlKey||r.metaKey||r.shiftKey){if(!1===h.enablePan)return;G(r),d=f.PAN}else{if(!1===h.enableRotate)return;H(r),d=f.ROTATE}break;case p.MOUSE.PAN:if(r.ctrlKey||r.metaKey||r.shiftKey){if(!1===h.enableRotate)return;H(r),d=f.ROTATE}else{if(!1===h.enablePan)return;G(r),d=f.PAN}break;default:d=f.NONE}d!==f.NONE&&h.dispatchEvent(Ze)}}function J(e){if(!1!==h.enabled)if("touch"===e.pointerType){var t=e;switch(oe(t),d){case f.TOUCH_ROTATE:if(!1===h.enableRotate)return;Y(t),h.update();break;case f.TOUCH_PAN:if(!1===h.enablePan)return;Z(t),h.update();break;case f.TOUCH_DOLLY_PAN:if(!1===h.enableZoom&&!1===h.enablePan)return;!function(e){h.enableZoom&&Q(e),h.enablePan&&Z(e)}(t),h.update();break;case f.TOUCH_DOLLY_ROTATE:if(!1===h.enableZoom&&!1===h.enableRotate)return;!function(e){h.enableZoom&&Q(e),h.enableRotate&&Y(e)}(t),h.update();break;default:d=f.NONE}}else{var r=e;if(!1!==h.enabled)switch(d){case f.ROTATE:if(!1===h.enableRotate)return;!function(e){S.set(e.clientX,e.clientY),_.subVectors(S,x).multiplyScalar(h.rotateSpeed),e=h.domElement,C(2*Math.PI*_.x/e.clientHeight),D(2*Math.PI*_.y/e.clientHeight),x.copy(S),h.update()}(r);break;case f.DOLLY:if(!1===h.enableZoom)return;!function(e){P.set(e.clientX,e.clientY),R.subVectors(P,M),0<R.y?F(A()):R.y<0&&V(A()),M.copy(P),h.update()}(r);break;case f.PAN:if(!1===h.enablePan)return;!function(e){E.set(e.clientX,e.clientY),O.subVectors(E,T).multiplyScalar(h.panSpeed),N(O.x,O.y),T.copy(E),h.update()}(r)}}}function $(e){ie(e),0===k.length&&(h.domElement.releasePointerCapture(e.pointerId),h.domElement.removeEventListener("pointermove",J),h.domElement.removeEventListener("pointerup",$)),h.dispatchEvent(Qe),d=f.NONE}function ee(e){ie(e)}function te(e){!1!==h.enabled&&!1!==h.enableZoom&&d===f.NONE&&(e.preventDefault(),h.dispatchEvent(Ze),e.deltaY<0?V(A()):0<e.deltaY&&F(A()),h.update(),h.dispatchEvent(Qe))}function re(e){if(!1!==h.enabled&&!1!==h.enablePan){var t=!1;switch(e.code){case h.keys.UP:N(0,h.keyPanSpeed),t=!0;break;case h.keys.BOTTOM:N(0,-h.keyPanSpeed),t=!0;break;case h.keys.LEFT:N(h.keyPanSpeed,0),t=!0;break;case h.keys.RIGHT:N(-h.keyPanSpeed,0),t=!0}t&&(e.preventDefault(),h.update())}}function ne(e){!1!==h.enabled&&e.preventDefault()}function ie(e){delete j[e.pointerId];for(var t=0;t<k.length;t++)if(k[t].pointerId==e.pointerId)return void k.splice(t,1)}function oe(e){var t=j[e.pointerId];void 0===t&&(t=new p.Vector2,j[e.pointerId]=t),t.set(e.pageX,e.pageY)}function ae(e){return e=e.pointerId===k[0].pointerId?k[1]:k[0],j[e.pointerId]}return h.domElement.addEventListener("contextmenu",ne),h.domElement.addEventListener("pointerdown",K),h.domElement.addEventListener("pointercancel",ee),h.domElement.addEventListener("wheel",te,{passive:!1}),i.update(),i}return function(e,t,r){return Object.defineProperty(e,"prototype",{writable:!1}),e}(t)}();class Je{create(e,t){return new Ke(e,t)}static toJSON(e){return e.target}}class $e{constructor(e){this._state=!1,this._libsState=!1,this.map={val:"Box",type:"base-model"},this.libsMap={data:"Box",type:"texture"},this.events=e}get state(){return this._state}set state(e){this._state=e}setVal(e){this.state=!0,this.map=e}getVal(){if(this.state)return this.state=!1,this.map}setLibsVal(e){this._libsState=!0,this.libsMap=e}getLibsVal(){if(this._libsState)return this._libsState=!1,this.libsMap}}var et=a(9594),tt=a(1129),rt=a(3685);function nt(){return(nt="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=ut(e)););return e}(e,t);if(n)return(n=Object.getOwnPropertyDescriptor(n,t)).get?n.get.call(arguments.length<3?e:r):n.value}).apply(this,arguments)}function it(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&&ot(e,t)}function ot(e,t){return(ot=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function at(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=ut(e);if(r=t?(r=ut(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===dt(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return st(n)}}function st(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ut(e){return(ut=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function lt(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function ct(e,t,r){return t&<(e.prototype,t),r&<(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function ht(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ft(e){return function(e){if(Array.isArray(e))return pt(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 pt(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(r="Object"===r&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?pt(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 pt(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function dt(e){return(dt="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 mt(e){return void 0===e}function yt(){return"undefined"!=typeof window}function vt(e){return Vr(e)||Fr(e)}function gt(e){return(rn=Mt(e,tn))&&Si}function bt(e,t){return!t&&console.warn(e)}function wt(e,t){return e&&(tn[e]=t)&&rn&&(rn[e]=t)||tn}function xt(){return 0}function St(e,t,r){return(r=e[t])&&Vr(r)?e[t]():mt(r)&&e.getAttribute&&e.getAttribute(t)||r}function _t(e,t){(e=e.split(",")).forEach(t)}function Tt(e,t,r,n){an.length&&yn(),e.render(t,r,n),an.length&&yn()}function Et(e){var t=parseFloat(e);return(t||0===t)&&(e+"").match($r).length<2?t:Fr(e)?e.trim():e}function Ot(e){return e}function Mt(e,t){for(var r in t)e[r]=t[r];return e}function Pt(e,t){for(var r in t)"__proto__"!==r&&"constructor"!==r&&"prototype"!==r&&(e[r]=Gr(t[r])?Pt(e[r]||(e[r]={}),t[r]):t[r]);return e}function Rt(e){var t,r=e.parent||ur,n=e.keyframes?(t=qr(e.keyframes),function(e,r){for(var n in r)n in e||"duration"===n&&t||"ease"===n||(e[n]=r[n])}):vn;if(Wr(e.inherit))for(;r;)n(e,r.vars.defaults),r=r.parent||r._dp;return e}function kt(e){return!e||e._ts&&kt(e.parent)}function jt(e){return e._repeat?At(e._tTime,e=e.duration()+e._rDelay)*e:0}function At(e,t){return t=Math.floor(e/=t),e&&t===e?t-1:t}function Ct(e,t){return(e-t._start)*t._ts+(0<=t._ts?0:t._dirty?t.totalDuration():t._tDur)}function Dt(e,t){var r;if((t._time||t._initted&&!t._dur)&&(r=Ct(e.rawTime(),t),(!t._dur||Gt(0,t.totalDuration(),r)-t._tTime>Dr)&&t.render(r,!0)),xn(e,t)._dp&&e._initted&&e._time>=e._dur&&e._ts){if(e._dur<e.duration())for(r=e;r._dp;)0<=r.rawTime()&&r.totalTime(r._tTime),r=r._dp;e._zTime=-Dr}}function Lt(e,t,r,n){return t.parent&&wn(t),t._start=mn((Hr(r)?r:r||e!==ur?Vt(e,r,t):e._time)+t._delay),t._end=mn(t._start+(t.totalDuration()/Math.abs(t.timeScale())||0)),function(e,t){var r,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"_first",i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:"_last",o=4<arguments.length?arguments[4]:void 0,a=e[i];if(o)for(r=t[o];a&&a[o]>r;)a=a._prev;a?(t._next=a._next,a._next=t):(t._next=e[n],e[n]=t),t._next?t._next._prev=t:e[i]=t,t._prev=a,t.parent=t._dp=e}(e,t,"_first","_last",e._sort?"_start":0),Ut(t)||(e._recent=t),n||Dt(e,t),e}function zt(e,t){(tn.ScrollTrigger||nn("scrollTrigger",t))&&tn.ScrollTrigger.create(t,e)}function It(e,t,r,n){return qn(e,t),e._initted?!r&&e._pt&&(e._dur&&!1!==e.vars.lazy||!e._dur&&e.vars.lazy)&&pr!==Bn.frame?(an.push(e),e._lazy=[t,n]):void 0:1}function Bt(e){return(e=e.parent)&&e._ts&&e._initted&&!e._lock&&(e.rawTime()<0||Bt(e))}function Ut(e){return"isFromStart"===(e=e.data)||"isStart"===e}function Nt(e,t,r,n){var i=e._repeat,o=mn(t)||0;return(t=e._tTime/e._tDur)&&!n&&(e._time*=o/e._dur),e._dur=o,e._tDur=i?i<0?1e10:mn(o*(i+1)+e._rDelay*i):o,0<t&&!n?_n(e,e._tTime=e._tDur*t):e.parent&&Sn(e),r||xn(e.parent,e),e}function Ft(e){return e instanceof oi?xn(e):Nt(e,e._dur)}function Vt(e,t,r){var n,i,o,a=e.labels,s=e._recent||Tn,u=e.duration()>=Cr?s.endTime(!1):e._dur;return Fr(t)&&(isNaN(t)||t in a)?(i=t.charAt(0),o="%"===t.substr(-1),n=t.indexOf("="),"<"===i||">"===i?(0<=n&&(t=t.replace(/=/,"")),("<"===i?s._start:s.endTime(0<=s._repeat))+(parseFloat(t.substr(1))||0)*(o?(n<0?s:r).totalDuration()/100:1)):n<0?(t in a||(a[t]=u),a[t]):(i=parseFloat(t.charAt(n-1)+t.substr(n+1)),o&&r&&(i=i/100*(qr(r)?r[0]:r).totalDuration()),1<n?Vt(e,t.substr(0,n-1),r)+i:u+i)):null==t?u:+t}function Ht(e,t,r){var n,i,o=Hr(t[1]),a=(o?2:1)+(e<2?0:1),s=t[a];if(o&&(s.duration=t[1]),s.parent=r,e){for(n=s,i=r;i&&!("immediateRender"in n);)n=i.vars.defaults||{},i=Wr(i.vars.inherit)&&i.parent;s.immediateRender=Wr(n.immediateRender),e<2?s.runBackwards=1:s.startAt=t[a-1]}return new hi(t[0],s,t[1+a])}function Gt(e,t,r){return r<e?e:t<r?t:r}function Wt(e){if(Vr(e))return e;var t=Gr(e)?e:{each:e},r=Gn(t.ease),n=t.from||0,i=parseFloat(t.base)||0,o={},a=(e=0<n&&n<1,isNaN(n)||e),s=t.axis,u=n,l=n;return Fr(n)?u=l={center:.5,edges:.5,end:1}[n]||0:!e&&a&&(u=n[0],l=n[1]),function(e,c,h){var f,p,d,m,y,v,g,b,w=(h||t).length,x=o[w];if(!x){if(!(b="auto"===t.grid?0:(t.grid||[1,Cr])[1])){for(v=-Cr;v<(v=h[b++].getBoundingClientRect().left)&&b<w;);b--}for(x=o[w]=[],f=a?Math.min(b,w)*u-.5:n%b,p=b===Cr?0:a?w*l/b-.5:n/b|0,g=Cr,y=v=0;y<w;y++)m=y%b-f,d=p-(y/b|0),x[y]=m=s?Math.abs("y"===s?d:m):Br(m*m+d*d),v<m&&(v=m),m<g&&(g=m);"random"===n&&kn(x),x.max=v-g,x.min=g,x.v=w=(parseFloat(t.amount)||parseFloat(t.each)*(w<b?w-1:s?"y"===s?w/b:b:Math.max(b,w/b))||0)*("edges"===n?-1:1),x.b=w<0?i-w:i,x.u=On(t.amount||t.each)||0,r=r&&w<0?Hn(r):r}return w=(x[e]-x.min)/x.max||0,mn(x.b+(r?r(w):w)*x.v)+x.u}}function Xt(e){var t=Math.pow(10,((e+"").split(".")[1]||"").length);return function(r){var n=Math.round(parseFloat(r)/e)*e*t;return(n-n%1)/t+(Hr(r)?0:On(r))}}function qt(e,t){var r,n,i=qr(e);return!i&&Gr(e)&&(r=i=e.radius||Cr,e.values?(e=Rn(e.values),(n=!Hr(e[0]))&&(r*=r)):e=Xt(e.increment)),En(t,i?Vr(e)?function(t){return n=e(t),Math.abs(n-t)<=r?n:t}:function(t){for(var i,o,a=parseFloat(n?t.x:t),s=parseFloat(n?t.y:0),u=Cr,l=0,c=e.length;c--;)(i=n?(i=e[c].x-a)*i+(o=e[c].y-s)*o:Math.abs(e[c]-a))<u&&(u=i,l=c);return l=!r||u<=r?e[l]:t,n||l===t||Hr(t)?l:l+On(t)}:Xt(e))}function Yt(e,t,r,n){return En(qr(e)?!t:!0===r?!!(r=0):!n,(function(){return qr(e)?e[~~(Math.random()*e.length)]:(r=r||1e-5)&&(n=r<1?Math.pow(10,(r+"").length-2):1)&&Math.floor(Math.round((e-r/2+Math.random()*(t-e+.99*r))/r)*r*n)/n}))}function Zt(e,t,r){return En(r,(function(r){return e[~~t(r)]}))}function Qt(e,t,r,n,i){var o=t-e,a=n-r;return En(i,(function(t){return r+((t-e)/o*a||0)}))}function Kt(e,t,r){var n,i,o,a=e.labels,s=Cr;for(n in a)(i=a[n]-t)<0==!!r&&i&&s>(i=Math.abs(i))&&(o=n,s=i);return o}function Jt(e,t,r){var n=e.vars,i=n[t];i&&(t=n[t+"Params"],n=n.callbackScope||e,r&&an.length&&yn(),t?i.apply(n,t):i.call(n))}function $t(e){return wn(e),e.scrollTrigger&&e.scrollTrigger.kill(!1),e.progress()<1&&Jt(e,"onInterrupt"),e}function er(e,t,r){return(6*(e+=e<0?1:1<e?-1:0)<1?t+(r-t)*e*6:e<.5?r:3*e<2?t+(r-t)*(2/3-e)*6:t)*An+.5|0}function tr(e,t,r){var n,i,o,a,s="",u=(e+s).match(zn),l=t?"hsla(":"rgba(",c=0;if(!u)return e;if(u=u.map((function(e){return(e=Dn(e,t,1))&&l+(t?e[0]+","+e[1]+"%,"+e[2]+"%,"+e[3]:e.join(","))+")"})),r&&(o=Ln(e),(n=r.c).join(s)!==o.c.join(s)))for(a=(i=e.replace(zn,"1").split(Qr)).length-1;c<a;c++)s+=i[c]+(~n.indexOf(c)?u.shift()||l+"0,0,0,0)":(o.length?o:u.length?u:r).shift());if(!i)for(a=(i=e.split(zn)).length-1;c<a;c++)s+=i[c]+u[c];return s+i[a]}function rr(e,t){for(var r,n=e._first;n;)n instanceof oi?rr(n,t):!n.vars.yoyoEase||n._yoyo&&n._repeat||n._yoyo===t||(n.timeline?rr(n.timeline,t):(r=n._ease,n._ease=n._yEase,n._yEase=r,n._yoyo=t)),n=n._next}function nr(e,t){var r,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:function(e){return 1-t(1-e)},i={easeIn:t,easeOut:n,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}};_t(e,(function(e){for(var t in Nn[e]=tn[e]=i,Nn[r=e.toLowerCase()]=n,i)Nn[r+("easeIn"===t?".in":"easeOut"===t?".out":".inOut")]=Nn[e+"."+t]=i[t]}))}function ir(e){return function(t){return t<.5?(1-e(1-2*t))/2:.5+e(2*(t-.5))/2}}function or(e,t,r){function n(e){return 1===e?1:i*Math.pow(2,-10*e)*Nr((e-o)*a)+1}var i=1<=t?t:1,o=(a=(r||(e?.3:.45))/(t<1?t:1))/Lr*(Math.asin(1/i)||0),a=(r="out"===e?n:"in"===e?function(e){return 1-n(1-e)}:ir(n),Lr/a);return r.config=function(t,r){return or(e,t,r)},r}function ar(e){function t(e){return e?--e*e*((r+1)*e+r)+1:0}var r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1.70158,n="out"===e?t:"in"===e?function(e){return 1-t(1-e)}:ir(t);return n.config=function(t){return ar(e,t)},n}var sr,ur,lr,cr,hr,fr,pr,dr,mr,yr,vr,gr,br,wr,xr,Sr,_r,Tr,Er,Or,Mr,Pr,Rr,kr,jr={autoSleep:120,force3D:"auto",nullTargetWarn:1,units:{lineHeight:""}},Ar={duration:.5,overwrite:!1,delay:0},Cr=1e8,Dr=1/Cr,Lr=2*Math.PI,zr=Lr/4,Ir=0,Br=Math.sqrt,Ur=Math.cos,Nr=Math.sin,Fr=function(e){return"string"==typeof e},Vr=function(e){return"function"==typeof e},Hr=function(e){return"number"==typeof e},Gr=function(e){return"object"==dt(e)},Wr=function(e){return!1!==e},Xr="function"==typeof ArrayBuffer&&ArrayBuffer.isView||function(){},qr=Array.isArray,Yr=/(?:-?\.?\d|\.)+/gi,Zr=/[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g,Qr=/[-+=.]*\d+[.e-]*\d*[a-z%]*/g,Kr=/[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi,Jr=/[+-]=-?[.\d]+/,$r=/[^,'"\[\]\s]+/gi,en=/[\d.+\-=]+(?:e[-+]\d*)*/i,tn={},rn={},nn=function(e,t){return console.warn("Invalid property",e,"set to",t,"Missing plugin? gsap.registerPlugin()")},on={},an=[],sn={},un={},ln={},cn=30,hn=[],fn="",pn=function(e){var t,r,n=e[0];if(Gr(n)||Vr(n)||(e=[e]),!(t=(n._gsap||{}).harness)){for(r=hn.length;r--&&!hn[r].targetTest(n););t=hn[r]}for(r=e.length;r--;)e[r]&&(e[r]._gsap||(e[r]._gsap=new ni(e[r],t)))||e.splice(r,1);return e},dn=function(e){return e._gsap||pn(Rn(e))[0]._gsap},mn=function(e){return Math.round(1e7*e)/1e7||0},yn=function(){var e,t,r=an.length,n=an.slice(0);for(sn={},e=an.length=0;e<r;e++)(t=n[e])&&t._lazy&&(t.render(t._lazy[0],t._lazy[1],!0)._lazy=0)},vn=function(e,t){for(var r in t)r in e||(e[r]=t[r]);return e},gn=function(e,t){var r,n={};for(r in e)r in t||(n[r]=e[r]);return n},bn=function(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"_first",n=3<arguments.length&&void 0!==arguments[3]?arguments[3]:"_last",i=t._prev,o=t._next;i?i._next=o:e[r]===t&&(e[r]=o),o?o._prev=i:e[n]===t&&(e[n]=i),t._next=t._prev=t.parent=null},wn=function(e,t){!e.parent||t&&!e.parent.autoRemoveChildren||e.parent.remove(e),e._act=0},xn=function(e,t){if(e&&(!t||t._end>e._dur||t._start<0))for(var r=e;r;)r._dirty=1,r=r.parent;return e},Sn=function(e){return e._end=mn(e._start+(e._tDur/Math.abs(e._ts||e._rts||Dr)||0))},_n=function(e,t){var r=e._dp;return r&&r.smoothChildTiming&&e._ts&&(e._start=mn(r._time-(0<e._ts?t/e._ts:((e._dirty?e.totalDuration():e._tDur)-t)/-e._ts)),Sn(e),r._dirty||xn(r,e)),e},Tn={_start:0,endTime:xt,totalDuration:xt},En=function(e,t){return e||0===e?t(e):t},On=function(e,t){return Fr(e)&&(t=en.exec(e))?e.substr(t.index+t[0].length):""},Mn=[].slice,Pn=function(e,t){return e&&Gr(e)&&"length"in e&&(!t&&!e.length||e.length-1 in e&&Gr(e[0]))&&!e.nodeType&&e!==lr},Rn=function(e,t,r){return!Fr(e)||r||!cr&&Un()?qr(e)?function(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:[];return e.forEach((function(e){return Fr(e)&&!t||Pn(e,1)?r.push.apply(r,ft(Rn(e))):r.push(e)}))||r}(e,r):Pn(e)?Mn.call(e,0):e?[e]:[]:Mn.call((t||hr).querySelectorAll(e),0)},kn=function(e){return e.sort((function(){return.5-Math.random()}))},jn=function(e){for(var t,r,n,i,o=0,a="";~(t=e.indexOf("random(",o));)n=e.indexOf(")",t),i="["===e.charAt(t+7),r=e.substr(t+7,n-t-7).match(i?$r:Yr),a+=e.substr(o,t-o)+Yt(i?r:+r[0],i?0:+r[1],+r[2]||1e-5),o=n+1;return a+e.substr(o,e.length-o)},An=255,Cn={aqua:[0,An,An],lime:[0,An,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,An],navy:[0,0,128],white:[An,An,An],olive:[128,128,0],yellow:[An,An,0],orange:[An,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[An,0,0],pink:[An,192,203],cyan:[0,An,An],transparent:[An,An,An,0]},Dn=function(e,t,r){var n,i,o,a,s,u,l,c=e?Hr(e)?[e>>16,e>>8&An,e&An]:0:Cn.black;if(!c){if(","===e.substr(-1)&&(e=e.substr(0,e.length-1)),Cn[e])c=Cn[e];else if("#"===e.charAt(0)){if(9===(e=e.length<6?"#"+(n=e.charAt(1))+n+(i=e.charAt(2))+i+(o=e.charAt(3))+o+(5===e.length?e.charAt(4)+e.charAt(4):""):e).length)return[(c=parseInt(e.substr(1,6),16))>>16,c>>8&An,c&An,parseInt(e.substr(7),16)/255];c=[(e=parseInt(e.substr(1),16))>>16,e>>8&An,e&An]}else if("hsl"===e.substr(0,3))if(c=l=e.match(Yr),t){if(~e.indexOf("="))return c=e.match(Zr),r&&c.length<4&&(c[3]=1),c}else a=+c[0]%360/360,s=+c[1]/100,n=2*(u=+c[2]/100)-(i=u<=.5?u*(s+1):u+s-u*s),3<c.length&&(c[3]*=1),c[0]=er(a+1/3,n,i),c[1]=er(a,n,i),c[2]=er(a-1/3,n,i);else c=e.match(Yr)||Cn.transparent;c=c.map(Number)}return t&&!l&&(n=c[0]/An,i=c[1]/An,o=c[2]/An,u=((e=Math.max(n,i,o))+(t=Math.min(n,i,o)))/2,e===t?a=s=0:(l=e-t,s=.5<u?l/(2-e-t):l/(e+t),a=e===n?(i-o)/l+(i<o?6:0):e===i?(o-n)/l+2:(n-i)/l+4,a*=60),c[0]=~~(a+.5),c[1]=~~(100*s+.5),c[2]=~~(100*u+.5)),r&&c.length<4&&(c[3]=1),c},Ln=function(e){var t=[],r=[],n=-1;return e.split(zn).forEach((function(e){e=e.match(Qr)||[],t.push.apply(t,ft(e)),r.push(n+=e.length+1)})),t.c=r,t},zn=function(){var e,t="(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3,4}){1,2}\\b";for(e in Cn)t+="|"+e+"\\b";return new RegExp(t+")","gi")}(),In=/hsl[a]?\(/,Bn=(xr=Date.now,Sr=500,_r=33,Tr=xr(),Er=Tr,Mr=Or=1e3/240,Rr={time:0,frame:0,tick:function(){Wn(!0)},deltaRatio:function(e){return br/(1e3/(e||60))},wake:function(){fr&&(!cr&&yt()&&(lr=cr=window,hr=lr.document||{},tn.gsap=Si,(lr.gsapVersions||(lr.gsapVersions=[])).push(Si.version),gt(rn||lr.GreenSockGlobals||!lr.gsap&&lr||{}),gr=lr.requestAnimationFrame),yr&&Rr.sleep(),vr=gr||function(e){return setTimeout(e,Mr-1e3*Rr.time+1|0)},mr=1,Wn(2))},sleep:function(){(gr?lr.cancelAnimationFrame:clearTimeout)(yr),mr=0,vr=xt},lagSmoothing:function(e,t){Sr=e||1/Dr,_r=Math.min(t,Sr,0)},fps:function(e){Or=1e3/(e||240),Mr=1e3*Rr.time+Or},add:function(e){Pr.indexOf(e)<0&&Pr.push(e),Un()},remove:function(e,t){~(t=Pr.indexOf(e))&&Pr.splice(t,1)&&t<=wr&&wr--},_listeners:Pr=[]}),Un=function(){return!mr&&Bn.wake()},Nn={},Fn=/^[\d.\-M][\d.\-,\s]/,Vn=/["']/g,Hn=function(e){return function(t){return 1-e(1-t)}},Gn=function(e,t){return e&&(Vr(e)?e:Nn[e]||function(e){var t,r,n,i=(e+"").split("("),o=Nn[i[0]];return o&&1<i.length&&o.config?o.config.apply(null,~e.indexOf("{")?[function(e){for(var t,r,n,i={},o=e.substr(1,e.length-3).split(":"),a=o[0],s=1,u=o.length;s<u;s++)r=o[s],t=s!==u-1?r.lastIndexOf(","):r.length,n=r.substr(0,t),i[a]=isNaN(n)?n.replace(Vn,"").trim():+n,a=r.substr(t+1).trim();return i}(i[1])]:(t=(i=e).indexOf("(")+1,r=i.indexOf(")"),n=i.indexOf("(",t),i.substring(t,~n&&n<r?i.indexOf(")",r+1):r).split(",").map(Et))):Nn._CE&&Fn.test(e)?Nn._CE("",e):o}(e))||t};function Wn(e){var t,r,n,i=xr()-Er,o=!0===e;if(Sr<i&&(Tr+=i-_r),(0<(i=(r=(Er+=i)-Tr)-Mr)||o)&&(n=++Rr.frame,br=r-1e3*Rr.time,Rr.time=r/=1e3,Mr+=i+(Or<=i?4:Or-i),t=1),o||(yr=vr(Wn)),t)for(wr=0;wr<Pr.length;wr++)Pr[wr](r,br,n,e)}function Xn(e){return e<1/2.75?kr*e*e:e<.7272727272727273?kr*Math.pow(e-1.5/2.75,2)+.75:e<.9090909090909092?kr*(e-=2.25/2.75)*e+.9375:kr*Math.pow(e-2.625/2.75,2)+.984375}function qn(e,t){var r,n,i,o,a,s,u,l,c,h,f,p,d,m=e.vars,y=m.ease,v=m.startAt,g=m.immediateRender,b=m.lazy,w=m.onUpdate,x=m.onUpdateParams,S=m.callbackScope,_=m.runBackwards,T=m.yoyoEase,E=m.keyframes,O=m.autoRevert,M=e._dur,P=e._startAt,R=e._targets,k=e.parent,j=k&&"nested"===k.data?k.parent._targets:R,A="auto"===e._overwrite&&!sr,C=e.timeline;if(e._ease=Gn(y=!C||E&&y?y:"none",Ar.ease),e._yEase=T?Hn(Gn(!0===T?y:T,Ar.ease)):0,T&&e._yoyo&&!e._repeat&&(T=e._yEase,e._yEase=e._ease,e._ease=T),e._from=!C&&!!m.runBackwards,!C||E&&!m.stagger){if(p=(l=R[0]?dn(R[0]).harness:0)&&m[l.prop],r=gn(m,on),P&&wn(P.render(-1,!0)),v)if(wn(e._startAt=hi.set(R,vn({data:"isStart",overwrite:!1,parent:k,immediateRender:!0,lazy:Wr(b),startAt:null,delay:0,onUpdate:w,onUpdateParams:x,callbackScope:S,stagger:0},v))),t<0&&!g&&!O&&e._startAt.render(-1,!0),g){if(0<t&&!O&&(e._startAt=0),M&&t<=0)return void(t&&(e._zTime=t))}else!1===O&&(e._startAt=0);else if(_&&M)if(P)O||(e._startAt=0);else if(i=vn({overwrite:!1,data:"isFromStart",lazy:(g=!t&&g)&&Wr(b),immediateRender:g,stagger:0,parent:k},r),p&&(i[l.prop]=p),wn(e._startAt=hi.set(R,i)),t<0&&e._startAt.render(-1,!0),e._zTime=t,g){if(!t)return}else qn(e._startAt,Dr);for(e._pt=0,b=M&&Wr(b)||b&&!M,n=0;n<R.length;n++){if(u=(a=R[n])._gsap||pn(R)[n]._gsap,e._ptLookup[n]=h={},sn[u.id]&&an.length&&yn(),f=j===R?n:j.indexOf(a),l&&!1!==(c=new l).init(a,p||r,e,f,j)&&(e._pt=o=new bi(e._pt,a,c.name,0,1,c.render,c,0,c.priority),c._props.forEach((function(e){h[e]=o})),c.priority&&(s=1)),!l||p)for(i in r)un[i]&&(c=ui(i,r,e,f,a,j))?c.priority&&(s=1):h[i]=o=si.call(e,a,i,"get",r[i],f,j,0,m.stringFilter);e._op&&e._op[n]&&e.kill(a,e._op[n]),A&&e._pt&&(ri=e,ur.killTweensOf(a,h,e.globalTime(t)),d=!e.parent,ri=0),e._pt&&b&&(sn[u.id]=1)}s&&gi(e),e._onInit&&e._onInit(e)}e._onUpdate=w,e._initted=(!e._op||e._pt)&&!d,E&&t<=0&&C.render(Cr,!0,!0)}function Yn(e,t,r,n,i){return Vr(e)?e.call(t,r,n,i):Fr(e)&&~e.indexOf("random(")?jn(e):e}function Zn(e,t,r){return e.setAttribute(t,r)}function Qn(e,t){var r=t._pt,n="";if(!e&&t.b)n=t.b;else if(1===e&&t.e)n=t.e;else{for(;r;)n=r.p+(r.m?r.m(r.s+r.c*e):Math.round(1e4*(r.s+r.c*e))/1e4)+n,r=r._next;n+=t.c}t.set(t.t,t.p,n,t)}function Kn(e,t){for(var r=t._pt;r;)r.r(e,r.d),r=r._next}function Jn(e,t,r,n){for(var i,o=this._pt;o;)i=o._next,o.p===n&&o.modifier(e,t,r),o=i}function $n(e){for(var t,r,n=this._pt;n;)r=n._next,n.p===e&&!n.op||n.op===e?bn(this,n,"_pt"):n.dep||(t=1),n=r;return!t}function ei(e,t,r,n){n.mSet(e,t,n.m.call(n.tween,r,n.mt),n)}function ti(e,t){return{name:e,rawVars:1,init:function(e,r,n){n._onInit=function(e){var n,i;if(Fr(r)&&(n={},_t(r,(function(e){return n[e]=1})),r=n),t){for(i in n={},r)n[i]=t(r[i]);r=n}var o,a,s,u=e,l=r,c=u._targets;for(o in l)for(a=c.length;a--;)(s=(s=u._ptLookup[a][o])&&s.d)&&(s=s._pt?xi(s,o):s)&&s.modifier&&s.modifier(l[o],u,c[a],o)}}}}_t("Linear,Quad,Cubic,Quart,Quint,Strong",(function(e,t){var r=t<5?t+1:t;nr(e+",Power"+(r-1),t?function(e){return Math.pow(e,r)}:function(e){return e},(function(e){return 1-Math.pow(1-e,r)}),(function(e){return e<.5?Math.pow(2*e,r)/2:1-Math.pow(2*(1-e),r)/2}))})),Nn.Linear.easeNone=Nn.none=Nn.Linear.easeIn,nr("Elastic",or("in"),or("out"),or()),kr=7.5625,nr("Bounce",(function(e){return 1-Xn(1-e)}),Xn),nr("Expo",(function(e){return e?Math.pow(2,10*(e-1)):0})),nr("Circ",(function(e){return-(Br(1-e*e)-1)})),nr("Sine",(function(e){return 1===e?1:1-Ur(e*zr)})),nr("Back",ar("in"),ar("out"),ar()),Nn.SteppedEase=Nn.steps=tn.SteppedEase={config:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1,t=1<arguments.length?arguments[1]:void 0,r=1/e,n=e+(t?0:1),i=t?1:0,o=1-Dr;return function(e){return((n*Gt(0,o,e)|0)+i)*r}}},Ar.ease=Nn["quad.out"],_t("onComplete,onUpdate,onStart,onRepeat,onReverseComplete,onInterrupt",(function(e){return fn+=e+","+e+"Params,"}));var ri,ni=ct((function e(t,r){ht(this,e),this.id=Ir++,(t._gsap=this).target=t,this.harness=r,this.get=r?r.get:St,this.set=r?r.getSetter:mi})),ii=function(){function e(t){ht(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,Nt(this,+t.duration,1,1),this.data=t.data,mr||Bn.wake()}return ct(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,Nt(this,this._repeat<0?e:(e-this._repeat*this._rDelay)/(this._repeat+1))):this._tDur}},{key:"totalTime",value:function(e,t){if(Un(),!arguments.length)return this._tTime;var r=this._dp;if(r&&r.smoothChildTiming&&this._ts){for(_n(this,e),r._dp&&!r.parent&&Dt(r,this);r&&r.parent;)r.parent._time!==r._start+(0<=r._ts?r._tTime/r._ts:(r.totalDuration()-r._tTime)/-r._ts)&&r.totalTime(r._tTime,!0),r=r.parent;!this.parent&&this._dp.autoRemoveChildren&&(0<this._ts&&e<this._tDur||this._ts<0&&0<e||!this._tDur&&!e)&&Lt(this._dp,this,this._start-this._delay)}return(this._tTime!==e||!this._dur&&!t||this._initted&&Math.abs(this._zTime)===Dr||!e&&!this._initted&&(this.add||this._ptLookup))&&(this._ts||(this._pTime=e),Tt(this,e,t)),this}},{key:"time",value:function(e,t){return arguments.length?this.totalTime(Math.min(this.totalDuration(),e+jt(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)+jt(this),t):this.duration()?Math.min(1,this._time/this._dur):this.ratio}},{key:"iteration",value:function(e,t){var r=this.duration()+this._rDelay;return arguments.length?this.totalTime(this._time+(e-1)*r,t):this._repeat?At(this._tTime,r)+1:1}},{key:"timeScale",value:function(e){if(!arguments.length)return this._rts===-Dr?0:this._rts;if(this._rts===e)return this;for(var t=this.parent&&this._ts?Ct(this.parent._time,this):this._tTime,r=(this._rts=+e||0,this._ts=this._ps||e===-Dr?0:this._rts,e=this.totalTime(Gt(-this._delay,this._tDur,t),!0)).parent;r&&r.parent;)r._dirty=1,r.totalDuration(),r=r.parent;return Sn(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):(Un(),this._ts=this._rts,this.totalTime(this.parent&&!this.parent.smoothChildTiming?this.rawTime():this._tTime||this._pTime,1===this.progress()&&Math.abs(this._zTime)!==Dr&&(this._tTime-=Dr)))),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||Lt(t,this,e-this._delay),this):this._start}},{key:"endTime",value:function(e){return this._start+(Wr(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?Ct(t.rawTime(e),this):this._tTime:this._tTime}},{key:"globalTime",value:function(e){for(var t=this,r=arguments.length?e:t.rawTime();t;)r=t._start+r/(t._ts||1),t=t._dp;return r}},{key:"repeat",value:function(e){return arguments.length?(this._repeat=e===1/0?-2:e,Ft(this)):-2===this._repeat?1/0:this._repeat}},{key:"repeatDelay",value:function(e){var t;return arguments.length?(t=this._time,this._rDelay=e,Ft(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(Vt(this,e),Wr(t))}},{key:"restart",value:function(e,t){return this.play().totalTime(e?-this._delay:0,Wr(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?-Dr:0)),this):this._rts<0}},{key:"invalidate",value:function(){return this._initted=this._act=0,this._zTime=-Dr,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)-Dr))}},{key:"eventCallback",value:function(e,t,r){var n=this.vars;return 1<arguments.length?(t?(n[e]=t,r&&(n[e+"Params"]=r),"onUpdate"===e&&(this._onUpdate=t)):delete n[e],this):n[e]}},{key:"then",value:function(e){var t=this;return new Promise((function(r){function n(){var e=t.then;t.then=null,Vr(i)&&(i=i(t))&&(i.then||i===t)&&(t.then=e),r(i),t.then=e}var i=Vr(e)?e:Ot;t._initted&&1===t.totalProgress()&&0<=t._ts||!t._tTime&&t._ts<0?n():t._prom=n}))}},{key:"kill",value:function(){$t(this)}}]),e}(),oi=(vn(ii.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:-Dr,_prom:0,_ps:!1,_rts:1}),function(){it(t,ii);var e=at(t);function t(){var r,n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},i=1<arguments.length?arguments[1]:void 0;return ht(this,t),(r=e.call(this,n)).labels={},r.smoothChildTiming=!!n.smoothChildTiming,r.autoRemoveChildren=!!n.autoRemoveChildren,r._sort=Wr(n.sortChildren),ur&&Lt(n.parent||ur,st(r),i),n.reversed&&r.reverse(),n.paused&&r.paused(!0),n.scrollTrigger&&zt(st(r),n.scrollTrigger),r}return ct(t,[{key:"to",value:function(e,t,r){return Ht(0,arguments,this),this}},{key:"from",value:function(e,t,r){return Ht(1,arguments,this),this}},{key:"fromTo",value:function(e,t,r,n){return Ht(2,arguments,this),this}},{key:"set",value:function(e,t,r){return t.duration=0,t.parent=this,Rt(t).repeatDelay||(t.repeat=0),t.immediateRender=!!t.immediateRender,new hi(e,t,Vt(this,r),1),this}},{key:"call",value:function(e,t,r){return Lt(this,hi.delayedCall(0,e,t),r)}},{key:"staggerTo",value:function(e,t,r,n,i,o,a){return r.duration=t,r.stagger=r.stagger||n,r.onComplete=o,r.onCompleteParams=a,r.parent=this,new hi(e,r,Vt(this,i)),this}},{key:"staggerFrom",value:function(e,t,r,n,i,o,a){return r.runBackwards=1,Rt(r).immediateRender=Wr(r.immediateRender),this.staggerTo(e,t,r,n,i,o,a)}},{key:"staggerFromTo",value:function(e,t,r,n,i,o,a,s){return n.startAt=r,Rt(n).immediateRender=Wr(n.immediateRender),this.staggerTo(e,t,n,i,o,a,s)}},{key:"render",value:function(e,t,r){var n,i,o,a,s,u,l,c,h,f,p=this._time,d=this._dirty?this.totalDuration():this._tDur,m=this._dur,y=e<=0?0:mn(e),v=this._zTime<0!=e<0&&(this._initted||!m);if((y=this!==ur&&d<y&&0<=e?d:y)!==this._tTime||r||v){if(p!==this._time&&m&&(y+=this._time-p,e+=this._time-p),n=y,c=this._start,s=!(l=this._ts),v&&(m||(p=this._zTime),!e&&t||(this._zTime=e)),this._repeat){if(v=this._yoyo,a=m+this._rDelay,this._repeat<-1&&e<0)return this.totalTime(100*a+e,t,r);if(n=mn(y%a),y===d?(o=this._repeat,n=m):((o=~~(y/a))&&o===y/a&&(n=m,o--),m<n&&(n=m)),h=At(this._tTime,a),v&&1&o&&(n=m-n,f=1),o!==(h=!p&&this._tTime&&h!==o?o:h)&&!this._lock){var g=v&&1&h;if(v=g===(v&&1&o),p=(g=o<h?!g:g)?0:m,this._lock=1,this.render(p||(f?0:mn(o*a)),t,!m)._lock=0,this._tTime=y,!t&&this.parent&&Jt(this,"onRepeat"),this.vars.repeatRefresh&&!f&&(this.invalidate()._lock=1),p&&p!==this._time||s!=!this._ts||this.vars.onRepeat&&!this.parent&&!this._act)return this;if(m=this._dur,d=this._tDur,v&&(this._lock=2,this.render(p=g?m:-1e-4,!0),this.vars.repeatRefresh&&!f&&this.invalidate()),this._lock=0,!this._ts&&!s)return this;rr(this,f)}}if(this._hasPause&&!this._forcing&&this._lock<2&&(u=function(e,t,r){var n;if(t<r)for(n=e._first;n&&n._start<=r;){if("isPause"===n.data&&n._start>t)return n;n=n._next}else for(n=e._last;n&&n._start>=r;){if("isPause"===n.data&&n._start<t)return n;n=n._prev}}(this,mn(p),mn(n)))&&(y-=n-(n=u._start)),this._tTime=y,this._time=n,this._act=!l,this._initted||(this._onUpdate=this.vars.onUpdate,this._initted=1,this._zTime=e,p=0),!p&&n&&!t&&(Jt(this,"onStart"),this._tTime!==y))return this;if(p<=n&&0<=e)for(b=this._first;b;){if(i=b._next,(b._act||n>=b._start)&&b._ts&&u!==b){if(b.parent!==this)return this.render(e,t,r);if(b.render(0<b._ts?(n-b._start)*b._ts:(b._dirty?b.totalDuration():b._tDur)+(n-b._start)*b._ts,t,r),n!==this._time||!this._ts&&!s){u=0,i&&(y+=this._zTime=-Dr);break}}b=i}else for(var b=this._last,w=e<0?e:n;b;){if(i=b._prev,(b._act||w<=b._end)&&b._ts&&u!==b){if(b.parent!==this)return this.render(e,t,r);if(b.render(0<b._ts?(w-b._start)*b._ts:(b._dirty?b.totalDuration():b._tDur)+(w-b._start)*b._ts,t,r),n!==this._time||!this._ts&&!s){u=0,i&&(y+=this._zTime=w?-Dr:Dr);break}}b=i}if(u&&!t&&(this.pause(),u.render(p<=n?0:-Dr)._zTime=p<=n?1:-1,this._ts))return this._start=c,Sn(this),this.render(e,t,r);this._onUpdate&&!t&&Jt(this,"onUpdate",!0),!(y===d&&d>=this.totalDuration()||!y&&p)||c!==this._start&&Math.abs(l)===Math.abs(this._ts)||this._lock||(!e&&m||!(y===d&&0<this._ts||!y&&this._ts<0)||wn(this,1),t||e<0&&!p||!y&&!p&&d||(Jt(this,y===d&&0<=e?"onComplete":"onReverseComplete",!0),!this._prom||y<d&&0<this.timeScale()||this._prom()))}return this}},{key:"add",value:function(e,t){var r=this;if(Hr(t)||(t=Vt(this,t,e)),!(e instanceof ii)){if(qr(e))return e.forEach((function(e){return r.add(e,t)})),this;if(Fr(e))return this.addLabel(e,t);if(!Vr(e))return this;e=hi.delayedCall(0,e)}return this!==e?Lt(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],r=!(2<arguments.length&&void 0!==arguments[2])||arguments[2],n=3<arguments.length&&void 0!==arguments[3]?arguments[3]:-Cr,i=[],o=this._first;o;)o._start>=n&&(o instanceof hi?t&&i.push(o):(r&&i.push(o),e&&i.push.apply(i,ft(o.getChildren(!0,t,r))))),o=o._next;return i}},{key:"getById",value:function(e){for(var t=this.getChildren(1,1,1),r=t.length;r--;)if(t[r].vars.id===e)return t[r]}},{key:"remove",value:function(e){return Fr(e)?this.removeLabel(e):Vr(e)?this.killTweensOf(e):(bn(this,e),e===this._recent&&(this._recent=this._last),xn(this))}},{key:"totalTime",value:function(e,r){return arguments.length?(this._forcing=1,!this._dp&&this._ts&&(this._start=mn(Bn.time-(0<this._ts?e/this._ts:(this.totalDuration()-e)/-this._ts))),nt(ut(t.prototype),"totalTime",this).call(this,e,r),this._forcing=0,this):this._tTime}},{key:"addLabel",value:function(e,t){return this.labels[e]=Vt(this,t),this}},{key:"removeLabel",value:function(e){return delete this.labels[e],this}},{key:"addPause",value:function(e,t,r){return(t=hi.delayedCall(0,t||xt,r)).data="isPause",this._hasPause=1,Lt(this,t,Vt(this,e))}},{key:"removePause",value:function(e){var t=this._first;for(e=Vt(this,e);t;)t._start===e&&"isPause"===t.data&&wn(t),t=t._next}},{key:"killTweensOf",value:function(e,t,r){for(var n=this.getTweensOf(e,r),i=n.length;i--;)ri!==n[i]&&n[i].kill(e,t);return this}},{key:"getTweensOf",value:function(e,t){for(var r,n=[],i=Rn(e),o=this._first,a=Hr(t);o;)o instanceof hi?function(e,t){for(var r=t.length,n=0;e.indexOf(t[n])<0&&++n<r;);return n<r}(o._targets,i)&&(a?(!ri||o._initted&&o._ts)&&o.globalTime(0)<=t&&o.globalTime(o.totalDuration())>t:!t||o.isActive())&&n.push(o):(r=o.getTweensOf(i,t)).length&&n.push.apply(n,ft(r)),o=o._next;return n}},{key:"tweenTo",value:function(e,t){t=t||{};var r,n=this,i=Vt(n,e),o=(e=t).startAt,a=e.onStart,s=e.onStartParams,u=(e=e.immediateRender,hi.to(n,vn({ease:t.ease||"none",lazy:!1,immediateRender:!1,time:i,overwrite:"auto",duration:t.duration||Math.abs((i-(o&&"time"in o?o.time:n._time))/n.timeScale())||Dr,onStart:function(){var e;n.pause(),r||(e=t.duration||Math.abs((i-(o&&"time"in o?o.time:n._time))/n.timeScale()),u._dur!==e&&Nt(u,e,0,1).render(u._time,!0,!0),r=1),a&&a.apply(u,s||[])}},t)));return e?u.render(0):u}},{key:"tweenFromTo",value:function(e,t,r){return this.tweenTo(t,vn({startAt:{time:Vt(this,e)}},r))}},{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 Kt(this,Vt(this,e))}},{key:"previousLabel",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this._time;return Kt(this,Vt(this,e),1)}},{key:"currentLabel",value:function(e){return arguments.length?this.seek(e,!0):this.previousLabel(this._time+Dr)}},{key:"shiftChildren",value:function(e,t){for(var r,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,i=this._first,o=this.labels;i;)i._start>=n&&(i._start+=e,i._end+=e),i=i._next;if(t)for(r in o)o[r]>=n&&(o[r]+=e);return xn(this)}},{key:"invalidate",value:function(){var e=this._first;for(this._lock=0;e;)e.invalidate(),e=e._next;return nt(ut(t.prototype),"invalidate",this).call(this)}},{key:"clear",value:function(){for(var e,t=!(0<arguments.length&&void 0!==arguments[0])||arguments[0],r=this._first;r;)e=r._next,this.remove(r),r=e;return this._dp&&(this._time=this._tTime=this._pTime=0),t&&(this.labels={}),xn(this)}},{key:"totalDuration",value:function(e){var t,r,n,i=0,o=this,a=o._last,s=Cr;if(arguments.length)return o.timeScale((o._repeat<0?o.duration():o.totalDuration())/(o.reversed()?-e:e));if(o._dirty){for(n=o.parent;a;)t=a._prev,a._dirty&&a.totalDuration(),(r=a._start)>s&&o._sort&&a._ts&&!o._lock?(o._lock=1,Lt(o,a,r-a._delay,1)._lock=0):s=r,r<0&&a._ts&&(i-=r,(!n&&!o._dp||n&&n.smoothChildTiming)&&(o._start+=r/o._ts,o._time-=r,o._tTime-=r),o.shiftChildren(-r,!1,-1/0),s=0),a._end>i&&a._ts&&(i=a._end),a=t;Nt(o,o===ur&&o._time>i?o._time:i,1,1),o._dirty=0}return o._tDur}}],[{key:"updateRoot",value:function(e){if(ur._ts&&(Tt(ur,Ct(e,ur)),pr=Bn.frame),Bn.frame>=cn){cn+=jr.autoSleep||120;var t=ur._first;if((!t||!t._ts)&&jr.autoSleep&&Bn._listeners.length<2){for(;t&&!t._ts;)t=t._next;t||Bn.sleep()}}}}]),t}()),ai=(vn(oi.prototype,{_lock:0,_hasPause:0,_forcing:0}),function(e,t,r,n,i,o,a){var s,u,l,c,h,f=new bi(this._pt,e,t,0,1,Qn,null,i),p=0,d=0;for(f.b=r,f.e=n,r+="",(i=~(n+="").indexOf("random("))&&(n=jn(n)),o&&(o(o=[r,n],e,t),r=o[0],n=o[1]),s=r.match(Kr)||[];c=Kr.exec(n);)l=c[0],c=n.substring(p,c.index),u?u=(u+1)%5:"rgba("===c.substr(-5)&&(u=1),l!==s[d++]&&(h=parseFloat(s[d-1])||0,f._pt={_next:f._pt,p:c||1===d?c:",",s:h,c:"="===l.charAt(1)?parseFloat(l.substr(2))*("-"===l.charAt(0)?-1:1):parseFloat(l)-h,m:u&&u<4?Math.round:0},p=Kr.lastIndex);return f.c=p<n.length?n.substring(p,n.length):"",f.fp=a,(Jr.test(n)||i)&&(f.e=0),this._pt=f}),si=function(e,t,r,n,i,o,a,s,u){var l;if(Vr(n)&&(n=n(i||0,e,o)),i=e[t],o="get"!==r?r:Vr(i)?u?e[t.indexOf("set")||!Vr(e["get"+t.substr(3)])?t:"get"+t.substr(3)](u):e[t]():i,r=Vr(i)?u?di:pi:fi,Fr(n)&&"="===(n=~n.indexOf("random(")?jn(n):n).charAt(1)&&(!(l=parseFloat(o)+parseFloat(n.substr(2))*("-"===n.charAt(0)?-1:1)+(On(o)||0))&&0!==l||(n=l)),o!==n)return isNaN(o*n)||""===n?(i||t in e||nn(t,n),ai.call(this,e,t,o,n,r,s||jr.stringFilter,u)):(l=new bi(this._pt,e,t,+o||0,n-(o||0),"boolean"==typeof i?vi:yi,0,r),u&&(l.fp=u),a&&l.modifier(a,this,e),this._pt=l)},ui=function(e,t,r,n,i,o){var a,s,u,l;if(un[e]&&!1!==(a=new un[e]).init(i,a.rawVars?t[e]:function(e,t,r,n,i){if(Vr(e)&&(e=Yn(e,i,t,r,n)),!Gr(e)||e.style&&e.nodeType||qr(e)||Xr(e))return Fr(e)?Yn(e,i,t,r,n):e;var o,a={};for(o in e)a[o]=Yn(e[o],i,t,r,n);return a}(t[e],n,i,o,r),r,n,o)&&(r._pt=s=new bi(r._pt,i,e,0,1,a.render,a,0,a.priority),r!==dr))for(u=r._ptLookup[r._targets.indexOf(i)],l=a._props.length;l--;)u[a._props[l]]=s;return a},li=fn+"repeat,repeatDelay,yoyo,repeatRefresh,yoyoEase",ci={},hi=(_t(li+",id,stagger,delay,duration,paused,scrollTrigger",(function(e){return ci[e]=1})),function(){it(t,ii);var e=at(t);function t(r,n,i,o){ht(this,t),"number"==typeof n&&(i.duration=n,n=i,i=null);var a,s,u,l,c,h,f,p,d,m=(o=(a=e.call(this,o?n:Rt(n))).vars).duration,y=o.delay,v=o.immediateRender,g=o.stagger,b=o.overwrite,w=o.keyframes,x=o.defaults,S=o.scrollTrigger,_=o.yoyoEase,T=(o=n.parent||ur,(qr(r)||Xr(r)?Hr(r[0]):"length"in n)?[r]:Rn(r));if(a._targets=T.length?pn(T):bt("GSAP target "+r+" not found. https://greensock.com",!jr.nullTargetWarn)||[],a._ptLookup=[],a._overwrite=b,w||g||vt(m)||vt(y)){if(n=a.vars,(s=a.timeline=new oi({data:"nested",defaults:x||{}})).kill(),s.parent=s._dp=st(a),s._start=0,g||vt(m)||vt(y)){if(c=T.length,p=g&&Wt(g),Gr(g))for(h in g)~li.indexOf(h)&&((d=d||{})[h]=g[h]);for(u=0;u<c;u++)(l=gn(n,ci)).stagger=0,_&&(l.yoyoEase=_),d&&Mt(l,d),f=T[u],l.duration=+Yn(m,st(a),u,f,T),l.delay=(+Yn(y,st(a),u,f,T)||0)-a._delay,!g&&1===c&&l.delay&&(a._delay=y=l.delay,a._start+=y,l.delay=0),s.to(f,l,p?p(u,f,T):0),s._ease=Nn.none;s.duration()?m=y=0:a.timeline=0}else if(w){Rt(vn(s.vars.defaults,{ease:"none"})),s._ease=Gn(w.ease||n.ease||"none");var E,O,M,P=0;if(qr(w))w.forEach((function(e){return s.to(T,e,">")}));else{for(h in l={},w)"ease"!==h&&"easeEach"!==h&&function(e,t,r,n){var i,o,a=t.ease||n||"power1.inOut";if(qr(t))o=r[e]||(r[e]=[]),t.forEach((function(e,r){return o.push({t:r/(t.length-1)*100,v:e,e:a})}));else for(i in t)o=r[i]||(r[i]=[]),"ease"!==i&&o.push({t:parseFloat(e),v:t[i],e:a})}(h,w[h],l,w.easeEach);for(h in l)for(E=l[h].sort((function(e,t){return e.t-t.t})),u=P=0;u<E.length;u++)(M={ease:(O=E[u]).e,duration:(O.t-(u?E[u-1].t:0))/100*m})[h]=O.v,s.to(T,M,P),P+=M.duration;s.duration()<m&&s.to({},{duration:m-s.duration()})}}m||a.duration(m=s.duration())}else a.timeline=0;return!0!==b||sr||(ri=st(a),ur.killTweensOf(T),ri=0),Lt(o,st(a),i),n.reversed&&a.reverse(),n.paused&&a.paused(!0),(v||!m&&!w&&a._start===mn(o._time)&&Wr(v)&&kt(st(a))&&"nested"!==o.data)&&(a._tTime=-Dr,a.render(Math.max(0,-y))),S&&zt(st(a),S),a}return ct(t,[{key:"render",value:function(e,t,r){var n,i,o=this._time,a=this._tDur,s=this._dur,u=a-Dr<e&&0<=e?a:e<Dr?0:e;if(s){if(u!==this._tTime||!e||r||!this._initted&&this._tTime||this._startAt&&this._zTime<0!=e<0){if(m=u,d=this.timeline,this._repeat){if(h=s+this._rDelay,this._repeat<-1&&e<0)return this.totalTime(100*h+e,t,r);if(m=mn(u%h),u===a?(v=this._repeat,m=s):((v=~~(u/h))&&v===u/h&&(m=s,v--),s<m&&(m=s)),(p=this._yoyo&&1&v)&&(f=this._yEase,m=s-m),g=At(this._tTime,h),m===o&&!r&&this._initted)return this;v!==g&&(d&&this._yEase&&rr(d,p),!this.vars.repeatRefresh||p||this._lock||(this._lock=r=1,this.render(mn(h*v),!0).invalidate()._lock=0))}if(!this._initted){if(It(this,e<0?e:m,r,t))return this._tTime=0,this;if(s!==this._dur)return this.render(e,t,r)}if(this._tTime=u,this._time=m,!this._act&&this._ts&&(this._act=1,this._lazy=0),this.ratio=i=(f||this._ease)(m/s),this._from&&(this.ratio=i=1-i),m&&!o&&!t&&(Jt(this,"onStart"),this._tTime!==u))return this;for(n=this._pt;n;)n.r(i,n.d),n=n._next;d&&d.render(e<0?e:!m&&p?-Dr:d._dur*d._ease(m/this._dur),t,r)||this._startAt&&(this._zTime=e),this._onUpdate&&!t&&(e<0&&this._startAt&&this._startAt.render(e,!0,r),Jt(this,"onUpdate")),this._repeat&&v!==g&&this.vars.onRepeat&&!t&&this.parent&&Jt(this,"onRepeat"),u!==this._tDur&&u||this._tTime!==u||(e<0&&this._startAt&&!this._onUpdate&&this._startAt.render(e,!0,!0),!e&&s||!(u===this._tDur&&0<this._ts||!u&&this._ts<0)||wn(this,1),t||e<0&&!o||!u&&!o||(Jt(this,u===a?"onComplete":"onReverseComplete",!0),!this._prom||u<a&&0<this.timeScale()||this._prom()))}}else{var l,c,h=this,f=e,p=t,d=r,m=h.ratio,y=f<0||!f&&(!h._start&&Bt(h)&&(h._initted||!Ut(h))||(h._ts<0||h._dp._ts<0)&&!Ut(h))?0:1,v=h._rDelay,g=0;if(v&&h._repeat&&(c=At(g=Gt(0,h._tDur,f),v),h._yoyo&&1&c&&(y=1-y),c!==At(h._tTime,v)&&(m=1-y,h.vars.repeatRefresh&&h._initted&&h.invalidate())),y!==m||d||h._zTime===Dr||!f&&h._zTime){if(h._initted||!It(h,f,d,p)){for(c=h._zTime,h._zTime=f||(p?Dr:0),p=p||f&&!c,h.ratio=y,h._from&&(y=1-y),h._time=0,h._tTime=g,l=h._pt;l;)l.r(y,l.d),l=l._next;h._startAt&&f<0&&h._startAt.render(f,!0,!0),h._onUpdate&&!p&&Jt(h,"onUpdate"),g&&h._repeat&&!p&&h.parent&&Jt(h,"onRepeat"),(f>=h._tDur||f<0)&&h.ratio===y&&(y&&wn(h,1),p||(Jt(h,y?"onComplete":"onReverseComplete",!0),h._prom&&h._prom()))}}else h._zTime||(h._zTime=f)}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(),nt(ut(t.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?$t(this):this;if(this.timeline)return f=this.timeline.totalDuration(),this.timeline.killTweensOf(e,t,ri&&!0!==ri.vars.overwrite)._first||$t(this),this.parent&&f!==this.timeline.totalDuration()&&Nt(this,this._dur*this.timeline._tDur/f,0,1),this;var r,n,i,o,a,s,u,l=this._targets,c=e?Rn(e):l,h=this._ptLookup,f=this._pt;if((!t||"all"===t)&&function(e,t){for(var r=e.length,n=r===t.length;n&&r--&&e[r]===t[r];);return r<0}(l,c))return"all"===t&&(this._pt=0),$t(this);for(r=this._op=this._op||[],"all"!==t&&(Fr(t)&&(a={},_t(t,(function(e){return a[e]=1})),t=a),t=function(e,t){var r,n,i,o,a=(e=e[0]?dn(e[0]).harness:0)&&e.aliases;if(!a)return t;for(n in r=Mt({},t),a)if(n in r)for(i=(o=a[n].split(",")).length;i--;)r[o[i]]=r[n];return r}(l,t)),u=l.length;u--;)if(~c.indexOf(l[u]))for(a in n=h[u],"all"===t?(r[u]=t,o=n,i={}):(i=r[u]=r[u]||{},o=t),o)(s=n&&n[a])&&("kill"in s.d&&!0!==s.d.kill(a)||bn(this,s,"_pt"),delete n[a]),"all"!==i&&(i[a]=1);return this._initted&&!this._pt&&f&&$t(this),this}}],[{key:"to",value:function(e,r){return new t(e,r,arguments[2])}},{key:"from",value:function(e,t){return Ht(1,arguments)}},{key:"delayedCall",value:function(e,r,n,i){return new t(r,0,{immediateRender:!1,lazy:!1,overwrite:!1,delay:e,onComplete:r,onReverseComplete:r,onCompleteParams:n,onReverseCompleteParams:n,callbackScope:i})}},{key:"fromTo",value:function(e,t,r){return Ht(2,arguments)}},{key:"set",value:function(e,r){return r.duration=0,r.repeatDelay||(r.repeat=0),new t(e,r)}},{key:"killTweensOf",value:function(e,t,r){return ur.killTweensOf(e,t,r)}}]),t}()),fi=(vn(hi.prototype,{_targets:[],_lazy:0,_startAt:0,_op:0,_onInit:0}),_t("staggerTo,staggerFrom,staggerFromTo",(function(e){hi[e]=function(){var t=new oi,r=Mn.call(arguments,0);return r.splice("staggerFromTo"===e?5:4,0,0),t[e].apply(t,r)}})),function(e,t,r){return e[t]=r}),pi=function(e,t,r){return e[t](r)},di=function(e,t,r,n){return e[t](n.fp,r)},mi=function(e,t){return Vr(e[t])?pi:mt(e[t])&&e.setAttribute?Zn:fi},yi=function(e,t){return t.set(t.t,t.p,Math.round(1e6*(t.s+t.c*e))/1e6,t)},vi=function(e,t){return t.set(t.t,t.p,!!(t.s+t.c*e),t)},gi=function(e){for(var t,r,n,i,o=e._pt;o;){for(t=o._next,r=n;r&&r.pr>o.pr;)r=r._next;(o._prev=r?r._prev:i)?o._prev._next=o:n=o,(o._next=r)?r._prev=o:i=o,o=t}e._pt=n},bi=function(){function e(t,r,n,i,o,a,s,u,l){ht(this,e),this.t=r,this.s=i,this.c=o,this.p=n,this.r=a||yi,this.d=s||this,this.set=u||fi,this.pr=l||0,(this._next=t)&&(t._prev=this)}return ct(e,[{key:"modifier",value:function(e,t,r){this.mSet=this.mSet||this.set,this.set=ei,this.m=e,this.mt=r,this.tween=t}}]),e}(),wi=(_t(fn+"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 on[e]=1})),tn.TweenMax=tn.TweenLite=hi,tn.TimelineLite=tn.TimelineMax=oi,ur=new oi({sortChildren:!1,defaults:Ar,autoRemoveChildren:!0,id:"root",smoothChildTiming:!0}),jr.stringFilter=function(e){var t=e.join(" ");if(zn.lastIndex=0,zn.test(t))return t=In.test(t),e[1]=tr(e[1],t),e[0]=tr(e[0],t,Ln(e[1])),!0},{registerPlugin:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];t.forEach((function(e){var t=(e=!e.name&&e.default||e).name,r=Vr(e),n=(r=t&&!r&&e.init?function(){this._props=[]}:e,{init:xt,render:Kn,add:si,kill:$n,modifier:Jn,rawVars:0}),i={targetTest:0,get:0,getSetter:mi,aliases:{},register:0};if(Un(),e!==r){if(un[t])return;vn(r,vn(gn(e,n),i)),Mt(r.prototype,Mt(n,gn(e,i))),un[r.prop=t]=r,e.targetTest&&(hn.push(r),on[t]=1),t=("css"===t?"CSS":t.charAt(0).toUpperCase()+t.substr(1))+"Plugin"}wt(t,r),e.register&&e.register(Si,r,bi)}))},timeline:function(e){return new oi(e)},getTweensOf:function(e,t){return ur.getTweensOf(e,t)},getProperty:function(e,t,r,n){Fr(e)&&(e=Rn(e)[0]);var i=dn(e||{}).get,o=r?Ot:Et;return"native"===r&&(r=""),e&&(t?o((un[t]&&un[t].get||i)(e,t,r,n)):function(t,r,n){return o((un[t]&&un[t].get||i)(e,t,r,n))})},quickSetter:function(e,t,r){var n,i;if(1<(e=Rn(e)).length)return n=e.map((function(e){return Si.quickSetter(e,t,r)})),i=n.length,function(e){for(var t=i;t--;)n[t](e)};e=e[0]||{};var o=un[t],a=dn(e),s=a.harness&&(a.harness.aliases||{})[t]||t,u=o?function(t){var n=new o;dr._pt=0,n.init(e,r?t+r:t,dr,0,[e]),n.render(1,n),dr._pt&&Kn(1,dr)}:a.set(e,s);return o?u:function(t){return u(e,s,r?t+r:t,a,1)}},isTweening:function(e){return 0<ur.getTweensOf(e,!0).length},defaults:function(e){return e&&e.ease&&(e.ease=Gn(e.ease,Ar.ease)),Pt(Ar,e||{})},config:function(e){return Pt(jr,e||{})},registerEffect:function(e){var t=e.name,r=e.effect,n=e.plugins,i=e.defaults;e=e.extendTimeline,(n||"").split(",").forEach((function(e){return e&&!un[e]&&!tn[e]&&bt(t+" effect requires "+e+" plugin.")})),ln[t]=function(e,t,n){return r(Rn(e),vn(t||{},i),n)},e&&(oi.prototype[t]=function(e,r,n){return this.add(ln[t](e,Gr(r)?r:(n=r)&&{},this),n)})},registerEase:function(e,t){Nn[e]=Gn(t)},parseEase:function(e,t){return arguments.length?Gn(e,t):Nn},getById:function(e){return ur.getById(e)},exportRoot:function(){var e,t,r=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},n=1<arguments.length?arguments[1]:void 0,i=new oi(r);for(i.smoothChildTiming=Wr(r.smoothChildTiming),ur.remove(i),i._dp=0,i._time=i._tTime=ur._time,e=ur._first;e;)t=e._next,!n&&!e._dur&&e instanceof hi&&e.vars.onComplete===e._targets[0]||Lt(i,e,e._start-e._delay),e=t;return Lt(ur,i,0),i},utils:{wrap:function e(t,r,n){var i=r-t;return qr(t)?Zt(t,e(0,t.length),r):En(n,(function(e){return(i+(e-t)%i)%i+t}))},wrapYoyo:function e(t,r,n){var i=r-t,o=2*i;return qr(t)?Zt(t,e(0,t.length-1),r):En(n,(function(e){return t+(i<(e=(o+(e-t)%o)%o||0)?o-e:e)}))},distribute:Wt,random:Yt,snap:qt,normalize:function(e,t,r){return Qt(e,t,0,1,r)},getUnit:On,clamp:function(e,t,r){return En(r,(function(r){return Gt(e,t,r)}))},splitColor:Dn,toArray:Rn,selector:function(e){return e=Rn(e)[0]||bt("Invalid scope")||{},function(t){var r=e.current||e.nativeElement||e;return Rn(t,r.querySelectorAll?r:r===e?bt("Invalid scope")||hr.createElement("div"):e)}},mapRange:Qt,pipe:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(e){return t.reduce((function(e,t){return t(e)}),e)}},unitize:function(e,t){return function(r){return e(parseFloat(r))+(t||On(r))}},interpolate:function e(t,r,n,i){var o=isNaN(t+r)?0:function(e){return(1-e)*t+e*r};if(!o){var a,s,u,l,c,h=Fr(t),f={};if(!0===n&&(i=1)&&(n=null),h)t={p:t},r={p:r};else if(qr(t)&&!qr(r)){for(u=[],l=t.length,c=l-2,s=1;s<l;s++)u.push(e(t[s-1],t[s]));l--,o=function(e){e*=l;var t=Math.min(c,~~e);return u[t](e-t)},n=r}else i||(t=Mt(qr(t)?[]:{},t));if(!u){for(a in r)si.call(f,t,a,"get",r[a]);o=function(e){return Kn(e,f),h?t.p:t}}}return En(n,o)},shuffle:kn},install:gt,effects:ln,ticker:Bn,updateRoot:oi.updateRoot,plugins:un,globalTimeline:ur,core:{PropTween:bi,globals:wt,Tween:hi,Timeline:oi,Animation:ii,getCache:dn,_removeLinkedListItem:bn,suppressOverwrites:function(e){return sr=e}}}),xi=(_t("to,from,fromTo,delayedCall,set,killTweensOf",(function(e){return wi[e]=hi[e]})),Bn.add(oi.updateRoot),dr=wi.to({},{duration:0}),function(e,t){for(var r=e._pt;r&&r.p!==t&&r.op!==t&&r.fp!==t;)r=r._next;return r}),Si=wi.registerPlugin({name:"attr",init:function(e,t,r,n,i){var o,a;for(o in t)(a=this.add(e,"setAttribute",(e.getAttribute(o)||0)+"",t[o],n,i,0,0,o))&&(a.op=o),this._props.push(o)}},{name:"endArray",init:function(e,t){for(var r=t.length;r--;)this.add(e,r,e[r]||0,t[r])}},ti("roundProps",Xt),ti("modifiers"),ti("snap",qt))||wi;hi.version=oi.version=Si.version="3.9.1",fr=1,yt()&&Un(),Nn.Power0,Nn.Power1,Nn.Power2,Nn.Power3,Nn.Power4,Nn.Linear,Nn.Quad,Nn.Cubic,Nn.Quart,Nn.Quint,Nn.Strong,Nn.Elastic,Nn.Back,Nn.SteppedEase,Nn.Bounce,Nn.Sine,Nn.Expo,Nn.Circ;const _i=p,Ti=["map","normalMap","aoMap"],Ei=["map","metalnessMap","roughnessMap","normalMap","aoMap","emissiveMap","alphaMap","lightMap","envMap","displacementMap"];class Oi{}const Mi=class extends Oi{constructor(e){super(),this.type="修改材质";var{target:e,info:t,newVal:r,oldVal:n,runScene:i}=e;this.runScene=i,this.target=e,this.info=t,this.newVal=r,this.oldVal=n}_execute(e,t){this.target[this.info]=e,this.target.needsUpdate=!0,Ei.includes(this.info)&&e&&this.runScene.uniqueEx.texture.addMaterial(e,{material:this.target,type:this.info})}execute(){return this.redo(),this}undo(){this._execute(this.oldVal,this.newVal)}redo(){this._execute(this.newVal,this.oldVal)}};var Pi=function(e,t,r,n){return new(r=r||Promise)((function(i,o){function a(e){try{u(n.next(e))}catch(e){o(e)}}function s(e){try{u(n.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(a,s)}u((n=n.apply(e,t||[])).next())}))};class Ri{constructor(e){this.allTextures=new Set,this.runScene=e}load(e){return Pi(this,void 0,void 0,(function*(){var t=yield Vo(e);return this.parse(t)}))}parse(e){return Pi(this,void 0,void 0,(function*(){var t="Blob"===Ea(e)?e:yield Go(e);return this.afterLoad(t,yield Bi(t))}))}clone(e){const t=new p.Texture(e.image);return t.userData=Object.assign(Object.assign({},e.userData),{id:(0,f.getId)()}),Di(t),this.getSameAndAddtoAll(t)}getDef(e){return e=new p.Texture(e),Di(e),this.getSameAndAddtoAll(e)}getSameAndAddtoAll(e){var t=e.userData.md5;return(t=this.getSameTexture(t,e))?(Ci(e),t):(this.initTextureAndAddtoAll(e),e)}afterLoad(e,t){return Pi(this,void 0,void 0,(function*(){return this.getSameAndAddtoAll(yield Di(t,e))}))}getSameTexture(e,t){for(const n in this.runScene.uniqueEx.texture.map){var r=this.runScene.uniqueEx.texture.get(n);if(r.userData.md5===e&&r.mapping===t.mapping)return r}}initTextureAndAddtoAll(e){return Pi(this,void 0,void 0,(function*(){return zi(e),Di(e),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.optionsEx.cb.texture.add.cb(e)}getBlobAndBase64(e){return e.userData.blob?e.userData:zo(e)}coverByImage(e,t){return Pi(this,void 0,void 0,(function*(){let r;r=t instanceof p.Texture?t:t?yield this.parse(t):null;var n=this.runScene.uniqueEx.texture.getMaterials(this.runScene.uniqueEx.getId(e));if(n){const t=[];(0,et.js)(n,((n,i)=>{const o=this.runScene.uniqueEx.material.get(n);o&&i.forEach((n=>{t.push(new Mi({target:o,info:n,newVal:r,oldVal:e,runScene:this.runScene}).execute())}))})),this.runScene.undoEx.addUndo(t)}}))}removeTexture(e){this.runScene.optionsEx.cb.texture.remove.cb(e),this.runScene.uniqueEx.texture.remove(e)}}const ki={环境遮蔽:"aoMap",法线:"normalMap",金属度:"metalnessMap",粗糙度:"roughnessMap",自发光:"emissiveMap",颜色:"map",置换:"displacementMap",光照贴图:"lightMap",环境:"envMap",透明度:"alphaMap"},ji=e=>1023===e.format?"image/png":"image/jpeg",Ai=e=>{var{width:e,height:t}=e.image;return e*t*4*1.33},Ci=e=>{if(e){const r=e.image;var t=e.userData.url;r.close(),URL.revokeObjectURL(t),e.dispose()}},Di=(e,t)=>Pi(void 0,void 0,void 0,(function*(){const r=t||e.userData.blob||(yield Li(e));var{md5:n,url:i}=e.userData;return e.userData.blob=r,n||(e.userData.md5=Yo(yield r.arrayBuffer())),i||(e.userData.url=URL.createObjectURL(r)),e.userData.gm=Ai(e),e.format=e.userData.format||-1!==r.type.indexOf("png")?1023:1022,e})),Li=e=>e.userData.blob||Do(e.image),zi=e=>(e.magFilter=1003,e.wrapS=_i.RepeatWrapping,e.wrapT=_i.RepeatWrapping,e.encoding=3e3,e.version=3,e.flipY=!1,e.minFilter=_i.LinearMipmapLinearFilter,e.needsUpdate=!0,e),Ii=e=>createImageBitmap(e,{imageOrientation:"flipY",resizeQuality:"pixelated"}),Bi=e=>Pi(void 0,void 0,void 0,(function*(){var t=yield Ii(e instanceof Blob?e:yield Vo(e));return new p.Texture(t)})),Ui=e=>e.userData.url,Ni=(e,t="repeat")=>(e.mapping="repeat"===t?_i.EquirectangularReflectionMapping:300,e.needsUpdate=!0,e),Fi=e=>{var{width:e,height:t}=e.image;return{width:e,height:t}};function Vi(e){return(Vi="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 Hi(e,t){return(Hi=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Gi(e){return(Gi=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Wi=new p.Box3,Xi=new p.Vector3,qi=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Hi(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Gi(e);if(r=t?(r=Gi(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Vi(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(){var e;if(!(this instanceof n))throw new TypeError("Cannot call a class as a function");return(e=r.call(this)).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 p.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 p.Float32BufferAttribute([-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],2)),e}return t=n,(e=[{key:"applyMatrix4",value:function(e){var t=this.attributes.instanceStart,r=this.attributes.instanceEnd;return void 0!==t&&(t.applyMatrix4(e),r.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 p.InstancedInterleavedBuffer(t,6,1),this.setAttribute("instanceStart",new p.InterleavedBufferAttribute(e,3,0)),this.setAttribute("instanceEnd",new p.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 p.InstancedInterleavedBuffer(t,6,1),this.setAttribute("instanceColorStart",new p.InterleavedBufferAttribute(e,3,0)),this.setAttribute("instanceColorEnd",new p.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 p.WireframeGeometry(e.geometry)),this}},{key:"fromLineSegments",value:function(e){if(!(e=e.geometry).isGeometry)return e.isBufferGeometry&&this.setPositions(e.attributes.position.array),this;console.error("THREE.LineSegmentsGeometry no longer supports Geometry. Use THREE.BufferGeometry instead.")}},{key:"computeBoundingBox",value:function(){null===this.boundingBox&&(this.boundingBox=new p.Box3);var e=this.attributes.instanceStart,t=this.attributes.instanceEnd;void 0!==e&&void 0!==t&&(this.boundingBox.setFromBufferAttribute(e),Wi.setFromBufferAttribute(t),this.boundingBox.union(Wi))}},{key:"computeBoundingSphere",value:function(){null===this.boundingSphere&&(this.boundingSphere=new p.Sphere),null===this.boundingBox&&this.computeBoundingBox();var e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(void 0!==e&&void 0!==t){for(var r=this.boundingSphere.center,n=(this.boundingBox.getCenter(r),0),i=0,o=e.count;i<o;i++)Xi.fromBufferAttribute(e,i),n=Math.max(n,r.distanceToSquared(Xi)),Xi.fromBufferAttribute(t,i),n=Math.max(n,r.distanceToSquared(Xi));this.boundingSphere.radius=Math.sqrt(n),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 r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),n}(p.InstancedBufferGeometry);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 Zi(e,t){return(Zi=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Qi(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ki(e){return(Ki=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}qi.prototype.isLineSegmentsGeometry=!0,p.UniformsLib.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new p.Vector2(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}},p.ShaderLib.line={uniforms:p.UniformsUtils.merge([p.UniformsLib.common,p.UniformsLib.fog,p.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\t// get the offset direction as perpendicular to the view vector\n\t\t\t\tvec3 worldDir = normalize( end.xyz - start.xyz );\n\t\t\t\tvec3 offset;\n\t\t\t\tif ( position.y < 0.5 ) {\n\n\t\t\t\t\toffset = normalize( cross( start.xyz, worldDir ) );\n\n\t\t\t\t} else {\n\n\t\t\t\t\toffset = normalize( cross( end.xyz, worldDir ) );\n\n\t\t\t\t}\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\tfloat forwardOffset = dot( worldDir, vec3( 0.0, 0.0, 1.0 ) );\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// extend the line bounds to encompass endcaps\n\t\t\t\t\tstart.xyz += - worldDir * linewidth * 0.5;\n\t\t\t\t\tend.xyz += worldDir * linewidth * 0.5;\n\n\t\t\t\t\t// shift the position of the quad so it hugs the forward edge of the line\n\t\t\t\t\toffset.xy -= dir * forwardOffset;\n\t\t\t\t\toffset.z += 0.5;\n\n\t\t\t\t#endif\n\n\t\t\t\t// endcaps\n\t\t\t\tif ( position.y > 1.0 || position.y < 0.0 ) {\n\n\t\t\t\t\toffset.xy += dir * 2.0 * forwardOffset;\n\n\t\t\t\t}\n\n\t\t\t\t// adjust for linewidth\n\t\t\t\toffset *= linewidth * 0.5;\n\n\t\t\t\t// set the world position\n\t\t\t\tworldPos = ( position.y < 0.5 ) ? start : end;\n\t\t\t\tworldPos.xyz += offset;\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 <encodings_fragment>\n\t\t\t#include <fog_fragment>\n\t\t\t#include <premultiplied_alpha_fragment>\n\n\t\t}\n\t\t"};var Ji=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Zi(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Ki(e);if(r=t?(r=Ki(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Yi(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return Qi(n)}}(n);function n(e){var t;if(this instanceof n)return t=r.call(this,{type:"LineMaterial",uniforms:p.UniformsUtils.clone(p.ShaderLib.line.uniforms),vertexShader:p.ShaderLib.line.vertexShader,fragmentShader:p.ShaderLib.line.fragmentShader,clipping:!0}),Object.defineProperties(Qi(t),{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(e){this.uniforms.diffuse.value=e}},worldUnits:{enumerable:!0,get:function(){return"WORLD_UNITS"in this.defines},set:function(e){!0===e?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(e){this.uniforms.linewidth.value=e}},dashed:{enumerable:!0,get:function(){return Boolean("USE_DASH"in this.defines)},set:function(e){Boolean(e)!==Boolean("USE_DASH"in this.defines)&&(this.needsUpdate=!0),!0===e?this.defines.USE_DASH="":delete this.defines.USE_DASH}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(e){this.uniforms.dashScale.value=e}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(e){this.uniforms.dashSize.value=e}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(e){this.uniforms.dashOffset.value=e}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(e){this.uniforms.gapSize.value=e}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(e){this.uniforms.opacity.value=e}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(e){this.uniforms.resolution.value.copy(e)}},alphaToCoverage:{enumerable:!0,get:function(){return Boolean("USE_ALPHA_TO_COVERAGE"in this.defines)},set:function(e){Boolean(e)!==Boolean("USE_ALPHA_TO_COVERAGE"in this.defines)&&(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)}}}),t.setValues(e),t;throw new TypeError("Cannot call a class as a function")}return t=n,Object.defineProperty(t,"prototype",{writable:!1}),t}(p.ShaderMaterial);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 eo(e,t){return(eo=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function to(e){return(to=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}Ji.prototype.isLineMaterial=!0;var ro,no,io,oo,ao=new p.Vector3,so=new p.Vector3,uo=new p.Vector4,lo=new p.Vector4,co=new p.Vector4,ho=new p.Vector3,fo=new p.Matrix4,po=new p.Line3,mo=new p.Vector3,yo=new p.Box3,vo=new p.Sphere,go=new p.Vector4;function bo(e,t,r){return go.set(0,0,-t,1).applyMatrix4(e.projectionMatrix),go.multiplyScalar(1/go.w),go.x=oo/r.width,go.y=oo/r.height,go.applyMatrix4(e.projectionMatrixInverse),go.multiplyScalar(1/go.w),Math.abs(Math.max(go.x,go.y))}var wo=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&eo(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=to(e);if(r=t?(r=to(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===$i(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new qi,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new Ji({color:16777215*Math.random()}),i=this,o=n;if(i instanceof o)return(i=r.call(this,e,t)).type="LineSegments2",i;throw new TypeError("Cannot call a class as a function")}return t=n,(e=[{key:"computeLineDistances",value:function(){for(var e=this.geometry,t=e.attributes.instanceStart,r=e.attributes.instanceEnd,n=new Float32Array(2*t.count),i=0,o=0,a=t.count;i<a;i++,o+=2)ao.fromBufferAttribute(t,i),so.fromBufferAttribute(r,i),n[o]=0===o?0:n[o-1],n[o+1]=n[o]+ao.distanceTo(so);var s=new p.InstancedInterleavedBuffer(n,2,1);return e.setAttribute("instanceDistanceStart",new p.InterleavedBufferAttribute(s,1,0)),e.setAttribute("instanceDistanceEnd",new p.InterleavedBufferAttribute(s,1,1)),this}},{key:"raycast",value:function(e,t){var r=this.material.worldUnits,n=e.camera,i=(null!==n||r||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),o=(ro=e.ray,e=this.matrixWorld,this.geometry),a=this.material;if(oo=a.linewidth+i,no=o.attributes.instanceStart,io=o.attributes.instanceEnd,null===o.boundingSphere&&o.computeBoundingSphere(),vo.copy(o.boundingSphere).applyMatrix4(e),i=r?.5*oo:bo(n,Math.max(n.near,vo.distanceToPoint(ro.origin)),a.resolution),vo.radius+=i,!1!==ro.intersectsSphere(vo)&&(null===o.boundingBox&&o.computeBoundingBox(),yo.copy(o.boundingBox).applyMatrix4(e),i=r?.5*oo:bo(n,Math.max(n.near,yo.distanceToPoint(ro.origin)),a.resolution),yo.expandByScalar(i),!1!==ro.intersectsBox(yo)))if(r)for(var s=t,u=0,l=no.count;u<l;u++){po.start.fromBufferAttribute(no,u),po.end.fromBufferAttribute(io,u);var c=new p.Vector3,h=new p.Vector3;ro.distanceSqToSegment(po.start,po.end,h,c),h.distanceTo(c)<.5*oo&&s.push({point:h,pointOnLine:c,distance:ro.origin.distanceTo(h),object:this,face:null,faceIndex:u,uv:null,uv2:null})}else{var f=this,d=t,m=(o=n).projectionMatrix,y=f.material.resolution,v=f.matrixWorld,g=(e=f.geometry).attributes.instanceStart,b=e.attributes.instanceEnd,w=-o.near;ro.at(1,co),co.w=1,co.applyMatrix4(o.matrixWorldInverse),co.applyMatrix4(m),co.multiplyScalar(1/co.w),co.x*=y.x/2,co.y*=y.y/2,co.z=0,ho.copy(co),fo.multiplyMatrices(o.matrixWorldInverse,v);for(var x,S,_,T,E=0,O=g.count;E<O;E++)uo.fromBufferAttribute(g,E),lo.fromBufferAttribute(b,E),uo.w=1,lo.w=1,uo.applyMatrix4(fo),lo.applyMatrix4(fo),uo.z>w&&lo.z>w||(uo.z>w?(x=uo.z-lo.z,x=(uo.z-w)/x,uo.lerp(lo,x)):lo.z>w&&(x=lo.z-uo.z,S=(lo.z-w)/x,lo.lerp(uo,S)),uo.applyMatrix4(m),lo.applyMatrix4(m),uo.multiplyScalar(1/uo.w),lo.multiplyScalar(1/lo.w),uo.x*=y.x/2,uo.y*=y.y/2,lo.x*=y.x/2,lo.y*=y.y/2,po.start.copy(uo),po.start.z=0,po.end.copy(lo),po.end.z=0,S=po.closestPointToPointParameter(ho,!0),po.at(S,mo),_=-1<=(_=p.MathUtils.lerp(uo.z,lo.z,S))&&_<=1,T=ho.distanceTo(mo)<.5*oo,_&&T&&(po.start.fromBufferAttribute(g,E),po.end.fromBufferAttribute(b,E),po.start.applyMatrix4(v),po.end.applyMatrix4(v),_=new p.Vector3,T=new p.Vector3,ro.distanceSqToSegment(po.start,po.end,T,_),d.push({point:T,pointOnLine:_,distance:ro.origin.distanceTo(T),object:f,face:null,faceIndex:E,uv:null,uv2:null})))}}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),n}(p.Mesh);function xo(e){return(xo="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 So(){return(So="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=To(e)););return e}(e,t);if(n)return(n=Object.getOwnPropertyDescriptor(n,t)).get?n.get.call(arguments.length<3?e:r):n.value}).apply(this,arguments)}function _o(e,t){return(_o=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function To(e){return(To=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}wo.prototype.isLineSegments2=!0;var Eo=function(){var e=n,t=qi;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&&_o(e,t);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=To(e);if(r=t?(r=To(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===xo(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(){var e;if(this instanceof n)return(e=r.call(this)).type="LineGeometry",e;throw new TypeError("Cannot call a class as a function")}return 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 So(To(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 So(To(n.prototype),"setColors",this).call(this,r),this}},{key:"fromLine",value:function(e){if(!(e=e.geometry).isGeometry)return e.isBufferGeometry&&this.setPositions(e.attributes.position.array),this;console.error("THREE.LineGeometry no longer supports Geometry. Use THREE.BufferGeometry instead.")}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),n}();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 Mo(e,t){return(Mo=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Po(e){return(Po=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}Eo.prototype.isLineGeometry=!0;var Ro=function(){var e=n,t=wo;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&&Mo(e,t);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Po(e);if(r=t?(r=Po(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Oo(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new Eo,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new Ji({color:16777215*Math.random()}),i=this,o=n;if(i instanceof o)return(i=r.call(this,e,t)).type="Line2",i;throw new TypeError("Cannot call a class as a function")}return e=n,Object.defineProperty(e,"prototype",{writable:!1}),e}(),ko=(Ro.prototype.isLine2=!0,function(e,t,r,n){return new(r=r||Promise)((function(i,o){function a(e){try{u(n.next(e))}catch(e){o(e)}}function s(e){try{u(n.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(a,s)}u((n=n.apply(e,t||[])).next())}))});const jo=(e,t,r,n,i)=>{let o=Object.assign({},e),a=new hi(o,r,t).eventCallback("onUpdate",(e=>n&&n(o))).eventCallback("onComplete",(e=>{i&&i(),hi.killTweensOf(a)}));return a},Ao=(e,t)=>(t.updateMatrixWorld(!0),t=new _i.Vector3,e.getWorldPosition(t),t),Co=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()},Do=e=>ko(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)}))}))})),Lo=e=>{const t=document.createElement("canvas"),r=(t.width=e.width,t.height=e.height,t.getContext("2d"));r.translate(0,t.height),r.scale(1,-1),r.drawImage(e,0,0,t.width,t.height)},zo=e=>ko(void 0,void 0,void 0,(function*(){var t=e.image;const r=document.createElement("canvas"),n=(r.width=t.width,r.height=t.height,r.getContext("2d")),i=ji(e);return n.drawImage(t,0,0,r.width,r.height),new Promise((e=>{r.toBlob((t=>{e({blob:t,base64:r.toDataURL(i)})}),i)}))})),Io=e=>ko(void 0,void 0,void 0,(function*(){-1!==e.indexOf(",")&&(e=Bo(e));const t=window.atob(e);var r=t.length;const n=new Uint8Array(r);for(let e=0;e<r;e++)n[e]=t.charCodeAt(e);return n.buffer})),Bo=e=>e.substring(e.indexOf(",")+1),Uo=e=>URL.createObjectURL(new Blob([e])),No=(e,t)=>URL.createObjectURL(new Blob([e],t)),Fo=e=>{let t="";var r=new Uint8Array(e);for(let e=0,n=r.byteLength;e<n;e++)t+=String.fromCharCode(r[e]);return"data:image/jpg;base64,"+window.btoa(t)},Vo=e=>ko(void 0,void 0,void 0,(function*(){return(yield h().get(e,{responseType:"blob"})).data})),Ho=e=>{let t=e.split(","),r=t[0].match(/:(.*?);/)[1],n=atob(t[1]),i=n.length,o=new Uint8Array(i);for(;i--;)o[i]=n.charCodeAt(i);return new Blob([o],{type:r})},Go=e=>ko(void 0,void 0,void 0,(function*(){return Ho(yield(0,rt.toResult)(e,"base64"))})),Wo=(e,t)=>new File([e],t),Xo=e=>e.substring(e.indexOf(":")+1,e.indexOf(";")),qo=e=>{let t="";const r=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=r.indexOf("."),"00"==r.substr(e+1,2)?r.substring(0,e)+r.substr(e+3,2):t},Yo=e=>(0,tt.md5)(e),Zo=(e,t)=>{var{width:t,height:r}=t;let n=new Image,i=(n.src=e,n.width=t,n.height=r,document.createElement("canvas")),o=(i.width=t,i.height=r,i.getContext("2d"));return new Promise((e=>{n.onload=function(){o.drawImage(n,0,0,i.width,i.height),e({canvas:i,ctx:o})}}))},Qo=e=>{const t=document.createElement("canvas"),r=t.getContext("2d");return r.drawImage(e,0,0,e.width,e.height),{ctx:r,canvas:t}},Ko=(e,t)=>{const r=document.createElement("canvas"),n=r.getContext("2d");return r.width=e.width,r.height=e.height,n.drawImage(e,0,0,e.width,e.height),new Promise((e=>{r.toBlob((t=>{t&&e(URL.createObjectURL(t))}),"image/webp",t)}))},Jo=(e,t,r)=>{e/=255,t/=255,r/=255;var n,i=Math.max(e,t,r),o=Math.min(e,t,r),a=(i+o)/2;if(i==o)n=u=0;else{var s=i-o,u=.5<a?s/(2-i-o):s/(i+o);switch(i){case e:n=(t-r)/s+(t<r?6:0);break;case t:n=(r-e)/s+2;break;case r:n=(e-t)/s+4}n/=6}return[100*n,100*u,100*a]},$o=(e,t,r)=>{var n,i,o,a;return 0==t?i=o=a=r:(i=(n=function(e,t,r){return r<0&&(r+=1),1<r&&--r,r<1/6?e+6*(t-e)*r:r<.5?t:r<2/3?e+(t-e)*(2/3-r)*6:e})(t=2*r-(r=r<.5?r*(1+t):r+t-r*t),r,e+1/3),o=n(t,r,e),a=n(t,r,e-1/3)),[255*i,255*o,255*a]},ea=e=>ko(void 0,void 0,void 0,(function*(){var{bitmap:t,texture:r}=e;const{ctx:n,canvas:i}=yield Zo(URL.createObjectURL(r.userData.blob),{width:t.width,height:t.height});for(var o=n.getImageData(0,0,t.width,t.height,{colorSpace:"srgb"}),a=0,s=o.data.length;a<s;a+=4){var u=(c=Jo(o.data[a],o.data[a+1],o.data[a+2]))[0]/100,l=c[1]/100,c=c[2]/100;u=$o(u,l,c),o.data[a]=u[0],o.data[a+1]=u[1],o.data[a+2]=u[2]}return n.putImageData(o,0,0),new _i.Texture(i)})),ta=e=>{for(var t=(e=e.bitmap).width,r=e.height,n=Qo(e).ctx.getImageData(0,0,t,r).data,i=[],o=0;o<n/4;o+=1)i.push(n.slice(4*o,4*(o+1)))},ra=e=>new Array(e.files.length).fill(0).map(((t,r)=>e.files.item(r))).filter((e=>null!==e)),na=e=>new Promise((t=>{e.toBlob((e=>{t(e)}))})),ia={parse(e){var{x:e,y:t,z:r}=e;return void 0===r?new p.Vector2(e,t):new p.Vector3(e,t,r)},toJSON(e){var{x:t,y:r}=e;return e instanceof p.Vector2?{x:t,y:r}:{x:t,y:r,z:e.z}}},oa=(e,t)=>h().get(e,{responseType:t||"arraybuffer"}).then((e=>e.data)).catch((e=>{console.log(e,"加载出错")})),aa=(e,t)=>Object.assign(e,t||{}),sa=(e,t)=>e.distanceTo(t),ua=(e,t,r,n,i,o)=>({cx:e,cy:t,cz:r,tx:n,ty:i,tz:o}),la=e=>new O(e),ca=e=>new B(e),ha=e=>new M(e),fa=(e,t=0)=>{let r=setTimeout((()=>(null!==r&&clearTimeout(r),r=null,e())),t)},pa=e=>{if(null===e)return null;if("object"!=typeof e)return e;var t,r,n=new e.constructor;for(t in e)e.hasOwnProperty(t)&&(r=e[t],n[t]=r);return n},da=(e,t=.5,r=!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),r)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)},ma=(e,t,r)=>{"Group"===e.type||"Object3D"===e.type?e.children.forEach((e=>ma(e,t,r))):da(e,t,r)},ya=(e,t,r=1,n)=>new Array(t).fill("").map(((t,i)=>e+(i+r)+(n||""))),va=e=>(e.mapping=p.EquirectangularReflectionMapping,e),ga=e=>{let t=e=>"Group"!==e.type&&"Object3D"!==e.type||1!==e.children.length?e:t(e.children[0]);return t(e)},ba=(e,t)=>{let r=document.createElement("video");return r.style="position:absolute;top:0;left:0;z-index:1000000;",r.src=e,r.loop="loop",r.muted="muted",r.play(),t.appendChild(r),new p.VideoTexture(r)},wa=(e,t=!1)=>{let r=new p.CatmullRomCurve3(e),n=new p.BufferGeometry;e=r.getSpacedPoints(100),n.setFromPoints(e),e=new p.LineBasicMaterial({color:26214});let i=new p.Line(n,e);return i.visible=t,{line:i,curve:r}},xa=e=>{let t=0;const r=[],n={},i={0:"x",1:"y",2:"z"};return e.map((e=>{var o,a,s;3===t&&(t=0,({x:o,y:a,z:s}=n),r.push(new p.Vector3(o,a,s))),n[i[t]]=e,t++})),r},Sa=e=>{var{pointArray:e,material:t,lineWidth:r,colorArray:n}=e;const i=new Eo,o=(i.setPositions(e),t||new Ji({transparent:!0,side:p.DoubleSide,linewidth:r||5,vertexColors:!0})),a=(i.setColors(n||[1,1,1]),o.resolution.set(window.innerWidth,window.innerHeight),new Ro(i,o));return a.name="gw",a.computeLineDistances(),a},_a=(()=>{const e=(e,t,r)=>{e.matrixAutoUpdate=t,r&&(r(),t&&(e.matrixAutoUpdate=!t))};return(t,r,n)=>{if(0===t.children.length)return e(t,r,n);const i=[];t.traverse((e=>i.push(e))),i.map((t=>e(t,r,n)))}})(),Ta=e=>3.1415926*e/180,Ea=e=>e.toString().replace(/(\[object )([a-zA-Z]+)(])/,"$2"),Oa=(e,t)=>((0,et.js)(e,((r,n)=>{let i=t[r];void 0!==i&&("Object"===Ea(n)&&"Object"===Ea(i)&&(i=Oa(n,i)),e[r]=i)})),e),Ma=(e,t)=>e.find((e=>e===t)),Pa=(e,t,r=!1)=>{let n=e/t;return r&&(n*=100),Number(n.toFixed(2))},Ra=e=>{const t=new Image;return t.src=e,new Promise((e=>{t.onload=()=>{e(t)}}))},ka=e=>ko(void 0,void 0,void 0,(function*(){if(!e)throw TypeError("该参数为空");var t=yield Ra(e);const r=document.createElement("canvas"),n=(r.width=t.width,r.height=t.height,r.getContext("2d"));return n.drawImage(t,0,0),{img:t,canvas:r,ctx:n}}));class ja{constructor(e){this.alt=!1,this.ctrl=!1,this.shift=!1,this.eventsMap={down:{},up:{}},this.allFn={s_saveScene:()=>function(e,t,r,n){return new(r=r||Promise)((function(t,i){function o(e){try{s(n.next(e))}catch(e){i(e)}}function a(e){try{s(n.throw(e))}catch(e){i(e)}}function s(e){var n;e.done?t(e.value):((n=e.value)instanceof r?n:new r((function(e){e(n)}))).then(o,a)}s((n=n.apply(e,[])).next())}))}(this,0,void 0,(function*(){this.events.runScene.optionsEx.log("正在保存","base","info"),yield this.events.runScene.optionsEx.cb.scene.saveNet.cb("")})),d_exporter_Gltf:()=>{this.events.runScene.exporter.gltf.scene()},alt_selectDom:()=>{console.log("多选dom")},r_runScript:()=>{console.log("运行脚本")},d_copyModel:()=>{console.log("复制模型")},g_createGroup:()=>{console.log("生成组")},meta_showMateriallLibrary:()=>{console.log("弹出材质库窗口")},f_focusModel:()=>{const e=this.events.runScene.modelEx.select;if(e){const{scene:r,camera:n,renderer:i,controls:o}=this.events.runScene.assetsEx.get(),a=new p.Vector3,s=new p.Vector3;if("Mesh"===e.type||"Group"===e.type||"Object3D"===e.type){const e=this.events.runScene.helperEx.boxHelper;if(e.update(),!e||!e.object)return;var t=i.domElement.getBoundingClientRect();let r=t.width/t.height;const o=new p.Vector3;t=e.geometry.attributes.position.array,o.set(Math.abs(t[0]-t[3]),Math.abs(t[1]-t[7]),Math.abs(t[2]-t[14])),s.x=.5*(t[0]+t[3]),s.y=.5*(t[1]+t[7]),s.z=.5*(t[2]+t[14]);let u=new p.Vector3;u.subVectors(n.position,s),u.projectOnPlane(new p.Vector3(0,1,0)),u.normalize(),1<r&&(r=1/r),t=2*Math.tan(.5*n.fov*Math.PI/180),t=o.length()/r/t,a.addVectors(s,u.multiplyScalar(t))}else{r.updateMatrixWorld(!0),t=new p.Vector3,e.getWorldPosition(t),s.set(t.x,t.y,t.z);let i=new p.Vector3;i.subVectors(n.position,s),i.projectOnPlane(new p.Vector3(0,1,0)),i.normalize(),a.addVectors(s,i.multiplyScalar(3))}jo({positionX:n.position.x,positionY:n.position.y,positionZ:n.position.z,targetX:o.target.x,targetY:o.target.y,targetZ:o.target.z},{positionX:a.x,positionY:a.y,positionZ:a.z,targetX:s.x,targetY:s.y,targetZ:s.z},.5,(e=>{n.position.set(e.positionX,e.positionY,e.positionZ),n.lookAt(e.targetX,e.targetY,e.targetZ),o.target.set(e.targetX,e.targetY,e.targetZ),o.update()}))}},z_undo:e=>{this.events.runScene.undoEx.undo()},y_redo:e=>{this.events.runScene.undoEx.redo()}},this.events=e}bindEvent(e,t,r){if(void 0!==this.eventsMap[e][t])throw SyntaxError("该函数名已存在");this.eventsMap[e][t]=r}init(e){"running"!==this.events.runScene.optionsEx.options.mode&&(document.addEventListener("keydown",this.keyDown.bind(this)),document.addEventListener("keyup",this.keyUp.bind(this)))}keyDown(e){const t=e.key.toLowerCase();switch((0,et.js)(this.eventsMap.down,((r,n)=>{n(t,e)})),t){case"s":this.ctrl&&(e.preventDefault(),this.allFn.s_saveScene());break;case"d":if(this.ctrl){e.preventDefault();var r=this.events.runScene.modelEx.select;if(!r)return;this.events.runScene.modelEx.selectNull();var n=this.events.runScene.modelEx.clone(r);if(!n)return;this.events.runScene.modelEx.add(n,r.parent,{isClone:!0})}break;case"alt":this.ctrl&&(e.preventDefault(),this.allFn.alt_selectDom()),this.alt=!0;break;case"control":case"ctrl":this.ctrl=!0;break;case"shift":this.shift=!0;break;case"w":e.preventDefault(),e.stopPropagation(),this.events.runScene.helperEx.transContro.changeMode("position");break;case"e":this.events.runScene.helperEx.transContro.changeMode("rotation");break;case"r":if(this.events.runScene.helperEx.transContro.changeMode("scale"),!this.ctrl)return;e.preventDefault(),this.allFn.r_runScript();break;case"g":this.events.runScene.optionsEx.cb.events.key.g.cb({event:e,eventKey:this});break;case"f":this.allFn.f_focusModel();break;case"delete":console.log("删除"),this.events.runScene.helperEx.unfocus(),n=this.events.runScene.multipSelector.getSelectedList("value"),this.events.runScene.sceneEx.remove(this.events.runScene.modelEx.select||n),n&&this.events.runScene.multipSelector.delete();break;case"z":if(!this.ctrl)return;this.allFn.z_undo(e),console.log("撤销功能~~~~");break;case"y":if(!this.ctrl)return;this.allFn.y_redo(e),console.log("向前功能~~~~")}}keyUp(e){const t=e.key.toLowerCase();switch((0,et.js)(this.eventsMap.up,((r,n)=>{n(t,e)})),t){case"meta":if(!this.ctrl)return;this.allFn.meta_showMateriallLibrary();break;case"s":if(this.ctrl)break;return;case"alt":this.alt=!1;break;case"control":case"ctrl":this.ctrl=!1;break;case"shift":this.shift=!1}}}class Aa{constructor(e){this.downPosition={x:0,y:0},this.enableUp=!0,this.fnMap={global:{down:{},up:{}},local:{down:{},up:{}}},this.down=e=>{(0,et.js)(this.fnMap.local.down,((t,r)=>{r(e)})),this.downPosition={x:e.offsetX,y:e.offsetY}},this.up=e=>{var t,r,n,i;2===e.button||null!=(t=this.events.runScene.helperEx.transContro)&&t.isDraggingChange||((0,et.js)(this.fnMap.local.up,((t,r)=>{r(e)})),t=e.offsetX,r=e.offsetY,({x:n,y:i}=this.downPosition),t===n&&r===i&&this.trigger(e))},this.events=e}bindEvent(e){var{type:e,name:t,fn:r,local:n}=e;this.fnMap[n][e][t]=r}init(e){e.addEventListener("pointerdown",this.down.bind(this)),e.addEventListener("pointerup",this.up.bind(this)),window.addEventListener("pointerdown",(e=>{this.events.runScene.optionsEx.cb.events.pointer.down.cb(e)})),window.addEventListener("pointerup",(e=>{this.events.runScene.optionsEx.cb.events.pointer.up.cb(e)}))}getTriggerModels(e){const t=new p.Raycaster,r=new p.Vector2,{engineDom:n,camera:i,scene:o}=this.events.runScene.assetsEx.get();return r.x=e.offsetX/n.clientWidth*2-1,r.y=-e.offsetY/n.clientHeight*2+1,t.setFromCamera(r,i),e=o.children.filter((e=>{if((!this.events.runScene.helperEx.isHelper(e)||e.userData.id)&&!e.userData.unClick)return e})),t.intersectObjects(e,!0).map((e=>e.object))}removeHideModel(e){return e.find((e=>this.events.runScene.modelEx.deepIsVisible(e)))}trigger(e){let t=this.removeHideModel(this.getTriggerModels(e));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(console.log("鼠标按下选中的模型:",t),this.events.key.ctrl)return this.enableUp=!1,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)})):void 0}this.events.runScene.modelEx.setSelectByModel(t),this.events.runScene.lightEx.isLight(t)&&this.events.runScene.lightEx.setSelect(t)}}class Ca{constructor(e){this.runScene=e}}c=a(4356);var Da=a.n(c),La=a(4298);const za=["Group","Box","Circle","Cylinder","Dodecahedron","Icosahedron","Lathe","Octahedron","Plane","Ring","Sphere","Sprite","Tetrahedron","Torus","TorusKnot","Tube","Reflector"];class Ia{static create(){return new p.MeshStandardMaterial}static isDefval(e){for(const t in this.defVal){const r=this.defVal[t],n=e[t];if(r instanceof p.Color){if(r.getHexString()!==n.getHexString())return!1}else if("object"==typeof r){if(n.x!==r.x)return!1}else if(n!==r)return!1}for(const t of Ei)if(e[t])return!1;return!0}}Ia.defVal={color:new p.Color(16777215),emissive:new p.Color(0),roughness:1,metalness:0,lightMapIntensity:1,aoMapIntensity:1,emissiveIntensity:1,bumpScale:1,normalScale:new p.Vector2(1,1),displacementScale:1,envMapIntensity:1,wireframe:!1,transparent:!1,opacity:1};class Ba{constructor(e){this.undos=[],this.redos=[],this.dataMap={history:[],index:0},this.runScene=e}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))}}addUndos(e){var t;return this.undos.push(e),t=this.dataMap.history.push(e),this.dataMap.index=this.undos.length-1,this.runScene.optionsEx.cb.undo.addUndos.cb(e,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.optionsEx.cb.undo.removeUndos.cb(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.optionsEx.cb.undo.undoByIndex.cb(e)}addUndo(e){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))}}reset(){this.undos=[],this.redos=[],this.dataMap.history=[],this.dataMap.index=0,this.runScene.optionsEx.cb.undo.reset.cb("")}}function Ua(e){if("object"!=typeof e)return e;if(null===e)return null;if(e){var t,r,n=new e.constructor;for(t in e)e.hasOwnProperty(t)&&(r=Ua(e[t]),n[t]=r);return n}}const Na=class extends Oi{constructor(e){super(),this.type="多层级修改",this.target=e.target,this.typeList=e.typeList,this.new=e.newVal,this.cb=e.cb,this.old=(0,et.qR)(e.target,this.typeList)[(0,La.lastArrayEle)(e.typeList)]}execute(){return this.redo(),this}_execute(e){const t=(0,et.qR)(this.target,this.typeList);t[(0,La.lastArrayEle)(this.typeList)]=e,this.cb&&this.cb(t),"shadow"!==this.typeList[0]&&this.typeList[1]}undo(){this._execute(this.old)}redo(){this._execute(this.new)}};class Fa{constructor(e){this.tools={type:"FakeInterior",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},parseData:e=>{const{textures:t,normal:r}=e,n=new p.ShaderMaterial({uniforms:Ua(Va.uniforms),vertexShader:Va.vertexShader,fragmentShader:Va.fragmentShader});return t.forEach((e=>{"ceilingTex"===e.type?n.uniforms.ceilingTex.value=e.texture||null:"floorTex"===e.type?n.uniforms.floorTex.value=e.texture||null:"sideWallTex"===e.type?n.uniforms.sideWallTex.value=e.texture||null:"backWallTex"===e.type&&(n.uniforms.backWallTex.value=e.texture||null)})),Object.keys(r.uniforms).filter((e=>!Fa.TextureNames.includes(e))).map((e=>{var t=r.uniforms[e];n.uniforms[e].value="roomsXYZPropsW"===e||"positionOffsetRoomsXYZPropsW"===e||"roomColorTint"===e?new p.Vector4(t.x,t.y,t.z,t.w):t})),n.userData.tools=this.tools,n},toNormal:e=>{const t=ts(),r=(t.userData=Object.assign(Object.assign({},t.userData),{normal:{type:this.tools.type,uniforms:{}},textures:this.tools.getTextures(e)}),{}),n=e.uniforms,i=Va.uniforms;return Object.keys(n).filter((e=>!Fa.TextureNames.includes(e))).map((e=>{var t,o,a,s,u,l,c=n[e].value,h=i[e].value;c instanceof p.Vector4?(({x:t,y:o,z:a}=c),({x:s,y:u,z:l}=h),t===s&&o===u&&a===l||(r[e]=c)):c!==h&&(r[e]=c)})),t.userData.normal.uniforms=r,t},clone:function(e,t){return e}},this.runScene=e}create(){const e=new p.ShaderMaterial({uniforms:Ua(Va.uniforms),vertexShader:Va.vertexShader,fragmentShader:Va.fragmentShader});return e.userData.tools=this.tools,e}undo(e){var{material:e,list:t,val:r}=e;this.runScene.undoEx.addUndo(new Na({target:e,typeList:["uniforms",...t],newVal:r}).execute())}}Fa.TextureNames=["sideWallTex","backWallTex","floorTex","ceilingTex"];const Va={uniforms:{roomIntensity:{value:1},roomColorTint:{value:new p.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 p.Vector4(.35,.65,.1,1)},positionOffsetRoomsXYZPropsW:{value:new p.Vector4(4.7,2,-11,-3)}},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 "},Ha={uniforms:{tDiffuse:new p.Uniform(null),h:new p.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}"},Ga={uniforms:{tDiffuse:new p.Uniform(null),v:new p.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}"};new p.Uniform(null),new p.Uniform(null),new p.Uniform(0),new p.Uniform(0),new p.Uniform(0),new p.Uniform(new p.Vector2),new p.Uniform(.1),new p.Uniform(1e3);class Wa{constructor(e){this.materials={},this.render=()=>{(0,et.js)(this.materials,((e,t)=>{const{model:r,material:n}=t;n.update(r)}))},this.tools={type:"Reflector",getTextures:e=>is(e),parseData:e=>{const{textures:t,normal:r,models:n,material:i}=e,o=rs(i,new Xa(void 0,void 0,this.runScene));return o.name=i.name,t.forEach((e=>{o[e.type]=e.texture})),Object.keys(r.uniforms).filter((e=>!Wa.TextureNames.includes(e))).map((e=>{o[e]=r.uniforms[e]})),o.setRTSize(o.resolution),o.setBlurPass(o.blurSize),o.insertReflectorShader(),o.userData.tools=this.tools,this.bindData({model:n[0],material:o}),o},toNormal:e=>{const t=rs(e,ts()),r=(t.userData=Object.assign(Object.assign({},t.userData),{normal:{type:this.tools.type,uniforms:{}},textures:this.tools.getTextures(e)}),t.name=e.name,{}),n=qa.uniforms;return Object.keys(n).filter((e=>!Wa.TextureNames.includes(e))).map((t=>{var i=e[t],o=n[t].value;"mirror"===t||"mixBlur"===t||"mixStrength"===t||"mixContrast"===t?i.value!==o&&(r[t]=i):i!==o&&(r[t]=i)})),t.userData.normal.uniforms=r,t},clone:(e,t)=>this.create(t)},this.runScene=e,this.init()}init(){this.runScene.optionsEx.cb.render.add("Reflector-render",this.render),this.runScene.optionsEx.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.optionsEx.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 r=(0,f.getId)();t.userData.id=r,this.materials[r]=e}create(e){const t=new Xa(void 0,void 0,this.runScene);return t.insertReflectorShader(),t.userData.tools=this.tools,(e=e||this.runScene.modelEx.select)&&(t.name=e.name),this.bindData({model:e,material:t}),t}undo(e){var{material:e,list:t,val:r}=e;this.runScene.undoEx.addUndo(new Na({target:e,typeList:[...t],newVal:r}).execute())}dispose(){this.materials={}}}Wa.TextureNames=["map","normalMap","roughnessMap","metalnessMap","tDiffuse","tDiffuseBlur"];class Xa extends p.MeshStandardMaterial{constructor(e,t,r){e?super(e):(super(),this.opacity=qa.uniforms.opacity.value,this.transparent=qa.uniforms.transparent.value,this.roughness=qa.uniforms.roughness.value,this.metalness=qa.uniforms.metalness.value),this.runScene=r,t?(this.resolution=t.resolution,this.blurSize=t.blurSize,this.mirror=new p.Uniform(t.mirror),this.mixBlur=new p.Uniform(t.mixBlur),this.mixStrength=new p.Uniform(t.mixStrength),this.mixContrast=new p.Uniform(t.mixContrast)):(this.resolution=qa.uniforms.resolution.value,this.blurSize=qa.uniforms.blurSize.value,this.mirror=new p.Uniform(qa.uniforms.mirror.value),this.mixBlur=new p.Uniform(qa.uniforms.mixBlur.value),this.mixStrength=new p.Uniform(qa.uniforms.mixStrength.value),this.mixContrast=new p.Uniform(qa.uniforms.mixContrast.value)),this.textureMatrix=new p.Uniform(new p.Matrix4),this.reflectorWorldPosition=new p.Vector3,this.cameraWorldPosition=new p.Vector3,this.rotationMatrix=new p.Matrix4,this.normal=new p.Vector3,this.view=new p.Vector3,this.lookAtPosition=new p.Vector3,this.target=new p.Vector3,this.tempQuaternion=new p.Vector4,this.virtualCamera=new p.PerspectiveCamera,this.reflectorPlane=new p.Plane,this.clipPlane=new p.Vector4,e={minFilter:p.LinearFilter,magFilter:p.LinearFilter,type:p.HalfFloatType,encoding:this.runScene.assetsEx.get().renderer.outputEncoding},this.glRT1=new p.WebGLRenderTarget(this.resolution,this.resolution,e),this.glRT2=new p.WebGLRenderTarget(this.resolution,this.resolution,e),this.tDiffuse=new p.Uniform(this.glRT1.texture),this.tDiffuseBlur=new p.Uniform(this.glRT2.texture),this.hBlurPass=new ne(Ha),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 ne(Ga),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=qa.vertexParas+""+e.vertexShader,e.vertexShader=e.vertexShader.replace("#include <project_vertex>",qa.vertexShader),e.fragmentShader=qa.fragmentParas+""+e.fragmentShader,e.fragmentShader=e.fragmentShader.replace("#include <emissivemap_fragment>",qa.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 qa={uniforms:{opacity:new p.Uniform(1),transparent:new p.Uniform(!1),roughness:new p.Uniform(1),metalness:new p.Uniform(.6),resolution:new p.Uniform(1024),blurSize:new p.Uniform(1024),mirror:new p.Uniform(0),mixBlur:new p.Uniform(10),mixStrength:new p.Uniform(2),mixContrast:new p.Uniform(1)},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 "};class Ya{constructor(e){this.tools={type:"Fresnel",getTextures(e){const t=[];return e.envMap&&t.push({type:"envMap",texture:e.envMap}),t},parseData:e=>{const{textures:t,normal:r,material:n}=e,i=rs(n,new Za(void 0,void 0,this.runScene));return i.name=n.name,t.forEach((e=>{i[e.type]=e.texture})),Object.keys(r.uniforms).filter((e=>!Ya.TextureNames.includes(e))).map((e=>{i[e]=r.uniforms[e]})),i.insertFresnelShader(),i.userData.tools=this.tools,i},toNormal:e=>{const t=rs(e,ts()),r=(t.userData=Object.assign(Object.assign({},t.userData),{normal:{type:this.tools.type,uniforms:{}},textures:this.tools.getTextures(e)}),t.name=e.name,{}),n=Qa.uniforms;return Object.keys(n).filter((e=>!Ya.TextureNames.includes(e))).map((t=>{var i=e[t],o=n[t].value;"fresnelBias"===t||"fresnelScale"===t||"fresnelPower"===t?i.value!==o&&(r[t]=i):i!==o&&(r[t]=i)})),t.userData.normal.uniforms=r,t},clone:(e,t)=>this.create(t)},this.runScene=e}create(e){const t=new Za(void 0,void 0,this.runScene);return t.insertFresnelShader(),t.userData.tools=this.tools,(e=e||this.runScene.modelEx.select)&&(t.name=e.name),t}undo(e){var{material:e,list:t,val:r}=e;this.runScene.undoEx.addUndo(new Na({target:e,typeList:[...t],newVal:r}).execute())}}Ya.TextureNames=["envMap"];class Za extends p.MeshPhysicalMaterial{constructor(e,t,r){if(e?super(e):(super(),this.emissive=new p.Color(65535),this.envMap=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=r,t?(this.fresnelBias=new p.Uniform(t.fresnelBias),this.fresnelScale=new p.Uniform(t.fresnelScale),this.fresnelPower=new p.Uniform(t.fresnelPower)):(this.fresnelBias=new p.Uniform(Qa.uniforms.fresnelBias.value),this.fresnelScale=new p.Uniform(Qa.uniforms.fresnelScale.value),this.fresnelPower=new p.Uniform(Qa.uniforms.fresnelPower.value)),!this.cubeCamera){const e=new p.WebGLCubeRenderTarget(2048);e.texture.mapping=p.CubeRefractionMapping,this.cubeCamera=new p.CubeCamera(.1,1e5,e),this.runScene.assetsEx.scene.add(this.cubeCamera),this.runScene.optionsEx.cb.render.add("Fresnel",(()=>{this.update()}))}}insertFresnelShader(){this.onBeforeCompile=e=>{e.uniforms.fresnelBias=this.fresnelBias,e.uniforms.fresnelScale=this.fresnelScale,e.uniforms.fresnelPower=this.fresnelPower,e.vertexShader=e.vertexShader.replace(/varying vec3 vWorldPosition;/g,Qa.vertexParas),e.vertexShader=e.vertexShader.replace(/vWorldPosition = worldPosition.xyz;/g,Qa.vertexShader),e.fragmentShader=e.fragmentShader.replace(/#include <transmission_pars_fragment>/g,Qa.fragmentParas),e.fragmentShader=e.fragmentShader.replace(/vec3 totalEmissiveRadiance = emissive;/g,Qa.fragmentShaderEmissive)}}update(){this.cubeCamera&&(this.cubeCamera.position.copy(this.runScene.assetsEx.camera.position),this.cubeCamera.update(this.runScene.assetsEx.renderer,this.runScene.assetsEx.scene))}}const Qa={uniforms:{fresnelBias:new p.Uniform(0),fresnelScale:new p.Uniform(1),fresnelPower:new p.Uniform(3)},vertexParas:"\n varying vec3 vWorldPosition;\n varying vec3 vWorldNormal;\n ",vertexShader:"\n vWorldPosition = worldPosition.xyz;\n vWorldNormal = normalize(vec3(modelMatrix * vec4(normal, 0.0)));\n ",fragmentParas:"\n #include <transmission_pars_fragment>\n varying vec3 vWorldNormal;\n uniform float fresnelBias;\n uniform float fresnelScale;\n uniform float fresnelPower;\n ",fragmentShaderEmissive:"\n vec3 viewDir = normalize(cameraPosition - vWorldPosition);\n float fresnelNdot = dot(viewDir, vWorldNormal);\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 "},Ka=class extends Oi{constructor(e){super(),this.type="修改属性",this.cb=e=>{};var{target:e,info:t,oldVal:r,newVal:n,runScene:i,cb:o,executeCb:a}=e;this.runScene=i,this.target=e,this.info=t,this.newVal=n,this.oldVal=r,o&&(this.cb=o),a&&(this.executeCb=a)}_execute(e){var{target:t,info:r}=this;if(this.executeCb)return this.executeCb({target:t,info:r,val:e});this.target[this.info]=e,"name"===this.info&&this.target.isObject3D?(t=this.runScene.uniqueEx.model.parseName(this.target),r=e,this.runScene.optionsEx.cb.model.changeName.cb({model:this.target,name:e=t||e,oldName:r})):"material"===this.info?this.runScene.uniqueEx.material.addModel(this.target,e,e===this.newVal?this.oldVal:this.newVal):"visible"===this.info&&this.runScene.optionsEx.cb.model.setVisible.cb({model:this.target,visible:e}),this.cb(this.target)}execute(){return this.redo(),this}undo(){this._execute(this.oldVal)}redo(){this._execute(this.newVal)}},Ja={depthTest:!0,depthWrite:!0,alphaTest:0,side:0,displacementScale:1,visible:!0,normalScale:{x:1,y:1},aoMapIntensity:1,lightMapIntensity:1,envMapIntensity:1},$a=["color","emissive","roughness","metalness","normalScale","aoMapIntensity","displacementScale","transparent","lightMapIntensity","envMapIntensity","opacity","alphaTest"];class es{constructor(e){this.defMaterialMap={BaseMaterial:Ia,SpriteMaterial:us,FakeInterior:Fa,Reflector:Wa,Fresnel:Ya},this.defMaterial=ts(),this.addCb=e=>{this.runScene.optionsEx.cb.material.add.cb(e)},this.setParses=[],this.runScene=e,this.runScene.optionsEx.cb.unique.material.add.add("engine-material-add",(e=>{"SpriteMaterial"!==e.type&&this.addCb(e)})),this.defMaterialMap={BaseMaterial:Ia,SpriteMaterial:us,FakeInterior:new Fa(e),Reflector:new Wa(e),Fresnel:new Ya(e)},this.addSetParses((e=>{const{material:t,type:r,newVal:n}=e;"opacity"===r&&n<1&&(t.transparent=!0)}))}add(e,t,r){this.runScene.uniqueEx.material.add(e,t,r)}create(){var e=new p.MeshStandardMaterial;return this.add(e),e}clone(e){const t=e.clone();return t.userData.id=(0,f.getId)(),t}addSetParses(e){this.setParses.push(e)}set(e){const{material:t,type:r,val:n}=e,i=t[r];return t[r]=n,t.needsUpdate=!0,this.setParses.map((e=>e({material:t,type:r,newVal:n,oldVal:i})))}setNormal(e,t=!0){return e=new Mi(Object.assign(Object.assign({},e),{runScene:this.runScene})).execute(),t&&this.runScene.undoEx.addUndo(e),e}setTexture(e,t=!0){return function(e,t,r,n){return new(r=r||Promise)((function(t,i){function o(e){try{s(n.next(e))}catch(e){i(e)}}function a(e){try{s(n.throw(e))}catch(e){i(e)}}function s(e){var n;e.done?t(e.value):((n=e.value)instanceof r?n:new r((function(e){e(n)}))).then(o,a)}s((n=n.apply(e,[])).next())}))}(this,0,void 0,(function*(){var{info:r,newVal:n}=e,n=(n instanceof File&&(e.newVal=yield this.runScene.textureEx.parse(n)),"envMap"===r&&Ni(e.newVal),new Mi(Object.assign(Object.assign({},e),{runScene:this.runScene})).execute());return t&&this.runScene.undoEx.addUndo(n),e.newVal}))}resetMaterial(e,t,r=!0){var n;e&&t&&e.material&&(n=new Ka({target:e,runScene:this.runScene,info:"material",newVal:t,oldVal:e.material}).execute(),this.runScene.modelEx.select===e&&this.runScene.optionsEx.cb.setSelectMaterial.cb(t),r&&this.runScene.undoEx.addUndo(n))}getBase(e){const t=this.defMaterialMap[e];if(("SpriteMaterial"!==e||"Sprite"===(null==(e=this.runScene.modelEx.select)?void 0:e.type))&&t)return t.create()}toNromal(e){var t;const r=(null==(t=e.userData.tools)?void 0:t.toNormal(e))||e.clone();return r.userData=Object.assign(Object.assign({},r.userData),e.userData),r}setSelect(e){this.runScene.optionsEx.cb.setSelectMaterial.cb(e)}getDataByType(e,t){return this.defMaterialMap[e].tools.parseData(t)}dispose(){this.defMaterialMap.Reflector.dispose(),this.runScene.optionsEx.cb.material.dispose.cb("")}remove(e){}getDefNromals(e){var t;if(null!=(t=null==(t=e.userData)?void 0:t.tools)&&t.type)return{};const r={};return(0,et.js)(Ja,((t,n)=>{const i=e[t];if("object"==typeof i)for(const e in i)if(i[e]!==n[e])return void(r[t]=i.clone());i!==n&&(r[t]=i)})),r}parseNromals(e,t){(0,et.js)(e,((e,r)=>{var n,i,o,a,s;void 0!==Ja[e]&&("object"==typeof r?(({x:o,y:a,z:s}=r),null!=(i=null==(n=t[e])?void 0:n.set)&&i.call(n,o,a,s)):t[e]=r)}))}isBaseMaterial(e){return"MeshStandardMaterial"===e.type&&!e.userData.isTimeLineUsed&&Ia.isDefval(e)}}const ts=()=>{const e=new p.MeshStandardMaterial;return e.userData.id=(0,f.getId)(),e},rs=(e,t)=>($a.map((r=>{const n=e[r];"object"==typeof n&&(t[r]=n.clone()),t[r]=n})),t),ns=e=>{e.dispose();const t=is(e);0!==t.length&&t.map((e=>{e=e.texture,Ci(e)}))},is=e=>{var t=e.userData.textures||Ei.map((t=>({type:t,texture:e[t]}))).filter((e=>e.texture));return delete e.userData.textures,t},os=e=>{var t;return(null==(t=e.userData.tools)?void 0:t.getTextures(e))||Ei.map((t=>({type:t,texture:e[t]}))).filter((e=>e.texture))},as=e=>{const{material:t,type:r,texture:n}=e;"envMap"===r&&Ni(n),t[r]=n,t.needsUpdate=!0},ss=e=>{e.vertexColors=!1,e.needsUpdate=!1};class us{static create(){const e=new p.SpriteMaterial;return e.userData.tools=this.tools,e}}us.modelTools={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,1===e.layers.mask?t.layers.set(0):t.layers.enable(1)},toNormal:e=>{const t=ms("Box");return t.userData.normal={type:"MySpriteMaterial"},us.modelTools.merge(e,t),t},parseData:(e,t)=>{const r=ms("Sprite");return us.modelTools.merge(e,r),r.material=e.material,r}},us.tools={type:"SpriteMaterial",getTextures:function(e){return["map","alphaMap"].map((t=>{var r=e[t];if(r)return{type:t,texture:r}})).filter((e=>e))},parseData:function(e){const{textures:t,material:r}=e,n=rs(r,us.create());return t.map((e=>{var{type:e,texture:t}=e;n[e]=t})),n},toNormal:e=>{const t=rs(e,ts());return t.userData=Object.assign(Object.assign({},t.userData),{normal:{type:us.tools.type},textures:us.tools.getTextures(e)}),t},clone:function(e,t){return e}};class ls{constructor(e){this.addTree=!0,this.isClone=!1,this.cb=(e,t)=>{};var{model:e,parent:t,cb:r,addTree:n,isClone:i,runScene:o}=e;this.runScene=o,this.model=e,this.parent=t,!1===n&&(this.addTree=n),!0===i&&(this.isClone=i),r&&(this.cb=r)}remove(e){const{model:t,parent:r,addTree:n,runScene:i}=e;i.modelEx.select===t&&i.modelEx.selectNull(),r.remove(t),n&&i.uniqueEx.model.remove(t),n&&i.optionsEx.cb.model.remove.cb({model:t,parent:r}),this.cb(t,"remove"),i.uniqueEx.material.addModel(t,void 0,t.material)}add(e){const{model:t,parent:r,addTree:n,isClone:i,runScene:o}=e;r.add(t),n&&o.uniqueEx.model.add(t),n&&o.optionsEx.cb.model.add.cb({model:t,parent:r,isClone:i}),this.cb(t,"add"),o.uniqueEx.material.addModel(t,t.material)}}class cs extends ls{constructor(e){super(e),this.type="添加模型"}_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})}execute(){return this.redo(),this}}const hs=class extends Oi{constructor(e){super(),this.type="修改父元素",this.runScene=e.runScene,this.oldParent=e.oldParent,this.newParent=e.newParent,this.target=e.target}execute(){return this.redo(),this}_execute(e){e.attach(this.target),this.runScene.optionsEx.cb.model.setParent.cb({model:this.target,parent:e})}undo(){this._execute(this.oldParent)}redo(){this._execute(this.newParent)}};class fs extends ls{constructor(e){super(e),this.type="移除模型"}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}}const ps=class extends Oi{constructor(e){super(),this.type="三维矩阵修改";var{target:e,info:t,newV3:r,oldV3:n,runScene:i}=e;this.target=e,this.info=t,this.runScene=i,this.newV3=r,this.oldV3=n,this.target.uuid===(null==(e=this.runScene.modelEx.select)?void 0:e.uuid)&&(this.runScene.optionsEx.cb.model.setSelect.cb(null),this.runScene.optionsEx.cb.model.setSelect.cb(this.target))}_execute(e){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)}execute(){return this.redo(),this}undo(){this._execute(this.oldV3)}redo(){this._execute(this.newV3)}};class ds{constructor(e){this._selectModel=void 0,this.defNodeMap={castShadow:!1,receiveShadow:!1,renderOrder:0,visible:!0},this.deepIsVisible=e=>"Scene"===e.type||!!e.visible&&!!e.parent&&this.deepIsVisible(e.parent),this.runScene=e}get select(){return this._selectModel}set select(e){this.setSelectByModel(e)}add(e,t,r){var{addUndo:n,isClone:i,select:o}=aa({addUndo:!0,isClone:!1,select:!0},r);if(e instanceof Array)return e.map((e=>this.add(e,t,r)));i?(this.runScene.uniqueEx.model.add(e,{hasReset:!0}),this.runScene.optionsEx.cb.model.clone.cb(e)):this.runScene.uniqueEx.model.add(e);var a=new cs({model:e,parent:t||this.runScene.sceneEx.get(),isClone:i,runScene:this.runScene}).execute();!0===n&&this.runScene.undoEx.addUndo(a),o&&this.setSelectByModel(e,{isDomTreeActive:!1,isClone:i})}addParse(){}setSelectByModel(e,t){var r,{isDomTreeActive:t,isClone:n}=t||{};if(this.runScene.events.key.shift&&this._selectModel)return(r=this.getBeTweenChildByTwoModel(this._selectModel,e))?void this.runScene.multipSelector.add([...r,e],!0):void 0;if(this.runScene.events.key.ctrl&&!n)this.runScene.multipSelector.add(e);else{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),this.runScene.optionsEx.cb.model.unFocus.cb(this._selectModel)}e&&(e.isCamera||(this.runScene.helperEx.focus(e),this.runScene.lightEx.setSelect(e)),this.runScene.optionsEx.cb.model.focus.cb({model:e,status:!0,domActive:!t}),this.runScene.materialEx.setSelect(e.material),this.runScene.optionsEx.cb.model.setSelect.cb(e),this._selectModel=e)}}setSelectById(e){(e=this.runScene.uniqueEx.model.get(e))&&this.setSelectByModel(e)}remove(e,t=!0){if(e instanceof Array)return e.map((e=>this.remove(e)));e=new fs({runScene:this.runScene,model:e,parent:e.parent||this.runScene.sceneEx.get()}).execute(),t&&this.runScene.undoEx.addUndo(e)}isNavieV3(e,t=0){var{x:e,y:r,z:n}=e;return e+r+n===t}isNavieV2(e,t=0){var{x:e,y:r}=e;return e===t&&r===t}isUnless(e){return!e.material&&this.isNavieV3(e.position)&&this.isNavieV3(e.rotation)&&this.isNavieV3(e.scale,3)&&0===e.children.length}isUnlessLevel(e){return this.isNavieV3(e.position)&&this.isNavieV3(e.rotation)&&this.isNavieV3(e.scale,3)&&1===e.children.length&&!gs(e)}create(){return Da().model.getModelByType("Box")}clone(e){if(!this.runScene.lightEx.isLight(e)){let n=e.clone();n.userData.cloneId=e.userData.id;var t,r=null==e?void 0:e.material;return null!=(t=null==r?void 0:r.userData)&&t.tools&&(t=null==(t=r.userData.tools)?void 0:t.clone(r,n))&&t.uuid!==r.uuid&&(this.runScene.materialEx.resetMaterial(n,t,!0),this.runScene.materialEx.add(t,e,r)),this.runScene.uniqueEx.model.add(n,{reset:!0}),n}this.runScene.lightEx.clone(e)}getLevel(e,t=0){return e.parent&&"Scene"!==e.parent.type?this.getLevel(e.parent,++t):t}selectNull(){var e=this._selectModel;e&&(this.runScene.optionsEx.cb.model.unFocus.cb(e),this.runScene.materialEx.setSelect(null),this.runScene.lightEx.setNull(e)),this._selectModel=void 0,this.runScene.optionsEx.cb.model.setSelect.cb(null),this.runScene.helperEx.unfocus()}cloneV3(e){return e.clone()}setParent(e,t,r=!0){if(t=new hs({oldParent:e.parent,newParent:t,target:e,runScene:this.runScene}).execute(),!r)return t;this.runScene.undoEx.addUndo(t)}setV3(e,t=!0,r=!0){var{model:e,info:n,newV3:i,oldV3:o}=e;const a=new ps({target:e,info:n,oldV3:o,newV3:i,runScene:this.runScene});r&&a.execute(),t&&this.runScene.undoEx.addUndo(a)}setNormal(e,t=!0){var{model:e,info:r,val:n}=e;e=new Ka({target:e,info:r,runScene:this.runScene,oldVal:e[r],newVal:n}).execute(),t&&this.runScene.undoEx.addUndo(e)}setMaterial(e,t,r=!0){var n=new Ka({target:e,info:"material",runScene:this.runScene,oldVal:e.material,newVal:t}).execute();this.select===e&&this.runScene.optionsEx.cb.setSelectMaterial.cb(t),e.material.needsUpdate=!0,r&&this.runScene.undoEx.addUndo(n)}addDef(e){this.add(ms(e))}isModel(e){return!(e.isLight||e.isCamera)}getSphere(){var e=new p.MeshBasicMaterial,t=new p.SphereGeometry(.7,150,150);return new p.Mesh(t,e)}getIndexByModel(e){var t;return e.parent?null==(t=e.parent)?void 0:t.children.findIndex((t=>t===e)):-1}getBeTweenChildByTwoModel(e,t){if(e.parent.uuid===t.parent.uuid){var r=this.getIndexByModel(e);if(t=this.getIndexByModel(t),-1!==r&&-1!==t){const n=Math.max(r,t),i=r===n?t:r;return e.parent.children.map(((e,t)=>t>i&&t<n&&e)).filter((e=>e))}}}setMultip(e){var{model:e,typeList:t,newVal:r}=e;this.runScene.undoEx.addUndo(new Na({target:e,typeList:t,newVal:r}).execute())}createGroup(e,t,r){const n=t||new p.Group,i=[];i.push(new cs({model:n,runScene:this.runScene,parent:r||this.runScene.assetsEx.get().scene}).execute()),e instanceof Array?i.push(...e.map((e=>new hs({target:e,oldParent:e.parent,newParent:n,runScene:this.runScene}).execute()))):i.push(new hs({target:e,oldParent:e.parent,newParent:n,runScene:this.runScene}).execute()),r&&this.runScene.optionsEx.cb.model.setOpen.cb({isOpen:!0,model:r}),this.runScene.optionsEx.cb.model.setOpen.cb({isOpen:!0,model:n}),this.runScene.optionsEx.cb.model.setMainStatue.cb({status:!0,model:n}),this.runScene.undoEx.addUndo(i),this.setSelectByModel(n)}cleanGroup(e,t=!0){if(e instanceof Array){const t=(0,La.multiArrToArr)(e.map((e=>(this.runScene.optionsEx.cb.model.unFocus.cb(e),this.cleanGroup(e,!1)))).filter((e=>e)));return this.runScene.undoEx.addUndo(t),t}if(this.runScene.optionsEx.cb.model.unFocus.cb(e),0!==e.children.length){const r=[],n=e.children.map((e=>{if(e.parent.parent)return new hs({target:e,oldParent:e.parent,newParent:e.parent.parent,runScene:this.runScene})})).filter((e=>e));return r.push(...n.map((e=>e.execute()))),r.push(new fs({runScene:this.runScene,model:e,parent:e.parent}).execute()),t&&this.runScene.undoEx.addUndo(r),r}}hideOther(e){const t=e.uuid,r=0<e.children.length,n=this.runScene.sceneEx.getClearModels(),i=[];n.map((n=>{n.traverse((n=>{r?!1===Da().model.deepFindParentByUuid(n,t)&&n.uuid!==e.uuid&&i.push(n):n.uuid!==e.uuid&&i.push(n)}))}));var o=i.map((e=>new Ka({target:e,info:"visible",newVal:!1,runScene:this.runScene,oldVal:e.visible}).execute()));this.runScene.undoEx.addUndo(o),Da().model.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 r=t.map((e=>new Ka({target:e,info:"visible",runScene:this.runScene,newVal:!0,oldVal:e.visible}).execute()));this.runScene.undoEx.addUndo(r)}removeHide(){const e=this.runScene.sceneEx.getClearModels(),t=new Set,r=[];e.map((e=>{e.traverse((e=>{e.visible||t.add(e)}))})),t.forEach((e=>{r.push(new fs({runScene:this.runScene,model:e,parent:e.parent}).execute())})),this.runScene.undoEx.addUndo(r)}_getModel(e){if(e=this.runScene.uniqueEx.model.nameMap[e])return this.runScene.uniqueEx.model.get(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 p.Vector3;return e.getWorldPosition(t),t}getClickObj(e,t,r=!1){let n=new p.Raycaster,i=new p.Vector2,o=(i.x=e.offsetX/this.runScene.assetsEx.engineDom.clientWidth*2-1,i.y=-e.offsetY/this.runScene.assetsEx.engineDom.clientHeight*2+1,n.setFromCamera(i,this.runScene.assetsEx.camera),n.intersectObjects(t,!0)),a={intersects:null,obj:null};if(0===o.length)return a;if(r){if(0===(e=o.filter((e=>Da().model.isVisible(e.object)))).length)return a;a={intersects:e,obj:e[0].object}}else a={intersects:o,obj:o[0].object};return a}getCamLocal(){var{x:e,y:t,z:r}=this.runScene.assetsEx.camera.position,{x:n,y:i,z:o}=this.runScene.assetsEx.controls.target;return{cx:e,cy:t,cz:r,tx:n,ty:i,tz:o}}camAnima(e,t,r=1,n,i){return jo(e,t,r,(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=>{n&&n()}))}setGlow(e,t=!0){t=t?1:0,0==(e.userData.layers=t)?e.layers.set(0):e.layers.enable(1),this.runScene.optionsEx.cb.model.setLayers.cb({model:e,val:t})}beforeLoad(e){return e instanceof Array?e.map((e=>this.beforeLoad(e))):e}}const ms=e=>{if(za.includes(e)){const t=Da().model.getModelByType(e);return"Sprite"===t.type&&(t.material.userData.tools=us.tools),t}throw TypeError("")},ys=(e,t)=>{t=(t||{}).remove;const{geomerty:r,material:n}=e;r&&(null!=r&&r.dispose(),delete e.geometry),n&&(ns(e.material),e.material.dispose(),delete e.material),!1!==t&&e.parent&&e.parent.remove(e)},vs=(e,t)=>{var{material:r,geometry:n}=e;const i=new _i.InstancedMesh(n,r,t.length+1);return[e,...t].map(((e,t)=>{i.setMatrixAt(t,e.matrix)})),i},gs=e=>0!==e.animations.length,bs=e=>{e&&e.userData&&(e.userData.isHelper=!0)};class ws{constructor(e){this.setSize=(e,t)=>{var{w:r,h:n}=this.getDomSize();this.runScene.setSize(e||r,t||n)},this.runScene=e}create(e){let t=new p.WebGLRenderer({antialias:!0,alpha:!0,powerPreference:"high-performance"});return t.domElement.style.position="absolute",t.setPixelRatio(window.devicePixelRatio),t.shadowMap.enabled=!0,t.shadowMap.type=p.PCFSoftShadowMap,t.physicallyCorrectLights=!0,t.localClippingEnabled=!0,e.appendChild(t.domElement),t}getDomSize(){var{clientWidth:e,clientHeight:t}=this.runScene.assetsEx.get().engineDom;return{w:e,h:t}}}const xs=(e,t)=>{t=(t||{}).removeDom,!(e.render=()=>{})!==t&&e.domElement.remove(),e.setAnimationLoop(null),e.dispose(),e.renderLists&&e.renderLists.dispose()};class Ss{constructor(e){this.oldFog=null,this.removeMap={light:{valid:e=>this.runScene.lightEx.isLight(e),remove:e=>this.runScene.lightEx.remove(e)}},this.runScene=e}each(e){return this.runScene.assetsEx.get().scene.traverseAncestors(e)}get(){return new Proxy(this.runScene.assetsEx.get().scene,{set:(e,t,r)=>(e[t]=r,!0)})}getNromal(){return this.get().children.filter((e=>!this.runScene.helperEx.isHelper(e)))}remove(e){var t;if(e){if(e instanceof Array){const t=[];return e.map((e=>{for(const r in this.removeMap){const{valid:n,remove:i}=this.removeMap[r];if(n(e))return t.push(...(0,La.multiArrToArr)(i(e)))}t.push(new fs({model:e,runScene:this.runScene,parent:e.parent}).execute())})),this.runScene.undoEx.addUndo(t),t}for(const t in this.removeMap){const{valid:r,remove:n}=this.removeMap[t];if(r(e))return n(e)}this.runScene.modelEx.remove(e),null!=(t=this.runScene.helperEx.boxHelper)&&t.setFromObject(this.get())}}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}getClearModels(){return this.get().children.filter((e=>!this.runScene.helperEx.isHelper(e)&&!this.runScene.lightEx.isLight(e)))}getClear(){const e=this.get(),t=new p.Group;return e.children.filter((e=>!this.runScene.helperEx.isHelper(e)&&!this.runScene.lightEx.isLight(e))).map((e=>{const r=e.clone();console.log(r,"nm"),gs(e)&&(r.animations=[...e.animations]),t.add(r)})),this.runScene.helperEx.setHelper(t),this.cleanUnlessLevel(t)}cleanNormal(){this.getNromal().map((e=>this.remove(e)))}cleanSceneInfo(e){e.background=null,e.environment=null,e.fog=null}setBackground(e,t=!0){e instanceof p.Texture&&(e.userData.isBackgroud=!0);var r=this.get(),n=new Ka({target:r,info:"background",newVal:e,oldVal:r.background,runScene:this.runScene,cb:e=>{this.runScene.bloom.glow.setBackground(e.background)}}).execute();return t&&this.runScene.undoEx.addUndo(n),this.runScene.optionsEx.cb.setScene.cb({scene:r,type:"background"}),this.runScene.bloom.glow.setBackground(e),e}isBackground(e){return e.userData.isBackgroud}clean(){this.runScene.helperEx.unfocus(),this.runScene.anima.reset();const e=this.getClearModels();let t=[];e.map((e=>{e.traverse((e=>t.push(e)))})),t.map((e=>{ys(e,{remove:!1}),this.runScene.optionsEx.cb.model.dispose.cb(e)})),xs(this.runScene.assetsEx.get().renderer),this.runScene.assetsEx.get().controls.dispose(),this.runScene.assetsEx.reset(),this.runScene.modelEx.selectNull(),this.cleanSceneInfo(this.get()),this.runScene.cameraEx.reset(this.runScene.assetsEx.get().camera),this.cleanNormal(),this.runScene.assetsEx.get().renderer.resetState(),this.runScene.assetsEx.get().controls.update(),this.runScene.uniqueEx.dispose(),this.runScene.materialEx.dispose(),this.runScene.undoEx.reset(),this.runScene.timeLineEx.reset(),this.runScene.bloom.glow.dispose(),this.runScene.bloom.glow.init(this.runScene.assetsEx.get()),this.runScene.helperEx.reset(),this.runScene.optionsEx.cb.reset.cb(this.get())}dispose(){const{renderer:e,controls:t}=this.runScene.assetsEx.get();this.clean(),xs(e),t.dispose(),this.runScene.bloom.glow.dispose(),p.Cache.clear()}render(){}create(){return new p.Scene}setEnv(e,t){return function(e,t,r,n){return new(r=r||Promise)((function(t,i){function o(e){try{s(n.next(e))}catch(e){i(e)}}function a(e){try{s(n.throw(e))}catch(e){i(e)}}function s(e){var n;e.done?t(e.value):((n=e.value)instanceof r?n:new r((function(e){e(n)}))).then(o,a)}s((n=n.apply(e,[])).next())}))}(this,0,void 0,(function*(){let r;return t instanceof File&&(r=Ni(yield this.runScene.textureEx.parse(t))),null!=t&&t.isTexture&&(r=Ni(this.runScene.textureEx.clone(t))),this.setNormal({model:e,info:"environment",val:r}),this.runScene.optionsEx.cb.setScene.cb({scene:e,type:"environment"}),r}))}setNormal(e,t=!0){var{model:e,info:r,val:n}=e;e=new Ka({target:e,info:r,oldVal:e[r],newVal:n,runScene:this.runScene}).execute(),t&&this.runScene.undoEx.addUndo(e)}setFogShow(e){var{show:e,color:t,scene:r}=e;e?this.setNormal({model:r,info:"fog",val:this.oldFog||new p.Fog(t)}):(this.oldFog=r.fog,this.setNormal({model:r,info:"fog",val:null})),this.runScene.optionsEx.cb.setScene.cb({scene:r,type:"fog"})}setFog(e){var{scene:e,type:t,val:r}=e;e=new Na({target:e,typeList:["fog",t],newVal:r}).execute(),this.runScene.undoEx.addUndo(e)}sreenShotDefFile(){this.runScene.helperEx.unfocus();var{w:e,h:t}=this.runScene.renderEx.getDomSize();const r=this.runScene.assetsEx.get().renderer.domElement,{renderer:n,scene:i,camera:o}=(r.width=1920,r.height=1080,this.runScene.renderEx.setSize(1920,1080),this.runScene.assetsEx.get());n.render(i,o);var a=r.toDataURL("image/webp",1);return a=(0,rt.base64ToFile)(a,"screenShot.webp"),r.width=e,r.height=t,this.runScene.renderEx.setSize(),n.render(i,o),a}static toJSON(e){const t=Object.assign({},e.userData.ex);return e.fog&&(t.fog=_s(e.fog)),e.background instanceof p.Color&&(t.backgroundColor=e.background.getHexString()),t}}const _s=e=>{const{color:t,far:r,near:n}=e;return{color:t.getHexString(),far:r,near:n}};var Ts=function(e,t,r,n){return new(r=r||Promise)((function(i,o){function a(e){try{u(n.next(e))}catch(e){o(e)}}function s(e){try{u(n.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(a,s)}u((n=n.apply(e,t||[])).next())}))};class Es{constructor(e){this.materialMap={},this.textureMap={},this.modelType={Sprite:us};var{type:e,runScene:t,helper:r}=e;this.type=e,this.helper=r,this.runScene=t}parse(e){return Ts(this,void 0,void 0,(function*(){const t=new p.Group;t.name="back-texture-ex",t.userData.isHelper=!0,e.add(t),"scene"===this.type&&this.parseScene(t),this.parseModel(e),this.materialMapToJson(),this.setMultipMaterial(t,Object.keys(this.textureMap))}))}parseScene(e){const t=this.runScene.sceneEx.get();if(t.background instanceof p.Texture||t.environment instanceof p.Texture){t.userData.ex={},this.runScene.bloom.glow.setUpdate(!1);const{background:r,environment:n}=t,i=(this.runScene.bloom.glow.setUpdate(!0),ms("Box")),o=ts();i.material=o,e.add(i),e=(0,f.getId)(),t.userData.ex.materialId=e,o.userData.id=e,this.materialMap[e]={material:o},r instanceof p.Texture&&(r.userData.notCompress=!0,303===(o.map=r).mapping&&(t.userData.ex.backgroundMapping=303)),n instanceof p.Texture&&(n.userData.notCompress=!0,o.envMap=n)}}_processMaterial(e){if(e.material&&e.material.userData){var t=this.runScene.materialEx.isBaseMaterial(e.material),r=this.materialMap[e.material.userData.id];return r?(r.normalMaterial&&(e.material=r.normalMaterial),void(null!=(r=r.models)&&r.push(e))):(r=t||this.runScene.optionsEx.exporterOptions.notMaterial?this.runScene.materialEx.defMaterial:this.runScene.materialEx.toNromal(e.material),e.material=r,this.materialMap[r.userData.id]={material:r,normalMaterial:r,models:[e]},r)}}compressLocal(e){var{x:t,y:r,z:n}=e.position;0===t&&0===r&&0===n||(e.position.set(0,0,0),e.userData.local=t+","+r+","+n)}_processModel(e,t){var r;gs(e)&&(r=e.animations.map((e=>e.toJSON())),e.userData.animations=r);const n=this.modelType[e.type];if(!n)return e;const i=n.modelTools.toNormal(e);return t&&(i.material=t),e.parent.add(i),e.parent.remove(e),i}parseModel(e){const t=new Set;e.traverse((e=>t.add(e))),t.forEach((e=>{var t=this._processMaterial(e);e=this._processModel(e,t),this.runScene.optionsEx.options.hideLocal&&this.compressLocal(e)}))}materialMapToJson(){return(0,et.js)(this.materialMap,((e,t)=>Ts(this,void 0,void 0,(function*(){var e=t.material,r=is(e);return this.helper.material.materialMap[e.userData.id]||(this.helper.material.materialMap[e.userData.id]={normal:e.userData.normal||{},textures:{}}),this.mergeAndRemoveTexture(r,e)}))))}mergeSame(e){var t=e.userData;for(const i in this.textureMap){var{md5:r,texture:n}=this.textureMap[i];if(t.md5===r&&e.mapping===n.mapping)return{isSame:!0,texture:n}}return this.textureMap[e.userData.id]=Object.assign(Object.assign({},t),{texture:e}),{isSame:!1,texture:e}}mergeAndRemoveTexture(e,t){return Ts(this,void 0,void 0,(function*(){return e.map((e=>{var{type:e,texture:r}=e;this.runScene.uniqueEx.texture.add(r),t[e]=null;const n=this.mergeSame(r).texture;if(!this.helper.material.textureMap[n.userData.id]){var i,{format:r,repeat:o,center:a,rotation:s,offset:u}=n;const e={format:r};this.runScene.modelEx.isNavieV2(o,1)||(({x:r,y:i}=o),e.repeat=r===i?r:o),this.runScene.modelEx.isNavieV2(a,0)||(({x:i,y:r}=a),e.center=i===r?i:a),this.runScene.modelEx.isNavieV2(u,0)||(({x:o,y:r}=u),e.offset=o===r?o:u),0!==s&&(e.rotation=s),this.helper.material.textureMap[n.userData.id]=e}"normalMap"!==e||n.userData.isNormalMap||(n.userData.isNormalMap=!0),this.helper.material.materialMap[t.userData.id].textures[e]=n.userData.id}))}))}setMultipMaterial(e,t){const r=this.runScene.modelEx.create(),n=ts();r.material=n,e.add(r);for(const e of Ti){if(!t.length)return;var i=t.pop();if(!i)return;n[e]=this.textureMap[i].texture}t.length&&this.setMultipMaterial(e,t)}}class Os{constructor(e){this.materialMap={},this.textureMap={};var{runScene:e,helper:t}=e;this.helper=t,this.runScene=e}parseMaterial(e){const{material:t,materialDef:r}=e;r.id=t.userData.id,this.parseNormal(t)}parseNormal(e){this.materialMap[e.userData.id]||(this.materialMap[e.userData.id]={normal:{},textures:{}}),this.materialMap[e.userData.id].normal=Object.assign(Object.assign({},this.materialMap[e.userData.id].normal),this.runScene.materialEx.getDefNromals(e)),console.log(this.materialMap[e.userData.id].normal," this.materialMap[material.userData.id].normal ")}setMaterialDef(e){const{type:t,data:r,normal:n}=e;n[t]=r}processTexture(e){const{texture:t,textureDef:r}=e;e=t.userData.notCompress;var{width:e,height:n}=(e&&(r.notCompress=!0),r.md5=t.userData.md5,r.id=t.userData.id,r.format=t.userData.format,Fi(t));r.size={w:e,h:n}}done(e){var{textureMap:t,materialMap:r}=this;e.asset.ex=Object.assign(Object.assign({},e.asset.ex),{textureMap:t,materialMap:r})}}function Ms(e){return(Ms="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 Ps(e,t){return(Ps=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Rs(e){return(Rs=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var ks=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ps(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Rs(e);if(r=t?(r=Rs(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Ms(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(e,t){if(!(this instanceof n))throw new TypeError("Cannot call a class as a function");var i=new p.BufferGeometry,o=(i.setAttribute("position",new p.Float32BufferAttribute([1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],3)),i.computeBoundingSphere(),new p.LineBasicMaterial({fog:!1}));return((i=r.call(this,i,o)).light=e,i.color=t,i.type="RectAreaLightHelper",o=new p.BufferGeometry).setAttribute("position",new p.Float32BufferAttribute([1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],3)),o.computeBoundingSphere(),i.add(new p.Mesh(o,new p.MeshBasicMaterial({side:p.BackSide,fog:!1}))),i}return 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 r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),n}(p.Line);class js{constructor(e){this.runScene=e}}class As extends js{get(){}static toJSON(e){const{type:t,intensity:r,name:n,visible:i,color:o}=e;return{type:t,intensity:r,name:n,visible:i,color:o.getHexString()}}parseJSON(e){const t=this.runScene.lightEx.get("AmbientLight",{addUndo:!1});var{type:e,intensity:r,name:n,visible:i,color:o}=e;return t.intensity=r,t.type=e,t.name=n,t.visible=i,t.color=new _i.Color("#"+o),t}}class Cs extends js{get(){throw new Error("Method not implemented.")}static toJSON(e){const{intensity:t,name:r,type:n,position:i,visible:o,color:a,castShadow:s,shadow:u,rotation:l,target:c}=e;var{mapSize:e,camera:h}=u,{scale:h,near:f,far:p}=h;return{type:n,intensity:t,name:r,visible:o,color:a.getHexString(),castShadow:s,shadow:{mapSize:e.x,camera:{near:f,far:p,scale:h.x}},position:{x:i.x,y:i.y,z:i.z},rotation:{x:l.x,y:l.y,z:l.z},targetPosition:{x:c.position.x,y:c.position.y,z:c.position.z}}}parseJSON(e){const t=this.runScene.lightEx.get("DirectionalLight",{addUndo:!1});var{targetPosition:e,intensity:r,name:n,position:i,visible:o,color:a,castShadow:s,shadow:u,rotation:l,type:c}=e,{mapSize:u,camera:h}=u,{scale:h,near:f,far:p}=h;return t.intensity=r,t.type=c,t.name=n,t.visible=o,t.castShadow=s,t.color=new _i.Color("#"+a),t.position.set(i.x,i.y,i.z),t.rotation.set(l.x,l.y,l.z),t.target.position.set(e.x,e.y,e.z),t.shadow.mapSize.x=u,t.shadow.mapSize.y=u,t.shadow.camera.scale.x=h,t.shadow.camera.scale.y=h,t.shadow.camera.scale.z=h,t.shadow.camera.near=f,t.shadow.camera.far=p,t.shadow.camera.updateProjectionMatrix(),null!=(r=t.cameraHelper)&&r.update(),t}}class Ds extends js{get(){throw new Error("Method not implemented.")}static toJSON(e){const{type:t,intensity:r,name:n,visible:i,color:o,groundColor:a,position:s}=e;return{name:n,type:t,intensity:r,visible:i,position:{x:s.x,y:s.y,z:s.z},groundColor:a.getHexString(),color:o.getHexString()}}parseJSON(e){const t=this.runScene.lightEx.get("HemisphereLight",{addUndo:!1});var{type:e,intensity:r,name:n,visible:i,color:o,groundColor:a,position:s}=e;return t.type=e,t.intensity=r,t.name=n,t.visible=i,t.color=new _i.Color("#"+o),t.groundColor=new _i.Color("#"+a),t.position.set(s.x,s.y,s.z),t}}class Ls extends js{get(){throw new Error("Method not implemented.")}static toJSON(e){const{name:t,type:r,intensity:n,distance:i,decay:o,renderOrder:a,color:s,visible:u,castShadow:l,shadow:c,position:h}=e;var{mapSize:e,camera:f,bias:p,radius:d}=c,{scale:f,near:m,far:y}=f;return{name:t,type:r,intensity:n,visible:u,color:s.getHexString(),castShadow:l,distance:i,decay:o,renderOrder:a,shadow:{mapSize:e.x,camera:{near:m,far:y,scale:f.x},radius:d,bias:p},position:{x:h.x,y:h.y,z:h.z}}}parseJSON(e){const t=this.runScene.lightEx.get("PointLight",{addUndo:!1});var{name:e,type:r,intensity:n,distance:i,decay:o,renderOrder:a,color:s,visible:u,castShadow:l,shadow:c,position:h}=e,{mapSize:c,camera:f,bias:p,radius:d}=c,{scale:f,near:m,far:y}=f;return t.intensity=n,t.type=r,t.name=e,t.visible=u,t.castShadow=l,t.distance=i,t.renderOrder=a,t.color=new _i.Color("#"+s),t.position.set(h.x,h.y,h.z),t.shadow.mapSize.x=c,t.shadow.mapSize.y=c,t.shadow.bias=p,t.decay=o,t.shadow.radius=d,t.shadow.camera.scale.x=f,t.shadow.camera.scale.y=f,t.shadow.camera.scale.z=f,t.shadow.camera.near=m,t.shadow.camera.far=y,t.shadow.camera.updateProjectionMatrix(),t}}class zs{constructor(e){this.runScene=e}static toJSON(e){const{type:t,intensity:r,name:n,visible:i,color:o,position:a}=e;return{name:n,type:t,intensity:r,visible:i,position:{x:a.x,y:a.y,z:a.z},color:o.getHexString()}}parseJSON(e){const t=this.runScene.lightEx.get("RectAreaLight",{addUndo:!1});var{type:e,intensity:r,name:n,visible:i,color:o,position:a}=e;return t.type=e,t.intensity=r,t.name=n,t.visible=i,t.color=new _i.Color("#"+o),t.position.set(a.x,a.y,a.z),t}}class Is{constructor(e){this.runScene=e}static toJSON(e){const{name:t,type:r,color:n,distance:i,decay:o,intensity:a,angle:s,penumbra:u,visible:l,castShadow:c,shadow:h,renderOrder:f,position:p,target:d}=e;var{bias:e,camera:m,normalBias:y,mapSize:v,radius:g}=h,m=m.near;return{type:r,intensity:a,name:t,visible:l,distance:i,angle:s,decay:o,penumbra:u,renderOrder:f,color:n.getHexString(),castShadow:c,shadow:{bias:e,normalBias:y,mapSize:v.x,camera:{near:m},radius:g},position:{x:p.x,y:p.y,z:p.z},targetPosition:{x:d.position.x,y:d.position.y,z:d.position.z}}}parseJSON(e){const t=this.runScene.lightEx.get("SpotLight",{addUndo:!1});var{name:e,type:r,color:n,distance:i,decay:o,intensity:a,angle:s,penumbra:u,visible:l,castShadow:c,shadow:h,renderOrder:f,position:p,targetPosition:d}=e,{bias:h,camera:m,normalBias:y,mapSize:v,radius:g}=h,m=m.near;return t.intensity=a,t.type=r,t.name=e,t.visible=l,t.distance=i,t.decay=o,t.angle=s,t.penumbra=u,t.renderOrder=f,t.castShadow=c,t.color=new _i.Color("#"+n),t.position.set(p.x,p.y,p.z),t.shadow.mapSize.x=v,t.shadow.mapSize.y=v,t.shadow.camera.near=m,t.target.position.set(d.x,d.y,d.z),t.shadow.bias=h,t.shadow.normalBias=y,t.shadow.radius=g,t.shadow.camera.updateProjectionMatrix(),t}}const Bs={DirectionalLight:Cs,PointLight:Ls,SpotLight:Is,RectAreaLight:zs,HemisphereLight:Ds,AmbientLight:As};class Us{constructor(e){this.shadowList=["DirectionalLight","PointLight","SpotLight"],this.helperList=["DirectionalLight","PointLight","SpotLight","RectAreaLight","HemisphereLight"],this.lightDom=void 0,this.helperUpdateList=["DirectionalLight","PointLight","SpotLight","HemisphereLight"],this.runScene=e,this.lightExMap={DirectionalLight:new Cs(e),PointLight:new Ls(e),SpotLight:new Is(e),RectAreaLight:new zs(e),HemisphereLight:new Ds(e),AmbientLight:new As(e)}}getLightsByScene(e=this.runScene.sceneEx.get()){return e.children.filter((e=>e.isLight))}get(e,t){var{isClone:t,id:r,addUndo:n,addToScene:i}=aa({isClone:!1,id:(0,f.getId)(),addUndo:!0,addToScene:!0},t);let o=new _i[e];if(o.position.y=10,o.name=e,o.userData.id=r,this.shadowList.includes(e)&&(o.castShadow=!0),this.setLight(o),!i)return o;if(this.helperList.includes(o.type)){const t=this.setLightHelper(o);t.push({model:o,parent:this.runScene.sceneEx.get(),addTree:!0}),r=t.map((e=>new cs(Object.assign(Object.assign({},e),{runScene:this.runScene})).execute())),n&&this.runScene.undoEx.addUndo(r),null!=(e=null==o?void 0:o.lightHelper)&&e.update()}else this.runScene.modelEx.add(o,void 0,{addUndo:n});return this.runScene.modelEx.setSelectByModel(o,{isClone:t}),o}setNull(e){e.userData.light&&this.setNull(e.userData.light),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.userData.light&&this.setSelect(e.userData.light),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.userData.light&&(e=e.userData.light),this.isLight(e)&&("DirectionalLight"===e.type||"SpotLight"===e.type?(e.helper.update(),null!=(t=e.cameraHelper)&&t.update()):null!=(e=null==(t=e.helper)?void 0:t.update)&&e.call(t))}remove(e,t=!0){let r;return this.runScene.helperEx.unfocus(),r="DirectionalLight"===e.type||"SpotLight"===e.type?[e,e.cameraHelper,e.helper].map((t=>{if(t)return new fs({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 fs({addTree:t===e,runScene:this.runScene,model:t,parent:t.parent||this.runScene.sceneEx.get()}).execute()})).filter((e=>e)),t&&r&&this.runScene.undoEx.addUndo(r),r}getLightHelper(e,t){this.runScene.uniqueEx.model.add(t);const r=this.runScene.uniqueEx.getId(t);let n,i=[];switch(e){case"RectAreaLight":n=new ks(t,16773120);break;case"DirectionalLight":if(n=new _i.DirectionalLightHelper(t,1,16711680),t.children[0])t.target=t.children[0];else{let e=new _i.Object3D;(t.target=e).name="helperModel",e.position.y=-10,t.shadow.autoUpdate=!0,e.userData.isLightTarget=!0,(e.userData.light=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 _i.CameraHelper(t.shadow.camera);t.shadow.camera.matrixWorldNeedsUpdate=!0,this.runScene.helperEx.setHelper(e,!0,(e=>{e.userData.id=r,e.userData.unClick=!0})),e.userData.id=r,e.userData.unClick=!0,t.cameraHelper=e,i.push({model:e,parent:this.runScene.sceneEx.get(),addTree:!1});break;case"PointLight":n=new _i.PointLightHelper(t,1,16711935);break;case"SpotLight":n=new _i.SpotLightHelper(t);let o=new _i.Object3D;(t.target=o).name="helperModel",o.userData.isLightTarget=!0,o.userData.light=t,o.position.y=-10,t.shadow.autoUpdate=!0,t.add(o);const a=new _i.CameraHelper(t.shadow.camera);t.shadow.camera.matrixWorldNeedsUpdate=!0,this.runScene.helperEx.setHelper(a,!0,(e=>{e.userData.id=r})),a.userData.id=r,t.cameraHelper=a,i.push({model:a,parent:this.runScene.sceneEx.get(),addTree:!1});break;case"HemisphereLight":n=new _i.HemisphereLightHelper(t,1,16773135)}return n.name="helperModel",this.runScene.helperEx.setHelper(n,!0,(e=>{e.userData.id=r})),n.userData.id=r,(n.light=t).helper=n,i.push({model:n,parent:this.runScene.sceneEx.get(),addTree:!1}),i}setLightHelper(e){return"editor"!==this.runScene.optionsEx.options.mode?[]: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:r,val:n,cb:i}=e;return new Ka({target:e,runScene:this.runScene,info:r,oldVal:e[r],newVal:n,cb:i}).execute()}setMultip(e,t,r=!0,n=!0){if(e instanceof Array)return i=e.map((e=>{var{model:e,typeList:n,newVal:i}=e;const o=new Na({target:e,typeList:n,newVal:i,cb:t});return r?o.execute():o})),n&&this.runScene.undoEx.addUndo(i),i;{var{model:i,typeList:e,newVal:o}=e;const a=new Na({target:i,typeList:e,newVal:o,cb:t});return n&&this.runScene.undoEx.addUndo(a),r?a.execute():a}}isLight(e){return null==(e=e.userData)?void 0:e.isLight}setLight(e){e.userData.isLight=!0}isHelperTarget(e){return e.userData.isLightTarget}clone(e){return this.runScene.modelEx.selectNull(),this.get(e.type,{isClone:!0,id:(0,f.getId)()})}static toJSON(e){return e.map((e=>{var t=e.type;return Bs[t].toJSON(e)}))}}class Ns{constructor(e){this.helperModels=[];var{type:e,runScene:t}=e;this.runScene=t,this.type=e,this.material=new Os({runScene:t,helper:this}),this.before=new Es({helper:this,type:e,runScene:t})}init(e){return this.before.parse(e)}parseNode(e){const{object:t,nodeDef:r}=e;(0,et.js)(this.runScene.modelEx.defNodeMap,((e,n)=>{t[e]!==n&&(r[e]=t[e])})),t.material&&t.material.wireframe&&(t.material.wireframe=!1,r.wireframe=!0)}getNodeMapValueWithBone(e,t){for(const r of t.keys())if(r.userData.id===e.userData.id)return t.get(r)}done(e){e.asset.ex||(e.asset.ex={type:this.type}),"scene"===this.type&&(e.asset.ex=this.setSceneEx(e.asset.ex)),this.material.done(e)}setSceneEx(e){var t=this.runScene.sceneEx.get();const{controls:r,camera:n}=this.runScene.assetsEx.get();return Object.assign(Object.assign({},e),{lights:Us.toJSON(this.runScene.lightEx.getLightsByScene()),camera:n.toJSON(),sceneEx:Ss.toJSON(t),timeLine:this.runScene.timeLineEx.getSavedData(),controls:Je.toJSON(r),options:this.runScene.exporter.gltf.options.getOptions(t)})}}class Fs{constructor(){this.optionsConfigs={}}getParse(e){return this.optionsConfigs[e]}addOption(e){var t=e.type;if(this.optionsConfigs[t])throw TypeError("该配置项已被挂载");this.optionsConfigs[t]=e}getOptions(e){return Object.values(this.optionsConfigs).map((t=>{const{process:r,type:n}=t;return{type:n,data:r(e)}}))}}function Vs(){Vs=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=(p="function"==typeof Symbol?Symbol:{}).iterator||"@@iterator",i=p.asyncIterator||"@@asyncIterator",o=p.toStringTag||"@@toStringTag";function a(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{a({},"")}catch(t){a=function(e,t,r){return e[t]=r}}function s(e,t,r,n){var i,o,a,s;return t=t&&t.prototype instanceof c?t:c,t=Object.create(t.prototype),n=new w(n||[]),t._invoke=(i=e,o=r,a=n,s="suspendedStart",function(e,t){if("executing"===s)throw new Error("Generator is already running");if("completed"===s){if("throw"===e)throw t;return{value:void 0,done:!0}}for(a.method=e,a.arg=t;;){var r=a.delegate;if(r&&(r=function e(t,r){var n=t.iterator[r.method];if(void 0===n){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=void 0,e(t,r),"throw"===r.method))return l;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}return"throw"===(n=u(n,t.iterator,r.arg)).type?(r.method="throw",r.arg=n.arg,r.delegate=null,l):(n=n.arg)?n.done?(r[t.resultName]=n.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,l):n:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,l)}(r,a),r)){if(r===l)continue;return r}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if("suspendedStart"===s)throw s="completed",a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);if(s="executing","normal"===(r=u(i,o,a)).type){if(s=a.done?"completed":"suspendedYield",r.arg===l)continue;return{value:r.arg,done:a.done}}"throw"===r.type&&(s="completed",a.method="throw",a.arg=r.arg)}}),t}function u(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=s;var l={};function c(){}function h(){}function f(){}var p,d,m=(a(p={},n,(function(){return this})),(d=(d=Object.getPrototypeOf)&&d(d(x([]))))&&d!==t&&r.call(d,n)&&(p=d),f.prototype=c.prototype=Object.create(p));function y(e){["next","throw","return"].forEach((function(t){a(e,t,(function(e){return this._invoke(t,e)}))}))}function v(e,t){var n;this._invoke=function(i,o){function a(){return new t((function(n,a){!function n(i,o,a,s){var l;if("throw"!==(i=u(e[i],e,o)).type)return(o=(l=i.arg).value)&&"object"==Gs(o)&&r.call(o,"__await")?t.resolve(o.__await).then((function(e){n("next",e,a,s)}),(function(e){n("throw",e,a,s)})):t.resolve(o).then((function(e){l.value=e,a(l)}),(function(e){return n("throw",e,a,s)}));s(i.arg)}(i,o,n,a)}))}return n=n?n.then(a,a):a()}}function g(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 w(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(g,this),this.reset(!0)}function x(e){if(e){var t,i=e[n];if(i)return i.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return t=-1,(i=function n(){for(;++t<e.length;)if(r.call(e,t))return n.value=e[t],n.done=!1,n;return n.value=void 0,n.done=!0,n}).next=i}return{next:S}}function S(){return{value:void 0,done:!0}}return a(m,"constructor",h.prototype=f),a(f,"constructor",h),h.displayName=a(f,o,"GeneratorFunction"),e.isGeneratorFunction=function(e){return!!(e="function"==typeof e&&e.constructor)&&(e===h||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,f):(e.__proto__=f,a(e,o,"GeneratorFunction")),e.prototype=Object.create(m),e},e.awrap=function(e){return{__await:e}},y(v.prototype),a(v.prototype,i,(function(){return this})),e.AsyncIterator=v,e.async=function(t,r,n,i,o){void 0===o&&(o=Promise);var a=new v(s(t,r,n,i),o);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},y(m),a(m,o,"Generator"),a(m,n,(function(){return this})),a(m,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t,r=[];for(t in e)r.push(t);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=x,w.prototype={constructor:w,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)&&r.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 n(r,n){return a.type="throw",a.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var i=this.tryEntries.length-1;0<=i;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var s=r.call(o,"catchLoc"),u=r.call(o,"finallyLoc");if(s&&u){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;0<=n;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}var a=(o=o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc?null:o)?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,l):this.complete(a)},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),l},finish:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),b(r),l}},catch:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var r,n,i=this.tryEntries[t];if(i.tryLoc===e)return"throw"===(r=i.completion).type&&(n=r.arg,b(i)),n}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:x(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},e}function Hs(e,t,r,n,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,i)}function Gs(e){return(Gs="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 Ws(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Xs(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function qs(e,t,r){t&&Xs(e.prototype,t),r&&Xs(e,r),Object.defineProperty(e,"prototype",{writable:!1})}var Ys=function(){function e(){Ws(this,e),this.pluginCallbacks=[],this.register((function(e){return new fu(e)})),this.register((function(e){return new pu(e)})),this.register((function(e){return new du(e)})),this.register((function(e){return new yu(e)})),this.register((function(e){return new vu(e)})),this.register((function(e){return new mu(e)}))}return qs(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,r,n){"object"===Gs(r)&&(console.warn("THREE.GLTFExporter: parse() expects options as the fourth argument now."),n=r);for(var i=new hu,o=[],a=0,s=this.pluginCallbacks.length;a<s;a++)o.push(this.pluginCallbacks[a](i));i.setPlugins(o),i.write(e,t,n).catch(r)}},{key:"parseAsync",value:function(e,t){var r=this;return new Promise((function(n,i){r.parse(e,n,i,t)}))}}]),e}(),Zs=5121,Qs=5123,Ks=(c=9728,9729),Js=9984,$s=9985,eu=9986,tu=9987,ru=33071,nu=33648,iu=10497,ou={},au=(ou[p.NearestFilter]=c,ou[p.NearestMipmapNearestFilter]=Js,ou[p.NearestMipmapLinearFilter]=eu,ou[p.LinearFilter]=Ks,ou[p.LinearMipmapNearestFilter]=$s,ou[p.LinearMipmapLinearFilter]=tu,ou[p.ClampToEdgeWrapping]=ru,ou[p.RepeatWrapping]=iu,ou[p.MirroredRepeatWrapping]=nu,{scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"});function su(e,t){return e.length===t.length&&e.every((function(e,r){return e===t[r]}))}function uu(e){return 4*Math.ceil(e/4)}function lu(e,t){var r=1<arguments.length&&void 0!==t?t:0,n=uu(e.byteLength);if(n===e.byteLength)return e;var i=new Uint8Array(n);if(i.set(new Uint8Array(e)),0!==r)for(var o=e.byteLength;o<n;o++)i[o]=r;return i.buffer}var cu=null,hu=function(){function e(){Ws(this,e),this.plugins=[],this.options={},this.pending=[],this.buffers=[],this.byteOffset=0,this.buffers=[],this.nodeMap=new Map,this.skins=[],this.extensionsUsed={},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,r;return qs(e,[{key:"setPlugins",value:function(e){this.plugins=e}},{key:"write",value:(t=Vs().mark((function e(t,r,n){var i,o,a,s,u,l,c;return Vs().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.options=Object.assign({},{binary:!1,trs:!1,onlyVisible:!0,truncateDrawRange:!0,embedImages:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},n),0<this.options.animations.length&&(this.options.trs=!0),this.processInput(t),e.next=5,Promise.all(this.pending);case 5:return o=(i=this).buffers,a=i.json,n=i.options,e.next=11,i.options.myOptions.helper.done(a);case 11:u=i.extensionsUsed,s=new Blob(o,{type:"application/octet-stream"}),0<(u=Object.keys(u)).length&&(a.extensionsUsed=u),a.buffers&&0<a.buffers.length&&(a.buffers[0].byteLength=s.size),!0===n.binary?(console.log(a,"json"),(l=new window.FileReader).readAsArrayBuffer(s),l.onloadend=function(){var e=lu(l.result),t=new DataView(new ArrayBuffer(8)),n=(t.setUint32(0,e.byteLength,!0),t.setUint32(4,5130562,!0),lu(function(e){if(void 0!==window.TextEncoder)return(new TextEncoder).encode(e).buffer;for(var t=new Uint8Array(new ArrayBuffer(e.length)),r=0,n=e.length;r<n;r++){var i=e.charCodeAt(r);t[r]=255<i?32:i}return t.buffer}(JSON.stringify(a)),32)),i=new DataView(new ArrayBuffer(8)),o=(i.setUint32(0,n.byteLength,!0),i.setUint32(4,1313821514,!0),new ArrayBuffer(12)),s=((u=new DataView(o)).setUint32(0,1179937895,!0),u.setUint32(4,2,!0),12+i.byteLength+n.byteLength+t.byteLength+e.byteLength),u=(u.setUint32(8,s,!0),new Blob([o,i,n,t,e],{type:"application/octet-stream"})),c=new window.FileReader;c.readAsArrayBuffer(u),c.onloadend=function(){r(c.result)}}):a.buffers&&0<a.buffers.length?((c=new window.FileReader).readAsDataURL(s),c.onloadend=function(){var e=c.result;a.buffers[0].uri=e,r(a)}):r(a);case 17:case"end":return e.stop()}}),e,this)})),r=function(){var e=this,r=arguments;return new Promise((function(n,i){var o=t.apply(e,r);function a(e){Hs(o,n,i,a,s,"next",e)}function s(e){Hs(o,n,i,a,s,"throw",e)}a(void 0)}))},function(e,t,n){return r.apply(this,arguments)})},{key:"serializeUserData",value:function(e,t){if(0!==Object.keys(e.userData).length){var r=this.options,n=this.extensionsUsed;try{var i=JSON.parse(JSON.stringify(e.userData));if(r.includeCustomExtensions&&i.gltfExtensions){for(var o in void 0===t.extensions&&(t.extensions={}),i.gltfExtensions)t.extensions[o]=i.gltfExtensions[o],n[o]=!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){return this.uids.has(e)||this.uids.set(e,this.uid++),this.uids.get(e)}},{key:"isNormalizedNormalAttribute",value:function(e){if(this.cache.attributesNormalized.has(e))return!1;for(var t=new p.Vector3,r=0,n=e.count;r<n;r++)if(5e-4<Math.abs(t.fromBufferAttribute(e,r).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 r=e.clone(),n=new p.Vector3,i=0,o=r.count;i<o;i++)n.fromBufferAttribute(r,i),0===n.x&&0===n.y&&0===n.z?n.setX(1):n.normalize(),r.setXYZ(i,n.x,n.y,n.z);return t.attributesNormalized.set(e,r),r}},{key:"applyTextureTransform",value:function(e,t){var r=!1,n={};0===t.offset.x&&0===t.offset.y||(n.offset=t.offset.toArray(),r=!0),0!==t.rotation&&(n.rotation=t.rotation,r=!0),1===t.repeat.x&&1===t.repeat.y||(n.scale=t.repeat.toArray(),r=!0),r&&(e.extensions=e.extensions||{},e.extensions.KHR_texture_transform=n,this.extensionsUsed.KHR_texture_transform=!0)}},{key:"buildORMTexture",value:function(e){var t=null==(t=e.aoMap)?void 0:t.image,r=null==(r=e.roughnessMap)?void 0:r.image,n=null==(n=e.metalnessMap)?void 0:n.image;if(t===r&&r===n)return e.aoMap;if(t||r||n){e=Math.max((null==t?void 0:t.width)||0,(null==r?void 0:r.width)||0,(null==n?void 0:n.width)||0);var i=Math.max((null==t?void 0:t.height)||0,(null==r?void 0:r.height)||0,(null==n?void 0:n.height)||0),o=document.createElement("canvas"),a=(o.width=e,o.height=i,o.getContext("2d")),s=(a.fillStyle="#ffffff",a.fillRect(0,0,e,i),a.getImageData(0,0,e,i));if(t){a.drawImage(t,0,0,e,i);for(var u=a.getImageData(0,0,e,i).data,l=0;l<u.length;l+=4)s.data[l]=u[l]}if(r){a.drawImage(r,0,0,e,i);for(var c=a.getImageData(0,0,e,i).data,h=1;h<c.length;h+=4)s.data[h]=c[h]}if(n){a.drawImage(n,0,0,e,i);for(var f=a.getImageData(0,0,e,i).data,d=2;d<f.length;d+=4)s.data[d]=f[d]}return a.putImageData(s,0,0),new p.Texture(o)}}},{key:"processBuffer",value:function(e){var t=this.json,r=this.buffers;return t.buffers||(t.buffers=[{byteLength:0}]),r.push(e),0}},{key:"processBufferView",value:function(e,t,r,n,i){for(var o,a=this.json,s=(a.bufferViews||(a.bufferViews=[]),o=t===Zs?1:t===Qs?2:4,uu(n*e.itemSize*o)),u=new DataView(new ArrayBuffer(s)),l=0,c=r;c<r+n;c++)for(var h=0;h<e.itemSize;h++){var f=void 0;4<e.itemSize?f=e.array[c*e.itemSize+h]:0===h?f=e.getX(c):1===h?f=e.getY(c):2===h?f=e.getZ(c):3===h&&(f=e.getW(c)),5126===t?u.setFloat32(l,f,!0):5125===t?u.setUint32(l,f,!0):t===Qs?u.setUint16(l,f,!0):t===Zs&&u.setUint8(l,f),l+=o}var p={buffer:this.processBuffer(u.buffer),byteOffset:this.byteOffset,byteLength:s};return void 0!==i&&(p.target=i),34962===i&&(p.byteStride=e.itemSize*o),this.byteOffset+=s,a.bufferViews.push(p),{id:a.bufferViews.length-1,byteLength:0}}},{key:"processBufferViewImage",value:function(e){var t=this,r=t.json;return r.bufferViews||(r.bufferViews=[]),new Promise((function(n,i){var o=new window.FileReader;if(!(e instanceof Blob))return i();o.readAsArrayBuffer(e),o.onloadend=function(){var e=lu(o.result),i={buffer:t.processBuffer(e),byteOffset:t.byteOffset,byteLength:e.byteLength};t.byteOffset+=e.byteLength,n(r.bufferViews.push(i)-1)}}))}},{key:"processAccessor",value:function(e,t,r,n){var i,o=this.options,a=this.json;if(e.array.constructor===Float32Array)i=5126;else if(e.array.constructor===Uint32Array)i=5125;else if(e.array.constructor===Uint16Array)i=Qs;else{if(e.array.constructor!==Uint8Array)throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type.");i=Zs}if(void 0===r&&(r=0),void 0===n&&(n=e.count),o.truncateDrawRange&&void 0!==t&&null===t.index&&(o=r+n,u=t.drawRange.count===1/0?e.count:t.drawRange.start+t.drawRange.count,r=Math.max(r,t.drawRange.start),(n=Math.min(o,u)-r)<0&&(n=0)),0===n)return null;o=function(e,t,r){for(var n={min:new Array(e.itemSize).fill(Number.POSITIVE_INFINITY),max:new Array(e.itemSize).fill(Number.NEGATIVE_INFINITY)},i=t;i<t+r;i++)for(var o=0;o<e.itemSize;o++){var a=void 0;4<e.itemSize?a=e.array[i*e.itemSize+o]:0===o?a=e.getX(i):1===o?a=e.getY(i):2===o?a=e.getZ(i):3===o&&(a=e.getW(i)),n.min[o]=Math.min(n.min[o],a),n.max[o]=Math.max(n.max[o],a)}return n}(e,r,n);var s,u=(void 0!==t&&(s=e===t.index?34963:34962),this.processBufferView(e,i,r,n,s));return t={bufferView:u.id,byteOffset:u.byteOffset,componentType:i,count:n,max:o.max,min:o.min,type:{1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",16:"MAT4"}[e.itemSize]},!0===e.normalized&&(t.normalized=!0),a.accessors||(a.accessors=[]),a.accessors.push(t)-1}},{key:"processImage",value:function(e,t,r,n){var i=this,o=i.cache,a=i.json,s=i.options,u=i.pending,l=(o.images.has(e)||o.images.set(e,{}),o=o.images.get(e),"image/png");if(void 0!==o[r=l+":flipY/"+r.toString()])return o[r];a.images||(a.images=[]);var c={mimeType:l};if(!0===s.binary&&null!=n&&null!=(f=n.userData)&&f.blob&&(null==n||null==(f=n.userData)?void 0:f.blob)instanceof Blob)u.push(new Promise((function(e){i.processBufferViewImage(n.userData.blob).then((function(t){c.bufferView=t,e()}))})));else if(s.embedImages){var h=cu=cu||document.createElement("canvas"),f=(h.width=Math.min(e.width,s.maxTextureSize),h.height=Math.min(e.height,s.maxTextureSize),h.getContext("2d"));if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap)f.drawImage(e,0,0,h.width,h.height);else{t!==p.RGBAFormat&&console.error("GLTFExporter: Only RGBAFormat is supported."),(e.width>s.maxTextureSize||e.height>s.maxTextureSize)&&console.warn("GLTFExporter: Image size is bigger than maxTextureSize",e);for(var d=new Uint8ClampedArray(e.height*e.width*4),m=0;m<d.length;m+=4)d[m+0]=e.data[m+0],d[m+1]=e.data[m+1],d[m+2]=e.data[m+2],d[m+3]=e.data[m+3];f.putImageData(new ImageData(d,e.width,e.height),0,0)}!0===s.binary?u.push(new Promise((function(e){h.toBlob((function(t){i.processBufferViewImage(t).then((function(t){c.bufferView=t,e()}))}),l)}))):c.uri=h.toDataURL(l)}else c.uri=e.src;return t=a.images.push(c)-1,o[r]=t}},{key:"processSampler",value:function(e){var t=this.json;return t.samplers||(t.samplers=[]),e={magFilter:ou[e.magFilter],minFilter:ou[e.minFilter],wrapS:ou[e.wrapS],wrapT:ou[e.wrapT]},t.samplers.push(e)-1}},{key:"processTexture",value:function(e){var t=this.cache,r=this.json;if(t.textures.has(e))return t.textures.get(e);r.textures||(r.textures=[]);var n={sampler:this.processSampler(e),source:this.processImage(e.image,e.format,e.flipY,e)};return e.name&&(n.name=e.name),this._invokeAll((function(t){t.writeTexture&&t.writeTexture(e,n)})),r=r.textures.push(n)-1,t.textures.set(e,r),this.options.myOptions.helper.material.processTexture({texture:e,textureDef:n}),r}},{key:"processMaterial",value:function(e){var t=this.cache,r=this.json;if(t.materials.has(e))return t.materials.get(e);if(e.isShaderMaterial)return console.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;r.materials||(r.materials=[]);var n,i={pbrMetallicRoughness:{}},o=(su((this.options.myOptions.helper.material.parseMaterial({material:e,materialDef:i,options:this}),!0!==e.isMeshStandardMaterial&&!0!==e.isMeshBasicMaterial&&console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results."),o=e.color.toArray().concat([e.opacity])),[1,1,1,1])||(i.pbrMetallicRoughness.baseColorFactor=o),e.isMeshStandardMaterial?(i.pbrMetallicRoughness.metallicFactor=e.metalness,i.pbrMetallicRoughness.roughnessFactor=e.roughness):(i.pbrMetallicRoughness.metallicFactor=.5,i.pbrMetallicRoughness.roughnessFactor=.5),this.buildORMTexture(e));return(e.metalnessMap||e.roughnessMap)&&(o={index:this.processTexture(o)},this.applyTextureTransform(o,e.metalnessMap||e.roughnessMap),i.pbrMetallicRoughness.metallicRoughnessTexture=o),e.map&&(o={index:this.processTexture(e.map)},this.applyTextureTransform(o,e.map),i.pbrMetallicRoughness.baseColorTexture=o),e.emissive&&(o=e.emissive.clone().multiplyScalar(e.emissiveIntensity),1<(n=Math.max(o.r,o.g,o.b))&&(o.multiplyScalar(1/n),console.warn("THREE.GLTFExporter: Some emissive components exceed 1; emissive has been limited")),0<n&&(i.emissiveFactor=o.toArray()),e.emissiveMap&&(n={index:this.processTexture(e.emissiveMap)},this.applyTextureTransform(n,e.emissiveMap),i.emissiveTexture=n)),e.normalMap&&(o={index:this.processTexture(e.normalMap)},e.normalScale&&1!==e.normalScale.x&&(o.scale=e.normalScale.x),this.applyTextureTransform(o,e.normalMap),i.normalTexture=o),e.aoMap&&(n={index:this.processTexture(e.aoMap),texCoord:1},1!==e.aoMapIntensity&&(n.strength=e.aoMapIntensity),this.applyTextureTransform(n,e.aoMap),i.occlusionTexture=n),e.transparent?i.alphaMode="BLEND":0<e.alphaTest&&(i.alphaMode="MASK",i.alphaCutoff=e.alphaTest),e.side===p.DoubleSide&&(i.doubleSided=!0),""!==e.name&&(i.name=e.name),this.serializeUserData(e,i),this._invokeAll((function(t){t.writeMaterial&&t.writeMaterial(e,i)})),o=r.materials.push(i)-1,t.materials.set(e,o),o}},{key:"processMesh",value:function(e){var t=this.cache,r=this.json,n=[e.geometry.uuid];if(Array.isArray(e.material))for(var i=0,o=e.material.length;i<o;i++)n.push(e.material[i].uuid);else n.push(e.material.uuid);var a=n.join(":");if(t.meshes.has(a))return t.meshes.get(a);var s=e.geometry,u=e.isLineSegments?1:e.isLineLoop?2:e.isLine?3:e.isPoints?0:e.material.wireframe?1:4;if(!0!==s.isBufferGeometry)throw new Error("THREE.GLTFExporter: Geometry is not of type THREE.BufferGeometry.");var l,c,h,f={},d={},m=[],y=[],v={uv:"TEXCOORD_0",uv2:"TEXCOORD_1",color:"COLOR_0",skinWeight:"WEIGHTS_0",skinIndex:"JOINTS_0"},g=s.getAttribute("normal"),b=(void 0===g||this.isNormalizedNormalAttribute(g)||(console.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."),s.setAttribute("normal",this.createNormalizedNormalAttribute(g))),null);for(c in s.attributes)"morph"!==c.slice(0,5)&&(l=s.attributes[c],c=v[c]||c.toUpperCase(),/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(c)||(c="_"+c),t.attributes.has(this.getUID(l))?d[c]=t.attributes.get(this.getUID(l)):(b=null,h=l.array,"JOINTS_0"!==c||h instanceof Uint16Array||h instanceof Uint8Array||(console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'),b=new p.BufferAttribute(new Uint16Array(h),l.itemSize,l.normalized)),null!==(h=this.processAccessor(b||l,s))&&(d[c]=h,t.attributes.set(this.getUID(l),h))));if(void 0!==g&&s.setAttribute("normal",g),0===Object.keys(d).length)return null;if(void 0!==e.morphTargetInfluences&&0<e.morphTargetInfluences.length){var w=[],x=[],S={};if(void 0!==e.morphTargetDictionary)for(var _ in e.morphTargetDictionary)S[e.morphTargetDictionary[_]]=_;for(var T=0;T<e.morphTargetInfluences.length;++T){var E,O={},M=!1;for(E in s.morphAttributes)if("position"!==E&&"normal"!==E)M||(console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."),M=!0);else{var P=s.morphAttributes[E][T],R=E.toUpperCase(),k=s.attributes[E];if(t.attributes.has(this.getUID(P)))O[R]=t.attributes.get(this.getUID(P));else{var j=P.clone();if(!s.morphTargetsRelative)for(var A=0,C=P.count;A<C;A++)j.setXYZ(A,P.getX(A)-k.getX(A),P.getY(A)-k.getY(A),P.getZ(A)-k.getZ(A));O[R]=this.processAccessor(j,s),t.attributes.set(this.getUID(k),O[R])}}y.push(O),w.push(e.morphTargetInfluences[T]),void 0!==e.morphTargetDictionary&&x.push(S[T])}f.weights=w,0<x.length&&(f.extras={},f.extras.targetNames=x)}if((g=Array.isArray(e.material))&&0===s.groups.length)return null;for(var D=g?e.material:[e.material],L=g?s.groups:[{materialIndex:0,start:void 0,count:void 0}],z=0,I=L.length;z<I;z++){var B={mode:u,attributes:d},U=(this.serializeUserData(s,B),0<y.length&&(B.targets=y),null!==s.index&&(U=this.getUID(s.index),void 0===L[z].start&&void 0===L[z].count||(U+=":"+L[z].start+":"+L[z].count),t.attributes.has(U)?B.indices=t.attributes.get(U):(B.indices=this.processAccessor(s.index,s,L[z].start,L[z].count),t.attributes.set(U,B.indices)),null===B.indices&&delete B.indices),this.processMaterial(D[L[z].materialIndex]));null!==U&&(B.material=U),m.push(B)}return f.primitives=m,r.meshes||(r.meshes=[]),this._invokeAll((function(t){t.writeMesh&&t.writeMesh(e,f)})),g=r.meshes.push(f)-1,t.meshes.set(a,g),g}},{key:"processCamera",value:function(e){var t=this.json,r=(t.cameras||(t.cameras=[]),e.isOrthographicCamera),n={type:r?"orthographic":"perspective"};return r?n.orthographic={xmag:2*e.right,ymag:2*e.top,zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near}:n.perspective={aspectRatio:e.aspect,yfov:p.MathUtils.degToRad(e.fov),zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near},""!==e.name&&(n.name=e.type),t.cameras.push(n)-1}},{key:"processAnimation",value:function(e,t){for(var r=this.json,n=this.nodeMap,i=(r.animations||(r.animations=[]),(e=Ys.Utils.mergeMorphTargetTracks(e.clone(),t)).tracks),o=[],a=[],s=0;s<i.length;++s){var u=i[s],l=p.PropertyBinding.parseTrackName(u.name),c=p.PropertyBinding.findNode(t,l.nodeName),h=au[l.propertyName];if(!(c="bones"===l.objectName?!0===c.isSkinnedMesh?c.skeleton.getBoneByName(l.objectIndex):void 0:c)||!h)return console.warn('THREE.GLTFExporter: Could not export animation track "%s".',u.name),null;l=u.values.length/u.times.length;var f=void(h===au.morphTargetInfluences&&(l/=c.morphTargetInfluences.length));!0===u.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline?(f="CUBICSPLINE",l/=3):f=u.getInterpolation()===p.InterpolateDiscrete?"STEP":"LINEAR",a.push({input:this.processAccessor(new p.BufferAttribute(u.times,1)),output:this.processAccessor(new p.BufferAttribute(u.values,l)),interpolation:f}),o.push({sampler:a.length-1,target:{node:n.get(c),path:h}})}return r.animations.push({name:e.name||"clip_"+r.animations.length,samplers:a,channels:o}),r.animations.length-1}},{key:"processSkin",value:function(e){var t=this.json,r=this.nodeMap,n=(console.log(r,"nodeMap"),t.nodes[r.get(e)]),i=(console.log(n,e,"node"),e.skeleton);if(void 0===i)return null;var o=e.skeleton.bones[0];if(void 0===o)return null;for(var a=[],s=new Float32Array(16*i.bones.length),u=new p.Matrix4,l=0;l<i.bones.length;++l)console.log(i.bones[l],(r.get(),"(nodeMap.ge)(skeleton.bones[i])")),a.push(r.get(i.bones[l])),u.copy(i.boneInverses[l]),u.multiply(e.bindMatrix).toArray(s,16*l);return void 0===t.skins&&(t.skins=[]),t.skins.push({inverseBindMatrices:this.processAccessor(new p.BufferAttribute(s,16)),joints:a,skeleton:r.get(o)}),n.skin=t.skins.length-1}},{key:"processNode",value:function(e){var t,r,n=this.json,i=this.options,o=this.nodeMap,a=(n.nodes||(n.nodes=[]),{});if(i.myOptions.helper.parseNode({object:e,nodeDef:a,options:this}),i.trs?(r=e.quaternion.toArray(),h=e.position.toArray(),t=e.scale.toArray(),su(r,[0,0,0,1])||(a.rotation=r),su(h,[0,0,0])||(a.translation=h),su(t,[1,1,1])||(a.scale=t)):(e.matrixAutoUpdate&&e.updateMatrix(),!1===su(e.matrix.elements,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])&&(a.matrix=e.matrix.elements)),""!==e.name&&(a.name=String(e.name)),this.serializeUserData(e,a),e.isMesh||e.isLine||e.isPoints?null!==(r=this.processMesh(e))&&(a.mesh=r):e.isCamera&&(a.camera=this.processCamera(e)),e.isSkinnedMesh&&this.skins.push(e),0<e.children.length){for(var s=[],u=0,l=e.children.length;u<l;u++){var c=e.children[u];!c.visible&&!1!==i.onlyVisible||null!==(c=this.processNode(c))&&s.push(c)}0<s.length&&(a.children=s)}this._invokeAll((function(t){t.writeNode&&t.writeNode(e,a)}));var h=n.nodes.push(a)-1;return console.log(e,h,"object,nodeIndex"),o.set(e,h),h}},{key:"processScene",value:function(e){for(var t=this.json,r=this.options,n=(t.scenes||(t.scenes=[],t.scene=0),{}),i=(""!==e.name&&(n.name=e.name),t.scenes.push(n),[]),o=0,a=e.children.length;o<a;o++){var s=e.children[o];!s.visible&&!1!==r.onlyVisible||null!==(s=this.processNode(s))&&i.push(s)}0<i.length&&(n.nodes=i),this.serializeUserData(e,n)}},{key:"processObjects",value:function(e){console.log(e,"objects");var t=new p.Scene;t.name="AuxScene";for(var r=0;r<e.length;r++)t.children.push(e[r]);this.processScene(t)}},{key:"processInput",value:function(e){for(var t,r,n=this.options,i=(e=e instanceof Array?e:[e],this._invokeAll((function(t){t.beforeParse&&t.beforeParse(e)})),[]),o=0;o<e.length;o++)e[o]instanceof p.Scene?this.processScene(e[o]):i.push(e[o]);1===i.length?(t=i[0],"model"===n.myOptions.helper.type&&((r=new p.Group).name="glb_model",r.add(t),t=r),this.processScene(t)):1<i.length&&this.processObjects(i);for(var a=0;a<this.skins.length;++a)this.processSkin(this.skins[a]);for(var s=0;s<n.animations.length;++s)this.processAnimation(n.animations[s],e[0]);this._invokeAll((function(t){t.afterParse&&t.afterParse(e)}))}},{key:"_invokeAll",value:function(e){for(var t=0,r=this.plugins.length;t<r;t++)e(this.plugins[t])}}]),e}(),fu=function(){function e(t){Ws(this,e),this.writer=t,this.name="KHR_lights_punctual"}return qs(e,[{key:"writeNode",value:function(e,t){var r,n,i;e.isLight&&(e.isDirectionalLight||e.isPointLight||e.isSpotLight?(r=(i=this.writer).json,i=i.extensionsUsed,n={},e.name&&(n.name=e.name),n.color=e.color.toArray(),n.intensity=e.intensity,e.isDirectionalLight?n.type="directional":e.isPointLight?(n.type="point",0<e.distance&&(n.range=e.distance)):e.isSpotLight&&(n.type="spot",0<e.distance&&(n.range=e.distance),n.spot={},n.spot.innerConeAngle=(e.penumbra-1)*e.angle*-1,n.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]||(r.extensions=r.extensions||{},r.extensions[this.name]={lights:[]},i[this.name]=!0),(i=r.extensions[this.name].lights).push(n),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}(),pu=function(){function e(t){Ws(this,e),this.writer=t,this.name="KHR_materials_unlit"}return qs(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}(),du=function(){function e(t){Ws(this,e),this.writer=t,this.name="KHR_materials_pbrSpecularGlossiness"}return qs(e,[{key:"writeMaterial",value:function(e,t){var r,n,i,o;e.isGLTFSpecularGlossinessMaterial&&(n=(r=this.writer).extensionsUsed,i={},t.pbrMetallicRoughness.baseColorFactor&&(i.diffuseFactor=t.pbrMetallicRoughness.baseColorFactor),e.specular.toArray(o=[1,1,1],0),i.specularFactor=o,i.glossinessFactor=e.glossiness,t.pbrMetallicRoughness.baseColorTexture&&(i.diffuseTexture=t.pbrMetallicRoughness.baseColorTexture),e.specularMap&&(o={index:r.processTexture(e.specularMap)},r.applyTextureTransform(o,e.specularMap),i.specularGlossinessTexture=o),t.extensions=t.extensions||{},t.extensions[this.name]=i,n[this.name]=!0)}}]),e}(),mu=function(){function e(t){Ws(this,e),this.writer=t,this.name="KHR_materials_clearcoat"}return qs(e,[{key:"writeMaterial",value:function(e,t){var r,n,i,o;e.isMeshPhysicalMaterial&&(n=(r=this.writer).extensionsUsed,(i={}).clearcoatFactor=e.clearcoat,e.clearcoatMap&&(o={index:r.processTexture(e.clearcoatMap)},r.applyTextureTransform(o,e.clearcoatMap),i.clearcoatTexture=o),i.clearcoatRoughnessFactor=e.clearcoatRoughness,e.clearcoatRoughnessMap&&(o={index:r.processTexture(e.clearcoatRoughnessMap)},r.applyTextureTransform(o,e.clearcoatRoughnessMap),i.clearcoatRoughnessTexture=o),e.clearcoatNormalMap&&(o={index:r.processTexture(e.clearcoatNormalMap)},r.applyTextureTransform(o,e.clearcoatNormalMap),i.clearcoatNormalTexture=o),t.extensions=t.extensions||{},t.extensions[this.name]=i,n[this.name]=!0)}}]),e}(),yu=function(){function e(t){Ws(this,e),this.writer=t,this.name="KHR_materials_transmission"}return qs(e,[{key:"writeMaterial",value:function(e,t){var r,n,i,o;e.isMeshPhysicalMaterial&&0!==e.transmission&&(n=(r=this.writer).extensionsUsed,(i={}).transmissionFactor=e.transmission,e.transmissionMap&&(o={index:r.processTexture(e.transmissionMap)},r.applyTextureTransform(o,e.transmissionMap),i.transmissionTexture=o),t.extensions=t.extensions||{},t.extensions[this.name]=i,n[this.name]=!0)}}]),e}(),vu=function(){function e(t){Ws(this,e),this.writer=t,this.name="KHR_materials_volume"}return qs(e,[{key:"writeMaterial",value:function(e,t){var r,n,i,o;e.isMeshPhysicalMaterial&&0!==e.transmission&&(n=(r=this.writer).extensionsUsed,(i={}).thicknessFactor=e.thickness,e.thicknessMap&&(o={index:r.processTexture(e.thicknessMap)},r.applyTextureTransform(o,e.thicknessMap),i.thicknessTexture=o),i.attenuationDistance=e.attenuationDistance,i.attenuationColor=e.attenuationColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=i,n[this.name]=!0)}}]),e}(),gu=(Ys.Utils={insertKeyframe:function(e,t){var r,n=e.getValueSize(),i=new e.TimeBufferType(e.times.length+1),o=new e.ValueBufferType(e.values.length+n),a=e.createInterpolant(new e.ValueBufferType(n));if(0===e.times.length){i[0]=t;for(var s=0;s<n;s++)o[s]=0;r=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),o.set(a.evaluate(t),0),o.set(e.values,n),r=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),o.set(e.values,0),o.set(a.evaluate(t),e.values.length),r=i.length-1}else for(var u=0;u<e.times.length;u++){if(Math.abs(e.times[u]-t)<.001)return u;if(e.times[u]<t&&e.times[u+1]>t){i.set(e.times.slice(0,u+1),0),i[u+1]=t,i.set(e.times.slice(u+1),u+2),o.set(e.values.slice(0,(u+1)*n),0),o.set(a.evaluate(t),(u+1)*n),o.set(e.values.slice((u+1)*n),(u+2)*n),r=u+1;break}}return e.times=i,e.values=o,r},mergeMorphTargetTracks:function(e,t){for(var r=[],n={},i=e.tracks,o=0;o<i.length;++o){var a=i[o],s=p.PropertyBinding.parseTrackName(a.name),u=p.PropertyBinding.findNode(t,s.nodeName);if("morphTargetInfluences"!==s.propertyName||void 0===s.propertyIndex)r.push(a);else{if(a.createInterpolant!==a.InterpolantFactoryMethodDiscrete&&a.createInterpolant!==a.InterpolantFactoryMethodLinear){if(a.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."),(a=a.clone()).setInterpolation(p.InterpolateLinear)}var l=u.morphTargetInfluences.length,c=u.morphTargetDictionary[s.propertyIndex];if(void 0===c)throw new Error("THREE.GLTFExporter: Morph target name not found: "+s.propertyIndex);var h=void 0;if(void 0===n[u.uuid]){for(var f=new((h=a.clone()).ValueBufferType)(l*h.times.length),d=0;d<h.times.length;d++)f[d*l+c]=h.values[d];h.name=(s.nodeName||"")+".morphTargetInfluences",h.values=f,n[u.uuid]=h,r.push(h)}else{var m=a.createInterpolant(new a.ValueBufferType(1));h=n[u.uuid];for(var y=0;y<h.times.length;y++)h.values[y*l+c]=m.evaluate(h.times[y]);for(var v=0;v<a.times.length;v++){var g=this.insertKeyframe(h,a.times[v]);h.values[g*l+c]=a.values[v]}}}}return e.tracks=r,e}},function(e,t,r,n){return new(r=r||Promise)((function(i,o){function a(e){try{u(n.next(e))}catch(e){o(e)}}function s(e){try{u(n.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(a,s)}u((n=n.apply(e,t||[])).next())}))});class bu extends Ca{constructor(){super(...arguments),this._gltf=new Ys,this.options=new Fs}getArrayBuffer(e=this.runScene.sceneEx.getClear(),t="scene"){return gu(this,void 0,void 0,(function*(){const r=new Ns({type:t,runScene:this.runScene});return yield r.init(e),e.traverse((e=>{console.log(e,"a")})),new Promise((t=>{this._gltf.parse(e,(e=>{t(e)}),{binary:!0,onlyVisible:!1,includeCustomExtensions:!0,myOptions:{helper:r,optionsEx:this.runScene.optionsEx}})}))}))}export(e){return gu(this,void 0,void 0,(function*(){var t=yield this.getArrayBuffer(e);(0,rt.downloadFile)(new Blob([t]),"scene.glb")}))}model(e){return gu(this,void 0,void 0,(function*(){const t=e||this.runScene.modelEx.select;var r,n;t&&(r=t.name||t.type,n=yield this.getArrayBuffer(t.clone(),"model"),(0,rt.downloadFile)(new Blob([n]),r+".glb"))}))}material(e){var t;return gu(this,void 0,void 0,(function*(){if(r=e||(null==(t=this.runScene.modelEx.select)?void 0:t.material)){const e=ms("Box");var r=(e.material=r).name||"material",n=yield this.getArrayBuffer(e,"material");(0,rt.downloadFile)(new Blob([n]),r+".glb")}}))}scene(){return gu(this,void 0,void 0,(function*(){var e=yield this.getArrayBuffer();(0,rt.downloadFile)(new Blob([e]),"scene.glb")}))}}class wu extends Ca{constructor(e){super(e),this.gltf=new bu(e)}}var xu={},Su=function(e){return URL.createObjectURL(new Blob([e],{type:"text/javascript"}))},_u=function(e){return new Worker(e)};try{URL.revokeObjectURL(Su(""))}catch(Lu){Su=function(e){return"data:application/javascript;charset=UTF-8,"+encodeURI(e)},_u=function(e){return new Worker(e,{type:"module"})}}for(var Tu=Uint8Array,Eu=Uint16Array,Ou=Uint32Array,Mu=new Tu([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]),Pu=new Tu([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]),Ru=new Tu([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),ku=(c=function(e,t){for(var r=new Eu(31),n=0;n<31;++n)r[n]=t+=1<<e[n-1];var i=new Ou(r[30]);for(n=1;n<30;++n)for(var o=r[n];o<r[n+1];++o)i[o]=o-r[n]<<5|n;return[r,i]},(Js=c(Mu,2))[0]),ju=Js[1],Au=(ku[28]=258,ju[258]=28,eu=c(Pu,0))[0],Cu=eu[1],Du=new Eu(32768),Lu=0;Lu<32768;++Lu){var zu=(43690&Lu)>>>1|(21845&Lu)<<1;Du[Lu]=((65280&(zu=(61680&(zu=(52428&zu)>>>2|(13107&zu)<<2))>>>4|(3855&zu)<<4))>>>8|(255&zu)<<8)>>>1}var Iu=function(e,t,r){for(var n=e.length,i=0,o=new Eu(t);i<n;++i)++o[e[i]-1];var a=new Eu(t);for(i=0;i<t;++i)a[i]=a[i-1]+o[i-1]<<1;if(r){var s=new Eu(1<<t),u=15-t;for(i=0;i<n;++i)if(e[i])for(var l=i<<4|e[i],c=t-e[i],h=a[e[i]-1]++<<c,f=h|(1<<c)-1;h<=f;++h)s[Du[h]>>>u]=l}else for(s=new Eu(n),i=0;i<n;++i)e[i]&&(s[i]=Du[a[e[i]-1]++]>>>15-e[i]);return s},Bu=new Tu(288);for(Lu=0;Lu<144;++Lu)Bu[Lu]=8;for(Lu=144;Lu<256;++Lu)Bu[Lu]=9;for(Lu=256;Lu<280;++Lu)Bu[Lu]=7;for(Lu=280;Lu<288;++Lu)Bu[Lu]=8;var Uu=new Tu(32);for(Lu=0;Lu<32;++Lu)Uu[Lu]=5;function Nu(e){return e.ondata=function(e,t){return postMessage([e,t],[e.buffer])},function(t){return e.push(t.data[0],t.data[1])}}function Fu(e,t,r,n,i){var o,a=vl(e,n,i,(function(e,r){e?(a.terminate(),t.ondata.call(t,e)):(r[1]&&a.terminate(),t.ondata.call(t,e,r[0],r[1]))}));a.postMessage(r),t.push=function(e,r){if(o)throw"stream finished";if(!t.ondata)throw"no stream handler";a.postMessage([e,o=r],[e.buffer])},t.terminate=function(){a.terminate()}}function Vu(e,t){return Pl(e,t)+4294967296*Pl(e,t+4)}var Hu=Iu(Bu,9,0),Gu=Iu(Bu,9,1),Wu=Iu(Uu,5,0),Xu=Iu(Uu,5,1),qu=function(e){for(var t=e[0],r=1;r<e.length;++r)e[r]>t&&(t=e[r]);return t},Yu=function(e,t,r){var n=t/8|0;return(e[n]|e[1+n]<<8)>>(7&t)&r},Zu=function(e,t){var r=t/8|0;return(e[r]|e[1+r]<<8|e[2+r]<<16)>>(7&t)},Qu=function(e){return(e/8|0)+(7&e&&1)},Ku=function(e,t,r){(null==r||r>e.length)&&(r=e.length);var n=new(e instanceof Eu?Eu:e instanceof Ou?Ou:Tu)(r-(t=null==t||t<0?0:t));return n.set(e.subarray(t,r)),n},Ju=function(e,t,r){var n=e.length;if(!n||r&&!r.l&&n<5)return t||new Tu(0);function i(e){var r=t.length;r<e&&((r=new Tu(Math.max(2*r,e))).set(t),t=r)}var o=!t||r,a=!r||r.i,s=(r=r||{},t=t||new Tu(3*n),r.f||0),u=r.p||0,l=r.b||0,c=r.l,h=r.d,f=r.m,p=r.n,d=8*n;do{if(!c){r.f=s=Yu(e,u,1);var m=Yu(e,u+1,3);if(u+=3,!m){var y=e[(E=Qu(u)+4)-4]|e[E-3]<<8;if(n<(S=E+y)){if(a)throw"unexpected EOF";break}o&&i(l+y),t.set(e.subarray(E,S),l),r.b=l+=y,r.p=u=8*S;continue}if(1==m)c=Gu,h=Xu,f=9,p=5;else{if(2!=m)throw"invalid block type";y=Yu(e,u,31)+257;for(var v=Yu(e,u+10,15)+4,g=y+Yu(e,u+5,31)+1,b=(u+=14,new Tu(g)),w=new Tu(19),x=0;x<v;++x)w[Ru[x]]=Yu(e,u+3*x,7);u+=3*v;var S,_=(1<<(S=qu(w)))-1,T=Iu(w,S,1);for(x=0;x<g;){var E,O=T[Yu(e,u,_)];if(u+=15&O,(E=O>>>4)<16)b[x++]=E;else{var M=0,P=0;for(16==E?(P=3+Yu(e,u,3),u+=2,M=b[x-1]):17==E?(P=3+Yu(e,u,7),u+=3):18==E&&(P=11+Yu(e,u,127),u+=7);P--;)b[x++]=M}}m=b.subarray(0,y);var R=b.subarray(y);f=qu(m),p=qu(R),c=Iu(m,f,1),h=Iu(R,p,1)}if(d<u){if(a)throw"unexpected EOF";break}}o&&i(l+131072);for(var k=(1<<f)-1,j=(1<<p)-1,A=u;;A=u){var C=(M=c[Zu(e,u)&k])>>>4;if(d<(u+=15&M)){if(a)throw"unexpected EOF";break}if(!M)throw"invalid length/literal";if(C<256)t[l++]=C;else{if(256==C){A=u,c=null;break}var D,L=C-254,z=(264<C&&(D=Mu[x=C-257],L=Yu(e,u,(1<<D)-1)+ku[x],u+=D),(C=h[Zu(e,u)&j])>>>4);if(!C)throw"invalid distance";if(u+=15&C,R=Au[z],3<z&&(D=Pu[z],R+=Zu(e,u)&(1<<D)-1,u+=D),d<u){if(a)throw"unexpected EOF";break}o&&i(l+131072);for(var I=l+L;l<I;l+=4)t[l]=t[l-R],t[l+1]=t[l+1-R],t[l+2]=t[l+2-R],t[l+3]=t[l+3-R];l=I}}r.l=c,r.p=A,r.b=l,c&&(s=1,r.m=f,r.d=h,r.n=p)}while(!s);return l==t.length?t:Ku(t,0,l)},$u=function(e,t,r){var n=t/8|0;e[n]|=r<<=7&t,e[1+n]|=r>>>8},el=function(e,t,r){var n=t/8|0;e[n]|=r<<=7&t,e[1+n]|=r>>>8,e[2+n]|=r>>>16},tl=function(e,t){for(var r=[],n=0;n<e.length;++n)e[n]&&r.push({s:n,f:e[n]});var i=r.length,o=r.slice();if(!i)return[ul,0];if(1==i)return(m=new Tu(r[0].s+1))[r[0].s]=1,[m,1];r.sort((function(e,t){return e.f-t.f})),r.push({s:-1,f:25001});var a=r[0],s=r[1],u=0,l=1,c=2;for(r[0]={s:-1,f:a.f+s.f,l:a,r:s};l!=i-1;)a=r[r[u].f<r[c].f?u++:c++],s=r[u!=l&&r[u].f<r[c].f?u++:c++],r[l++]={s:-1,f:a.f+s.f,l:a,r:s};var h=o[0].s;for(n=1;n<i;++n)o[n].s>h&&(h=o[n].s);var f=new Eu(h+1),p=rl(r[l-1],f,0);if(t<p){n=0;var d=0,m=p-t,y=1<<m;for(o.sort((function(e,t){return f[t.s]-f[e.s]||e.f-t.f}));n<i;++n){var v=o[n].s;if(!(f[v]>t))break;d+=y-(1<<p-f[v]),f[v]=t}for(d>>>=m;0<d;){var g=o[n].s;f[g]<t?d-=1<<t-f[g]++-1:++n}for(;0<=n&&d;--n){var b=o[n].s;f[b]==t&&(--f[b],++d)}p=t}return[new Tu(f),p]},rl=function e(t,r,n){return-1==t.s?Math.max(e(t.l,r,n+1),e(t.r,r,n+1)):r[t.s]=n},nl=function(e){for(var t=e.length;t&&!e[--t];);for(var r=new Eu(++t),n=0,i=e[0],o=1,a=function(e){r[n++]=e},s=1;s<=t;++s)if(e[s]==i&&s!=t)++o;else{if(!i&&2<o){for(;138<o;o-=138)a(32754);2<o&&(a(10<o?o-11<<5|28690:o-3<<5|12305),o=0)}else if(3<o){for(a(i),--o;6<o;o-=6)a(8304);2<o&&(a(o-3<<5|8208),o=0)}for(;o--;)a(i);o=1,i=e[s]}return[r.subarray(0,n),t]},il=function(e,t){for(var r=0,n=0;n<t.length;++n)r+=e[n]*t[n];return r},ol=function(e,t,r){var n=r.length,i=Qu(t+2);e[i]=255&n,e[i+1]=n>>>8,e[i+2]=255^e[i],e[i+3]=255^e[i+1];for(var o=0;o<n;++o)e[i+o+4]=r[o];return 8*(i+4+n)},al=function(e,t,r,n,i,o,a,s,u,l,c){$u(t,c++,r),++i[256];for(var h=(r=tl(i,15))[0],f=(r=r[1],(p=tl(o,15))[0]),p=p[1],d=(m=nl(h))[0],m=m[1],y=(v=nl(f))[0],v=v[1],g=new Eu(19),b=0;b<d.length;++b)g[31&d[b]]++;for(b=0;b<y.length;++b)g[31&y[b]]++;for(var w=(x=tl(g,7))[0],x=x[1],S=19;4<S&&!w[Ru[S-1]];--S);var _,T=l+5<<3,E=il(i,Bu)+il(o,Uu)+a;if(i=il(i,h)+il(o,f)+a+14+3*S+il(g,w)+(2*g[16]+3*g[17]+7*g[18]),T<=E&&T<=i)return ol(t,c,e.subarray(u,u+l));if($u(t,c,1+(i<E)),c+=2,i<E){var O=Iu(h,r,0),M=h,P=Iu(f,p,0),R=f,k=Iu(w,x,0);for($u(t,c,m-257),$u(t,c+5,v-1),$u(t,c+10,S-4),c+=14,b=0;b<S;++b)$u(t,c+3*b,w[Ru[b]]);c+=3*S;for(var j=[d,y],A=0;A<2;++A){var C=j[A];for(b=0;b<C.length;++b){var D=31&C[b];$u(t,c,k[D]),c+=w[D],15<D&&($u(t,c,C[b]>>>5&127),c+=C[b]>>>12)}}}else O=Hu,M=Bu,P=Wu,R=Uu;for(b=0;b<s;++b)255<n[b]?(D=n[b]>>>18&31,el(t,c,O[D+257]),c+=M[D+257],7<D&&($u(t,c,n[b]>>>23&31),c+=Mu[D]),_=31&n[b],el(t,c,P[_]),c+=R[_],3<_&&(el(t,c,n[b]>>>5&8191),c+=Pu[_])):(el(t,c,O[n[b]]),c+=M[n[b]]);return el(t,c,O[256]),c+M[256]},sl=new Ou([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),ul=new Tu(0),ll=function(e,t,r,n,i,o){var a=e.length,s=new Tu(n+a+5*(1+Math.ceil(a/7e3))+i),u=s.subarray(n,s.length-i),l=0;if(!t||a<8)for(var c=0;c<=a;c+=65535){var h=c+65535;l=h<a?ol(u,l,e.subarray(c,h)):(u[c]=o,ol(u,l,e.subarray(c,a)))}else{for(var f=(t=sl[t-1])>>>13,p=8191&t,d=(1<<r)-1,m=new Eu(32768),y=new Eu(1+d),v=Math.ceil(r/3),g=2*v,b=function(t){return(e[t]^e[t+1]<<v^e[t+2]<<g)&d},w=new Ou(25e3),x=new Eu(288),S=new Eu(32),_=0,T=0,E=(c=0,0),O=0,M=0;c<a;++c){var P=b(c),R=32767&c,k=y[P];if(m[R]=k,y[P]=R,O<=c){var j=a-c;if((7e3<_||24576<E)&&423<j){l=al(e,u,0,w,x,S,T,E,M,c-M,l),E=_=T=0,M=c;for(var A=0;A<286;++A)x[A]=0;for(A=0;A<30;++A)S[A]=0}var C=2,D=0,L=p,z=R-k&32767;if(2<j&&P==b(c-z))for(var I=Math.min(f,j)-1,B=Math.min(32767,c),U=Math.min(258,j);z<=B&&--L&&R!=k;){if(e[c+C]==e[c+C-z]){for(var N=0;N<U&&e[c+N]==e[c+N-z];++N);if(C<N){if(D=z,I<(C=N))break;var F=Math.min(z,N-2),V=0;for(A=0;A<F;++A){var H=c-z+A+32768&32767,G=H-m[H]+32768&32767;V<G&&(V=G,k=H)}}}z+=(R=k)-(k=m[R])+32768&32767}D?(w[E++]=268435456|ju[C]<<18|Cu[D],P=31&ju[C],j=31&Cu[D],T+=Mu[P]+Pu[j],++x[257+P],++S[j],O=c+C,++_):(w[E++]=e[c],++x[e[c]])}}l=al(e,u,o,w,x,S,T,E,M,c-M,l),!o&&7&l&&(l=ol(u,l+1,ul))}return Ku(s,0,n+Qu(l)+i)},cl=function(){for(var e=new Ou(256),t=0;t<256;++t){for(var r=t,n=9;--n;)r=(1&r&&3988292384)^r>>>1;e[t]=r}return e}(),hl=function(){var e=-1;return{p:function(t){for(var r=e,n=0;n<t.length;++n)r=cl[255&r^t[n]]^r>>>8;e=r},d:function(){return~e}}},fl=function(){var e=1,t=0;return{p:function(r){for(var n=e,i=t,o=r.length,a=0;a!=o;){for(var s=Math.min(a+2655,o);a<s;++a)i+=n+=r[a];n=(65535&n)+15*(n>>16),i=(65535&i)+15*(i>>16)}e=n,t=i},d:function(){return(255&(e%=65521))<<24|e>>>8<<16|(255&(t%=65521))<<8|t>>>8}}},pl=function(e,t,r,n,i){return ll(e,null==t.level?6:t.level,null==t.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):12+t.mem,r,n,!i)},dl=function(e,t){var r,n={};for(r in e)n[r]=e[r];for(r in t)n[r]=t[r];return n},ml=function(e,t,r){for(var n=e(),i=(e=e.toString()).slice(e.indexOf("[")+1,e.lastIndexOf("]")).replace(/ /g,"").split(","),o=0;o<n.length;++o){var a=n[o],s=i[o];if("function"==typeof a){t+=";"+s+"=";var u=a.toString();if(a.prototype)if(-1!=u.indexOf("[native code]")){var l=u.indexOf(" ",8)+1;t+=u.slice(l,u.indexOf("(",l))}else for(var c in t+=u,a.prototype)t+=";"+s+".prototype."+c+"="+a.prototype[c].toString();else t+=u}else r[s]=a}return[t,r]},yl=[],vl=function(e,t,r,n){var i;if(!yl[r]){for(var o="",a={},s=e.length-1,u=0;u<s;++u)o=(i=ml(e[u],o,a))[0],a=i[1];yl[r]=ml(e[s],o,a)}var l=dl({},yl[r][1]);return function(e,t,r,n,i){return(t=_u(xu[t]||(xu[t]=Su(e)))).onerror=function(e){return i(e.error,null)},t.onmessage=function(e){return i(null,e.data)},t.postMessage(r,n),t}(yl[r][0]+";onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage="+t.toString()+"}",r,l,function(e){var t,r=[];for(t in e)(e[t]instanceof Tu||e[t]instanceof Eu||e[t]instanceof Ou)&&r.push((e[t]=new e[t].constructor(e[t])).buffer);return r}(l),n)},gl=function(){return[Tu,Eu,Ou,Mu,Pu,Ru,ku,Au,Gu,Xu,Du,Iu,qu,Yu,Zu,Qu,Ku,Ju,Gl,Tl,El]},bl=function(){return[Tu,Eu,Ou,Mu,Pu,Ru,ju,Cu,Hu,Bu,Wu,Uu,Du,sl,ul,Iu,$u,el,tl,rl,nl,il,ol,al,Qu,Ku,ll,pl,Nl,Tl]},wl=function(){return[kl,Cl,Rl,hl,cl]},xl=function(){return[jl,Al]},Sl=function(){return[Dl,Rl,fl]},_l=function(){return[Ll]},Tl=function(e){return postMessage(e,[e.buffer])},El=function(e){return e&&e.size&&new Tu(e.size)},Ol=function(e,t,r,n,i,o){var a=vl(r,n,i,(function(e,t){a.terminate(),o(e,t)}));return a.postMessage([e,t],t.consume?[e.buffer]:[]),function(){a.terminate()}},Ml=function(e,t){return e[t]|e[t+1]<<8},Pl=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},Rl=function(e,t,r){for(;r;++t)e[t]=r,r>>>=8},kl=function(e,t){var r=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=t.level<2?4:9==t.level?2:0,e[9]=3,0!=t.mtime&&Rl(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),r){e[3]=8;for(var n=0;n<=r.length;++n)e[n+10]=r.charCodeAt(n)}},jl=function(e){if(31!=e[0]||139!=e[1]||8!=e[2])throw"invalid gzip data";var t=e[3],r=10;4&t&&(r+=e[10]|2+(e[11]<<8));for(var n=(t>>3&1)+(t>>4&1);0<n;n-=!e[r++]);return r+(2&t)},Al=function(e){var t=e.length;return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0},Cl=function(e){return 10+(e.filename&&e.filename.length+1||0)},Dl=function(e,t){t=0==(t=t.level)?0:t<6?1:9==t?3:2,e[0]=120,e[1]=t<<6|(t?32-2*t:1)},Ll=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"};function zl(e,t){return t||"function"!=typeof e||(t=e,e={}),this.ondata=t,e}var Il=function(){function e(e,t){t||"function"!=typeof e||(t=e,e={}),this.ondata=t,this.o=e||{}}return e.prototype.p=function(e,t){this.ondata(pl(e,this.o,0,0,!t),t)},e.prototype.push=function(e,t){if(this.d)throw"stream finished";if(!this.ondata)throw"no stream handler";this.d=t,this.p(e,t||!1)},e}(),Bl=function(e,t){Fu([bl,function(){return[Nu,Il]}],this,zl.call(this,e,t),(function(e){e=new Il(e.data),onmessage=Nu(e)}),6)};function Ul(e,t,r){if(r||(r=t,t={}),"function"!=typeof r)throw"no callback";return Ol(e,t,[bl],(function(e){return Tl(Nl(e.data[0],e.data[1]))}),0,r)}function Nl(e,t){return pl(e,t||{},0,0)}var Fl=function(){function e(e){this.s={},this.p=new Tu(0),this.ondata=e}return e.prototype.e=function(e){if(this.d)throw"stream finished";if(!this.ondata)throw"no stream handler";var t=this.p.length,r=new Tu(t+e.length);r.set(this.p),r.set(e,t),this.p=r},e.prototype.c=function(e){this.d=this.s.i=e||!1,e=this.s.b;var t=Ju(this.p,this.o,this.s);this.ondata(Ku(t,e,this.s.b),this.d),this.o=Ku(t,this.s.b-32768),this.s.b=this.o.length,this.p=Ku(this.p,this.s.p/8|0),this.s.p&=7},e.prototype.push=function(e,t){this.e(e),this.c(t)},e}(),Vl=function(e){this.ondata=e,Fu([gl,function(){return[Nu,Fl]}],this,0,(function(){var e=new Fl;onmessage=Nu(e)}),7)};function Hl(e,t,r){if(r||(r=t,t={}),"function"!=typeof r)throw"no callback";return Ol(e,t,[gl],(function(e){return Tl(Gl(e.data[0],El(e.data[1])))}),1,r)}function Gl(e,t){return Ju(e,t)}var Wl=function(){function e(e,t){this.c=hl(),this.l=0,this.v=1,Il.call(this,e,t)}return e.prototype.push=function(e,t){Il.prototype.push.call(this,e,t)},e.prototype.p=function(e,t){this.c.p(e),this.l+=e.length,e=pl(e,this.o,this.v&&Cl(this.o),t&&8,!t),this.v&&(kl(e,this.o),this.v=0),t&&(Rl(e,e.length-8,this.c.d()),Rl(e,e.length-4,this.l)),this.ondata(e,t)},e}(),Xl=function(e,t){Fu([bl,wl,function(){return[Nu,Il,Wl]}],this,zl.call(this,e,t),(function(e){e=new Wl(e.data),onmessage=Nu(e)}),8)};function ql(e,t,r){if(r||(r=t,t={}),"function"!=typeof r)throw"no callback";return Ol(e,t,[bl,wl,function(){return[Yl]}],(function(e){return Tl(Yl(e.data[0],e.data[1]))}),2,r)}function Yl(e,t){t=t||{};var r=hl(),n=e.length,i=(r.p(e),e=pl(e,t,Cl(t),8)).length;return kl(e,t),Rl(e,i-8,r.d()),Rl(e,i-4,n),e}var Zl=function(){function e(e){this.v=1,Fl.call(this,e)}return e.prototype.push=function(e,t){if(Fl.prototype.e.call(this,e),this.v){if((e=3<this.p.length?jl(this.p):4)>=this.p.length&&!t)return;this.p=this.p.subarray(e),this.v=0}if(t){if(this.p.length<8)throw"invalid gzip stream";this.p=this.p.subarray(0,-8)}Fl.prototype.c.call(this,t)},e}(),Ql=function(e){this.ondata=e,Fu([gl,xl,function(){return[Nu,Fl,Zl]}],this,0,(function(){var e=new Zl;onmessage=Nu(e)}),9)};function Kl(e,t,r){if(r||(r=t,t={}),"function"!=typeof r)throw"no callback";return Ol(e,t,[gl,xl,function(){return[Jl]}],(function(e){return Tl(Jl(e.data[0]))}),3,r)}function Jl(e,t){return Ju(e.subarray(jl(e),-8),t||new Tu(Al(e)))}var $l=function(){function e(e,t){this.c=fl(),this.v=1,Il.call(this,e,t)}return e.prototype.push=function(e,t){Il.prototype.push.call(this,e,t)},e.prototype.p=function(e,t){this.c.p(e),e=pl(e,this.o,this.v&&2,t&&4,!t),this.v&&(Dl(e,this.o),this.v=0),t&&Rl(e,e.length-4,this.c.d()),this.ondata(e,t)},e}(),ec=function(e,t){Fu([bl,Sl,function(){return[Nu,Il,$l]}],this,zl.call(this,e,t),(function(e){e=new $l(e.data),onmessage=Nu(e)}),10)};function tc(e,t){t=t||{};var r=fl();return r.p(e),e=pl(e,t,2,4),Dl(e,t),Rl(e,e.length-4,r.d()),e}var rc=function(){function e(e){this.v=1,Fl.call(this,e)}return e.prototype.push=function(e,t){if(Fl.prototype.e.call(this,e),this.v){if(this.p.length<2&&!t)return;this.p=this.p.subarray(2),this.v=0}if(t){if(this.p.length<4)throw"invalid zlib stream";this.p=this.p.subarray(0,-4)}Fl.prototype.c.call(this,t)},e}(),nc=function(e){this.ondata=e,Fu([gl,_l,function(){return[Nu,Fl,rc]}],this,0,(function(){var e=new rc;onmessage=Nu(e)}),11)};function ic(e,t,r){if(r||(r=t,t={}),"function"!=typeof r)throw"no callback";return Ol(e,t,[gl,_l,function(){return[oc]}],(function(e){return Tl(oc(e.data[0],El(e.data[1])))}),5,r)}function oc(e,t){return Ju((Ll(e),e.subarray(2,-4)),t)}var ac=function(){function e(e){this.G=Zl,this.I=Fl,this.Z=rc,this.ondata=e}return e.prototype.push=function(e,t){if(!this.ondata)throw"no stream handler";var r,n;this.s?this.s.push(e,t):(this.p&&this.p.length?((r=new Tu(this.p.length+e.length)).set(this.p),r.set(e,this.p.length)):this.p=e,2<this.p.length&&((n=this).s=new(31==this.p[0]&&139==this.p[1]&&8==this.p[2]?this.G:8!=(15&this.p[0])||7<this.p[0]>>4||(this.p[0]<<8|this.p[1])%31?this.I:this.Z)((function(){n.ondata.apply(n,arguments)})),this.s.push(this.p,t),this.p=null))},e}(),sc=function(){function e(e){this.G=Ql,this.I=Vl,this.Z=nc,this.ondata=e}return e.prototype.push=function(e,t){ac.prototype.push.call(this,e,t)},e}(),uc=function e(t,r,n,i){for(var o in t){var a=t[o];o=r+o,a instanceof Tu?n[o]=[a,i]:Array.isArray(a)?n[o]=[a[0],dl(i,a[1])]:e(a,o+"/",n,i)}},lc="undefined"!=typeof TextEncoder&&new TextEncoder,cc="undefined"!=typeof TextDecoder&&new TextDecoder,hc=0;try{cc.decode(ul,{stream:!0}),hc=1}catch(Lu){}var fc=function(e){for(var t="",r=0;;){var n=e[r++],i=(127<n)+(223<n)+(239<n);if(r+i>e.length)return[t,Ku(e,r-1)];i?3==i?(n=((15&n)<<18|(63&e[r++])<<12|(63&e[r++])<<6|63&e[r++])-65536,t+=String.fromCharCode(55296|n>>10,56320|1023&n)):t+=1&i?String.fromCharCode((31&n)<<6|63&e[r++]):String.fromCharCode((15&n)<<12|(63&e[r++])<<6|63&e[r++]):t+=String.fromCharCode(n)}},pc=function(){function e(e){this.ondata=e,hc?this.t=new TextDecoder:this.p=ul}return e.prototype.push=function(e,t){if(!this.ondata)throw"no callback";if(t=!!t,this.t){if(this.ondata(this.t.decode(e,{stream:!0}),t),t){if(this.t.decode().length)throw"invalid utf-8 data";this.t=null}}else{if(!this.p)throw"stream finished";var r=((r=new Tu(this.p.length+e.length)).set(this.p),r.set(e,this.p.length),e=fc(r))[0];if(e=e[1],t){if(e.length)throw"invalid utf-8 data";this.p=null}else this.p=e;this.ondata(r,t)}},e}(),dc=function(){function e(e){this.ondata=e}return e.prototype.push=function(e,t){if(!this.ondata)throw"no callback";if(this.d)throw"stream finished";this.ondata(mc(e),this.d=t||!1)},e}();function mc(e,t){if(t){for(var r=new Tu(e.length),n=0;n<e.length;++n)r[n]=e.charCodeAt(n);return r}if(lc)return lc.encode(e);var i=e.length,o=new Tu(e.length+(e.length>>1)),a=0,s=function(e){o[a++]=e};for(n=0;n<i;++n){a+5>o.length&&((u=new Tu(a+8+(i-n<<1))).set(o),o=u);var u=e.charCodeAt(n);u<128||t?s(u):(u<2048?s(192|u>>6):(55295<u&&u<57344?(s(240|(u=65536+(1047552&u)|1023&e.charCodeAt(++n))>>18),s(128|u>>12&63)):s(224|u>>12),s(128|u>>6&63)),s(128|63&u))}return Ku(o,0,a)}function yc(e,t){if(t){for(var r="",n=0;n<e.length;n+=16384)r+=String.fromCharCode.apply(null,e.subarray(n,n+16384));return r}if(cc)return cc.decode(e);var i=(t=fc(e))[0];if(t[1].length)throw"invalid utf-8 data";return i}function vc(e){return 1==e?3:e<6?2:9==e?1:0}var gc=function(e,t){return t+30+Ml(e,t+26)+Ml(e,t+28)},bc=function(e,t,r){var n=Ml(e,t+28),i=yc(e.subarray(t+46,t+46+n),!(2048&Ml(e,t+8))),o=(n=t+46+n,Pl(e,t+20)),a=(o=(r=r&&4294967295==o?wc(e,n):[o,Pl(e,t+24),Pl(e,t+42)])[0],r[1]);return r=r[2],[Ml(e,t+10),o,a,i,n+Ml(e,t+30)+Ml(e,t+32),r]},wc=function(e,t){for(;1!=Ml(e,t);t+=4+Ml(e,t+2));return[Vu(e,t+12),Vu(e,t+4),Vu(e,t+20)]},xc=function(e){var t=0;if(e)for(var r in e){if(65535<(r=e[r].length))throw"extra field too long";t+=r+4}return t},Sc=function(e,t,r,n,i,o,a,s){var u=n.length,l=r.extra,c=s&&s.length,h=xc(l),f=(Rl(e,t,null!=a?33639248:67324752),t+=4,null!=a&&(e[t++]=20,e[t++]=r.os),e[t]=20,t+=2,e[t++]=r.flag<<1|(null==o&&8),e[t++]=i&&8,e[t++]=255&r.compression,e[t++]=r.compression>>8,i=new Date(null==r.mtime?Date.now():r.mtime)).getFullYear()-1980;if(f<0||119<f)throw"date not in range 1980-2099";if(Rl(e,t,f<<25|i.getMonth()+1<<21|i.getDate()<<16|i.getHours()<<11|i.getMinutes()<<5|i.getSeconds()>>>1),t+=4,null!=o&&(Rl(e,t,r.crc),Rl(e,t+4,o),Rl(e,t+8,r.size)),Rl(e,t+12,u),Rl(e,t+14,h),t+=16,null!=a&&(Rl(e,t,c),Rl(e,t+6,r.attrs),Rl(e,t+10,a),t+=14),e.set(n,t),t+=u,h)for(var p in l){var d=l[p],m=d.length;Rl(e,t,+p),Rl(e,t+2,m),e.set(d,t+4),t+=4+m}return c&&(e.set(s,t),t+=c),t},_c=function(e,t,r,n,i){Rl(e,t,101010256),Rl(e,t+8,r),Rl(e,t+10,r),Rl(e,t+12,n),Rl(e,t+16,i)},Tc=function(){function e(e){this.filename=e,this.c=hl(),this.size=0,this.compression=0}return e.prototype.process=function(e,t){this.ondata(null,e,t)},e.prototype.push=function(e,t){if(!this.ondata)throw"no callback - add to ZIP archive before pushing";this.c.p(e),this.size+=e.length,t&&(this.crc=this.c.d()),this.process(e,t||!1)},e}(),Ec=function(){function e(e,t){var r=this;t=t||{},Tc.call(this,e),this.d=new Il(t,(function(e,t){r.ondata(null,e,t)})),this.compression=8,this.flag=vc(t.level)}return e.prototype.process=function(e,t){try{this.d.push(e,t)}catch(e){this.ondata(e,null,t)}},e.prototype.push=function(e,t){Tc.prototype.push.call(this,e,t)},e}(),Oc=function(){function e(e,t){var r=this;t=t||{},Tc.call(this,e),this.d=new Bl(t,(function(e,t,n){r.ondata(e,t,n)})),this.compression=8,this.flag=vc(t.level),this.terminate=this.d.terminate}return e.prototype.process=function(e,t){this.d.push(e,t)},e.prototype.push=function(e,t){Tc.prototype.push.call(this,e,t)},e}(),Mc=function(){function e(e){this.ondata=e,this.u=[],this.d=1}return e.prototype.add=function(e){var t=this;if(2&this.d)throw"stream finished";var r=mc(e.filename),n=r.length,i=(o=e.comment)&&mc(o),o=n!=e.filename.length||i&&o.length!=i.length,a=n+xc(e.extra)+30;if(65535<n)throw"filename too long";function s(){for(var e=0,r=u;e<r.length;e++){var n=r[e];t.ondata(null,n,!1)}u=[]}n=new Tu(a);var u=(Sc(n,0,e,r,o),[n]),l=this.d,c=(this.d=0,this.u.length),h=dl(e,{f:r,u:o,o:i,t:function(){e.terminate&&e.terminate()},r:function(){var e;s(),l&&((e=t.u[c+1])?e.r():t.d=1),l=1}}),f=0;e.ondata=function(r,n,i){r?(t.ondata(r,n,i),t.terminate()):(f+=n.length,u.push(n),i?(r=new Tu(16),Rl(r,0,134695760),Rl(r,4,e.crc),Rl(r,8,f),Rl(r,12,e.size),u.push(r),h.c=f,h.b=a+f+16,h.crc=e.crc,h.size=e.size,l&&h.r(),l=1):l&&s())},this.u.push(h)},e.prototype.end=function(){var e=this;if(2&this.d){if(1&this.d)throw"stream finishing";throw"stream finished"}this.d?this.e():this.u.push({r:function(){1&e.d&&(e.u.splice(-1,1),e.e())},t:function(){}}),this.d=3},e.prototype.e=function(){for(var e=0,t=0,r=0,n=0,i=this.u;n<i.length;n++)r+=46+(u=i[n]).f.length+xc(u.extra)+(u.o?u.o.length:0);for(var o=new Tu(r+22),a=0,s=this.u;a<s.length;a++){var u=s[a];Sc(o,e,u,u.f,u.u,u.c,t,u.o),e+=46+u.f.length+xc(u.extra)+(u.o?u.o.length:0),t+=u.b}_c(o,e,this.u.length,r,t),this.ondata(null,o,!0),this.d=2},e.prototype.terminate=function(){for(var e=0,t=this.u;e<t.length;e++)t[e].t();this.d=2},e}(),Pc=function(){function e(){}return e.prototype.push=function(e,t){this.ondata(null,e,t)},e.compression=0,e}(),Rc=function(){function e(){var e=this;this.i=new Fl((function(t,r){e.ondata(null,t,r)}))}return e.prototype.push=function(e,t){try{this.i.push(e,t)}catch(r){this.ondata(r,e,t)}},e.compression=8,e}(),kc=function(){function e(e,t){var r=this;t<32e4?this.i=new Fl((function(e,t){r.ondata(null,e,t)})):(this.i=new Vl((function(e,t,n){r.ondata(e,t,n)})),this.terminate=this.i.terminate)}return e.prototype.push=function(e,t){this.i.terminate&&(e=Ku(e,0)),this.i.push(e,t)},e.compression=8,e}(),jc=function(){function e(e){this.onfile=e,this.k=[],this.o={0:Pc},this.p=ul}return e.prototype.push=function(e,t){var r=this;if(!this.onfile)throw"no callback";if(!this.p)throw"stream finished";if(0<this.c){var n=Math.min(this.c,e.length),i=e.subarray(0,n);if(this.c-=n,this.d?this.d.push(i,!this.c):this.k[0].push(i),(e=e.subarray(n)).length)return this.push(e,t)}else{for(var o=0,a=0,s=void 0,u=void 0,l=(this.p.length?e.length?((u=new Tu(this.p.length+e.length)).set(this.p),u.set(e,this.p.length)):u=this.p:u=e,u.length),c=this.c,h=(i=c&&this.d,this);a<l-4&&"break"!==function(){var e,t,n,i,f,p,d,m,y,v,g,b=Pl(u,a);return 67324752==b?(o=1,s=a,h.d=null,h.c=0,n=Ml(u,a+6),e=Ml(u,a+8),t=2048&n,n&=8,i=Ml(u,a+26),f=Ml(u,a+28),a+30+i+f<l&&(h.k.unshift(p=[]),o=2,d=Pl(u,a+18),m=Pl(u,a+22),y=yc(u.subarray(a+30,a+=30+i),!t),4294967295==d?(i=n?[-2]:wc(u,a),d=i[0],m=i[1]):n&&(d=-1),a+=f,h.c=d,g={name:y,compression:e,start:function(){if(!g.ondata)throw"no callback";if(d){var t=r.o[e];if(!t)throw"unknown compression type "+e;(v=d<0?new t(y):new t(y,d,m)).ondata=function(e,t,r){g.ondata(e,t,r)};for(var n=0,i=p;n<i.length;n++)v.push(i[n],!1);r.k[0]==p&&r.c?r.d=v:v.push(ul,!0)}else g.ondata(null,ul,!0)},terminate:function(){v&&v.terminate&&v.terminate()}},0<=d&&(g.size=d,g.originalSize=m),h.onfile(g)),"break"):c?134695760==b?(s=a+=12+(-2==c&&8),o=3,h.c=0,"break"):33639248==b?(s=a-=4,o=3,h.c=0,"break"):void 0:void 0}();++a);if(this.p=ul,c<0&&(n=o?u.subarray(0,s-12-(-2==c&&8)-(134695760==Pl(u,s-16)&&4)):u.subarray(0,a),i?i.push(n,!!o):this.k[+(2==o)].push(n)),2&o)return this.push(u.subarray(a),t);this.p=u.subarray(a)}if(t){if(this.c)throw"invalid zip file";this.p=null}},e.prototype.register=function(e){this.o[e.compression]=e},e}();function Ac(e,t,r){var n=r.length-e-1;if(t>=r[n])return n-1;if(t<=r[e])return e;for(var i=e,o=n,a=Math.floor((i+o)/2);t<r[a]||t>=r[a+1];)t<r[a]?o=a:i=a,a=Math.floor((i+o)/2);return a}function Cc(e,t,r,n){for(var i=[],o=[],a=[],s=i[0]=1;s<=r;++s){o[s]=t-n[e+1-s],a[s]=n[e+s]-t;for(var u=0,l=0;l<s;++l){var c=a[l+1],h=o[s-l],f=i[l]/(c+h);i[l]=u+c*f,u=h*f}i[s]=u}return i}function Dc(e,t,r,n,i){for(var o=i<e?i:e,a=[],s=Ac(e,n,t),u=function(e,t,r,n,i){for(var o=[],a=0;a<=r;++a)o[a]=0;for(var s=[],u=0;u<=n;++u)s[u]=o.slice(0);for(var l=[],c=0;c<=r;++c)l[c]=o.slice(0);l[0][0]=1;for(var h=o.slice(0),f=o.slice(0),p=1;p<=r;++p){h[p]=t-i[e+1-p],f[p]=i[e+p]-t;for(var d=0,m=0;m<p;++m){var y=f[m+1],v=h[p-m],g=(l[p][m]=y+v,l[m][p-1]/l[p][m]);l[m][p]=d+y*g,d=v*g}l[p][p]=d}for(var b=0;b<=r;++b)s[0][b]=l[b][r];for(var w=0;w<=r;++w){for(var x=0,S=1,_=[],T=0;T<=r;++T)_[T]=o.slice(0);for(var E=_[0][0]=1;E<=n;++E){var O=0,M=w-E,P=r-E;E<=w&&(_[S][0]=_[x][0]/l[1+P][M],O=_[S][0]*l[M][P]);for(var R=w-1<=P?E-1:r-w,k=-1<=M?1:-M;k<=R;++k)_[S][k]=(_[x][k]-_[x][k-1])/l[1+P][M+k],O+=_[S][k]*l[M+k][P];w<=P&&(_[S][E]=-_[x][E-1]/l[1+P][w],O+=_[S][E]*l[w][P]),s[E][w]=O;var j=x;x=S,S=j}}for(var A=r,C=1;C<=n;++C){for(var D=0;D<=r;++D)s[C][D]*=A;A*=r-C}return s}(s,n,e,o,t),l=[],c=0;c<r.length;++c){var h=r[c].clone(),f=h.w;h.x*=f,h.y*=f,h.z*=f,l[c]=h}for(var d=0;d<=o;++d){for(var m=l[s-e].clone().multiplyScalar(u[d][0]),y=1;y<=e;++y)m.add(l[s-e+y].clone().multiplyScalar(u[d][y]));a[d]=m}for(var v=o+1;v<=i+1;++v)a[v]=new p.Vector4(0,0,0);return a}function Lc(e){for(var t=e.length,r=[],n=[],i=0;i<t;++i){var o=e[i];r[i]=new p.Vector3(o.x,o.y,o.z),n[i]=o.w}for(var a=[],s=0;s<t;++s){for(var u=r[s].clone(),l=1;l<=s;++l)u.sub(a[s-l].clone().multiplyScalar(function(e,t){for(var r=1,n=2;n<=e;++n)r*=n;for(var i=1,o=2;o<=t;++o)i*=o;for(var a=2;a<=e-t;++a)i*=a;return r/i}(s,l)*n[l]));a[s]=u.divideScalar(n[0])}return a}function zc(e){return(zc="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 Ic(e,t){return(Ic=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Bc(e){return(Bc=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Uc,Nc,Fc,Vc=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ic(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Bc(e);if(r=t?(r=Bc(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===zc(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(e,t,i,o,a){var s;if(!(this instanceof n))throw new TypeError("Cannot call a class as a function");(s=r.call(this)).degree=e,s.knots=t,s.controlPoints=[],s.startKnot=o||0,s.endKnot=a||s.knots.length-1;for(var u=0;u<i.length;++u){var l=i[u];s.controlPoints[u]=new p.Vector4(l.x,l.y,l.z,l.w)}return s}return t=n,(e=[{key:"getPoint",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new p.Vector3;return e=this.knots[this.startKnot]+e*(this.knots[this.endKnot]-this.knots[this.startKnot]),e=function(e,t,r,n){for(var i=Ac(e,n,t),o=Cc(i,n,e,t),a=new p.Vector4(0,0,0,0),s=0;s<=e;++s){var u=r[i-e+s],l=o[s],c=u.w*l;a.x+=u.x*c,a.y+=u.y*c,a.z+=u.z*c,a.w+=u.w*l}return a}(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 p.Vector3,r=(e=this.knots[0]+e*(this.knots[this.knots.length-1]-this.knots[0]),Lc(Dc(r=this.degree,this.knots,this.controlPoints,e,1)));return t.copy(r[1]).normalize(),t}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),n}(p.Curve);function Hc(e){return(Hc="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 Gc(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Wc(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Xc(e,t,r){t&&Wc(e.prototype,t),r&&Wc(e,r),Object.defineProperty(e,"prototype",{writable:!1})}function qc(e,t){return(qc=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Yc(e){return(Yc=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Zc=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&qc(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Yc(e);if(r=t?(r=Yc(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Hc(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(e){return Gc(this,n),r.call(this,e)}return Xc(n,[{key:"load",value:function(e,t,r,n){var i=this,o=""===i.path?p.LoaderUtils.extractUrlBase(e):i.path,a=new p.FileLoader(this.manager);a.setPath(i.path),a.setResponseType("arraybuffer"),a.setRequestHeader(i.requestHeader),a.setWithCredentials(i.withCredentials),a.load(e,(function(r){try{t(i.parse(r,o))}catch(r){n?n(r):console.error(r),i.manager.itemError(e)}}),r,n)}},{key:"parse",value:function(e,t){if(n="Kaydara FBX Binary \0",(r=e).byteLength>=n.length&&n===fh(r,0,n.length))Uc=(new eh).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","\\","\\"],r=0,n=0;n<t.length;++n)if(function(t){var n=e[0];return e=e.slice(r+1),r++,n}()===t[n])return;return 1}(r=fh(e)))throw new Error("THREE.FBXLoader: Unknown format.");if(nh(r)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+nh(r));Uc=(new $c).parse(r)}var r,n=new p.TextureLoader(this.manager).setPath(this.resourcePath||t).setCrossOrigin(this.crossOrigin);return new Qc(n,this.manager).parse(Uc)}}]),n}(p.Loader),Qc=function(){function e(t,r){Gc(this,e),this.textureLoader=t,this.manager=r}return Xc(e,[{key:"parse",value:function(){Nc=this.parseConnections();var e=this.parseImages(),t=(e=this.parseTextures(e),e=this.parseMaterials(e),this.parseDeformers()),r=(new Kc).parse(t);return this.parseScene(t,r,e),Fc}},{key:"parseConnections",value:function(){var e=new Map;return"Connections"in Uc&&Uc.Connections.connections.forEach((function(t){var r=t[0],n=t[1],i=(t=t[2],e.has(r)||e.set(r,{parents:[],children:[]}),{ID:n,relationship:t});e.get(r).parents.push(i),e.has(n)||e.set(n,{parents:[],children:[]}),i={ID:r,relationship:t},e.get(n).children.push(i)})),e}},{key:"parseImages",value:function(){var e,t={},r={};if("Video"in Uc.Objects){var n,i=Uc.Objects.Video;for(n in i){var o,a,s=i[n];t[parseInt(n)]=s.RelativeFilename||s.Filename,"Content"in s&&(a=s.Content instanceof ArrayBuffer&&0<s.Content.byteLength,o="string"==typeof s.Content&&""!==s.Content,(a||o)&&(a=this.parseImage(i[n]),r[s.RelativeFilename||s.Filename]=a))}}for(e in t){var u=t[e];void 0!==r[u]?t[e]=r[u]:t[e]=t[e].split("\\").pop()}return t}},{key:"parseImage",value:function(e){var t,r=e.Content,n=e.RelativeFilename||e.Filename,i=n.slice(n.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 ",n),t="image/tga";break;default:return void console.warn('FBXLoader: Image type "'+i+'" is not supported.')}return"string"==typeof r?"data:"+t+";base64,"+r:(e=new Uint8Array(r),window.URL.createObjectURL(new Blob([e],{type:t})))}},{key:"parseTextures",value:function(e){var t=new Map;if("Texture"in Uc.Objects){var r,n=Uc.Objects.Texture;for(r in n){var i=this.parseTexture(n[r],e);t.set(parseInt(r),i)}}return t}},{key:"parseTexture",value:function(e,t){var r=((t=this.loadTexture(e,t)).ID=e.id,t.name=e.attrName,e.WrapModeU),n=e.WrapModeV;return r=void 0!==r?r.value:0,n=void 0!==n?n.value:0,t.wrapS=0===r?p.RepeatWrapping:p.ClampToEdgeWrapping,t.wrapT=0===n?p.RepeatWrapping:p.ClampToEdgeWrapping,"Scaling"in e&&(r=e.Scaling.value,t.repeat.x=r[0],t.repeat.y=r[1]),"Translation"in e&&(n=e.Translation.value,t.offset.x=n[0],t.offset.y=n[1]),t}},{key:"loadTexture",value:function(e,t){var r,n=this.textureLoader.path,i=Nc.get(e.id).children;return i="tga"===(void 0!==i&&0<i.length&&void 0!==t[i[0].ID]&&(0!==(r=t[i[0].ID]).indexOf("blob:")&&0!==r.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 p.Texture):(i.setPath(this.textureLoader.path),i.load(r)):"psd"===t?(console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for",e.RelativeFilename),new p.Texture):this.textureLoader.load(r),this.textureLoader.setPath(n),i}},{key:"parseMaterials",value:function(e){var t=new Map;if("Material"in Uc.Objects){var r,n=Uc.Objects.Material;for(r in n){var i=this.parseMaterial(n[r],e);null!==i&&t.set(parseInt(r),i)}}return t}},{key:"parseMaterial",value:function(e,t){var r,n=e.id,i=e.attrName,o=e.ShadingModel;if("object"===Hc(o)&&(o=o.value),!Nc.has(n))return null;switch(e=this.parseParameters(e,t,n),o.toLowerCase()){case"phong":r=new p.MeshPhongMaterial;break;case"lambert":r=new p.MeshLambertMaterial;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',o),r=new p.MeshPhongMaterial}return r.setValues(e),r.name=i,r}},{key:"parseParameters",value:function(e,t,r){var n={},i=(e.BumpFactor&&(n.bumpScale=e.BumpFactor.value),e.Diffuse?n.color=(new p.Color).fromArray(e.Diffuse.value):!e.DiffuseColor||"Color"!==e.DiffuseColor.type&&"ColorRGB"!==e.DiffuseColor.type||(n.color=(new p.Color).fromArray(e.DiffuseColor.value)),e.DisplacementFactor&&(n.displacementScale=e.DisplacementFactor.value),e.Emissive?n.emissive=(new p.Color).fromArray(e.Emissive.value):!e.EmissiveColor||"Color"!==e.EmissiveColor.type&&"ColorRGB"!==e.EmissiveColor.type||(n.emissive=(new p.Color).fromArray(e.EmissiveColor.value)),e.EmissiveFactor&&(n.emissiveIntensity=parseFloat(e.EmissiveFactor.value)),e.Opacity&&(n.opacity=parseFloat(e.Opacity.value)),n.opacity<1&&(n.transparent=!0),e.ReflectionFactor&&(n.reflectivity=e.ReflectionFactor.value),e.Shininess&&(n.shininess=e.Shininess.value),e.Specular?n.specular=(new p.Color).fromArray(e.Specular.value):e.SpecularColor&&"Color"===e.SpecularColor.type&&(n.specular=(new p.Color).fromArray(e.SpecularColor.value)),this);return Nc.get(r).children.forEach((function(e){var r=e.relationship;switch(r){case"Bump":n.bumpMap=i.getTexture(t,e.ID);break;case"Maya|TEX_ao_map":n.aoMap=i.getTexture(t,e.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":n.map=i.getTexture(t,e.ID),void 0!==n.map&&(n.map.encoding=p.sRGBEncoding);break;case"DisplacementColor":n.displacementMap=i.getTexture(t,e.ID);break;case"EmissiveColor":n.emissiveMap=i.getTexture(t,e.ID),void 0!==n.emissiveMap&&(n.emissiveMap.encoding=p.sRGBEncoding);break;case"NormalMap":case"Maya|TEX_normal_map":n.normalMap=i.getTexture(t,e.ID);break;case"ReflectionColor":n.envMap=i.getTexture(t,e.ID),void 0!==n.envMap&&(n.envMap.mapping=p.EquirectangularReflectionMapping,n.envMap.encoding=p.sRGBEncoding);break;case"SpecularColor":n.specularMap=i.getTexture(t,e.ID),void 0!==n.specularMap&&(n.specularMap.encoding=p.sRGBEncoding);break;case"TransparentColor":case"TransparencyFactor":n.alphaMap=i.getTexture(t,e.ID),n.transparent=!0;break;default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",r)}})),n}},{key:"getTexture",value:function(e,t){return"LayeredTexture"in Uc.Objects&&t in Uc.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),t=Nc.get(t).children[0].ID),e.get(t)}},{key:"parseDeformers",value:function(){var e={},t={};if("Deformer"in Uc.Objects){var r,n=Uc.Objects.Deformer;for(r in n){var i,o=n[r],a=Nc.get(parseInt(r));"Skin"===o.attrType?((i=this.parseSkeleton(a,n)).ID=r,1<a.parents.length&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),i.geometryID=a.parents[0].ID,e[r]=i):"BlendShape"===o.attrType&&((i={id:r}).rawTargets=this.parseMorphTargets(a,n),i.id=r,1<a.parents.length&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),t[r]=i)}}return{skeletons:e,morphTargets:t}}},{key:"parseSkeleton",value:function(e,t){var r=[];return e.children.forEach((function(e){var n=t[e.ID];"Cluster"===n.attrType&&(e={ID:e.ID,indices:[],weights:[],transformLink:(new p.Matrix4).fromArray(n.TransformLink.a)},"Indexes"in n&&(e.indices=n.Indexes.a,e.weights=n.Weights.a),r.push(e))})),{rawBones:r,bones:[]}}},{key:"parseMorphTargets",value:function(e,t){for(var r=[],n=0;n<e.children.length;n++){var i=e.children[n],o=t[i.ID],a={name:o.attrName,initialWeight:o.DeformPercent,id:o.id,fullWeights:o.FullWeights.a};if("BlendShapeChannel"!==o.attrType)return;a.geoID=Nc.get(parseInt(i.ID)).children.filter((function(e){return void 0===e.relationship}))[0].ID,r.push(a)}return r}},{key:"parseScene",value:function(e,t,r){Fc=new p.Group;var n=this.parseModels(e.skeletons,t,r),i=Uc.Objects.Model,o=this;n.forEach((function(e){var t=i[e.ID];o.setLookAtProperties(e,t),Nc.get(e.ID).parents.forEach((function(t){void 0!==(t=n.get(t.ID))&&t.add(e)})),null===e.parent&&Fc.add(e)})),this.bindSkeleton(e.skeletons,t,n),this.createAmbientLight(),Fc.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=lh(e.userData.transformData),e.applyMatrix4(t),e.updateWorldMatrix())})),r=(new Jc).parse(),1===Fc.children.length&&Fc.children[0].isGroup&&(Fc.children[0].animations=r,Fc=Fc.children[0]),Fc.animations=r}},{key:"parseModels",value:function(e,t,r){var n,i=new Map,o=Uc.Objects.Model;for(n in o){var a=parseInt(n),s=o[n],u=Nc.get(a),l=this.buildSkeleton(u,e,a,s.attrName);if(!l){switch(s.attrType){case"Camera":l=this.createCamera(u);break;case"Light":l=this.createLight(u);break;case"Mesh":l=this.createMesh(u,t,r);break;case"NurbsCurve":l=this.createCurve(u,t);break;case"LimbNode":case"Root":l=new p.Bone;break;default:l=new p.Group}l.name=s.attrName?p.PropertyBinding.sanitizeNodeName(s.attrName):"",l.ID=a}this.getTransformData(l,s),i.set(a,l)}return i}},{key:"buildSkeleton",value:function(e,t,r,n){var i=null;return e.parents.forEach((function(e){for(var o in t)!function(o){var a=t[o];a.rawBones.forEach((function(t,o){var s;t.ID===e.ID&&(s=i,(i=new p.Bone).matrixWorld.copy(t.transformLink),i.name=n?p.PropertyBinding.sanitizeNodeName(n):"",i.ID=r,a.bones[o]=i,null!==s&&i.add(s))}))}(o)})),i}},{key:"createCamera",value:function(e){var t,r;if(e.children.forEach((function(e){void 0!==(e=Uc.Objects.NodeAttribute[e.ID])&&(r=e)})),void 0===r)t=new p.Object3D;else{var n=0,i=(void 0!==r.CameraProjectionType&&1===r.CameraProjectionType.value&&(n=1),1),o=(void 0!==r.NearPlane&&(i=r.NearPlane.value/1e3),1e3),a=(void 0!==r.FarPlane&&(o=r.FarPlane.value/1e3),window.innerWidth),s=window.innerHeight,u=(void 0!==r.AspectWidth&&void 0!==r.AspectHeight&&(a=r.AspectWidth.value,s=r.AspectHeight.value),a/s),l=45,c=(void 0!==r.FieldOfView&&(l=r.FieldOfView.value),r.FocalLength?r.FocalLength.value:null);switch(n){case 0:t=new p.PerspectiveCamera(l,u,i,o),null!==c&&t.setFocalLength(c);break;case 1:t=new p.OrthographicCamera(-a/2,a/2,s/2,-s/2,i,o);break;default:console.warn("THREE.FBXLoader: Unknown camera type "+n+"."),t=new p.Object3D}}return t}},{key:"createLight",value:function(e){var t,r;if(e.children.forEach((function(e){void 0!==(e=Uc.Objects.NodeAttribute[e.ID])&&(r=e)})),void 0===r)t=new p.Object3D;else{e=void 0===r.LightType?0:r.LightType.value;var n=16777215,i=(void 0!==r.Color&&(n=(new p.Color).fromArray(r.Color.value)),void 0===r.Intensity?1:r.Intensity.value/100),o=(void 0!==r.CastLightOnObject&&0===r.CastLightOnObject.value&&(i=0),0);switch(void 0!==r.FarAttenuationEnd&&(o=void 0!==r.EnableFarAttenuation&&0===r.EnableFarAttenuation.value?0:r.FarAttenuationEnd.value),e){case 0:t=new p.PointLight(n,i,o,1);break;case 1:t=new p.DirectionalLight(n,i);break;case 2:var a=Math.PI/3,s=(void 0!==r.InnerAngle&&(a=p.MathUtils.degToRad(r.InnerAngle.value)),0);void 0!==r.OuterAngle&&(s=p.MathUtils.degToRad(r.OuterAngle.value),s=Math.max(s,1)),t=new p.SpotLight(n,i,o,a,s,1);break;default:console.warn("THREE.FBXLoader: Unknown light type "+r.LightType.value+", defaulting to a PointLight."),t=new p.PointLight(n,i)}void 0!==r.CastShadows&&1===r.CastShadows.value&&(t.castShadow=!0)}return t}},{key:"createMesh",value:function(e,t,r){var n,i=null,o=null,a=[];return e.children.forEach((function(e){t.has(e.ID)&&(i=t.get(e.ID)),r.has(e.ID)&&a.push(r.get(e.ID))})),1<a.length?o=a:0<a.length?o=a[0]:(o=new p.MeshPhongMaterial({color:13421772}),a.push(o)),"color"in i.attributes&&a.forEach((function(e){e.vertexColors=!0})),i.FBX_Deformer?(n=new p.SkinnedMesh(i,o)).normalizeSkinWeights():n=new p.Mesh(i,o),n}},{key:"createCurve",value:function(e,t){e=e.children.reduce((function(e,r){return t.has(r.ID)?t.get(r.ID):e}),null);var r=new p.LineBasicMaterial({color:3342591,linewidth:1});return new p.Line(e,r)}},{key:"getTransformData",value:function(e,t){var r={};"InheritType"in t&&(r.inheritType=parseInt(t.InheritType.value)),r.eulerOrder="RotationOrder"in t?ch(t.RotationOrder.value):"ZYX","Lcl_Translation"in t&&(r.translation=t.Lcl_Translation.value),"PreRotation"in t&&(r.preRotation=t.PreRotation.value),"Lcl_Rotation"in t&&(r.rotation=t.Lcl_Rotation.value),"PostRotation"in t&&(r.postRotation=t.PostRotation.value),"Lcl_Scaling"in t&&(r.scale=t.Lcl_Scaling.value),"ScalingOffset"in t&&(r.scalingOffset=t.ScalingOffset.value),"ScalingPivot"in t&&(r.scalingPivot=t.ScalingPivot.value),"RotationOffset"in t&&(r.rotationOffset=t.RotationOffset.value),"RotationPivot"in t&&(r.rotationPivot=t.RotationPivot.value),e.userData.transformData=r}},{key:"setLookAtProperties",value:function(e,t){"LookAtProperty"in t&&Nc.get(e.ID).children.forEach((function(t){"LookAtProperty"===t.relationship&&"Lcl_Translation"in(t=Uc.Objects.Model[t.ID])&&(t=t.Lcl_Translation.value,void 0!==e.target?(e.target.position.fromArray(t),Fc.add(e.target)):e.lookAt((new p.Vector3).fromArray(t)))}))}},{key:"bindSkeleton",value:function(e,t,r){var n,i=this.parsePoseNodes();for(n in e)!function(n){var o=e[n];Nc.get(parseInt(o.ID)).parents.forEach((function(e){t.has(e.ID)&&(e=e.ID,Nc.get(e).parents.forEach((function(e){r.has(e.ID)&&r.get(e.ID).bind(new p.Skeleton(o.bones),i[e.ID])})))}))}(n)}},{key:"parsePoseNodes",value:function(){var e={};if("Pose"in Uc.Objects){var t,r,n=Uc.Objects.Pose;for(t in n)"BindPose"===n[t].attrType&&0<n[t].NbPoseNodes&&(r=n[t].PoseNode,Array.isArray(r)?r.forEach((function(t){e[t.Node]=(new p.Matrix4).fromArray(t.Matrix.a)})):e[r.Node]=(new p.Matrix4).fromArray(r.Matrix.a))}return e}},{key:"createAmbientLight",value:function(){var e,t,r;"GlobalSettings"in Uc&&"AmbientColor"in Uc.GlobalSettings&&(r=(t=Uc.GlobalSettings.AmbientColor.value)[0],e=t[1],t=t[2],0===r&&0===e&&0===t||(r=new p.Color(r,e,t),Fc.add(new p.AmbientLight(r,1))))}}]),e}(),Kc=function(){function e(){Gc(this,e)}return Xc(e,[{key:"parse",value:function(e){var t=new Map;if("Geometry"in Uc.Objects){var r,n=Uc.Objects.Geometry;for(r in n){var i=Nc.get(parseInt(r));i=this.parseGeometry(i,n[r],e),t.set(parseInt(r),i)}}return t}},{key:"parseGeometry",value:function(e,t,r){switch(t.attrType){case"Mesh":return this.parseMeshGeometry(e,t,r);case"NurbsCurve":return this.parseNurbsGeometry(t)}}},{key:"parseMeshGeometry",value:function(e,t,r){var n,i=r.skeletons,o=[],a=e.parents.map((function(e){return Uc.Objects.Model[e.ID]}));if(0!==a.length)return n=e.children.reduce((function(e,t){return void 0!==i[t.ID]?i[t.ID]:e}),null),e.children.forEach((function(e){void 0!==r.morphTargets[e.ID]&&o.push(r.morphTargets[e.ID])})),e=a[0],a={},"RotationOrder"in e&&(a.eulerOrder=ch(e.RotationOrder.value)),"InheritType"in e&&(a.inheritType=parseInt(e.InheritType.value)),"GeometricTranslation"in e&&(a.translation=e.GeometricTranslation.value),"GeometricRotation"in e&&(a.rotation=e.GeometricRotation.value),"GeometricScaling"in e&&(a.scale=e.GeometricScaling.value),e=lh(a),this.genGeometry(t,n,o,e)}},{key:"genGeometry",value:function(e,t,r,n){var i,o,a=new p.BufferGeometry,s=(e.attrName&&(a.name=e.attrName),this.parseGeoNode(e,t)),u=this.genBuffers(s),l=new p.Float32BufferAttribute(u.vertex,3);return l.applyMatrix4(n),a.setAttribute("position",l),0<u.colors.length&&a.setAttribute("color",new p.Float32BufferAttribute(u.colors,3)),t&&(a.setAttribute("skinIndex",new p.Uint16BufferAttribute(u.weightsIndices,4)),a.setAttribute("skinWeight",new p.Float32BufferAttribute(u.vertexWeights,4)),a.FBX_Deformer=t),0<u.normal.length&&(l=(new p.Matrix3).getNormalMatrix(n),(t=new p.Float32BufferAttribute(u.normal,3)).applyNormalMatrix(l),a.setAttribute("normal",t)),u.uvs.forEach((function(e,t){var r="uv"+(t+1).toString();a.setAttribute(r=0===t?"uv":r,new p.Float32BufferAttribute(u.uvs[t],2))})),s.material&&"AllSame"!==s.material.mappingType&&(i=u.materialIndex[0],o=0,u.materialIndex.forEach((function(e,t){e!==i&&(a.addGroup(o,t-o,i),i=e,o=t)})),0<a.groups.length&&(t=(l=a.groups[a.groups.length-1]).start+l.count)!==u.materialIndex.length&&a.addGroup(t,u.materialIndex.length-t,i),0===a.groups.length&&a.addGroup(0,u.materialIndex.length,u.materialIndex[0])),this.addMorphTargets(a,e,r,n),a}},{key:"parseGeoNode",value:function(e,t){var r={};if(r.vertexPositions=void 0!==e.Vertices?e.Vertices.a:[],r.vertexIndices=void 0!==e.PolygonVertexIndex?e.PolygonVertexIndex.a:[],e.LayerElementColor&&(r.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&&(r.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&&(r.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){r.uv=[];for(var n=0;e.LayerElementUV[n];)e.LayerElementUV[n].UV&&r.uv.push(this.parseUVs(e.LayerElementUV[n])),n++}return r.weightTable={},null!==t&&(r.skeleton=t).rawBones.forEach((function(e,t){e.indices.forEach((function(n,i){void 0===r.weightTable[n]&&(r.weightTable[n]=[]),r.weightTable[n].push({id:t,weight:e.weights[i]})}))})),r}},{key:"genBuffers",value:function(e){var t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]},r=0,n=0,i=!1,o=[],a=[],s=[],u=[],l=[],c=[],h=this;return e.vertexIndices.forEach((function(f,p){var d,m,y,v,g=!1,b=(f<0&&(f^=-1,g=!0),[]),w=[];if(o.push(3*f,3*f+1,3*f+2),e.color&&(v=ah(p,r,f,e.color),s.push(v[0],v[1],v[2])),e.skeleton){for(void 0!==e.weightTable[f]&&e.weightTable[f].forEach((function(e){w.push(e.weight),b.push(e.id)})),4<w.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],y=[0,0,0,0],w.forEach((function(e,t){var r=e,n=b[t];y.forEach((function(e,t,i){e<r&&(i[t]=r,r=e,i=m[t],m[t]=n,n=i)}))})),b=m,w=y);w.length<4;)w.push(0),b.push(0);for(var x=0;x<4;++x)l.push(w[x]),c.push(b[x])}e.normal&&(v=ah(p,r,f,e.normal),a.push(v[0],v[1],v[2])),e.material&&"AllSame"!==e.material.mappingType&&(d=ah(p,r,f,e.material)[0]),e.uv&&e.uv.forEach((function(e,t){e=ah(p,r,f,e),void 0===u[t]&&(u[t]=[]),u[t].push(e[0]),u[t].push(e[1])})),n++,g&&(h.genFace(t,e,o,d,a,s,u,l,c,n),r++,n=0,o=[],a=[],s=[],u=[],l=[],c=[])})),t}},{key:"genFace",value:function(e,t,r,n,i,o,a,s,u,l){for(var c=2;c<l;c++)!function(l){e.vertex.push(t.vertexPositions[r[0]]),e.vertex.push(t.vertexPositions[r[1]]),e.vertex.push(t.vertexPositions[r[2]]),e.vertex.push(t.vertexPositions[r[3*(l-1)]]),e.vertex.push(t.vertexPositions[r[3*(l-1)+1]]),e.vertex.push(t.vertexPositions[r[3*(l-1)+2]]),e.vertex.push(t.vertexPositions[r[3*l]]),e.vertex.push(t.vertexPositions[r[3*l+1]]),e.vertex.push(t.vertexPositions[r[3*l+2]]),t.skeleton&&(e.vertexWeights.push(s[0]),e.vertexWeights.push(s[1]),e.vertexWeights.push(s[2]),e.vertexWeights.push(s[3]),e.vertexWeights.push(s[4*(l-1)]),e.vertexWeights.push(s[4*(l-1)+1]),e.vertexWeights.push(s[4*(l-1)+2]),e.vertexWeights.push(s[4*(l-1)+3]),e.vertexWeights.push(s[4*l]),e.vertexWeights.push(s[4*l+1]),e.vertexWeights.push(s[4*l+2]),e.vertexWeights.push(s[4*l+3]),e.weightsIndices.push(u[0]),e.weightsIndices.push(u[1]),e.weightsIndices.push(u[2]),e.weightsIndices.push(u[3]),e.weightsIndices.push(u[4*(l-1)]),e.weightsIndices.push(u[4*(l-1)+1]),e.weightsIndices.push(u[4*(l-1)+2]),e.weightsIndices.push(u[4*(l-1)+3]),e.weightsIndices.push(u[4*l]),e.weightsIndices.push(u[4*l+1]),e.weightsIndices.push(u[4*l+2]),e.weightsIndices.push(u[4*l+3])),t.color&&(e.colors.push(o[0]),e.colors.push(o[1]),e.colors.push(o[2]),e.colors.push(o[3*(l-1)]),e.colors.push(o[3*(l-1)+1]),e.colors.push(o[3*(l-1)+2]),e.colors.push(o[3*l]),e.colors.push(o[3*l+1]),e.colors.push(o[3*l+2])),t.material&&"AllSame"!==t.material.mappingType&&(e.materialIndex.push(n),e.materialIndex.push(n),e.materialIndex.push(n)),t.normal&&(e.normal.push(i[0]),e.normal.push(i[1]),e.normal.push(i[2]),e.normal.push(i[3*(l-1)]),e.normal.push(i[3*(l-1)+1]),e.normal.push(i[3*(l-1)+2]),e.normal.push(i[3*l]),e.normal.push(i[3*l+1]),e.normal.push(i[3*l+2])),t.uv&&t.uv.forEach((function(t,r){void 0===e.uvs[r]&&(e.uvs[r]=[]),e.uvs[r].push(a[r][0]),e.uvs[r].push(a[r][1]),e.uvs[r].push(a[r][2*(l-1)]),e.uvs[r].push(a[r][2*(l-1)+1]),e.uvs[r].push(a[r][2*l]),e.uvs[r].push(a[r][2*l+1])}))}(c)}},{key:"addMorphTargets",value:function(e,t,r,n){var i;0!==r.length&&(e.morphTargetsRelative=!0,e.morphAttributes.position=[],i=this,r.forEach((function(r){r.rawTargets.forEach((function(r){var o=Uc.Objects.Geometry[r.geoID];void 0!==o&&i.genMorphGeometry(e,t,o,n,r.name)}))})))}},{key:"genMorphGeometry",value:function(e,t,r,n,i){t=void 0!==t.PolygonVertexIndex?t.PolygonVertexIndex.a:[];for(var o=void 0!==r.Vertices?r.Vertices.a:[],a=void 0!==r.Indexes?r.Indexes.a:[],s=3*e.attributes.position.count,u=new Float32Array(s),l=0;l<a.length;l++){var c=3*a[l];u[c]=o[3*l],u[1+c]=o[3*l+1],u[2+c]=o[3*l+2]}s=this.genBuffers({vertexIndices:t,vertexPositions:u}),(t=new p.Float32BufferAttribute(s.vertex,3)).name=i||r.attrName,t.applyMatrix4(n),e.morphAttributes.position.push(t)}},{key:"parseNormals",value:function(e){var t=e.MappingInformationType,r=e.ReferenceInformationType,n=e.Normals.a,i=[];return"IndexToDirect"===r&&("NormalIndex"in e?i=e.NormalIndex.a:"NormalsIndex"in e&&(i=e.NormalsIndex.a)),{dataSize:3,buffer:n,indices:i,mappingType:t,referenceType:r}}},{key:"parseUVs",value:function(e){var t=e.MappingInformationType,r=e.ReferenceInformationType,n=[];return{dataSize:2,buffer:e.UV.a,indices:n="IndexToDirect"===r?e.UVIndex.a:n,mappingType:t,referenceType:r}}},{key:"parseVertexColors",value:function(e){var t=e.MappingInformationType,r=e.ReferenceInformationType,n=[];return{dataSize:4,buffer:e.Colors.a,indices:n="IndexToDirect"===r?e.ColorIndex.a:n,mappingType:t,referenceType:r}}},{key:"parseMaterialIndices",value:function(e){var t=e.MappingInformationType,r=e.ReferenceInformationType;if("NoMappingInformation"===t)return{dataSize:1,buffer:[0],indices:[0],mappingType:"AllSame",referenceType:r};for(var n=e.Materials.a,i=[],o=0;o<n.length;++o)i.push(o);return{dataSize:1,buffer:n,indices:i,mappingType:t,referenceType:r}}},{key:"parseNurbsGeometry",value:function(e){if(void 0===Vc)return console.error("THREE.FBXLoader: The loader relies on NURBSCurve for any nurbs present in the model. Nurbs will show up as empty geometry."),new p.BufferGeometry;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 p.BufferGeometry;for(var r=t-1,n=(t=e.KnotVector.a,[]),i=e.Points.a,o=0,a=i.length;o<a;o+=4)n.push((new p.Vector4).fromArray(i,o));if("Closed"===e.Form)n.push(n[0]);else if("Periodic"===e.Form)for(var s=r,u=t.length-1-s,l=0;l<r;++l)n.push(n[l]);return e=new Vc(r,t,n,s,u).getPoints(12*n.length),(new p.BufferGeometry).setFromPoints(e)}}]),e}(),Jc=function(){function e(){Gc(this,e)}return Xc(e,[{key:"parse",value:function(){var e=[],t=this.parseClips();if(void 0!==t)for(var r in t)r=t[r],r=this.addClip(r),e.push(r);return e}},{key:"parseClips",value:function(){var e;if(void 0!==Uc.Objects.AnimationCurve)return e=this.parseAnimationCurveNodes(),this.parseAnimationCurves(e),e=this.parseAnimationLayers(e),this.parseAnimStacks(e)}},{key:"parseAnimationCurveNodes",value:function(){var e,t=Uc.Objects.AnimationCurveNode,r=new Map;for(e in t){var n=t[e];null!==n.attrName.match(/S|R|T|DeformPercent/)&&(n={id:n.id,attr:n.attrName,curves:{}},r.set(n.id,n))}return r}},{key:"parseAnimationCurves",value:function(e){var t,r=Uc.Objects.AnimationCurve;for(t in r){var n,i={id:r[t].id,times:r[t].KeyTime.a.map(ih),values:r[t].KeyValueFloat.a},o=Nc.get(i.id);void 0!==o&&(n=o.parents[0].ID,(o=o.parents[0].relationship).match(/X/)?e.get(n).curves.x=i:o.match(/Y/)?e.get(n).curves.y=i:o.match(/Z/)?e.get(n).curves.z=i:o.match(/d|DeformPercent/)&&e.has(n)&&(e.get(n).curves.morph=i))}}},{key:"parseAnimationLayers",value:function(e){var t,r=Uc.Objects.AnimationLayer,n=new Map;for(t in r)!function(t){var r=[],i=Nc.get(parseInt(t));void 0!==i&&(i.children.forEach((function(t,n){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===r[n]){var o=Nc.get(t.ID).parents.filter((function(e){return void 0!==e.relationship}))[0].ID;if(void 0!==o){var a=Uc.Objects.Model[o.toString()];if(void 0===a)return void console.warn("THREE.FBXLoader: Encountered a unused curve.",t);var s={modelName:a.attrName?p.PropertyBinding.sanitizeNodeName(a.attrName):"",ID:a.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1]};Fc.traverse((function(e){e.ID===a.id&&(s.transform=e.matrix,e.userData.transformData&&(s.eulerOrder=e.userData.transformData.eulerOrder))})),s.transform||(s.transform=new p.Matrix4),"PreRotation"in a&&(s.preRotation=a.PreRotation.value),"PostRotation"in a&&(s.postRotation=a.PostRotation.value),r[n]=s}}r[n]&&(r[n][i.attr]=i)}else void 0!==i.curves.morph&&(void 0===r[n]&&(o=Nc.get(t.ID).parents.filter((function(e){return void 0!==e.relationship}))[0].ID,t=Nc.get(o).parents[0].ID,t=Nc.get(t).parents[0].ID,t=Nc.get(t).parents[0].ID,t={modelName:(t=Uc.Objects.Model[t]).attrName?p.PropertyBinding.sanitizeNodeName(t.attrName):"",morphName:Uc.Objects.Deformer[o].attrName},r[n]=t),r[n][i.attr]=i)}})),n.set(parseInt(t),r))}(t);return n}},{key:"parseAnimStacks",value:function(e){var t,r=Uc.Objects.AnimationStack,n={};for(t in r){var i=(1<(i=Nc.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));n[t]={name:r[t].attrName,layer:i}}return n}},{key:"addClip",value:function(e){var t=[],r=this;return e.layer.forEach((function(e){t=t.concat(r.generateTracks(e))})),new p.AnimationClip(e.name,-1,t)}},{key:"generateTracks",value:function(e){var t=[],r=new p.Vector3,n=new p.Quaternion,i=new p.Vector3;return e.transform&&e.transform.decompose(r,n,i),r=r.toArray(),n=(new p.Euler).setFromQuaternion(n,e.eulerOrder).toArray(),i=i.toArray(),void 0!==e.T&&0<Object.keys(e.T.curves).length&&void 0!==(r=this.generateVectorTrack(e.modelName,e.T.curves,r,"position"))&&t.push(r),void 0!==e.R&&0<Object.keys(e.R.curves).length&&void 0!==(r=this.generateRotationTrack(e.modelName,e.R.curves,n,e.preRotation,e.postRotation,e.eulerOrder))&&t.push(r),void 0!==e.S&&0<Object.keys(e.S.curves).length&&void 0!==(n=this.generateVectorTrack(e.modelName,e.S.curves,i,"scale"))&&t.push(n),void 0!==e.DeformPercent&&void 0!==(r=this.generateMorphTrack(e))&&t.push(r),t}},{key:"generateVectorTrack",value:function(e,t,r,n){var i=this.getTimesForAllAxes(t);return t=this.getKeyframeTrackValues(i,t,r),new p.VectorKeyframeTrack(e+"."+n,i,t)}},{key:"generateRotationTrack",value:function(e,t,r,n,i,o){void 0!==t.x&&(this.interpolateRotations(t.x),t.x.values=t.x.values.map(p.MathUtils.degToRad)),void 0!==t.y&&(this.interpolateRotations(t.y),t.y.values=t.y.values.map(p.MathUtils.degToRad)),void 0!==t.z&&(this.interpolateRotations(t.z),t.z.values=t.z.values.map(p.MathUtils.degToRad));for(var a=this.getTimesForAllAxes(t),s=this.getKeyframeTrackValues(a,t,r),u=(void 0!==n&&((n=n.map(p.MathUtils.degToRad)).push(o),n=(new p.Euler).fromArray(n),n=(new p.Quaternion).setFromEuler(n)),void 0!==i&&((i=i.map(p.MathUtils.degToRad)).push(o),i=(new p.Euler).fromArray(i),i=(new p.Quaternion).setFromEuler(i).invert()),new p.Quaternion),l=new p.Euler,c=[],h=0;h<s.length;h+=3)l.set(s[h],s[h+1],s[h+2],o),u.setFromEuler(l),void 0!==n&&u.premultiply(n),void 0!==i&&u.multiply(i),u.toArray(c,h/3*4);return new p.QuaternionKeyframeTrack(e+".quaternion",a,c)}},{key:"generateMorphTrack",value:function(e){var t=e.DeformPercent.curves.morph,r=t.values.map((function(e){return e/100})),n=Fc.getObjectByName(e.modelName).morphTargetDictionary[e.morphName];return new p.NumberKeyframeTrack(e.modelName+".morphTargetInfluences["+n+"]",t.times,r)}},{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 r=1,n=t[0],i=1;i<t.length;i++){var o=t[i];o!==n&&(n=t[r]=o,r++)}t=t.slice(0,r)}return t}},{key:"getKeyframeTrackValues",value:function(e,t,r){var n=r,i=[],o=-1,a=-1,s=-1;return e.forEach((function(e){t.x&&(o=t.x.times.indexOf(e)),t.y&&(a=t.y.times.indexOf(e)),t.z&&(s=t.z.times.indexOf(e)),-1!==o?(e=t.x.values[o],i.push(e),n[0]=e):i.push(n[0]),-1!==a?(e=t.y.values[a],i.push(e),n[1]=e):i.push(n[1]),-1!==s?(e=t.z.values[s],i.push(e),n[2]=e):i.push(n[2])})),i}},{key:"interpolateRotations",value:function(e){for(var t=1;t<e.values.length;t++){var r=e.values[t-1],n=e.values[t]-r;if(180<=(i=Math.abs(n))){for(var i,o=n/(i/=180),a=r+o,s=(n=e.times[t-1],(e.times[t]-n)/i),u=n+s,l=[],c=[];u<e.times[t];)l.push(u),u+=s,c.push(a),a+=o;e.times=ph(e.times,t,l),e.values=ph(e.values,t,c)}}}}]),e}(),$c=function(){function e(){Gc(this,e)}return Xc(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 rh,this.nodeStack=[],this.currentProp=[],this.currentPropName="";var t=this,r=e.split(/[\r\n]+/);return r.forEach((function(e,n){var i,o=e.match(/^[\s\t]*;/),a=e.match(/^[\s\t]*$/);o||a||(o=e.match("^\\t{"+t.currentIndent+"}(\\w+):(.*){",""),a=e.match("^\\t{"+t.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),i=e.match("^\\t{"+(t.currentIndent-1)+"}}"),o?t.parseNodeBegin(e,o):a?t.parseNodeProperty(e,a,r[++n]):i?t.popStack():e.match(/^[^\s\t}]/)&&t.parseNodePropertyContinued(e))})),this.allNodes}},{key:"parseNodeBegin",value:function(e,t){var r=t[1].trim().replace(/^"/,"").replace(/"$/,""),n=(t=t[2].split(",").map((function(e){return e.trim().replace(/^"/,"").replace(/"$/,"")})),{name:r}),i=(t=this.parseNodeAttr(t),this.getCurrentNode());0===this.currentIndent?this.allNodes.add(r,n):r in i?("PoseNode"===r?i.PoseNode.push(n):void 0!==i[r].id&&(i[r]={},i[r][i[r].id]=i[r]),""!==t.id&&(i[r][t.id]=n)):"number"==typeof t.id?(i[r]={},i[r][t.id]=n):"Properties70"!==r&&(i[r]="PoseNode"===r?[n]:n),"number"==typeof t.id&&(n.id=t.id),""!==t.name&&(n.attrName=t.name),""!==t.type&&(n.attrType=t.type),this.pushStack(n)}},{key:"parseNodeAttr",value:function(e){var t=e[0],r=(""!==e[0]&&(t=parseInt(e[0]),isNaN(t)&&(t=e[0])),""),n="";return 1<e.length&&(r=e[1].replace(/^(\w+)::/,""),n=e[2]),{id:t,name:r,type:n}}},{key:"parseNodeProperty",value:function(e,t,r){var n=t[1].replace(/^"/,"").replace(/"$/,"").trim();if(t=t[2].replace(/^"/,"").replace(/"$/,"").trim(),"Properties70"===("Content"===n&&","===t&&(t=r.replace(/"/g,"").replace(/,$/,"").trim()),r=this.getCurrentNode()).name)this.parseNodeSpecialProperty(e,n,t);else{if("C"===n){e=t.split(",").slice(1);for(var i=parseInt(e[0]),o=(e=parseInt(e[1]),(o=t.split(",").slice(3)).map((function(e){return e.trim().replace(/^"/,"")}))),a=(n="connections",t=[i,e]),s=o,u=0,l=a.length,c=s.length;u<c;u++,l++)a[l]=s[u];void 0===r[n]&&(r[n]=[])}"Node"===n&&(r.id=t),n in r&&Array.isArray(r[n])?r[n].push(t):"a"!==n?r[n]=t:r.a=t,this.setCurrentProp(r,n),"a"===n&&","!==t.slice(-1)&&(r.a=hh(t))}}},{key:"parseNodePropertyContinued",value:function(e){var t=this.getCurrentNode();t.a+=e,","!==e.slice(-1)&&(t.a=hh(t.a))}},{key:"parseNodeSpecialProperty",value:function(e,t,r){r=r.split('",').map((function(e){return e.trim().replace(/^\"/,"").replace(/\s/,"_")}));var n=r[0],i=r[1],o=r[2],a=r[3],s=r[4];switch(i){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":s=parseFloat(s);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":s=hh(s)}this.getPrevNode()[n]={type:i,type2:o,flag:a,value:s},this.setCurrentProp(this.getPrevNode(),n)}}]),e}(),eh=function(){function e(){Gc(this,e)}return Xc(e,[{key:"parse",value:function(e){var t=new th(e),r=(t.skip(23),t.getUint32());if(r<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+r);for(var n=new rh;!this.endOfContent(t);){var i=this.parseNode(t,r);null!==i&&n.add(i.name,i)}return n}},{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 r={},n=7500<=t?e.getUint64():e.getUint32(),i=7500<=t?e.getUint64():e.getUint32(),o=(7500<=t?e.getUint64():e.getUint32(),e.getUint8()),a=e.getString(o);if(0===n)return null;for(var s=[],u=0;u<i;u++)s.push(this.parseProperty(e));o=0<s.length?s[0]:"";var l=1<s.length?s[1]:"",c=2<s.length?s[2]:"";for(r.singleProperty=1===i&&e.getOffset()===n;n>e.getOffset();){var h=this.parseNode(e,t);null!==h&&this.parseSubNode(a,r,h)}return r.propertyList=s,"number"==typeof o&&(r.id=o),""!==l&&(r.attrName=l),""!==c&&(r.attrType=c),""!==a&&(r.name=a),r}},{key:"parseSubNode",value:function(e,t,r){var n,i,o,a,s;!0===r.singleProperty?(i=r.propertyList[0],Array.isArray(i)?(t[r.name]=r).a=i:t[r.name]=i):"Connections"===e&&"C"===r.name?(n=[],r.propertyList.forEach((function(e,t){0!==t&&n.push(e)})),void 0===t.connections&&(t.connections=[]),t.connections.push(n)):"Properties70"===r.name?Object.keys(r).forEach((function(e){t[e]=r[e]})):"Properties70"===e&&"P"===r.name?(i=r.propertyList[0],e=r.propertyList[1],o=r.propertyList[2],a=r.propertyList[3],0===i.indexOf("Lcl ")&&(i=i.replace("Lcl ","Lcl_")),s="Color"===(e=0===e.indexOf("Lcl ")?e.replace("Lcl ","Lcl_"):e)||"ColorRGB"===e||"Vector"===e||"Vector3D"===e||0===e.indexOf("Lcl_")?[r.propertyList[4],r.propertyList[5],r.propertyList[6]]:r.propertyList[4],t[i]={type:e,type2:o,flag:a,value:s}):void 0===t[r.name]?"number"==typeof r.id?(t[r.name]={},t[r.name][r.id]=r):t[r.name]=r:"PoseNode"===r.name?(Array.isArray(t[r.name])||(t[r.name]=[t[r.name]]),t[r.name].push(r)):void 0===t[r.name][r.id]&&(t[r.name][r.id]=r)}},{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 n=e.getUint32(),e.getArrayBuffer(n);case"S":return n=e.getUint32(),e.getString(n);case"Y":return e.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":var r=e.getUint32(),n=e.getUint32(),o=e.getUint32();if(0===n)switch(t){case"b":case"c":return e.getBooleanArray(r);case"d":return e.getFloat64Array(r);case"f":return e.getFloat32Array(r);case"i":return e.getInt32Array(r);case"l":return e.getInt64Array(r)}void 0===i&&console.error("THREE.FBXLoader: External library fflate.min.js required."),n=oc(new Uint8Array(e.getArrayBuffer(o)));var a=new th(n.buffer);switch(t){case"b":case"c":return a.getBooleanArray(r);case"d":return a.getFloat64Array(r);case"f":return a.getFloat32Array(r);case"i":return a.getInt32Array(r);case"l":return a.getInt64Array(r)}default:throw new Error("THREE.FBXLoader: Unknown property type "+t)}}}]),e}(),th=function(){function e(t,r){Gc(this,e),this.dv=new DataView(t),this.offset=0,this.littleEndian=void 0===r||r}return Xc(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=[],r=0;r<e;r++)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=[],r=0;r<e;r++)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=[],r=0;r<e;r++)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=[],r=0;r<e;r++)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=[],r=0;r<e;r++)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){for(var t=[],r=0;r<e;r++)t[r]=this.getUint8();var n=t.indexOf(0);return 0<=n&&(t=t.slice(0,n)),p.LoaderUtils.decodeText(new Uint8Array(t))}}]),e}(),rh=function(){function e(){Gc(this,e)}return Xc(e,[{key:"add",value:function(e,t){this[e]=t}}]),e}();function nh(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 ih(e){return e/46186158e3}var oh=[];function ah(e,t,r,n){var i;switch(n.mappingType){case"ByPolygonVertex":i=e;break;case"ByPolygon":i=t;break;case"ByVertice":i=r;break;case"AllSame":i=n.indices[0];break;default:console.warn("THREE.FBXLoader: unknown attribute mapping type "+n.mappingType)}for(var o=(i="IndexToDirect"===n.referenceType?n.indices[i]:i)*n.dataSize,a=o+n.dataSize,s=oh,u=n.buffer,l=a,c=o,h=0;c<l;c++,h++)s[h]=u[c];return s}var sh=new p.Euler,uh=new p.Vector3;function lh(e){var t=new p.Matrix4,r=new p.Matrix4,n=new p.Matrix4,i=new p.Matrix4,o=new p.Matrix4,a=new p.Matrix4,s=new p.Matrix4,u=new p.Matrix4,l=new p.Matrix4,c=new p.Matrix4,h=new p.Matrix4,f=new p.Matrix4,d=e.inheritType||0,m=(e.translation&&t.setPosition(uh.fromArray(e.translation)),e.preRotation&&((m=e.preRotation.map(p.MathUtils.degToRad)).push(e.eulerOrder),r.makeRotationFromEuler(sh.fromArray(m))),e.rotation&&((m=e.rotation.map(p.MathUtils.degToRad)).push(e.eulerOrder),n.makeRotationFromEuler(sh.fromArray(m))),e.postRotation&&((m=e.postRotation.map(p.MathUtils.degToRad)).push(e.eulerOrder),i.makeRotationFromEuler(sh.fromArray(m)),i.invert()),e.scale&&o.scale(uh.fromArray(e.scale)),e.scalingOffset&&s.setPosition(uh.fromArray(e.scalingOffset)),e.scalingPivot&&a.setPosition(uh.fromArray(e.scalingPivot)),e.rotationOffset&&u.setPosition(uh.fromArray(e.rotationOffset)),e.rotationPivot&&l.setPosition(uh.fromArray(e.rotationPivot)),e.parentMatrixWorld&&(h.copy(e.parentMatrix),c.copy(e.parentMatrixWorld)),r.clone().multiply(n).multiply(i)),y=(((e=new p.Matrix4).extractRotation(c),y=new p.Matrix4).copyPosition(c),y.clone().invert().multiply(c)),v=(y=e.clone().invert().multiply(y),o),g=new p.Matrix4;return 0===d?g.copy(e).multiply(m).multiply(y).multiply(v):1===d?g.copy(e).multiply(y).multiply(m).multiply(v):(d=(new p.Matrix4).scale((new p.Vector3).setFromMatrixScale(h)).clone().invert(),h=y.clone().multiply(d),g.copy(e).multiply(m).multiply(h).multiply(v)),y=l.clone().invert(),d=a.clone().invert(),e=t.clone().multiply(u).multiply(l).multiply(r).multiply(n).multiply(i).multiply(y).multiply(s).multiply(a).multiply(o).multiply(d),m=(new p.Matrix4).copyPosition(e),h=c.clone().multiply(m),f.copyPosition(h),(e=f.clone().multiply(g)).premultiply(c.invert()),e}function ch(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 hh(e){return e.split(",").map((function(e){return parseFloat(e)}))}function fh(e,t,r){return void 0===t&&(t=0),void 0===r&&(r=e.byteLength),p.LoaderUtils.decodeText(new Uint8Array(e,t,r))}function ph(e,t,r){return e.slice(0,t).concat(r).concat(e.slice(t))}function dh(e){return(dh="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 mh(e,t){return(mh=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function yh(e){return(yh=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var vh=/^[og]\s*(.+)?/,gh=/^mtllib /,bh=/^usemtl /,wh=/^usemap /,xh=new p.Vector3,Sh=new p.Vector3,_h=new p.Vector3,Th=new p.Vector3,Eh=new p.Vector3,Oh=new p.Color;function Mh(){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 r=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 r=this._finalize(!1);return r&&(r.inherited||r.groupCount<=0)&&this.materials.splice(r.index,1),e={index:this.materials.length,name:e||"",mtllib:Array.isArray(t)&&0<t.length?t[t.length-1]:"",smooth:(void 0!==r?r:this).smooth,groupStart:void 0!==r?r.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 r=this.materials.length-1;0<=r;r--)this.materials[r].groupCount<=0&&this.materials.splice(r,1);return e&&0===this.materials.length&&this.materials.push({name:"",smooth:this.smooth}),t}},r&&r.name&&"function"==typeof r.clone&&((e=r.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,r){var n=this.vertices,i=this.object.geometry.vertices;i.push(n[e+0],n[e+1],n[e+2]),i.push(n[t+0],n[t+1],n[t+2]),i.push(n[r+0],n[r+1],n[r+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,r){var n=this.normals,i=this.object.geometry.normals;i.push(n[e+0],n[e+1],n[e+2]),i.push(n[t+0],n[t+1],n[t+2]),i.push(n[r+0],n[r+1],n[r+2])},addFaceNormal:function(e,t,r){var n=this.vertices,i=this.object.geometry.normals;xh.fromArray(n,e),Sh.fromArray(n,t),_h.fromArray(n,r),Eh.subVectors(_h,Sh),Th.subVectors(xh,Sh),Eh.cross(Th),Eh.normalize(),i.push(Eh.x,Eh.y,Eh.z),i.push(Eh.x,Eh.y,Eh.z),i.push(Eh.x,Eh.y,Eh.z)},addColor:function(e,t,r){var n=this.colors,i=this.object.geometry.colors;void 0!==n[e]&&i.push(n[e+0],n[e+1],n[e+2]),void 0!==n[t]&&i.push(n[t+0],n[t+1],n[t+2]),void 0!==n[r]&&i.push(n[r+0],n[r+1],n[r+2])},addUV:function(e,t,r){var n=this.uvs,i=this.object.geometry.uvs;i.push(n[e+0],n[e+1]),i.push(n[t+0],n[t+1]),i.push(n[r+0],n[r+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,r,n,i,o,a,s,u){var l=this.vertices.length;e=this.parseVertexIndex(e,l),t=this.parseVertexIndex(t,l),r=this.parseVertexIndex(r,l),this.addVertex(e,t,r),this.addColor(e,t,r),void 0!==a&&""!==a?(l=this.normals.length,e=this.parseNormalIndex(a,l),t=this.parseNormalIndex(s,l),r=this.parseNormalIndex(u,l),this.addNormal(e,t,r)):this.addFaceNormal(e,t,r),void 0!==n&&""!==n?(a=this.uvs.length,e=this.parseUVIndex(n,a),t=this.parseUVIndex(i,a),r=this.parseUVIndex(o,a),this.addUV(e,t,r),this.object.geometry.hasUVIndices=!0):this.addDefaultUV()},addPointGeometry:function(e){this.object.geometry.type="Points";for(var t=this.vertices.length,r=0,n=e.length;r<n;r++){var i=this.parseVertexIndex(e[r],t);this.addVertexPoint(i),this.addColor(i)}},addLineGeometry:function(e,t){this.object.geometry.type="Line";for(var r=this.vertices.length,n=this.uvs.length,i=0,o=e.length;i<o;i++)this.addVertexLine(this.parseVertexIndex(e[i],r));for(var a=0,s=t.length;a<s;a++)this.addUVLine(this.parseUVIndex(t[a],n))}};return e.startObject("",!1),e}function Ph(e){return Zh[e]||Zh.easeLinear}var Rh=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&mh(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=yh(e);if(r=t?(r=yh(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===dh(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(e){if(this instanceof n)return(e=r.call(this,e)).materials=null,e;throw new TypeError("Cannot call a class as a function")}return t=n,(e=[{key:"load",value:function(e,t,r,n){var i=this,o=new p.FileLoader(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,(function(r){try{t(i.parse(r))}catch(r){n?n(r):console.error(r),i.manager.itemError(e)}}),r,n)}},{key:"setMaterials",value:function(e){return this.materials=e,this}},{key:"parse",value:function(e){for(var t,r,n,i=new Mh,o=(e=-1!==(e=-1!==e.indexOf("\r\n")?e.replace(/\r\n/g,"\n"):e).indexOf("\\\n")?e.replace(/\\\n/g,""):e).split("\n"),a="",s=[],u="function"==typeof"".trimLeft,l=0,c=o.length;l<c;l++)if(a=o[l],0!==(a=u?a.trimLeft():a.trim()).length&&"#"!==(t=a.charAt(0)))if("v"===t){var h=a.split(/\s+/);switch(h[0]){case"v":i.vertices.push(parseFloat(h[1]),parseFloat(h[2]),parseFloat(h[3])),7<=h.length?(Oh.setRGB(parseFloat(h[4]),parseFloat(h[5]),parseFloat(h[6])).convertSRGBToLinear(),i.colors.push(Oh.r,Oh.g,Oh.b)):i.colors.push(void 0,void 0,void 0);break;case"vn":i.normals.push(parseFloat(h[1]),parseFloat(h[2]),parseFloat(h[3]));break;case"vt":i.uvs.push(parseFloat(h[1]),parseFloat(h[2]))}}else if("f"===t){for(var f=a.slice(1).trim().split(/\s+/),d=[],m=0,y=f.length;m<y;m++){var v=f[m];0<v.length&&(v=v.split("/"),d.push(v))}for(var g=d[0],b=1,w=d.length-1;b<w;b++){var x=d[b],S=d[b+1];i.addFace(g[0],x[0],S[0],g[1],x[1],S[1],g[2],x[2],S[2])}}else if("l"===t){var _=a.substring(1).trim().split(" "),T=[],E=[];if(-1===a.indexOf("/"))T=_;else for(var O=0,M=_.length;O<M;O++){var P=_[O].split("/");""!==P[0]&&T.push(P[0]),""!==P[1]&&E.push(P[1])}i.addLineGeometry(T,E)}else"p"===t?(r=a.slice(1).trim().split(" "),i.addPointGeometry(r)):null!==(s=vh.exec(a))?(r=(" "+s[0].slice(1).trim()).slice(1),i.startObject(r)):bh.test(a)?i.object.startMaterial(a.substring(7).trim(),i.materialLibraries):gh.test(a)?i.materialLibraries.push(a.substring(7).trim()):wh.test(a)?console.warn('THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.'):"s"===t?(1<(s=a.split(" ")).length?(n=s[1].trim().toLowerCase(),i.object.smooth="0"!==n&&"off"!==n):i.object.smooth=!0,(n=i.object.currentMaterial())&&(n.smooth=i.object.smooth)):"\0"!==a&&console.warn('THREE.OBJLoader: Unexpected line: "'+a+'"');i.finalize();var R,k=new p.Group;if(1==(k.materialLibraries=[].concat(i.materialLibraries),e=!(1===i.objects.length&&0===i.objects[0].geometry.vertices.length)))for(var j=0,A=i.objects.length;j<A;j++){var C=i.objects[j],D=C.geometry,L=C.materials,z="Line"===D.type,I="Points"===D.type,B=!1;if(0!==D.vertices.length){for(var U=new p.BufferGeometry,N=(U.setAttribute("position",new p.Float32BufferAttribute(D.vertices,3)),0<D.normals.length&&U.setAttribute("normal",new p.Float32BufferAttribute(D.normals,3)),0<D.colors.length&&(B=!0,U.setAttribute("color",new p.Float32BufferAttribute(D.colors,3))),!0===D.hasUVIndices&&U.setAttribute("uv",new p.Float32BufferAttribute(D.uvs,2)),[]),F=0,V=L.length;F<V;F++){var H,G=L[F],W=G.name+"_"+G.smooth+"_"+B,X=i.materials[W];null!==this.materials&&(X=this.materials.create(G.name),!z||!X||X instanceof p.LineBasicMaterial?!I||!X||X instanceof p.PointsMaterial||(H=new p.PointsMaterial({size:10,sizeAttenuation:!1}),p.Material.prototype.copy.call(H,X),H.color.copy(X.color),H.map=X.map,X=H):(H=new p.LineBasicMaterial,p.Material.prototype.copy.call(H,X),H.color.copy(X.color),X=H)),void 0===X&&((X=z?new p.LineBasicMaterial:I?new p.PointsMaterial({size:1,sizeAttenuation:!1}):new p.MeshPhongMaterial).name=G.name,X.flatShading=!G.smooth,X.vertexColors=B,i.materials[W]=X),N.push(X)}if(D=void 0,1<N.length){for(var q=0,Y=L.length;q<Y;q++){var Z=L[q];U.addGroup(Z.groupStart,Z.groupCount,q)}D=new(z?p.LineSegments:I?p.Points:p.Mesh)(U,N)}else D=new(z?p.LineSegments:I?p.Points:p.Mesh)(U,N[0]);D.name=C.name,k.add(D)}}else 0<i.vertices.length&&(e=new p.PointsMaterial({size:1,sizeAttenuation:!1}),(R=new p.BufferGeometry).setAttribute("position",new p.Float32BufferAttribute(i.vertices,3)),0<i.colors.length&&void 0!==i.colors[0]&&(R.setAttribute("color",new p.Float32BufferAttribute(i.colors,3)),e.vertexColors=!0),R=new p.Points(R,e),k.add(R));return k}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),n}(p.Loader),kh="Attraction",jh="CrossZone",Ah="Gravity",Ch="RandomDrift",Dh="Repulsion",Lh="BodySprite",zh="Texture",Ih="Position",Bh="VectorVelocity",Uh="PolarVelocity",Nh="RadialVelocity",Fh=[Lh,zh],Vh="BoxZone",Hh="LineZone",Gh="MeshZone",Wh="PointZone",Xh="SphereZone",qh=3.142,Yh=qh/180,Zh={easeLinear:function(e){return e},easeInQuad:function(e){return Math.pow(e,2)},easeOutQuad:function(e){return-(Math.pow(e-1,2)-1)},easeInOutQuad:function(e){return(e/=.5)<1?.5*Math.pow(e,2):-.5*((e-=2)*e-2)},easeInCubic:function(e){return Math.pow(e,3)},easeOutCubic:function(e){return Math.pow(e-1,3)+1},easeInOutCubic:function(e){return(e/=.5)<1?.5*Math.pow(e,3):.5*(Math.pow(e-2,3)+2)},easeInQuart:function(e){return Math.pow(e,4)},easeOutQuart:function(e){return-(Math.pow(e-1,4)-1)},easeInOutQuart:function(e){return(e/=.5)<1?.5*Math.pow(e,4):-.5*((e-=2)*Math.pow(e,3)-2)},easeInSine:function(e){return 1-Math.cos(e*(qh/2))},easeOutSine:function(e){return Math.sin(e*(qh/2))},easeInOutSine:function(e){return-.5*(Math.cos(qh*e)-1)},easeInExpo:function(e){return 0===e?0:Math.pow(2,10*(e-1))},easeOutExpo:function(e){return 1===e?1:1-Math.pow(2,-10*e)},easeInOutExpo:function(e){return 0===e?0:1===e?1:(e/=.5)<1?.5*Math.pow(2,10*(e-1)):.5*(2-Math.pow(2,-10*--e))},easeInCirc:function(e){return-(Math.sqrt(1-e*e)-1)},easeOutCirc:function(e){return Math.sqrt(1-Math.pow(e-1,2))},easeInOutCirc:function(e){return(e/=.5)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)},easeInBack:function(e){return e*e*(2.70158*e-1.70158)},easeOutBack:function(e){return(e-=1)*e*(2.70158*e+1.70158)+1},easeInOutBack:function(e){var t=1.70158;return(e/=.5)<1?e*e*((1+(t*=1.525))*e-t)*.5:.5*((e-=2)*e*((1+(t*=1.525))*e+t)+2)}},Qh=Ks=Zh.easeLinear,Kh=.0167,Jh=[Ih,"Life","Radius","Mass","Body",Lh,zh,Uh,Nh,Bh],$h=["Alpha",kh,"Color",jh,"Force",Ah,Ch,Dh,"Rotate","Scale","Spring"],ef=[Vh,Hh,Gh,Wh,Xh];function tf(e,t,r){t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}const rf=function(e){var t,r,n={};return"number"==typeof e?(r=Math.floor(e),n.r=(e>>16&255)/255,n.g=(e>>8&255)/255,n.b=(255&e)/255):"string"==typeof e?(t=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(e))?(n.r=Math.min(255,parseInt(t[1],10))/255,n.g=Math.min(255,parseInt(t[2],10))/255,n.b=Math.min(255,parseInt(t[3],10))/255):(t=/^\#([A-Fa-f0-9]+)$/.exec(e))&&(r=t[1],n.r=parseInt(r.charAt(0)+r.charAt(1),16)/255,n.g=parseInt(r.charAt(2)+r.charAt(3),16)/255,n.b=parseInt(r.charAt(4)+r.charAt(5),16)/255):(n.r=e.r,n.g=e.g,n.b=e.b),n},nf={_id:0,_uids:new Map,getNewId:function(){return"PUID_".concat(++this._id)},id:function(e){if(this._uids.has(e))return this._uids.get(e);var t=this.getNewId();return this._uids.set(e,t),t}};var of,af,sf,uf,lf,cf,hf,ff,pf,df,mf,yf,vf,gf,bf,wf,xf,Sf,_f,Tf={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:function(){for(var e=[],t=0;t<256;t++)e[t]=(t<16?"0":"")+t.toString(16);return function(){var t=4294967295*Math.random()|0,r=4294967295*Math.random()|0,n=4294967295*Math.random()|0,i=4294967295*Math.random()|0;return(e[255&t]+e[t>>8&255]+e[t>>16&255]+e[t>>24&255]+"-"+e[255&r]+e[r>>8&255]+"-"+e[r>>16&15|64]+e[r>>24&255]+"-"+e[63&n|128]+e[n>>8&255]+"-"+e[n>>16&255]+e[n>>24&255]+e[255&i]+e[i>>8&255]+e[i>>16&255]+e[i>>24&255]).toUpperCase()}}(),clamp:function(e,t,r){return Math.max(t,Math.min(r,e))},euclideanModulo:function(e,t){return(e%t+t)%t},mapLinear:function(e,t,r,n,i){return n+(e-t)*(i-n)/(r-t)},lerp:function(e,t,r){return(1-r)*e+r*t},smoothstep:function(e,t,r){return e<=t?0:r<=e?1:(e=(e-t)/(r-t))*e*(3-2*e)},smootherstep:function(e,t,r){return e<=t?0:r<=e?1:(e=(e-t)/(r-t))*e*e*(e*(6*e-15)+10)},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},degToRad:function(e){return e*Tf.DEG2RAD},radToDeg:function(e){return e*Tf.RAD2DEG},isPowerOfTwo:function(e){return 0==(e&e-1)&&0!==e},ceilPowerOfTwo:function(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))},floorPowerOfTwo:function(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))}};function Ef(e,t,r,n){this._x=e||0,this._y=t||0,this._z=r||0,this._w=void 0!==n?n:1}function Of(e,t,r){this.x=e||0,this.y=t||0,this.z=r||0}function Mf(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],0<arguments.length&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}function Pf(e,t,r,n){this._x=e||0,this._y=t||0,this._z=r||0,this._order=n||Pf.DefaultOrder}Object.assign(Ef,{slerp:function(e,t,r,n){return r.copy(e).slerp(t,n)},slerpFlat:function(e,t,r,n,i,o,a){var s,u,l,c=r[n+0],h=r[n+1],f=r[n+2],p=(r=r[n+3],n=i[o+0],i[o+1]),d=i[o+2];r===(i=i[o+3])&&c===n&&h===p&&f===d||(o=1-a,s=0<=(u=c*n+h*p+f*d+r*i)?1:-1,(l=1-u*u)>Number.EPSILON&&(l=Math.sqrt(l),u=Math.atan2(l,u*s),o=Math.sin(o*u)/l,a=Math.sin(a*u)/l),c=c*o+n*(u=a*s),h=h*o+p*u,f=f*o+d*u,r=r*o+i*u,o===1-a&&(c*=l=1/Math.sqrt(c*c+h*h+f*f+r*r),h*=l,f*=l,r*=l)),e[t]=c,e[t+1]=h,e[t+2]=f,e[t+3]=r}}),Object.defineProperties(Ef.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._onChangeCallback()}},y:{get:function(){return this._y},set:function(e){this._y=e,this._onChangeCallback()}},z:{get:function(){return this._z},set:function(e){this._z=e,this._onChangeCallback()}},w:{get:function(){return this._w},set:function(e){this._w=e,this._onChangeCallback()}}}),Object.assign(Ef.prototype,{isQuaternion:!0,set:function(e,t,r,n){return this._x=e,this._y=t,this._z=r,this._w=n,this._onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this},setFromEuler:function(e,t){if(!e||!e.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var r=e._x,n=e._y,i=e._z,o=(e=e.order,Math.cos),a=Math.sin,s=o(r/2),u=o(n/2);return o=o(i/2),r=a(r/2),n=a(n/2),a=a(i/2),"XYZ"===e?(this._x=r*u*o+s*n*a,this._y=s*n*o-r*u*a,this._z=s*u*a+r*n*o,this._w=s*u*o-r*n*a):"YXZ"===e?(this._x=r*u*o+s*n*a,this._y=s*n*o-r*u*a,this._z=s*u*a-r*n*o,this._w=s*u*o+r*n*a):"ZXY"===e?(this._x=r*u*o-s*n*a,this._y=s*n*o+r*u*a,this._z=s*u*a+r*n*o,this._w=s*u*o-r*n*a):"ZYX"===e?(this._x=r*u*o-s*n*a,this._y=s*n*o+r*u*a,this._z=s*u*a-r*n*o,this._w=s*u*o+r*n*a):"YZX"===e?(this._x=r*u*o+s*n*a,this._y=s*n*o+r*u*a,this._z=s*u*a-r*n*o,this._w=s*u*o-r*n*a):"XZY"===e&&(this._x=r*u*o-s*n*a,this._y=s*n*o-r*u*a,this._z=s*u*a+r*n*o,this._w=s*u*o+r*n*a),!1!==t&&this._onChangeCallback(),this},setFromAxisAngle:function(e,t){t/=2;var r=Math.sin(t);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(t),this._onChangeCallback(),this},setFromRotationMatrix:function(e){var t,r=(e=e.elements)[0],n=e[4],i=e[8],o=e[1],a=e[5],s=e[9],u=e[2],l=e[6],c=r+a+(e=e[10]);return 0<c?(t=.5/Math.sqrt(c+1),this._w=.25/t,this._x=(l-s)*t,this._y=(i-u)*t,this._z=(o-n)*t):a<r&&e<r?(t=2*Math.sqrt(1+r-a-e),this._w=(l-s)/t,this._x=.25*t,this._y=(n+o)/t,this._z=(i+u)/t):e<a?(t=2*Math.sqrt(1+a-r-e),this._w=(i-u)/t,this._x=(n+o)/t,this._y=.25*t,this._z=(s+l)/t):(t=2*Math.sqrt(1+e-r-a),this._w=(o-n)/t,this._x=(i+u)/t,this._y=(s+l)/t,this._z=.25*t),this._onChangeCallback(),this},setFromUnitVectors:function(e,t){var r=e.dot(t)+1;return r<1e-6?(r=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0):(this._x=0,this._y=-e.z,this._z=e.y)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x),this._w=r,this.normalize()},angleTo:function(e){return 2*Math.acos(Math.abs(Tf.clamp(this.dot(e),-1,1)))},rotateTowards:function(e,t){var r=this.angleTo(e);return 0===r||(t=Math.min(1,t/r),this.slerp(e,t)),this},inverse:function(){return this.conjugate()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this},dot:function(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(this._x=this._x*(e=1/e),this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(e,t)):this.multiplyQuaternions(this,e)},premultiply:function(e){return this.multiplyQuaternions(e,this)},multiplyQuaternions:function(e,t){var r=e._x,n=e._y,i=e._z,o=(e=e._w,t._x),a=t._y,s=t._z;return t=t._w,this._x=r*t+e*o+n*s-i*a,this._y=n*t+e*a+i*o-r*s,this._z=i*t+e*s+r*a-n*o,this._w=e*t-r*o-n*a-i*s,this._onChangeCallback(),this},slerp:function(e,t){if(0===t)return this;if(1===t)return this.copy(e);var r=this._x,n=this._y,i=this._z,o=this._w;if((s=o*e._w+r*e._x+n*e._y+i*e._z)<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,s=-s):this.copy(e),1<=s)return this._w=o,this._x=r,this._y=n,this._z=i,this;if((e=1-s*s)<=Number.EPSILON)return this._w=(a=1-t)*o+t*this._w,this._x=a*r+t*this._x,this._y=a*n+t*this._y,this._z=a*i+t*this._z,this.normalize(),this._onChangeCallback(),this;var a=Math.sqrt(e),s=(e=Math.atan2(a,s),Math.sin((1-t)*e)/a);return t=Math.sin(t*e)/a,this._w=o*s+this._w*t,this._x=r*s+this._x*t,this._y=n*s+this._y*t,this._z=i*s+this._z*t,this._onChangeCallback(),this},equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w},fromArray:function(e,t){return this._x=e[t=void 0===t?0:t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this},toArray:function(e,t){return(e=void 0===e?[]:e)[t=void 0===t?0:t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e},_onChange:function(e){return this._onChangeCallback=e,this},_onChangeCallback:function(){}}),Object.assign(Of.prototype,{isVector3:!0,set:function(e,t,r){return this.x=e,this.y=t,this.z=r,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(e,t)):(this.x*=e.x,this.y*=e.y,this.z*=e.z,this)},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this},multiplyVectors:function(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this},applyEuler:(uf=new Ef,function(e){return e&&e.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(uf.setFromEuler(e))}),applyAxisAngle:(sf=new Ef,function(e,t){return this.applyQuaternion(sf.setFromAxisAngle(e,t))}),applyMatrix3:function(e){var t=this.x,r=this.y,n=this.z;return e=e.elements,this.x=e[0]*t+e[3]*r+e[6]*n,this.y=e[1]*t+e[4]*r+e[7]*n,this.z=e[2]*t+e[5]*r+e[8]*n,this},applyMatrix4:function(e){var t=this.x,r=this.y,n=this.z,i=1/((e=e.elements)[3]*t+e[7]*r+e[11]*n+e[15]);return this.x=(e[0]*t+e[4]*r+e[8]*n+e[12])*i,this.y=(e[1]*t+e[5]*r+e[9]*n+e[13])*i,this.z=(e[2]*t+e[6]*r+e[10]*n+e[14])*i,this},applyQuaternion:function(e){var t=this.x,r=this.y,n=this.z,i=e.x,o=e.y,a=e.z,s=(e=e.w)*t+o*n-a*r,u=e*r+a*t-i*n,l=e*n+i*r-o*t;return t=-i*t-o*r-a*n,this.x=s*e+t*-i+u*-a-l*-o,this.y=u*e+t*-o+l*-i-s*-a,this.z=l*e+t*-a+s*-o-u*-i,this},project:function(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)},unproject:function(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)},transformDirection:function(e){var t=this.x,r=this.y,n=this.z;return e=e.elements,this.x=e[0]*t+e[4]*r+e[8]*n,this.y=e[1]*t+e[5]*r+e[9]*n,this.z=e[2]*t+e[6]*r+e[10]*n,this.normalize()},divide:function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this},divideScalar:function(e){return this.multiplyScalar(1/e)},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this},clampScalar:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this},clampLength:function(e,t){var r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,r)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this},lerpVectors:function(e,t,r){return this.subVectors(t,e).multiplyScalar(r).add(e)},cross:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(e,t)):this.crossVectors(this,e)},crossVectors:function(e,t){var r=e.x,n=e.y,i=(e=e.z,t.x),o=t.y;return t=t.z,this.x=n*t-e*o,this.y=e*i-r*t,this.z=r*o-n*i,this},projectOnVector:function(e){var t=e.dot(this)/e.lengthSq();return this.copy(e).multiplyScalar(t)},projectOnPlane:(af=new Of,function(e){return af.copy(this).projectOnVector(e),this.sub(af)}),reflect:(of=new Of,function(e){return this.sub(of.copy(e).multiplyScalar(2*this.dot(e)))}),angleTo:function(e){return e=this.dot(e)/Math.sqrt(this.lengthSq()*e.lengthSq()),Math.acos(Tf.clamp(e,-1,1))},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,r=this.y-e.y;return t*t+r*r+(e=this.z-e.z)*e},manhattanDistanceTo:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)},setFromSpherical:function(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)},setFromSphericalCoords:function(e,t,r){var n=Math.sin(t)*e;return this.x=n*Math.sin(r),this.y=Math.cos(t)*e,this.z=n*Math.cos(r),this},setFromCylindrical:function(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)},setFromCylindricalCoords:function(e,t,r){return this.x=e*Math.sin(t),this.y=r,this.z=e*Math.cos(t),this},setFromMatrixPosition:function(e){return e=e.elements,this.x=e[12],this.y=e[13],this.z=e[14],this},setFromMatrixScale:function(e){var t=this.setFromMatrixColumn(e,0).length(),r=this.setFromMatrixColumn(e,1).length();return e=this.setFromMatrixColumn(e,2).length(),this.x=t,this.y=r,this.z=e,this},setFromMatrixColumn:function(e,t){return this.fromArray(e.elements,4*t)},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z},fromArray:function(e,t){return this.x=e[t=void 0===t?0:t],this.y=e[t+1],this.z=e[t+2],this},toArray:function(e,t){return(e=void 0===e?[]:e)[t=void 0===t?0:t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e},fromBufferAttribute:function(e,t,r){return void 0!==r&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}}),Object.assign(Mf.prototype,{isMatrix4:!0,set:function(e,t,r,n,i,o,a,s,u,l,c,h,f,p,d,m){var y=this.elements;return y[0]=e,y[4]=t,y[8]=r,y[12]=n,y[1]=i,y[5]=o,y[9]=a,y[13]=s,y[2]=u,y[6]=l,y[10]=c,y[14]=h,y[3]=f,y[7]=p,y[11]=d,y[15]=m,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},clone:function(){return(new Mf).fromArray(this.elements)},copy:function(e){var t=this.elements;return e=e.elements,t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],this},copyPosition:function(e){var t=this.elements;return e=e.elements,t[12]=e[12],t[13]=e[13],t[14]=e[14],this},extractBasis:function(e,t,r){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),r.setFromMatrixColumn(this,2),this},makeBasis:function(e,t,r){return this.set(e.x,t.x,r.x,0,e.y,t.y,r.y,0,e.z,t.z,r.z,0,0,0,0,1),this},extractRotation:(vf=new Of,function(e){var t=this.elements,r=e.elements,n=1/vf.setFromMatrixColumn(e,0).length(),i=1/vf.setFromMatrixColumn(e,1).length();return e=1/vf.setFromMatrixColumn(e,2).length(),t[0]=r[0]*n,t[1]=r[1]*n,t[2]=r[2]*n,t[3]=0,t[4]=r[4]*i,t[5]=r[5]*i,t[6]=r[6]*i,t[7]=0,t[8]=r[8]*e,t[9]=r[9]*e,t[10]=r[10]*e,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}),makeRotationFromEuler:function(e){e&&e.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var t,r,n,i,o,a,s,u,l,c,h,f,p=this.elements,d=e.x,m=e.y,y=e.z,v=Math.cos(d),g=(d=Math.sin(d),Math.cos(m)),b=(m=Math.sin(m),Math.cos(y));return y=Math.sin(y),"XYZ"===e.order?(o=v*b,a=v*y,s=d*b,u=d*y,p[0]=g*b,p[4]=-g*y,p[8]=m,p[1]=a+s*m,p[5]=o-u*m,p[9]=-d*g,p[2]=u-o*m,p[6]=s+a*m,p[10]=v*g):"YXZ"===e.order?(r=g*y,n=m*b,p[0]=(t=g*b)+(i=m*y)*d,p[4]=n*d-r,p[8]=v*m,p[1]=v*y,p[5]=v*b,p[9]=-d,p[2]=r*d-n,p[6]=i+t*d,p[10]=v*g):"ZXY"===e.order?(r=g*y,n=m*b,p[0]=(t=g*b)-(i=m*y)*d,p[4]=-v*y,p[8]=n+r*d,p[1]=r+n*d,p[5]=v*b,p[9]=i-t*d,p[2]=-v*m,p[6]=d,p[10]=v*g):"ZYX"===e.order?(o=v*b,a=v*y,s=d*b,u=d*y,p[0]=g*b,p[4]=s*m-a,p[8]=o*m+u,p[1]=g*y,p[5]=u*m+o,p[9]=a*m-s,p[2]=-m,p[6]=d*g,p[10]=v*g):"YZX"===e.order?(l=v*g,c=v*m,h=d*g,f=d*m,p[0]=g*b,p[4]=f-l*y,p[8]=h*y+c,p[1]=y,p[5]=v*b,p[9]=-d*b,p[2]=-m*b,p[6]=c*y+h,p[10]=l-f*y):"XZY"===e.order&&(l=v*g,c=v*m,h=d*g,f=d*m,p[0]=g*b,p[4]=-y,p[8]=m*b,p[1]=l*y+f,p[5]=v*b,p[9]=c*y-h,p[2]=h*y-c,p[6]=d*b,p[10]=f*y+l),p[3]=0,p[7]=0,p[11]=0,p[12]=0,p[13]=0,p[14]=0,p[15]=1,this},makeRotationFromQuaternion:(mf=new Of(0,0,0),yf=new Of(1,1,1),function(e){return this.compose(mf,e,yf)}),lookAt:(ff=new Of,pf=new Of,df=new Of,function(e,t,r){var n=this.elements;return df.subVectors(e,t),0===df.lengthSq()&&(df.z=1),df.normalize(),ff.crossVectors(r,df),0===ff.lengthSq()&&(1===Math.abs(r.z)?df.x+=1e-4:df.z+=1e-4,df.normalize(),ff.crossVectors(r,df)),ff.normalize(),pf.crossVectors(df,ff),n[0]=ff.x,n[4]=pf.x,n[8]=df.x,n[1]=ff.y,n[5]=pf.y,n[9]=df.y,n[2]=ff.z,n[6]=pf.z,n[10]=df.z,this}),multiply:function(e,t){return void 0!==t?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(e,t)):this.multiplyMatrices(this,e)},premultiply:function(e){return this.multiplyMatrices(e,this)},multiplyMatrices:function(e,t){e=e.elements,t=t.elements;var r=this.elements,n=e[0],i=e[4],o=e[8],a=e[12],s=e[1],u=e[5],l=e[9],c=e[13],h=e[2],f=e[6],p=e[10],d=e[14],m=e[3],y=e[7],v=e[11],g=(e=e[15],t[0]),b=t[4],w=t[8],x=t[12],S=t[1],_=t[5],T=t[9],E=t[13],O=t[2],M=t[6],P=t[10],R=t[14],k=t[3],j=t[7],A=t[11];return t=t[15],r[0]=n*g+i*S+o*O+a*k,r[4]=n*b+i*_+o*M+a*j,r[8]=n*w+i*T+o*P+a*A,r[12]=n*x+i*E+o*R+a*t,r[1]=s*g+u*S+l*O+c*k,r[5]=s*b+u*_+l*M+c*j,r[9]=s*w+u*T+l*P+c*A,r[13]=s*x+u*E+l*R+c*t,r[2]=h*g+f*S+p*O+d*k,r[6]=h*b+f*_+p*M+d*j,r[10]=h*w+f*T+p*P+d*A,r[14]=h*x+f*E+p*R+d*t,r[3]=m*g+y*S+v*O+e*k,r[7]=m*b+y*_+v*M+e*j,r[11]=m*w+y*T+v*P+e*A,r[15]=m*x+y*E+v*R+e*t,this},multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this},applyToBufferAttribute:(hf=new Of,function(e){for(var t=0,r=e.count;t<r;t++)hf.x=e.getX(t),hf.y=e.getY(t),hf.z=e.getZ(t),hf.applyMatrix4(this),e.setXYZ(t,hf.x,hf.y,hf.z);return e}),determinant:function(){var e=this.elements,t=e[0],r=e[4],n=e[8],i=e[12],o=e[1],a=e[5],s=e[9],u=e[13],l=e[2],c=e[6],h=e[10],f=e[14];return e[3]*(+i*s*c-n*u*c-i*a*h+r*u*h+n*a*f-r*s*f)+e[7]*(+t*s*f-t*u*h+i*o*h-n*o*f+n*u*l-i*s*l)+e[11]*(+t*u*c-t*a*f-i*o*c+r*o*f+i*a*l-r*u*l)+e[15]*(-n*a*l-t*s*c+t*a*h+n*o*c-r*o*h+r*s*l)},transpose:function(){var e=this.elements,t=e[1];return e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this},setPosition:function(e,t,r){var n=this.elements;return e.isVector3?(n[12]=e.x,n[13]=e.y,n[14]=e.z):(n[12]=e,n[13]=t,n[14]=r),this},getInverse:function(e,t){var r=this.elements,n=(e=e.elements)[0],i=e[1],o=e[2],a=e[3],s=e[4],u=e[5],l=e[6],c=e[7],h=e[8],f=e[9],p=e[10],d=e[11],m=e[12],y=e[13],v=e[14],g=f*v*c-y*p*c+y*l*d-u*v*d-f*l*(e=e[15])+u*p*e,b=m*p*c-h*v*c-m*l*d+s*v*d+h*l*e-s*p*e,w=h*y*c-m*f*c+m*u*d-s*y*d-h*u*e+s*f*e,x=m*f*l-h*y*l-m*u*p+s*y*p+h*u*v-s*f*v,S=n*g+i*b+o*w+a*x;if(0==S){var _="THREE.Matrix4: .getInverse() can't invert matrix, determinant is 0";if(!0===t)throw new Error(_);return console.warn(_),this.identity()}return t=1/S,r[0]=g*t,r[1]=(y*p*a-f*v*a-y*o*d+i*v*d+f*o*e-i*p*e)*t,r[2]=(u*v*a-y*l*a+y*o*c-i*v*c-u*o*e+i*l*e)*t,r[3]=(f*l*a-u*p*a-f*o*c+i*p*c+u*o*d-i*l*d)*t,r[4]=b*t,r[5]=(h*v*a-m*p*a+m*o*d-n*v*d-h*o*e+n*p*e)*t,r[6]=(m*l*a-s*v*a-m*o*c+n*v*c+s*o*e-n*l*e)*t,r[7]=(s*p*a-h*l*a+h*o*c-n*p*c-s*o*d+n*l*d)*t,r[8]=w*t,r[9]=(m*f*a-h*y*a-m*i*d+n*y*d+h*i*e-n*f*e)*t,r[10]=(s*y*a-m*u*a+m*i*c-n*y*c-s*i*e+n*u*e)*t,r[11]=(h*u*a-s*f*a-h*i*c+n*f*c+s*i*d-n*u*d)*t,r[12]=x*t,r[13]=(h*y*o-m*f*o+m*i*p-n*y*p-h*i*v+n*f*v)*t,r[14]=(m*u*o-s*y*o-m*i*l+n*y*l+s*i*v-n*u*v)*t,r[15]=(s*f*o-h*u*o+h*i*l-n*f*l-s*i*p+n*u*p)*t,this},scale:function(e){var t=this.elements,r=e.x,n=e.y;return e=e.z,t[0]*=r,t[4]*=n,t[8]*=e,t[1]*=r,t[5]*=n,t[9]*=e,t[2]*=r,t[6]*=n,t[10]*=e,t[3]*=r,t[7]*=n,t[11]*=e,this},getMaxScaleOnAxis:function(){var e=(r=this.elements)[0]*r[0]+r[1]*r[1]+r[2]*r[2],t=r[4]*r[4]+r[5]*r[5]+r[6]*r[6],r=r[8]*r[8]+r[9]*r[9]+r[10]*r[10];return Math.sqrt(Math.max(e,t,r))},makeTranslation:function(e,t,r){return this.set(1,0,0,e,0,1,0,t,0,0,1,r,0,0,0,1),this},makeRotationX:function(e){var t=Math.cos(e);return e=Math.sin(e),this.set(1,0,0,0,0,t,-e,0,0,e,t,0,0,0,0,1),this},makeRotationY:function(e){var t=Math.cos(e);return e=Math.sin(e),this.set(t,0,e,0,0,1,0,0,-e,0,t,0,0,0,0,1),this},makeRotationZ:function(e){var t=Math.cos(e);return e=Math.sin(e),this.set(t,-e,0,0,e,t,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(e,t){var r=Math.cos(t),n=(t=Math.sin(t),1-r),i=e.x,o=e.y,a=(e=e.z,n*i),s=n*o;return this.set(a*i+r,a*o-t*e,a*e+t*o,0,a*o+t*e,s*o+r,s*e-t*i,0,a*e-t*o,s*e+t*i,n*e*e+r,0,0,0,0,1),this},makeScale:function(e,t,r){return this.set(e,0,0,0,0,t,0,0,0,0,r,0,0,0,0,1),this},makeShear:function(e,t,r){return this.set(1,t,r,0,e,1,r,0,e,t,1,0,0,0,0,1),this},compose:function(e,t,r){var n=this.elements,i=(a=t._x)*(c=a+a),o=a*(h=(u=t._y)+u),a=a*(f=(l=t._z)+l),s=u*h,u=u*f,l=l*f,c=(t=t._w)*c,h=t*h,f=(t*=f,r.x),p=r.y;return r=r.z,n[0]=(1-(s+l))*f,n[1]=(o+t)*f,n[2]=(a-h)*f,n[3]=0,n[4]=(o-t)*p,n[5]=(1-(i+l))*p,n[6]=(u+c)*p,n[7]=0,n[8]=(a+h)*r,n[9]=(u-c)*r,n[10]=(1-(i+s))*r,n[11]=0,n[12]=e.x,n[13]=e.y,n[14]=e.z,n[15]=1,this},decompose:(lf=new Of,cf=new Mf,function(e,t,r){var n=this.elements,i=lf.set(n[0],n[1],n[2]).length(),o=lf.set(n[4],n[5],n[6]).length(),a=lf.set(n[8],n[9],n[10]).length(),s=(this.determinant()<0&&(i=-i),e.x=n[12],e.y=n[13],e.z=n[14],cf.copy(this),e=1/i,n=1/o,1/a);return cf.elements[0]*=e,cf.elements[1]*=e,cf.elements[2]*=e,cf.elements[4]*=n,cf.elements[5]*=n,cf.elements[6]*=n,cf.elements[8]*=s,cf.elements[9]*=s,cf.elements[10]*=s,t.setFromRotationMatrix(cf),r.x=i,r.y=o,r.z=a,this}),makePerspective:function(e,t,r,n,i,o){void 0===o&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");var a=this.elements,s=2*i/(r-n),u=(t+e)/(t-e);return r=(r+n)/(r-n),n=-(o+i)/(o-i),o=-2*o*i/(o-i),a[0]=2*i/(t-e),a[4]=0,a[8]=u,a[12]=0,a[1]=0,a[5]=s,a[9]=r,a[13]=0,a[2]=0,a[6]=0,a[10]=n,a[14]=o,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this},makeOrthographic:function(e,t,r,n,i,o){var a=this.elements,s=1/(t-e),u=1/(r-n),l=1/(o-i);return t=(t+e)*s,e=(r+n)*u,r=(o+i)*l,a[0]=2*s,a[4]=0,a[8]=0,a[12]=-t,a[1]=0,a[5]=2*u,a[9]=0,a[13]=-e,a[2]=0,a[6]=0,a[10]=-2*l,a[14]=-r,a[3]=0,a[7]=0,a[11]=0,a[15]=1,this},equals:function(e){for(var t=this.elements,r=e.elements,n=0;n<16;n++)if(t[n]!==r[n])return!1;return!0},fromArray:function(e,t){void 0===t&&(t=0);for(var r=0;r<16;r++)this.elements[r]=e[r+t];return this},toArray:function(e,t){var r=this.elements;return(e=void 0===e?[]:e)[t=void 0===t?0:t]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=r[3],e[t+4]=r[4],e[t+5]=r[5],e[t+6]=r[6],e[t+7]=r[7],e[t+8]=r[8],e[t+9]=r[9],e[t+10]=r[10],e[t+11]=r[11],e[t+12]=r[12],e[t+13]=r[13],e[t+14]=r[14],e[t+15]=r[15],e}}),Pf.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"],Pf.DefaultOrder="XYZ",Object.defineProperties(Pf.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._onChangeCallback()}},y:{get:function(){return this._y},set:function(e){this._y=e,this._onChangeCallback()}},z:{get:function(){return this._z},set:function(e){this._z=e,this._onChangeCallback()}},order:{get:function(){return this._order},set:function(e){this._order=e,this._onChangeCallback()}}}),Object.assign(Pf.prototype,{isEuler:!0,set:function(e,t,r,n){return this._x=e,this._y=t,this._z=r,this._order=n||this._order,this._onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this},setFromRotationMatrix:function(e,t,r){var n=Tf.clamp,i=(e=e.elements)[0],o=e[4],a=e[8],s=e[1],u=e[5],l=e[9],c=e[2],h=e[6];return e=e[10],"XYZ"===(t=t||this._order)?(this._y=Math.asin(n(a,-1,1)),Math.abs(a)<.99999?(this._x=Math.atan2(-l,e),this._z=Math.atan2(-o,i)):(this._x=Math.atan2(h,u),this._z=0)):"YXZ"===t?(this._x=Math.asin(-n(l,-1,1)),Math.abs(l)<.99999?(this._y=Math.atan2(a,e),this._z=Math.atan2(s,u)):(this._y=Math.atan2(-c,i),this._z=0)):"ZXY"===t?(this._x=Math.asin(n(h,-1,1)),Math.abs(h)<.99999?(this._y=Math.atan2(-c,e),this._z=Math.atan2(-o,u)):(this._y=0,this._z=Math.atan2(s,i))):"ZYX"===t?(this._y=Math.asin(-n(c,-1,1)),Math.abs(c)<.99999?(this._x=Math.atan2(h,e),this._z=Math.atan2(s,i)):(this._x=0,this._z=Math.atan2(-o,u))):"YZX"===t?(this._z=Math.asin(n(s,-1,1)),Math.abs(s)<.99999?(this._x=Math.atan2(-l,u),this._y=Math.atan2(-c,i)):(this._x=0,this._y=Math.atan2(a,e))):"XZY"===t?(this._z=Math.asin(-n(o,-1,1)),Math.abs(o)<.99999?(this._x=Math.atan2(h,u),this._y=Math.atan2(a,i)):(this._x=Math.atan2(-l,e),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+t),this._order=t,!1!==r&&this._onChangeCallback(),this},setFromQuaternion:(bf=new Mf,function(e,t,r){return bf.makeRotationFromQuaternion(e),this.setFromRotationMatrix(bf,t,r)}),setFromVector3:function(e,t){return this.set(e.x,e.y,e.z,t||this._order)},reorder:(gf=new Ef,function(e){return gf.setFromEuler(this),this.setFromQuaternion(gf,e)}),equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order},fromArray:function(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this._onChangeCallback(),this},toArray:function(e,t){return(e=void 0===e?[]:e)[t=void 0===t?0:t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e},toVector3:function(e){return e?e.set(this._x,this._y,this._z):new Of(this._x,this._y,this._z)},_onChange:function(e){return this._onChangeCallback=e,this},_onChangeCallback:function(){}});const Rf={toScreenPos:(_f=new Of,function(e,t,r){return _f.copy(e),_f.project(t),_f.x=Math.round((_f.x+1)*r.width/2),_f.y=Math.round((1-_f.y)*r.height/2),_f.z=0,_f}),toSpacePos:(xf=new Of,Sf=new Of,function(e,t,r){return xf.set(e.x/r.width*2-1,-e.y/r.height*2+1,.5),xf.unproject(t),Sf.copy(xf.sub(t.position).normalize()),wf=-t.position.z/Sf.z,xf.copy(t.position),xf.add(Sf.multiplyScalar(wf)),xf})},kf={initValue:function(e,t){return null!=e?e:t},isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},destroyArray:function(e){e.length=0},destroyObject:function(e){for(var t in e)delete e[t]},isUndefined:function(){for(var e in arguments)if(void 0!==arguments[e])return!1;return!0},setVectorByObj:function(e,t){void 0!==t.x&&(e.position.x=t.x),void 0!==t.y&&(e.position.y=t.y),void 0!==t.z&&(e.position.z=t.z),void 0!==t.vx&&(e.velocity.x=t.vx),void 0!==t.vy&&(e.velocity.y=t.vy),void 0!==t.vz&&(e.velocity.z=t.vz),void 0!==t.ax&&(e.acceleration.x=t.ax),void 0!==t.ay&&(e.acceleration.y=t.ay),void 0!==t.az&&(e.acceleration.z=t.az),void 0!==t.p&&e.position.copy(t.p),void 0!==t.v&&e.velocity.copy(t.v),void 0!==t.a&&e.acceleration.copy(t.a),void 0!==t.position&&e.position.copy(t.position),void 0!==t.velocity&&e.velocity.copy(t.velocity),void 0!==t.accelerate&&e.acceleration.copy(t.accelerate)},setPrototypeByObj:function(e,t,r){for(var n in t)e.hasOwnProperty(n)&&(!r||r.indexOf(n)<0)&&(e[n]=this._getValue(t[n]));return e},_getValue:function(e){return"Span"===e.constructor.type?e.getValue():e}};$s=a(652);const jf=a.n($s)();function Af(e,t){var r,n=Object.keys(e);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(e),t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)),n}function Cf(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Af(Object(r),!0).forEach((function(t){tf(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Af(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Df(e,t){return Cf(Cf({},e),t)}const Lf={randomAToB:function(e,t,r){return r?(Math.random()*(t-e)>>0)+e:e+Math.random()*(t-e)},randomFloating:function(e,t,r){return this.randomAToB(e-t,e+t,r)},randomZone:function(e){},degreeTransform:function(e){return e*qh/180},toColor16:function(e){return"#"+e.toString(16)},randomColor:function(){return"#"+("00000"+(16777216*Math.random()<<0).toString(16)).slice(-6)},lerp:function(e,t,r){return t+(e-t)*r},getNormal:function(e,t){return 0==e.x&&0==e.y?0==e.z?t.set(1,0,1):t.set(1,1,-e.y/e.z):0==e.x?t.set(1,0,1):t.set(-e.y/e.x,1,1),t.normalize()},axisRotate:function(e,t,r,n){var i=Math.cos(n),o=(n=Math.sin(n),r.dot(t)*(1-i));e.copy(r),e.cross(t).scalar(n),e.addValue(t.x*i,t.y*i,t.z*i),e.addValue(r.x*o,r.y*o,r.z*o)}};function zf(e,t,r){return e instanceof If?e:void 0===t?new If(e):void 0===r?new If(e,t):new If(e,t,r)}var If=function(){function e(t,r,n){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");this._isArray=!1,this.type="Span",kf.isArray(t)?(this._isArray=!0,this.a=t):(this.a=kf.initValue(t,1),this.b=kf.initValue(r,this.a),this._center=kf.initValue(n,!1))}var t,r;return t=e,(r=[{key:"getValue",value:function(e){return this._isArray?this.a[this.a.length*Math.random()>>0]:this._center?Lf.randomFloating(this.a,this.b,e):Lf.randomAToB(this.a,this.b,e)}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,r),Object.defineProperty(t,"prototype",{writable:!1}),e}(),Bf=(tu=a(5689),a.n(tu));function Uf(e){return(Uf="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 Nf(e,t){return(Nf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Ff(e){return(Ff=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Vf=function(){var e=n,t=If;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&&Nf(e,t);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Ff(e);if(r=t?(r=Ff(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Uf(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(e){var t;if(this instanceof n)return(t=r.call(this)).type="ArraySpan",t.items=Array.isArray(e)?e:[e],t;throw new TypeError("Cannot call a class as a function")}return e=n,(t=[{key:"getValue",value:function(){return Bf()(this.items)}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),n}();function Hf(e){return(Hf="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 Gf(e,t){return(Gf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Wf(e){return(Wf=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Xf(e){return e||(console.warn("Invalid colors argument ".concat(e," passed to createColorSpan. Defaulting to 'random'.")),e="random"),e instanceof Yf?e:new Yf(e)}function qf(e,t,r){!function(e,t,r){e.sleep||(e.old.position.copy(e.position),e.old.velocity.copy(e.velocity),e.acceleration.scalar(1/e.mass),e.velocity.add(e.acceleration.scalar(t)),e.position.add(e.old.velocity.scalar(t)),r&&e.velocity.scalar(Math.pow(r,t/Kh)),e.acceleration.clear())}(e,t,r)}var Yf=function(){var e=n,t=If;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&&Gf(e,t);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Wf(e);if(r=t?(r=Wf(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Hf(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(e){var t;if(this instanceof n)return(t=r.call(this)).type="ColorSpan",t.shouldRandomize="random"===e,t.colors=Array.isArray(e)?e:[e],t;throw new TypeError("Cannot call a class as a function")}return e=n,(t=[{key:"getValue",value:function(){return this.shouldRandomize?Lf.randomColor():Bf()(this.colors)}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),n}(),Zf="EULER";function Qf(e){return(Qf="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 Kf(e,t){return(Kf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Jf(e){return(Jf=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var $f=function(){var e=n,t=Of;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&&Kf(e,t);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Jf(e);if(r=t?(r=Jf(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Qf(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(){var e=this,t=n;if(e instanceof t)return r.apply(this,arguments);throw new TypeError("Cannot call a class as a function")}return e=n,(t=[{key:"clear",value:function(){return this.x=0,this.y=0,this.z=0,this}},{key:"scalar",value:function(e){return this.x*=e,this.y*=e,this.z*=e,this}},{key:"addValue",value:function(e,t,r){return this.x+=e,this.y+=t,this.z+=r,this}},{key:"toString",value:function(){return"x:"+this.x+"y:"+this.y+"z:"+this.z}},{key:"eulerFromDir",value:function(e){return(new Pf).setFromVector3(e)}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),n}();var ep=function(){function e(t,r,n){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");this.type="Polar3D",this.radius=t||1,this.phi=n||0,this.theta=r||0}var t,r;return t=e,(r=[{key:"set",value:function(e,t,r){return this.radius=e||1,this.phi=r||0,this.theta=t||0,this}},{key:"setRadius",value:function(e){return this.radius=e,this}},{key:"setPhi",value:function(e){return this.phi=e,this}},{key:"setTheta",value:function(e){return this.theta=e,this}},{key:"copy",value:function(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}},{key:"toVector3D",value:function(){return new $f(this.getX(),this.getY(),this.getZ())}},{key:"getX",value:function(){return this.radius*Math.sin(this.theta)*Math.cos(this.phi)}},{key:"getY",value:function(){return-this.radius*Math.sin(this.theta)*Math.sin(this.phi)}},{key:"getZ",value:function(){return this.radius*Math.cos(this.theta)}},{key:"normalize",value:function(){return this.radius=1,this}},{key:"equals",value:function(e){return e.radius===this.radius&&e.phi===this.phi&&e.theta===this.theta}},{key:"clear",value:function(){return this.radius=0,this.phi=0,this.theta=0,this}},{key:"clone",value:function(){return new e(this.radius,this.phi,this.theta)}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,r),Object.defineProperty(t,"prototype",{writable:!1}),e}();var tp=function(){function e(t){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");this.id="particle-".concat(jf()),this.type="Particle",this.life=1/0,this.age=0,this.energy=1,this.dead=!1,this.sleep=!1,this.body=null,this.parent=null,this.mass=1,this.radius=10,this.alpha=1,this.scale=1,this.useColor=!1,this.useAlpha=!1,this.easing=Qh,this.position=new $f,this.velocity=new $f,this.acceleration=new $f,this.old={},this.old.position=this.position.clone(),this.old.velocity=this.velocity.clone(),this.old.acceleration=this.acceleration.clone(),this.behaviours=[],this.transform={},this.color={r:0,g:0,b:0},this.rotation=new $f,this.distanceToCamera=0,kf.setPrototypeByObj(this,t)}var t,r;return t=e,(r=[{key:"getDirection",value:function(){return Math.atan2(this.velocity.x,-this.velocity.y)*(180/qh)}},{key:"reset",value:function(){return this.life=1/0,this.age=0,this.energy=1,this.dead=!1,this.sleep=!1,this.body=null,this.parent=null,this.mass=1,this.radius=10,this.alpha=1,this.scale=1,this.useColor=!1,this.useAlpha=!1,this.easing=Qh,this.position.set(0,0,0),this.velocity.set(0,0,0),this.acceleration.set(0,0,0),this.old.position.set(0,0,0),this.old.velocity.set(0,0,0),this.old.acceleration.set(0,0,0),this.color.r=0,this.color.g=0,this.color.b=0,this.rotation.clear(),kf.destroyObject(this.transform),this.removeAllBehaviours(),this}},{key:"update",value:function(e,t){if(!this.sleep){this.age+=e;for(var r=this.behaviours.length;r--;)this.behaviours[r].applyBehaviour(this,e,t)}var n;this.age>=this.life?this.destroy():(n=this.easing(this.age/this.life),this.energy=Math.max(1-n,0))}},{key:"addBehaviour",value:function(e){this.behaviours.push(e),e.initialize(this)}},{key:"addBehaviours",value:function(e){for(var t=e.length;t--;)this.addBehaviour(e[t])}},{key:"removeBehaviour",value:function(e){-1<(e=this.behaviours.indexOf(e))&&this.behaviours.splice(e,1)}},{key:"removeAllBehaviours",value:function(){kf.destroyArray(this.behaviours)}},{key:"destroy",value:function(){this.removeAllBehaviours(),this.energy=0,this.dead=!0,this.parent=null}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,r),Object.defineProperty(t,"prototype",{writable:!1}),e}();function rp(e,t,r){return(rp=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(){}))),1}catch(e){return}}}()?Reflect.construct:function(e,t,r){var n=[null];return n.push.apply(n,t),t=new(Function.bind.apply(e,n)),r&&np(t,r.prototype),t}).apply(null,arguments)}function np(e,t){return(np=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var ip=function(){function e(){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");this.type="Pool",this.cID=0,this.list={}}var t,r;return t=e,(r=[{key:"create",value:function(e){if(!this.canCreateNewObject(e))throw new Error("The pool is unable to create or clone the object supplied");if(this.cID++,this.canInstantiateObject(e)){for(var t=arguments.length,r=new Array(1<t?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return rp(e,r)}if(this.canCloneObject(e))return e.clone()}},{key:"canInstantiateObject",value:function(e){return"function"==typeof e}},{key:"canCloneObject",value:function(e){return e.clone&&"function"==typeof e.clone}},{key:"canCreateNewObject",value:function(e){return!(!this.canInstantiateObject(e)&&!this.canCloneObject(e))}},{key:"getCount",value:function(){var e,t=0;for(e in this.list)t+=this.list[e].length;return t++}},{key:"get",value:function(e){for(var t,r=e.__puid||nf.id(e),n=arguments.length,i=new Array(1<n?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];return(t=this.list[r]&&0<this.list[r].length?this.list[r].pop():this.create.apply(this,[e].concat(i))).__puid=e.__puid||r,t}},{key:"expire",value:function(e){return this._getList(e.__puid).push(e)}},{key:"destroy",value:function(){for(var e in this.list)this.list[e].length=0,delete this.list[e]}},{key:"_getList",value:function(e){return this.list[e=e||"default"]||(this.list[e]=[]),this.list[e]}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,r),Object.defineProperty(t,"prototype",{writable:!1}),e}();const op=function(){function e(){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");this.listeners=null}var t,r;return t=e,(r=[{key:"listeners",get:function(){return this._listeners},set:function(e){this._listeners=e}},{key:"addEventListener",value:function(e,t){return this.listeners?this.removeEventListener(e,t):this.listeners={},this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t),t}},{key:"removeEventListener",value:function(e,t){if(this.listeners&&this.listeners[e])for(var r=this.listeners[e],n=0,i=r.length;n<i;n++)if(r[n]==t){1==i?delete this.listeners[e]:r.splice(n,1);break}}},{key:"removeAllEventListeners",value:function(e){e?this.listeners&&delete this.listeners[e]:this.listeners=null}},{key:"dispatchEvent",value:function(e,t){var r=!1,n=this.listeners;if(e&&n){var i=n[e];if(!i)return r;for(var o,a=(i=i.slice()).length;a--;)o=i[a],r=r||o(t)}return!!r}},{key:"hasEventListener",value:function(e){var t=this.listeners;return!(!t||!t[e])}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,r),Object.defineProperty(t,"prototype",{writable:!1}),e}();var ap="SYSTEM_UPDATE",sp="PARTICLE_CREATED",up="PARTICLE_UPDATE",lp="PARTICLE_DEAD",cp="EMITTER_DEAD";function hp(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var fp=function(){function e(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"Initializer",r=!(1<arguments.length&&void 0!==arguments[1])||arguments[1],n=this,i=e;if(!(n instanceof i))throw new TypeError("Cannot call a class as a function");this.type=t,this.isEnabled=r}var t,r,n;return t=e,n=[{key:"requiresWebGlApi",value:function(){return!1}},{key:"fromJSON",value:function(e){}}],(r=[{key:"init",value:function(e,t){this.isEnabled&&(t?(this.initialize(t),t.hasBeenInitialized=!0):(this.initialize(e),e.hasBeenInitialized=!0))}},{key:"reset",value:function(){}},{key:"initialize",value:function(e){}}])&&hp(t.prototype,r),n&&hp(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();function pp(e){return(pp="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 dp(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function mp(e,t){return(mp=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function yp(e){return(yp=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var vp=function(){var e=i,t=fp;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&&mp(e,t);var r,n=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=yp(e);if(r=t?(r=yp(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===pp(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(i);function i(e,t,r){var o=this,a=i;if(o instanceof a)return(o=n.call(this,"Body",!(3<arguments.length&&void 0!==arguments[3])||arguments[3])).body=(a=e)?a instanceof Vf?a:new Vf(a):null,o.w=t,o.h=r||t,o;throw new TypeError("Cannot call a class as a function")}return e=i,t=[{key:"fromJSON",value:function(e){return new i(e.body,e.width,e.height,void 0===(e=e.isEnabled)||e)}}],(r=[{key:"initialize",value:function(e){var t=this.body.getValue();this.w?e.body={width:this.w,height:this.h,body:t}:e.body=t}}])&&dp(e.prototype,r),t&&dp(e,t),Object.defineProperty(e,"prototype",{writable:!1}),i}();function gp(e,t){var r,n=Object.keys(e);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(e),t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)),n}function bp(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?gp(Object(r),!0).forEach((function(t){tf(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):gp(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var wp={AdditiveBlending:2,CustomBlending:5,MultiplyBlending:4,NoBlending:0,NormalBlending:1,SubtractiveBlending:3},xp={color:16711680,blending:2,fog:!0},Sp=bp(bp({},xp),{},{blending:"AdditiveBlending"});function _p(e){return(_p="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 Tp(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Ep(e,t){return(Ep=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Op(e){return(Op=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Mp(e,t){var r,n=Object.keys(e);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(e),t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)),n}function Pp(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Mp(Object(r),!0).forEach((function(t){tf(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Mp(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var Rp=function(){var e=i,t=fp;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&&Ep(e,t);var r,n=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Op(e);if(r=t?(r=Op(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===_p(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(i);function i(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:xp,o=!(3<arguments.length&&void 0!==arguments[3])||arguments[3],a=i;if(!((c=this)instanceof a))throw new TypeError("Cannot call a class as a function");var s=n.call(this,Lh,o),u=e.Sprite,l=e.SpriteMaterial,c=e.TextureLoader;return s.materialProperties=Df(xp,r),(new c).load(t,(function(e){s.texture=e,s.material=new l(Pp(Pp({},{map:e}),s.materialProperties)),s.sprite=new u(s.material)}),void 0,(function(e){throw new Error(e)})),s}return e=i,t=[{key:"fromJSON",value:function(e,t){var r=e.texture,n=void 0===(n=e.materialProperties)?Sp:n;return e=void 0===(e=e.isEnabled)||e,new i(t,r,Df(Sp,(t=n.blending,Pp(Pp({},n),{},{blending:t?wp[t]:wp[Sp.blending]}))),e)}}],(r=[{key:"initialize",value:function(e){e.body=this.sprite}}])&&Tp(e.prototype,r),t&&Tp(e,t),Object.defineProperty(e,"prototype",{writable:!1}),i}(),kp=new Pf;const jp={particleEuler:null,initialize:function(e,t,r){for(var n=r.length;n--;)r[n].init(e,t);e.bindEmitter&&this.bindEmitter(e,t)},bindEmitter:function(e,t){var r=(i=e.rotation).x,n=i.y,i=i.z;t.position.add(e.position),t.velocity.add(e.velocity),t.acceleration.add(e.acceleration),t.velocity.applyEuler(kp.set(r,n,i))}};function Ap(e){return(Ap="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 Cp(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Dp(e,t){return(Dp=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Lp(e){return(Lp=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var zp=function(){var e=i,t=fp;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&&Dp(e,t);var r,n=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Lp(e);if(r=t?(r=Lp(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Ap(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(i);function i(e,t,r){var o=this,a=i;if(o instanceof a)return(o=n.call(this,"Life",!(3<arguments.length&&void 0!==arguments[3])||arguments[3])).lifePan=zf(e,t,r),o;throw new TypeError("Cannot call a class as a function")}return e=i,t=[{key:"fromJSON",value:function(e){var t=e.min,r=e.max,n=e.center;return new i(t,r,void 0!==n&&n,void 0===(e=e.isEnabled)||e)}}],(r=[{key:"initialize",value:function(e){this.lifePan.a==1/0||"infi"==this.lifePan.a?e.life=1/0:e.life=this.lifePan.getValue()}}])&&Cp(e.prototype,r),t&&Cp(e,t),Object.defineProperty(e,"prototype",{writable:!1}),i}();function Ip(e){return(Ip="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 Bp(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Up(e,t){return(Up=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Np(e){return(Np=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Fp=function(){var e=i,t=fp;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&&Up(e,t);var r,n=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Np(e);if(r=t?(r=Np(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Ip(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(i);function i(e,t){var r=2<arguments.length&&void 0!==arguments[2]&&arguments[2],o=this,a=i;if(o instanceof a)return(o=n.call(this,"Mass",!(3<arguments.length&&void 0!==arguments[3])||arguments[3])).massPan=zf(e,t,r),o;throw new TypeError("Cannot call a class as a function")}return e=i,t=[{key:"fromJSON",value:function(e){var t=e.min,r=e.max,n=e.center;return new i(t,r,void 0!==n&&n,void 0===(e=e.isEnabled)||e)}}],(r=[{key:"initialize",value:function(e){e.mass=this.massPan.getValue()}}])&&Bp(e.prototype,r),t&&Bp(e,t),Object.defineProperty(e,"prototype",{writable:!1}),i}();var Vp=function(){function e(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"Zone",r=this,n=e;if(!(r instanceof n))throw new TypeError("Cannot call a class as a function");this.type=t,this.vector=new $f(0,0,0),this.random=0,this.crossType="dead",this.log=!0,this.supportsCrossing=!0}var t,r;return t=e,(r=[{key:"getPosition",value:function(){return null}},{key:"crossing",value:function(e){if(!this.supportsCrossing)return console.warn("".concat(this.constructor.name," does not support the crossing method"));switch(this.crossType){case"bound":this._bound(e);break;case"cross":this._cross(e);break;case"dead":this._dead(e)}}},{key:"isBoxZone",value:function(){return!1}},{key:"isLineZone",value:function(){return!1}},{key:"isMeshZone",value:function(){return!1}},{key:"isPointZone",value:function(){return!1}},{key:"isScreenZone",value:function(){return!1}},{key:"isSphereZone",value:function(){return!1}},{key:"_dead",value:function(e){}},{key:"_bound",value:function(e){}},{key:"_cross",value:function(e){}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,r),Object.defineProperty(t,"prototype",{writable:!1}),e}();function Hp(e){return(Hp="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 Gp(e,t){return(Gp=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Wp(e){return(Wp=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Xp=function(){var e=n,t=Vp;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&&Gp(e,t);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Wp(e);if(r=t?(r=Wp(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Hp(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(e,t,i,o,a,s){var u,l,c,h,f,p;if(this instanceof n)return u=r.call(this,Vh),kf.isUndefined(t,i,o,a,s)?(l=c=h=0,f=p=o=e||100):o=kf.isUndefined(o,a,s)?(l=c=h=0,f=e,p=t,i):(l=e,c=t,h=i,f=o,p=a,s),u.x=l,u.y=c,u.z=h,u.width=f,u.height=p,u.depth=o,u.friction=.85,u.max=6,u;throw new TypeError("Cannot call a class as a function")}return e=n,(t=[{key:"isBoxZone",value:function(){return!0}},{key:"getPosition",value:function(){return this.vector.x=this.x+Lf.randomAToB(-.5,.5)*this.width,this.vector.y=this.y+Lf.randomAToB(-.5,.5)*this.height,this.vector.z=this.z+Lf.randomAToB(-.5,.5)*this.depth,this.vector}},{key:"_dead",value:function(e){(e.position.x+e.radius<this.x-this.width/2||e.position.x-e.radius>this.x+this.width/2)&&(e.dead=!0),(e.position.y+e.radius<this.y-this.height/2||e.position.y-e.radius>this.y+this.height/2)&&(e.dead=!0),(e.position.z+e.radius<this.z-this.depth/2||e.position.z-e.radius>this.z+this.depth/2)&&(e.dead=!0)}},{key:"_bound",value:function(e){e.position.x-e.radius<this.x-this.width/2?(e.position.x=this.x-this.width/2+e.radius,e.velocity.x*=-this.friction,this._static(e,"x")):e.position.x+e.radius>this.x+this.width/2&&(e.position.x=this.x+this.width/2-e.radius,e.velocity.x*=-this.friction,this._static(e,"x")),e.position.y-e.radius<this.y-this.height/2?(e.position.y=this.y-this.height/2+e.radius,e.velocity.y*=-this.friction,this._static(e,"y")):e.position.y+e.radius>this.y+this.height/2&&(e.position.y=this.y+this.height/2-e.radius,e.velocity.y*=-this.friction,this._static(e,"y")),e.position.z-e.radius<this.z-this.depth/2?(e.position.z=this.z-this.depth/2+e.radius,e.velocity.z*=-this.friction,this._static(e,"z")):e.position.z+e.radius>this.z+this.depth/2&&(e.position.z=this.z+this.depth/2-e.radius,e.velocity.z*=-this.friction,this._static(e,"z"))}},{key:"_static",value:function(e,t){0<e.velocity[t]*e.acceleration[t]||Math.abs(e.velocity[t])<.0167*Math.abs(e.acceleration[t])*this.max&&(e.velocity[t]=0,e.acceleration[t]=0)}},{key:"_cross",value:function(e){e.position.x+e.radius<this.x-this.width/2&&e.velocity.x<=0?e.position.x=this.x+this.width/2+e.radius:e.position.x-e.radius>this.x+this.width/2&&0<=e.velocity.x&&(e.position.x=this.x-this.width/2-e.radius),e.position.y+e.radius<this.y-this.height/2&&e.velocity.y<=0?e.position.y=this.y+this.height/2+e.radius:e.position.y-e.radius>this.y+this.height/2&&0<=e.velocity.y&&(e.position.y=this.y-this.height/2-e.radius),e.position.z+e.radius<this.z-this.depth/2&&e.velocity.z<=0?e.position.z=this.z+this.depth/2+e.radius:e.position.z-e.radius>this.z+this.depth/2&&0<=e.velocity.z&&(e.position.z=this.z-this.depth/2-e.radius)}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),n}();function qp(e){return(qp="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 Yp(e,t){return(Yp=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Zp(e){return(Zp=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Qp=function(){var e=n,t=Vp;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&&Yp(e,t);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Zp(e);if(r=t?(r=Zp(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===qp(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(e,t,i,o,a,s){var u;if(this instanceof n)return u=r.call(this,Hh),e instanceof $f?(u.x1=e.x,u.y1=e.y,u.z1=e.z,u.x2=o.x,u.y2=o.y,u.z2=o.z):(u.x1=e,u.y1=t,u.z1=i,u.x2=o,u.y2=a,u.z2=s),u.supportsCrossing=!1,u;throw new TypeError("Cannot call a class as a function")}return e=n,(t=[{key:"isLineZone",value:function(){return!0}},{key:"getPosition",value:function(){return this.random=Math.random(),this.vector.x=this.x1+this.random*(this.x2-this.x1),this.vector.y=this.y1+this.random*(this.y2-this.y1),this.vector.z=this.z1+this.random*(this.z2-this.z1),this.vector}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),n}();function Kp(e){return(Kp="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 Jp(e,t){return(Jp=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function $p(e){return($p=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var ed=function(){var e=n,t=Vp;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&&Jp(e,t);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=$p(e);if(r=t?(r=$p(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Kp(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1,i=2<arguments.length?arguments[2]:void 0,o=this,a=n;if(!(o instanceof a))throw new TypeError("Cannot call a class as a function");if((o=r.call(this,Gh)).geometry=null,o.scale=t,o.supportsCrossing=!1,e.type&&"Geometry"===e.type&&(o.geometry=e),e.geometry&&(o.geometry=e.geometry),o.geometry)return o.geometry.isBufferGeometry&&(o.geometry=(new i).fromBufferGeometry(o.geometry)),o;throw new Error("MeshZone unable to set geometry from the supplied bounds")}return e=n,(t=[{key:"isMeshZone",value:function(){return!0}},{key:"getPosition",value:function(){var e=(e=this.geometry.vertices)[e.length*Math.random()>>0];return this.vector.x=e.x*this.scale,this.vector.y=e.y*this.scale,this.vector.z=e.z*this.scale,this.vector}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),n}();function td(e){return(td="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 rd(e,t){return(rd=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function nd(e){return(nd=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var id=function(){var e=n,t=Vp;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&&rd(e,t);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=nd(e);if(r=t?(r=nd(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===td(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(e,t,i){var o,a;if(this instanceof n)return o=r.call(this,Wh),a=kf.isUndefined(e,t,i)?0:e,o.x=a,o.y=a,o.z=a,o.supportsCrossing=!1,o;throw new TypeError("Cannot call a class as a function")}return e=n,(t=[{key:"isPointZone",value:function(){return!0}},{key:"getPosition",value:function(){return this.vector.x=this.x,this.vector.y=this.y,this.vector.z=this.z,this.vector}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),n}();function od(e){return(od="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 ad(e,t){return(ad=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function sd(e){return(sd=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var ud,ld,cd,hd=function(){var e=n,t=Vp;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&&ad(e,t);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=sd(e);if(r=t?(r=sd(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===od(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(e,t,i,o){var a;if(!(this instanceof n))throw new TypeError("Cannot call a class as a function");(a=r.call(this,"ScreenZone")).camera=e,a.renderer=t,a.dis=i||20,o=o||"1234";for(var s=1;s<5;s++)a["d"+s]=0<=o.indexOf(s+"");return a}return e=n,(t=[{key:"isScreenZone",value:function(){return!0}},{key:"_dead",value:function(e){var t=Rf.toScreenPos(e.position,this.camera,this.renderer.domElement),r=this.renderer.domElement;(t.y+e.radius<-this.dis&&this.d1||t.y-e.radius>r.height+this.dis&&this.d3)&&(e.dead=!0),(t.x+e.radius<-this.dis&&this.d4||t.x-e.radius>r.width+this.dis&&this.d2)&&(e.dead=!0)}},{key:"_bound",value:function(e){var t=Rf.toScreenPos(e.position,this.camera,this.renderer.domElement),r=this.renderer.domElement;(t.y+e.radius<-this.dis||t.y-e.radius>r.height+this.dis)&&(e.velocity.y*=-1),(t.x+e.radius<-this.dis||t.x-e.radius>r.width+this.dis)&&(e.velocity.y*=-1)}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),n}();function fd(e){return(fd="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 pd(e,t){return(pd=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function dd(e){return(dd=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}hd.prototype.getPosition=(ld=new $f,function(){return ud=this.renderer.domElement,ld.x=Math.random()*ud.width,ld.y=Math.random()*ud.height,this.vector.copy(Rf.toSpacePos(ld,this.camera,ud)),this.vector}),hd.prototype._cross=(cd=new $f,function(e){var t=Rf.toScreenPos(e.position,this.camera,this.renderer.domElement),r=this.renderer.domElement;t.y+e.radius<-this.dis?(cd.x=t.x,cd.y=r.height+this.dis+e.radius,e.position.y=Rf.toSpacePos(cd,this.camera,r).y):t.y-e.radius>r.height+this.dis&&(cd.x=t.x,cd.y=-this.dis-e.radius,e.position.y=Rf.toSpacePos(cd,this.camera,r).y),t.x+e.radius<-this.dis?(cd.y=t.y,cd.x=r.width+this.dis+e.radius,e.position.x=Rf.toSpacePos(cd,this.camera,r).x):t.x-e.radius>r.width+this.dis&&(cd.y=t.y,cd.x=-this.dis-e.radius,e.position.x=Rf.toSpacePos(cd,this.camera,r).x)});var md,yd,vd,gd,bd,wd,xd=function(){var e=n,t=Vp;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&&pd(e,t);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=dd(e);if(r=t?(r=dd(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===fd(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(e,t,i,o){var a,s;if(this instanceof n)return a=r.call(this,Xh),t=kf.isUndefined(t,i,o)?(s=0,e||100):(s=e,o),a.x=s,a.y=s,a.z=s,a.radius=t,a.the=a.phi=0,a;throw new TypeError("Cannot call a class as a function")}return e=n,(t=[{key:"isSphereZone",value:function(){return!0}},{key:"_dead",value:function(e){e.position.distanceTo(this)-e.radius>this.radius&&(e.dead=!0)}},{key:"_cross",value:function(){console.warn("".concat(this.constructor.name," does not support the _cross method"))}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),n}();function Sd(e){return(Sd="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 _d(e,t,r){return(_d=Pd()?Reflect.construct:function(e,t,r){var n=[null];return n.push.apply(n,t),t=new(Function.bind.apply(e,n)),r&&Od(t,r.prototype),t}).apply(null,arguments)}function Td(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Ed(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Od(e,t){return(Od=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Md(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Pd(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function Rd(e){return(Rd=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}xd.prototype.getPosition=function(){return this.random=Math.random(),vd=this.random*this.radius,md=qh*Math.random(),yd=2*qh*Math.random(),this.vector.x=this.x+vd*Math.sin(md)*Math.cos(yd),this.vector.y=this.y+vd*Math.sin(yd)*Math.sin(md),this.vector.z=this.z+vd*Math.cos(md),this.vector},xd.prototype._bound=(bd=new $f,wd=new $f,function(e){e.position.distanceTo(this)+e.radius>=this.radius&&(bd.copy(e.position).sub(this).normalize(),wd.copy(e.velocity),gd=2*wd.dot(bd),e.velocity.sub(bd.scalar(gd)))});var kd,jd=["zoneType"],Ad=function(){var e=i,t=fp;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&&Od(e,t);var r,n=function(e){var t=Pd();return function(){var r,n=Rd(e);if(r=t?(r=Rd(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Sd(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return Md(n)}}(i);function i(){var e=this,t=i;if(e instanceof t)return(e=n.call(this,Ih)).reset.apply(Md(e),arguments),e;throw new TypeError("Cannot call a class as a function")}return e=i,t=[{key:"fromJSON",value:function(e){var t=e.zoneType;if(e=function(e,t){if(null==e)return{};var r,n=function(e,t){if(null==e)return{};for(var r,n={},i=Object.keys(e),o=0;o<i.length;o++)r=i[o],0<=t.indexOf(r)||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols)for(var i=Object.getOwnPropertySymbols(e),o=0;o<i.length;o++)r=i[o],0<=t.indexOf(r)||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r]);return n}(e,jd),ef.includes(t))return new i(_d(o[t],function(e){return function(e){if(Array.isArray(e))return Td(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 Td(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(r="Object"===r&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Td(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.")}()}(Object.values(e))));throw new Error("The zone type ".concat(t," is invalid or not yet supported"))}}],(r=[{key:"reset",value:function(){this.zones?this.zones.length=0:this.zones=[],this.zones=this.zones.concat(Array.prototype.slice.call(arguments))}},{key:"addZone",value:function(){this.zones=this.zones.concat(Array.prototype.slice.call(arguments))}}])&&Ed(e.prototype,r),t&&Ed(e,t),Object.defineProperty(e,"prototype",{writable:!1}),i}();function Cd(e){return(Cd="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 Dd(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Ld(e,t){return(Ld=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function zd(e){return(zd=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}Ad.prototype.initialize=function(e){(kd=this.zones[Math.random()*this.zones.length>>0]).getPosition(),e.position.x=kd.vector.x,e.position.y=kd.vector.y,e.position.z=kd.vector.z};var Id=function(){var e=i,t=fp;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&&Ld(e,t);var r,n=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=zd(e);if(r=t?(r=zd(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Cd(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(i);function i(e,t){var r=2<arguments.length&&void 0!==arguments[2]&&arguments[2],o=this,a=i;if(o instanceof a)return(o=n.call(this,"Radius",!(3<arguments.length&&void 0!==arguments[3])||arguments[3])).radius=zf(e,t,r),o;throw new TypeError("Cannot call a class as a function")}return e=i,t=[{key:"fromJSON",value:function(e){var t=e.width,r=e.height,n=e.center;return new i(t,r,void 0!==n&&n,void 0===(e=e.isEnabled)||e)}}],(r=[{key:"reset",value:function(e,t){this.radius=zf(e,t,2<arguments.length&&void 0!==arguments[2]&&arguments[2])}},{key:"initialize",value:function(e){e.radius=this.radius.getValue(),e.transform.oldRadius=e.radius}}])&&Dd(e.prototype,r),t&&Dd(e,t),Object.defineProperty(e,"prototype",{writable:!1}),i}();function Bd(e){return(Bd="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 Ud(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Nd(e,t){return(Nd=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Fd(e){return(Fd=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Vd=function(){var e=i,t=fp;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&&Nd(e,t);var r,n=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Fd(e);if(r=t?(r=Fd(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Bd(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(i);function i(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1,r=this,o=i;if(r instanceof o)return(r=n.call(this,"Rate")).numPan=zf(e),r.timePan=zf(t),r.startTime=0,r.nextTime=0,r.init(),r;throw new TypeError("Cannot call a class as a function")}return e=i,t=[{key:"fromJSON",value:function(e){var t=e.particlesMin,r=e.particlesMax,n=e.perSecondMin;return e=e.perSecondMax,new i(new If(t,r),new If(n,e))}}],(r=[{key:"init",value:function(){this.startTime=0,this.nextTime=this.timePan.getValue()}},{key:"getValue",value:function(e){return this.startTime+=e,this.startTime>=this.nextTime?(this.init(),1==this.numPan.b?.5<this.numPan.getValue("Float")?1:0:this.numPan.getValue("Int")):0}}])&&Ud(e.prototype,r),t&&Ud(e,t),Object.defineProperty(e,"prototype",{writable:!1}),i}();function Hd(e){return(Hd="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 Gd(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Wd(e,t){return(Wd=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Xd(e){return(Xd=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function qd(e,t){var r,n=Object.keys(e);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(e),t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)),n}function Yd(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?qd(Object(r),!0).forEach((function(t){tf(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):qd(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var Zd=function(){var e=i,t=fp;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&&Wd(e,t);var r,n=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Xd(e);if(r=t?(r=Xd(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Hd(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(i);function i(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:xp,o=!(3<arguments.length&&void 0!==arguments[3])||arguments[3],a=this,s=i;if(!(a instanceof s))throw new TypeError("Cannot call a class as a function");return a=n.call(this,zh,o),s=e.Sprite,o=e.SpriteMaterial,a.materialProperties=Df(xp,r),a.texture=t,a.material=new o(Yd(Yd({},{map:t}),a.materialProperties)),a.sprite=new s(a.material),a}return e=i,t=[{key:"fromJSON",value:function(e,t){var r=e.loadedTexture,n=void 0===(n=e.materialProperties)?Sp:n;return e=void 0===(e=e.isEnabled)||e,new i(t,r,Df(Sp,(t=n.blending,Yd(Yd({},n),{},{blending:t?wp[t]:wp[Sp.blending]}))),e)}}],(r=[{key:"initialize",value:function(e){e.body=this.sprite}}])&&Gd(e.prototype,r),t&&Gd(e,t),Object.defineProperty(e,"prototype",{writable:!1}),i}();function Qd(e){return(Qd="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 Kd(e,t){return(Kd=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Jd(e){return(Jd=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var $d,em,tm,rm=function(){var e=n,t=fp;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&&Kd(e,t);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Jd(e);if(r=t?(r=Jd(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Qd(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(e){var t=this,i=n;if(t instanceof i)return(t=r.call(this,e,!(1<arguments.length&&void 0!==arguments[1])||arguments[1])).dirVec=new $f(0,0,0),t;throw new TypeError("Cannot call a class as a function")}return e=n,(t=[{key:"normalize",value:function(e){return 100*e}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),n}();function nm(e){return(nm="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 im(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function om(e,t){return(om=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function am(e){return(am=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}rm.prototype.initialize=(em=new $f(0,0,1),tm=new $f(0,0,0),function(e){return $d=this.tha*Math.random(),this._useV&&this.dirVec.copy(this.dir).scalar(this.radiusPan.getValue()),Lf.getNormal(this.dirVec,em),tm.copy(this.dirVec).applyAxisAngle(em,$d),tm.applyAxisAngle(this.dirVec.normalize(),Math.random()*qh*2),e.velocity.copy(tm),this});var sm=function(){var e=n,t=rm;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&&om(e,t);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=am(e);if(r=t?(r=am(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===nm(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(e,t){var i=this,o=n;if(i instanceof o)return(i=r.call(this,Uh,!(2<arguments.length&&void 0!==arguments[2])||arguments[2])).tha=t*Yh,i.dirVec=e.toVector3D(),i._useV=!1,i;throw new TypeError("Cannot call a class as a function")}return e=n,t=[{key:"fromJSON",value:function(e){var t=e.polarRadius,r=e.polarTheta,i=e.polarPhi,o=e.velocityTheta;return e=void 0===(e=e.isEnabled)||e,new n(new ep(t,r,i),o,e)}}],t&&im(e,t),Object.defineProperty(e,"prototype",{writable:!1}),n}();function um(e){return(um="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 lm(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function cm(e,t){return(cm=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function hm(e){return(hm=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var fm=function(){var e=n,t=rm;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&&cm(e,t);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=hm(e);if(r=t?(r=hm(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===um(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(e,t,i){var o=this,a=n;if(o instanceof a)return(o=r.call(this,Nh,!(3<arguments.length&&void 0!==arguments[3])||arguments[3])).radiusPan=zf(e),o.dir=t.clone().normalize(),o.tha=i*Yh,o._useV=!0,o;throw new TypeError("Cannot call a class as a function")}return e=n,t=[{key:"fromJSON",value:function(e){var t=e.radius,r=e.x,i=e.y,o=e.z,a=e.theta;return e=void 0===(e=e.isEnabled)||e,new n(t,new $f(r,i,o),a,e)}}],t&&lm(e,t),Object.defineProperty(e,"prototype",{writable:!1}),n}();function pm(e){return(pm="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 dm(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function mm(e,t){return(mm=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ym(e){return(ym=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var vm=function(){var e=n,t=rm;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&&mm(e,t);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=ym(e);if(r=t?(r=ym(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===pm(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(e,t){var i=this,o=n;if(i instanceof o)return(i=r.call(this,Bh,!(2<arguments.length&&void 0!==arguments[2])||arguments[2])).radiusPan=zf(1),i.dir=e.clone(),i.tha=t*Yh,i._useV=!0,i;throw new TypeError("Cannot call a class as a function")}return e=n,t=[{key:"fromJSON",value:function(e){var t=e.x,r=e.y,i=e.z,o=e.theta;return e=void 0===(e=e.isEnabled)||e,new n(new $f(t,r,i),o,e)}}],t&&dm(e,t),Object.defineProperty(e,"prototype",{writable:!1}),n}(),gm=new Vd(1,.1),bm=(ru=a(7451),a.n(ru));function wm(e){return(wm="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 xm(e,t){return(xm=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Sm(e){return(Sm=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var _m=function(){var e=n,t=tp;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&&xm(e,t);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Sm(e);if(r=t?(r=Sm(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===wm(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(e){if(this instanceof n)return(e=r.call(this,e)).type="Emitter",e.particles=[],e.initializers=[],e.behaviours=[],e.emitterBehaviours=[],e.currentEmitTime=0,e.totalEmitTimes=-1,e.damping=.006,e.bindEmitter=!0,e.bindEmitterEvent=!1,e.rate=gm,e.isEmitting=!1,e.id="emitter-".concat(jf()),e.cID=0,e.name="Emitter",e.index=void 0,e.eventDispatcher=new op,e;throw new TypeError("Cannot call a class as a function")}return e=n,(t=[{key:"dispatch",value:function(e){this.eventDispatcher.dispatchEvent(e,1<arguments.length&&void 0!==arguments[1]?arguments[1]:this)}},{key:"setRate",value:function(e){return this.rate=e,this}},{key:"setPosition",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=this.position,r=void 0===(r=e.x)?t.x:r,n=void 0===(n=e.y)?t.y:n;return t=void 0===(e=e.z)?t.z:e,this.position.set(r,n,t),this}},{key:"setRotation",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=this.rotation,r=void 0===(r=e.x)?t.x:r,n=void 0===(n=e.y)?t.y:n;return t=void 0===(e=e.z)?t.z:e,this.rotation.set(r,n,t),this}},{key:"emit",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1/0,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1/0;return this.currentEmitTime=0,this.totalEmitTimes=bm()(e)?e:1/0,this.life=1===e?e:bm()(t)?t:1/0,this.rate.init(),this.isEmitting=!0,this}},{key:"experimental_emit",value:function(){var e=this.isEmitting,t=this.totalEmitTimes,r=this.life;return e||(this.currentEmitTime=0,t||this.setTotalEmitTimes(1/0),r||this.setLife(1/0),this.rate.init(),this.isEmitting=!0),this}},{key:"setTotalEmitTimes",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1/0;return this.totalEmitTimes=bm()(e)?e:1/0,this}},{key:"setLife",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1/0;return 1===this.totalEmitTimes?this.life=this.totalEmitTimes:this.life=bm()(e)?e:1/0,this}},{key:"stopEmit",value:function(){this.totalEmitTimes=-1,this.currentEmitTime=0,this.isEmitting=!1}},{key:"removeAllParticles",value:function(){for(var e=this.particles.length;e--;)this.particles[e].dead=!0}},{key:"addInitializer",value:function(e){return this.initializers.push(e),this}},{key:"addInitializers",value:function(e){for(var t=e.length;t--;)this.addInitializer(e[t]);return this}},{key:"setInitializers",value:function(e){return this.initializers=e,this}},{key:"removeInitializer",value:function(e){return-1<(e=this.initializers.indexOf(e))&&this.initializers.splice(e,1),this}},{key:"removeAllInitializers",value:function(){return kf.destroyArray(this.initializers),this}},{key:"addBehaviour",value:function(e){return this.behaviours.push(e),this}},{key:"addBehaviours",value:function(e){for(var t=e.length;t--;)this.addBehaviour(e[t]);return this}},{key:"setBehaviours",value:function(e){return this.behaviours=e,this}},{key:"removeBehaviour",value:function(e){return-1<(e=this.behaviours.indexOf(e))&&this.behaviours.splice(e,1),this}},{key:"removeAllBehaviours",value:function(){return kf.destroyArray(this.behaviours),this}},{key:"addEmitterBehaviour",value:function(e){return this.emitterBehaviours.push(e),e.initialize(this),this}},{key:"addEmitterBehaviours",value:function(e){for(var t=e.length;t--;)this.addEmitterBehaviour(e[t]);return this}},{key:"setEmitterBehaviours",value:function(e){var t=e.length;this.emitterBehaviours=e;for(var r=0;r<t;r++)this.emitterBehaviours[r].initialize(this);return this}},{key:"removeEmitterBehaviour",value:function(e){return-1<(e=this.emitterBehaviours.indexOf(e))&&this.emitterBehaviours.splice(e,1),this}},{key:"removeAllEmitterBehaviours",value:function(){return kf.destroyArray(this.emitterBehaviours),this}},{key:"addOnEmitterDeadEventListener",value:function(e){return this.eventDispatcher.addEventListener("".concat(this.id,"_").concat(cp),(function(){return e()})),this}},{key:"createParticle",value:function(){var e=this.parent.pool.get(tp),t=this.particles.length;return this.setupParticle(e,t),this.parent&&this.parent.dispatch(sp,e),this.bindEmitterEvent&&this.dispatch(sp,e),e}},{key:"setupParticle",value:function(e,t){var r=this.initializers,n=this.behaviours;jp.initialize(this,e,r),e.addBehaviours(n),e.parent=this,e.index=t,this.particles.push(e)}},{key:"update",value:function(e){if(this.isEmitting){this.age+=e,(this.dead||this.age>=this.life)&&this.destroy(),this.generate(e),this.integrate(e);for(var t=this.particles.length;t--;){var r=this.particles[t];r.dead&&(this.parent&&this.parent.dispatch(lp,r),this.bindEmitterEvent&&this.dispatch(lp,r),this.parent.pool.expire(r.reset()),this.particles.splice(t,1))}this.updateEmitterBehaviours(e)}}},{key:"updateEmitterBehaviours",value:function(e){if(!this.sleep)for(var t=this.emitterBehaviours.length,r=0;r<t;r++)this.emitterBehaviours[r].applyBehaviour(this,e,r)}},{key:"integrate",value:function(e){this.parent&&this.parent.integrationType;for(var t=1-this.damping,r=(qf(this,e,t),this.particles.length);r--;){var n=this.particles[r];n.update(e,r),qf(n,e,t),this.parent&&this.parent.dispatch(up,n),this.bindEmitterEvent&&this.dispatch(up,n)}}},{key:"generate",value:function(e){if(1===this.totalEmitTimes){var t=this.rate.getValue(99999);for(0<t&&(this.cID=t);t--;)this.createParticle();this.totalEmitTimes=0}else if(this.currentEmitTime+=e,this.currentEmitTime<this.totalEmitTimes){var r=this.rate.getValue(e);for(0<r&&(this.cID=r);r--;)this.createParticle()}}},{key:"destroy",value:function(){this.dead=!0,this.energy=0,this.totalEmitTimes=-1,0==this.particles.length&&(this.isEmitting=!1,this.removeAllInitializers(),this.removeAllBehaviours(),this.dispatch("".concat(this.id,"_").concat(cp)),this.parent&&this.parent.removeEmitter(this))}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),n}(),Tm=Ks;var Em=function(){function e(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1/0,r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:Tm,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"Behaviour",i=!(3<arguments.length&&void 0!==arguments[3])||arguments[3],o=this,a=e;if(!(o instanceof a))throw new TypeError("Cannot call a class as a function");this.type=n,this.isEnabled=i,this.id="behaviour-".concat(jf()),this.life=t,this.easing=r,this.age=0,this.energy=1,this.dead=!1}var t,r;return t=e,(r=[{key:"reset",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1/0,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:Tm;this.life=e,this.easing=t||Tm}},{key:"life",get:function(){return this._life},set:function(e){this._life=bm()(e)?e:1/0}},{key:"normalizeForce",value:function(e){return e.scalar(100)}},{key:"normalizeValue",value:function(e){return 100*e}},{key:"initialize",value:function(e){}},{key:"applyBehaviour",value:function(e,t,r){this.isEnabled&&this.mutate(e,t,r)}},{key:"mutate",value:function(e,t,r){}},{key:"energize",value:function(e,t){if(!this.dead){if(this.age+=t,this.age>=this.life)return this.energy=0,void(this.dead=!0);t=this.easing(e.age/e.life),this.energy=Math.max(1-t,0)}}},{key:"destroy",value:function(){}},{key:"fromJSON",value:function(e){}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,r),Object.defineProperty(t,"prototype",{writable:!1}),e}();function Om(e){return(Om="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 Mm(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Pm(){return(Pm="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=km(e)););return e}(e,t);if(n)return(n=Object.getOwnPropertyDescriptor(n,t)).get?n.get.call(arguments.length<3?e:r):n.value}).apply(this,arguments)}function Rm(e,t){return(Rm=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function km(e){return(km=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var jm=function(){var e=i,t=Em;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&&Rm(e,t);var r,n=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=km(e);if(r=t?(r=km(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Om(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(i);function i(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null,r=this,o=i;if(r instanceof o)return(r=n.call(this,2<arguments.length?arguments[2]:void 0,3<arguments.length?arguments[3]:void 0,"Alpha",!(4<arguments.length&&void 0!==arguments[4])||arguments[4])).alphaA=e,r.alphaB=t,r.reset(e,t),r;throw new TypeError("Cannot call a class as a function")}return e=i,t=[{key:"fromJSON",value:function(e){var t=e.alphaA,r=e.alphaB,n=e.life,o=e.easing;return e=e.isEnabled,new i(t,r,n,Ph(o),void 0===e||e)}}],(r=[{key:"same",get:function(){return this._same},set:function(e){this._same=e}},{key:"reset",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null,r=2<arguments.length?arguments[2]:void 0,n=3<arguments.length?arguments[3]:void 0;this.same=null==t,this.alphaA=zf(e),this.alphaB=zf(t),r&&Pm(km(i.prototype),"reset",this).call(this,r,n)}},{key:"initialize",value:function(e){e.useAlpha=!0,e.transform.alphaA=this.alphaA.getValue(),e.transform.alphaB=this.same?e.transform.alphaA:this.alphaB.getValue()}},{key:"mutate",value:function(e,t,r){this.energize(e,t,r),e.alpha=Lf.lerp(e.transform.alphaA,e.transform.alphaB,this.energy),e.alpha<.002&&(e.alpha=0)}}])&&Mm(e.prototype,r),t&&Mm(e,t),Object.defineProperty(e,"prototype",{writable:!1}),i}();function Am(e){return(Am="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 Cm(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Dm(){return(Dm="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=zm(e)););return e}(e,t);if(n)return(n=Object.getOwnPropertyDescriptor(n,t)).get?n.get.call(arguments.length<3?e:r):n.value}).apply(this,arguments)}function Lm(e,t){return(Lm=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function zm(e){return(zm=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Im=function(){var e=i,t=Em;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&&Lm(e,t);var r,n=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=zm(e);if(r=t?(r=zm(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Am(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(i);function i(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new $f,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:100,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:1e3,o=this,a=i;if(o instanceof a)return(o=n.call(this,3<arguments.length&&void 0!==arguments[3]?arguments[3]:1/0,4<arguments.length&&void 0!==arguments[4]?arguments[4]:Tm,kh,!(5<arguments.length&&void 0!==arguments[5])||arguments[5])).targetPosition=e,o.radius=r,o.force=o.normalizeValue(t),o.radiusSq=o.radius*o.radius,o.attractionForce=new $f,o.lengthSq=0,o;throw new TypeError("Cannot call a class as a function")}return e=i,t=[{key:"fromJSON",value:function(e){var t=e.x,r=e.y,n=e.z,o=e.force,a=e.radius,s=e.life,u=e.easing;return e=void 0===(e=e.isEnabled)||e,new i(new $f(t,r,n),o,a,s,Ph(u),e)}}],(r=[{key:"reset",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new $f,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:100,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:1e3,n=3<arguments.length?arguments[3]:void 0,o=4<arguments.length?arguments[4]:void 0;this.targetPosition=e,this.radius=r,this.force=this.normalizeValue(t),this.radiusSq=this.radius*this.radius,this.attractionForce=new $f,this.lengthSq=0,n&&Dm(zm(i.prototype),"reset",this).call(this,n,o)}},{key:"mutate",value:function(e,t,r){this.energize(e,t,r),this.attractionForce.copy(this.targetPosition),this.attractionForce.sub(e.position),this.lengthSq=this.attractionForce.lengthSq(),4e-6<this.lengthSq&&this.lengthSq<this.radiusSq&&(this.attractionForce.normalize(),this.attractionForce.scalar(1-this.lengthSq/this.radiusSq),this.attractionForce.scalar(this.force),e.acceleration.add(this.attractionForce))}}])&&Cm(e.prototype,r),t&&Cm(e,t),Object.defineProperty(e,"prototype",{writable:!1}),i}();function Bm(e){return(Bm="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 Um(){return(Um="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=Fm(e)););return e}(e,t);if(n)return(n=Object.getOwnPropertyDescriptor(n,t)).get?n.get.call(arguments.length<3?e:r):n.value}).apply(this,arguments)}function Nm(e,t){return(Nm=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Fm(e){return(Fm=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Vm=function(){var e=n,t=Em;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&&Nm(e,t);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Fm(e);if(r=t?(r=Fm(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Bm(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(e,t,i,o,a){var s=this,u=n;if(s instanceof u)return(s=r.call(this,o,a,"Collision",!(5<arguments.length&&void 0!==arguments[5])||arguments[5])).reset(e,t,i),s;throw new TypeError("Cannot call a class as a function")}return e=n,(t=[{key:"reset",value:function(e,t,r,i,o){this.emitter=e,this.useMass=t,this.onCollide=r,this.particles=[],this.delta=new $f,i&&Um(Fm(n.prototype),"reset",this).call(this,i,o)}},{key:"mutate",value:function(e,t,r){for(var n,i,o,a,s=(this.emitter||this).particles.slice(r),u=s.length;u--;)(n=s[u])!=e&&(this.delta.copy(n.position).sub(e.position),(o=this.delta.lengthSq())<=(i=e.radius+n.radius)*i&&(i-=Math.sqrt(o),i+=.5,o=this._getAverageMass(e,n),a=this._getAverageMass(n,e),e.position.add(this.delta.clone().normalize().scalar(i*-o)),n.position.add(this.delta.normalize().scalar(i*a)),this.onCollide&&this.onCollide(e,n)))}},{key:"_getAverageMass",value:function(e,t){return this.useMass?t.mass/(e.mass+t.mass):.5}},{key:"fromJSON",value:function(e){}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),n}();function Hm(e){return(Hm="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 Gm(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Wm(){return(Wm="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=qm(e)););return e}(e,t);if(n)return(n=Object.getOwnPropertyDescriptor(n,t)).get?n.get.call(arguments.length<3?e:r):n.value}).apply(this,arguments)}function Xm(e,t){return(Xm=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function qm(e){return(qm=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Ym=function(){var e=i,t=Em;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&&Xm(e,t);var r,n=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=qm(e);if(r=t?(r=qm(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Hm(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(i);function i(e,t,r,o){var a=this,s=i;if(a instanceof s)return(a=n.call(this,r,o,"Color",!(4<arguments.length&&void 0!==arguments[4])||arguments[4])).reset(e,t),a;throw new TypeError("Cannot call a class as a function")}return e=i,t=[{key:"fromJSON",value:function(e){var t=e.colorA,r=e.colorB,n=e.life,o=e.easing;return e=e.isEnabled,new i(t,r,n,Ph(o),void 0===e||e)}}],(r=[{key:"same",get:function(){return this._same},set:function(e){this._same=e}},{key:"reset",value:function(e,t,r,n){this.same=null==t,this.colorA=Xf(e),this.colorB=Xf(t),r&&Wm(qm(i.prototype),"reset",this).call(this,r,n)}},{key:"initialize",value:function(e){e.transform.colorA=rf(this.colorA.getValue()),e.useColor=!0,e.transform.colorB=this.same?e.transform.colorA:rf(this.colorB.getValue())}},{key:"mutate",value:function(e,t,r){this.energize(e,t,r),this._same?(e.color.r=e.transform.colorA.r,e.color.g=e.transform.colorA.g,e.color.b=e.transform.colorA.b):(e.color.r=Lf.lerp(e.transform.colorA.r,e.transform.colorB.r,this.energy),e.color.g=Lf.lerp(e.transform.colorA.g,e.transform.colorB.g,this.energy),e.color.b=Lf.lerp(e.transform.colorA.b,e.transform.colorB.b,this.energy))}}])&&Gm(e.prototype,r),t&&Gm(e,t),Object.defineProperty(e,"prototype",{writable:!1}),i}();function Zm(e){return(Zm="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 Qm(e,t,r){return(Qm=ty()?Reflect.construct:function(e,t,r){var n=[null];return n.push.apply(n,t),t=new(Function.bind.apply(e,n)),r&&ey(t,r.prototype),t}).apply(null,arguments)}function Km(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Jm(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function $m(){return($m="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=ry(e)););return e}(e,t);if(n)return(n=Object.getOwnPropertyDescriptor(n,t)).get?n.get.call(arguments.length<3?e:r):n.value}).apply(this,arguments)}function ey(e,t){return(ey=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ty(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function ry(e){return(ry=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var ny=function(){var e=i,t=Em;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&&ey(e,t);var r,n=function(e){var t=ty();return function(){var r,n=ry(e);if(r=t?(r=ry(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Zm(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(i);function i(e,t,r,o,a){if(this instanceof i)return(r=n.call(this,r,o,jh,a)).reset(e,t),r;throw new TypeError("Cannot call a class as a function")}return e=i,t=[{key:"fromJSON",value:function(e){var t=e.zoneType,r=e.zoneParams,n=e.crossType,a=e.life,s=e.easing;return e=void 0===(e=e.isEnabled)||e,new i(Qm(o[t],function(e){return function(e){if(Array.isArray(e))return Km(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 Km(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(r="Object"===r&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Km(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.")}()}(Object.values(r))),n,a,Ph(s),e)}}],(r=[{key:"reset",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"dead",r=2<arguments.length?arguments[2]:void 0,n=3<arguments.length?arguments[3]:void 0;this.zone=e,this.zone.crossType=t,r&&$m(ry(i.prototype),"reset",this).call(this,r,n)}},{key:"mutate",value:function(e,t,r){this.energize(e,t,r),this.zone.crossing.call(this.zone,e)}}])&&Jm(e.prototype,r),t&&Jm(e,t),Object.defineProperty(e,"prototype",{writable:!1}),i}();function iy(e){return(iy="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 oy(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function ay(e,t){return(ay=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function sy(e){return(sy=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var uy=function(){var e=i,t=Em;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&&ay(e,t);var r,n=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=sy(e);if(r=t?(r=sy(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===iy(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(i);function i(e,t,r,o,a){var s=this,u=i;if(s instanceof u)return(s=n.call(this,o,a,"Force",!(5<arguments.length&&void 0!==arguments[5])||arguments[5])).reset(e,t,r),s;throw new TypeError("Cannot call a class as a function")}return e=i,t=[{key:"fromJSON",value:function(e){var t=e.fx,r=e.fy,n=e.fz,o=e.life,a=e.easing;return e=e.isEnabled,new i(t,r,n,o,Ph(a),void 0===e||e)}}],(r=[{key:"reset",value:function(e,t,r){this.force=this.normalizeForce(new $f(e,t,r)),this.force.id=Math.random()}},{key:"mutate",value:function(e,t,r){this.energize(e,t,r),e.acceleration.add(this.force)}}])&&oy(e.prototype,r),t&&oy(e,t),Object.defineProperty(e,"prototype",{writable:!1}),i}();function ly(e){return(ly="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 cy(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function hy(e,t){return(hy=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function fy(e){return(fy=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var py=function(){var e=n,t=uy;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&&hy(e,t);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=fy(e);if(r=t?(r=fy(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===ly(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(e,t,i){var o=this,a=n;if(o instanceof a)return(o=r.call(this,0,-e,0,t,i,!(3<arguments.length&&void 0!==arguments[3])||arguments[3])).type=Ah,o;throw new TypeError("Cannot call a class as a function")}return e=n,t=[{key:"fromJSON",value:function(e){var t=e.gravity,r=e.life,i=e.easing;return e=e.isEnabled,new n(t,r,Ph(i),void 0===e||e)}}],t&&cy(e,t),Object.defineProperty(e,"prototype",{writable:!1}),n}();function dy(e){return(dy="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 my(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function yy(){return(yy="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=gy(e)););return e}(e,t);if(n)return(n=Object.getOwnPropertyDescriptor(n,t)).get?n.get.call(arguments.length<3?e:r):n.value}).apply(this,arguments)}function vy(e,t){return(vy=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function gy(e){return(gy=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var by=function(){var e=i,t=Em;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&&vy(e,t);var r,n=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=gy(e);if(r=t?(r=gy(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===dy(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(i);function i(e,t,r){var o=3<arguments.length&&void 0!==arguments[3]?arguments[3]:.03,a=this,s=i;if(a instanceof s)return(a=n.call(this,4<arguments.length?arguments[4]:void 0,5<arguments.length?arguments[5]:void 0,Ch,!(6<arguments.length&&void 0!==arguments[6])||arguments[6])).reset(e,t,r,o),a.time=0,a;throw new TypeError("Cannot call a class as a function")}return e=i,t=[{key:"fromJSON",value:function(e){var t=e.x,r=e.y,n=e.z,o=e.delay,a=e.life,s=e.easing;return e=e.isEnabled,new i(t,r,n,o,a,Ph(s),void 0===e||e)}}],(r=[{key:"reset",value:function(e,t,r){var n=3<arguments.length&&void 0!==arguments[3]?arguments[3]:.03,o=4<arguments.length?arguments[4]:void 0,a=5<arguments.length?arguments[5]:void 0;this.randomForce=this.normalizeForce(new $f(e,t,r)),this.delayPan=zf(n),this.time=0,o&&yy(gy(i.prototype),"reset",this).call(this,o,a)}},{key:"mutate",value:function(e,t,r){var n;this.energize(e,t,r),this.time+=t,this.time>=this.delayPan.getValue()&&(r=Lf.randomAToB(-this.randomForce.x,this.randomForce.x),t=Lf.randomAToB(-this.randomForce.y,this.randomForce.y),n=Lf.randomAToB(-this.randomForce.z,this.randomForce.z),e.acceleration.addValue(r,t,n),this.time=0)}}])&&my(e.prototype,r),t&&my(e,t),Object.defineProperty(e,"prototype",{writable:!1}),i}();function wy(e){return(wy="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 xy(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Sy(){return(Sy="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=Ty(e)););return e}(e,t);if(n)return(n=Object.getOwnPropertyDescriptor(n,t)).get?n.get.call(arguments.length<3?e:r):n.value}).apply(this,arguments)}function _y(e,t){return(_y=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Ty(e){return(Ty=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Ey=function(){var e=i,t=Im;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&&_y(e,t);var r,n=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Ty(e);if(r=t?(r=Ty(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===wy(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(i);function i(e,t,r,o,a){var s=this,u=i;if(s instanceof u)return(s=n.call(this,e,t,r,o,a,!(5<arguments.length&&void 0!==arguments[5])||arguments[5])).force*=-1,s.type=Dh,s;throw new TypeError("Cannot call a class as a function")}return e=i,t=[{key:"fromJSON",value:function(e){var t=e.x,r=e.y,n=e.z,o=e.force,a=e.radius,s=e.life,u=e.easing;return e=void 0===(e=e.isEnabled)||e,new i(new $f(t,r,n),o,a,s,Ph(u),e)}}],(r=[{key:"reset",value:function(e,t,r,n,o){Sy(Ty(i.prototype),"reset",this).call(this,e,t,r,n,o),this.force*=-1}}])&&xy(e.prototype,r),t&&xy(e,t),Object.defineProperty(e,"prototype",{writable:!1}),i}();function Oy(e){return(Oy="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 My(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Py(){return(Py="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=ky(e)););return e}(e,t);if(n)return(n=Object.getOwnPropertyDescriptor(n,t)).get?n.get.call(arguments.length<3?e:r):n.value}).apply(this,arguments)}function Ry(e,t){return(Ry=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ky(e){return(ky=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var jy=function(){var e=i,t=Em;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&&Ry(e,t);var r,n=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=ky(e);if(r=t?(r=ky(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Oy(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(i);function i(e,t,r,o,a){var s=this,u=i;if(s instanceof u)return(s=n.call(this,o,a,"Rotate",!(5<arguments.length&&void 0!==arguments[5])||arguments[5])).reset(e,t,r),s;throw new TypeError("Cannot call a class as a function")}return e=i,t=[{key:"fromJSON",value:function(e){var t=e.x,r=e.y,n=e.z,o=e.life,a=e.easing;return e=e.isEnabled,new i(t,r,n,o,Ph(a),void 0===e||e)}}],(r=[{key:"rotationType",get:function(){return this._rotationType},set:function(e){this._rotationType=e}},{key:"reset",value:function(e,t,r,n,o){this.x=e||0,this.y=t||0,this.z=r||0,void 0===e||"same"==e?this.rotationType="same":null==t?this.rotationType="set":void 0===r?this.rotationType="to":(this.rotationType="add",this.x=zf(this.x*Yh),this.y=zf(this.y*Yh),this.z=zf(this.z*Yh)),n&&Py(ky(i.prototype),"reset",this).call(this,n,o)}},{key:"initialize",value:function(e){switch(this.rotationType){case"same":break;case"set":this._setRotation(e.rotation,this.x);break;case"to":e.transform.fR=e.transform.fR||new $f,e.transform.tR=e.transform.tR||new $f,this._setRotation(e.transform.fR,this.x),this._setRotation(e.transform.tR,this.y);break;case"add":e.transform.addR=new $f(this.x.getValue(),this.y.getValue(),this.z.getValue())}}},{key:"_setRotation",value:function(e,t){var r,n,i;e=e||new $f,"random"==t?(r=Lf.randomAToB(-qh,qh),n=Lf.randomAToB(-qh,qh),i=Lf.randomAToB(-qh,qh),e.set(r,n,i)):t instanceof $f&&e.copy(t)}},{key:"mutate",value:function(e,t,r){switch(this.energize(e,t,r),this.rotationType){case"same":e.rotation||(e.rotation=new $f),e.rotation.eulerFromDir(e.velocity);break;case"set":break;case"to":e.rotation.x=Lf.lerp(e.transform.fR.x,e.transform.tR.x,this.energy),e.rotation.y=Lf.lerp(e.transform.fR.y,e.transform.tR.y,this.energy),e.rotation.z=Lf.lerp(e.transform.fR.z,e.transform.tR.z,this.energy);break;case"add":e.rotation.add(e.transform.addR)}}}])&&My(e.prototype,r),t&&My(e,t),Object.defineProperty(e,"prototype",{writable:!1}),i}();function Ay(e){return(Ay="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 Cy(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Dy(){return(Dy="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=zy(e)););return e}(e,t);if(n)return(n=Object.getOwnPropertyDescriptor(n,t)).get?n.get.call(arguments.length<3?e:r):n.value}).apply(this,arguments)}function Ly(e,t){return(Ly=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function zy(e){return(zy=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Iy=function(){var e=i,t=Em;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&&Ly(e,t);var r,n=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=zy(e);if(r=t?(r=zy(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Ay(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(i);function i(e,t,r,o){var a=this,s=i;if(a instanceof s)return(a=n.call(this,r,o,"Scale",!(4<arguments.length&&void 0!==arguments[4])||arguments[4])).reset(e,t),a;throw new TypeError("Cannot call a class as a function")}return e=i,t=[{key:"fromJSON",value:function(e){var t=e.scaleA,r=e.scaleB,n=e.life,o=e.easing;return e=e.isEnabled,new i(t,r,n,Ph(o),void 0===e||e)}}],(r=[{key:"same",get:function(){return this._same},set:function(e){this._same=e}},{key:"reset",value:function(e,t,r,n){this.same=null==t,this.scaleA=zf(e||1),this.scaleB=zf(t),r&&Dy(zy(i.prototype),"reset",this).call(this,r,n)}},{key:"initialize",value:function(e){e.transform.scaleA=this.scaleA.getValue(),e.transform.oldRadius=e.radius,e.transform.scaleB=this.same?e.transform.scaleA:this.scaleB.getValue()}},{key:"mutate",value:function(e,t,r){this.energize(e,t,r),e.scale=Lf.lerp(e.transform.scaleA,e.transform.scaleB,this.energy),e.scale<5e-4&&(e.scale=0),e.radius=e.transform.oldRadius*e.scale}}])&&Cy(e.prototype,r),t&&Cy(e,t),Object.defineProperty(e,"prototype",{writable:!1}),i}();function By(e){return(By="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 Uy(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Ny(e,t){return(Ny=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Fy(e){return(Fy=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Vy(e){var t=[];return e.forEach((function(e){var r=e.type;if(e=e.properties,!$h.includes(r))throw new Error("The behaviour type ".concat(r," is invalid or not yet supported"));t.push(u[r].fromJSON(e))})),t}var Hy=function(){var e=i,t=Em;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&&Ny(e,t);var r,n=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Fy(e);if(r=t?(r=Fy(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===By(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(i);function i(e,t,r,o,a,s,u){var l=this,c=i;if(l instanceof c)return(l=n.call(this,s,u,"Spring",!(7<arguments.length&&void 0!==arguments[7])||arguments[7])).reset(e,t,r,o,a),l;throw new TypeError("Cannot call a class as a function")}return e=i,t=[{key:"fromJSON",value:function(e){var t=e.x,r=e.y,n=e.z,o=e.spring,a=e.friction,s=e.life,u=e.easing;return e=e.isEnabled,new i(t,r,n,o,a,s,Ph(u),void 0===e||e)}}],(r=[{key:"reset",value:function(e,t,r,n,i){this.pos?this.pos.set(e,t,r):this.pos=new $f(e,t,r),this.spring=n||.1,this.friction=i||.98}},{key:"mutate",value:function(e,t,r){this.energize(e,t,r),e.velocity.x+=(this.pos.x-e.position.x)*this.spring,e.velocity.y+=(this.pos.y-e.position.y)*this.spring,e.velocity.z+=(this.pos.z-e.position.z)*this.spring}}])&&Uy(e.prototype,r),t&&Uy(e,t),Object.defineProperty(e,"prototype",{writable:!1}),i}();function Gy(e,t){var r,n=Object.keys(e);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(e),t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)),n}function Wy(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Gy(Object(r),!0).forEach((function(t){tf(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Gy(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var Xy={shouldAutoEmit:!0},qy=function(e){return Vd.fromJSON(e)},Yy=function(e,t){return new Promise((function(r,n){if(!e.length)return r([]);var i=e.length,o=[],a=e.filter((function(e){return!e.properties.texture})),u=e.filter((function(e){return e.properties.texture}));a.forEach((function(e){var a=e.type;return e=e.properties,Jh.includes(a)?(Fh.includes(a)?o.push(s[a].fromJSON(e,t)):o.push(s[a].fromJSON(e)),o.length===i?r(o):void 0):n("The initializer type ".concat(a," is invalid or not yet supported"))})),u.forEach((function(e){var a=e.type,s=e.properties,u=(e=e.properties.texture,new t.TextureLoader);if(!Jh.includes(a))return n("The initializer type ".concat(a," is invalid or not yet supported"));u.load(e,(function(e){if(o.push(Zd.fromJSON(Wy(Wy({},s),{},{loadedTexture:e}),t)),o.length===i)return r(o)}),void 0,n)}))}))},Zy=function(e){return new Promise((function(t,r){if(!e.length)return t([]);var n=e.length,i=[];e.forEach((function(e){var o=e.type;return e=e.properties,$h.includes(o)?(i.push(u[o].fromJSON(e)),i.length===n?t(i):void 0):r("The behaviour type ".concat(o," is invalid or not yet supported"))}))}))};function Qy(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}iu=function(){function e(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:500,r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:Zf,n=this,i=e;if(!(n instanceof i))throw new TypeError("Cannot call a class as a function");this.type="System",this.canUpdate=!0,this.preParticles=t,this.integrationType=r,this.emitters=[],this.renderers=[],this.pool=new ip,this.eventDispatcher=new op}var t,r,n;return t=e,n=[{key:"fromJSON",value:function(t,r){return function(e,t,r,n){var i=e.preParticles,o=e.integrationType,a=(e=void 0===(e=e.emitters)?[]:e,new r(t,void 0===i?500:i,void 0===o?"euler":o));return e.forEach((function(e){var r,i,o=new n,u=e.rate,l=e.rotation,c=e.initializers,h=e.behaviours,f=void 0===(f=e.emitterBehaviours)?[]:f,p=e.position,d=void 0===(d=e.totalEmitTimes)?1/0:d;e=void 0===(e=e.life)?1/0:e,o.setRate(Vd.fromJSON(u)).setRotation(l).setInitializers((r=t,i=[],c.forEach((function(e){var t=e.type;if(e=e.properties,!Jh.includes(t))throw new Error("The initializer type ".concat(t," is invalid or not yet supported"));Fh.includes(t)?i.push(s[t].fromJSON(e,r)):i.push(s[t].fromJSON(e))})),i)).setBehaviours(Vy(h)).setEmitterBehaviours(Vy(f)).setPosition(p).emit(d,e),a.addEmitter(o)})),a}(t,r,e,_m)}},{key:"fromJSONAsync",value:function(t,r,n){return function(e,t,r,n){var i=4<arguments.length&&void 0!==arguments[4]?arguments[4]:{};return new Promise((function(o,a){var s,u,l,c,h=e.preParticles,f=e.integrationType,p=void 0===(p=e.emitters)?[]:p,d=new r(void 0===h?500:h,void 0===f?"euler":f);h=Wy(Wy({},Xy),i).shouldAutoEmit,s=p,u=n,l=t,c=h,new Promise((function(e,t){return s.length?(r=[],(n=s.length)?void s.forEach((function(i){var o,a=new u,s=i.rate,h=i.rotation,f=i.initializers,p=i.behaviours,d=void 0===(m=i.emitterBehaviours)?[]:m,m=i.position,y=void 0===(o=i.totalEmitTimes)?1/0:o,v=void 0===(o=i.life)?1/0:o;a.setRate(qy(s)).setRotation(h).setPosition(m),Yy(f,l).then((function(e){return a.setInitializers(e),Zy(p)})).then((function(e){return a.setBehaviours(e),Zy(d)})).then((function(e){return a.setEmitterBehaviours(e),Promise.resolve(a)})).then((function(t){if(r.push(c?t.emit(y,v):t.setTotalEmitTimes(y).setLife(v)),r.length===n)return e(r)})).catch(t)})):e(r)):e([]);var r,n})).then((function(e){var t=e.length;if(!t)return o(d);e.forEach((function(e){d.addEmitter(e),d.emitters.length===t&&o(d)}))})).catch(a)}))}(t,r,e,_m,n)}}],(r=[{key:"dispatch",value:function(e){this.eventDispatcher.dispatchEvent(e,1<arguments.length&&void 0!==arguments[1]?arguments[1]:this)}},{key:"addRenderer",value:function(e){return this.renderers.push(e),e.init(this),this}},{key:"removeRenderer",value:function(e){return this.renderers.splice(this.renderers.indexOf(e),1),e.remove(this),this}},{key:"addEmitter",value:function(e){var t=this.emitters.length;return e.parent=this,e.index=t,this.emitters.push(e),this.dispatch("EMITTER_ADDED",e),this}},{key:"removeEmitter",value:function(e){return e.parent!==this||(e.parent=null,e.index=void 0,this.emitters.splice(this.emitters.indexOf(e),1),this.dispatch("EMITTER_REMOVED",e)),this}},{key:"emit",value:function(e){var t=e.onStart,r=e.onUpdate,n=e.onEnd;t&&t(),r&&this.eventDispatcher.addEventListener(ap,r),e=this.emitters.map((function(e){return e.life===1/0?(n&&n(),e.experimental_emit(),Promise.resolve()):new Promise((function(t){e.addOnEmitterDeadEventListener((function(){n&&n(),t()})),e.experimental_emit()}))}));try{return Promise.all(e)}catch(e){console.warn(e)}}},{key:"update",value:function(){var e=(0<arguments.length&&void 0!==arguments[0]?arguments[0]:Kh)||Kh;if(this.canUpdate){if(0<e)for(var t=this.emitters.length;t--;){var r=this.emitters[t];r.update(e),r.isEmitting&&this.dispatch(ap)}this.dispatch("SYSTEM_UPDATE_AFTER")}return Promise.resolve()}},{key:"getCount",value:function(){for(var e=this.emitters.length,t=0,r=0;r<e;r++)t+=this.emitters[r].particles.length;return t}},{key:"destroy",value:function(){var e=this.emitters.length;this.canUpdate=!1;for(var t=0;t<e;t++)this.emitters[t]&&this.emitters[t].destroy(),delete this.emitters[t];for(var r=0;r<e;r++)this.renderers[r]&&this.renderers[r].destroy&&(this.renderers[r].destroy(),delete this.renderers[r]);this.emitters.length=0,this.pool.destroy(),this.canUpdate=!0}}])&&Qy(t.prototype,r),n&&Qy(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}(),[4*(nu=["x","y","z"].length),4,4*(Js=["r","g","b","a"].length)].reduce((function(e,t){return e+t})),[nu,1,Js,1,2].reduce((function(e,t){return e+t}));const Ky=iu;var Jy=function(e,t,r,n){return new(r=r||Promise)((function(i,o){function a(e){try{u(n.next(e))}catch(e){o(e)}}function s(e){try{u(n.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(a,s)}u((n=n.apply(e,t||[])).next())}))};class $y{constructor(e){this.parses={fbx:new Zc,obj:new Rh,object:new p.ObjectLoader},this.runScene=e}getBack(e){return e.name.substring(e.name.lastIndexOf(".")+1).toLowerCase()}parse(e){return Jy(this,void 0,void 0,(function*(){if(e instanceof Array)return Promise.all(e.map((e=>this.parse(e))));let t;switch(this.getBack(e).toLowerCase()){case"gltf":case"glb":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)}return this.runScene.modelEx.beforeLoad(yield t)}))}img(e){console.log(e,"file")}glb(e){return Jy(this,void 0,void 0,(function*(){var t=yield(0,rt.toResult)(e,"arrayBuffer");return this.runScene.loaderer.gltf.parse(t,{addToScene:!1})}))}fbx(e){return Jy(this,void 0,void 0,(function*(){var t=e instanceof ArrayBuffer?e:yield(0,rt.toResult)(e,"arrayBuffer");const r=this.parses.fbx.parse(t,"");return r.traverse((e=>{e.material&&(e.material=this.runScene.materialEx.create())})),this.runScene.sceneEx.cleanUnlessLevel(r)}))}obj(e){return Jy(this,void 0,void 0,(function*(){var t=e instanceof File?yield(0,rt.toResult)(e,"text"):e;const r=this.parses.obj.parse(t);return r.traverse((e=>{e.material&&(e.material=this.runScene.materialEx.create())})),this.runScene.sceneEx.cleanUnlessLevel(r)}))}json(e){return Jy(this,void 0,void 0,(function*(){var t,r=e instanceof File?yield(0,rt.toResult)(e,"text"):e,n=JSON.parse(r);if(n.particleSystemState)return console.log(Ky,Ky.prototype,"System"),t=new Ky,console.log(t,"s"),void Ky.fromJSONAsync(n,_i).then((e=>{console.log(e)}));const i=yield this.parses.object.parseAsync(JSON.parse(r));return i.traverse((e=>{this.runScene.uniqueEx.material.add(e.material)})),this.runScene.sceneEx.cleanUnlessLevel(i)}))}}function ev(e){return(ev="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 tv(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function rv(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function nv(e,t,r){t&&rv(e.prototype,t),r&&rv(e,r),Object.defineProperty(e,"prototype",{writable:!1})}function iv(){return(iv="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=lv(e)););return e}(e,t);if(n)return(n=Object.getOwnPropertyDescriptor(n,t)).get?n.get.call(arguments.length<3?e:r):n.value}).apply(this,arguments)}function ov(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&&av(e,t)}function av(e,t){return(av=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function sv(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=lv(e);if(r=t?(r=lv(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===ev(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return uv(n)}}function uv(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function lv(e){return(lv=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var cv=new p.Raycaster,hv=new p.Vector3,fv=new p.Vector3,pv=new p.Quaternion,dv={X:new p.Vector3(1,0,0),Y:new p.Vector3(0,1,0),Z:new p.Vector3(0,0,1)},mv={type:"change"},yv={type:"mouseDown"},vv={type:"mouseUp",mode:null},gv={type:"objectChange"};function bv(e,t,r){for(var n=t.intersectObject(e,!0),i=0;i<n.length;i++)if(n[i].object.visible||r)return n[i];return!1}c=function(){ov(t,p.Object3D);var e=sv(t);function t(r,n){tv(this,t),i=e.call(this),void 0===n&&(console.warn('THREE.TransformControls: The second parameter "domElement" is now mandatory.'),n=document),i.visible=!1,i.domElement=n,i.domElement.style.touchAction="none";var i,o=new Dv,a=(i._gizmo=o,i.add(o),new Lv),s=(i._plane=a,i.add(a),uv(i));function u(e,t){var r=t;Object.defineProperty(s,e,{get:function(){return void 0!==r?r:t},set:function(t){r!==t&&(r=t,a[e]=t,o[e]=t,s.dispatchEvent({type:e+"-changed",value:t}),s.dispatchEvent(mv))}}),s[e]=t,a[e]=t,o[e]=t}u("camera",r),u("object",void 0),u("enabled",!0),u("axis",null),u("mode","translate"),u("translationSnap",null),u("rotationSnap",null),u("scaleSnap",null),u("space","world"),u("size",1),u("dragging",!1),u("showX",!0),u("showY",!0),u("showZ",!0),n=new p.Vector3,r=new p.Vector3;var l=new p.Quaternion,c=new p.Quaternion,h=new p.Vector3,f=new p.Quaternion,d=new p.Vector3,m=new p.Vector3,y=new p.Vector3,v=new p.Vector3;return u("worldPosition",n),u("worldPositionStart",r),u("worldQuaternion",l),u("worldQuaternionStart",c),u("cameraPosition",h),u("cameraQuaternion",f),u("pointStart",d),u("pointEnd",m),u("rotationAxis",y),u("rotationAngle",0),u("eye",v),i._offset=new p.Vector3,i._startNorm=new p.Vector3,i._endNorm=new p.Vector3,i._cameraScale=new p.Vector3,i._parentPosition=new p.Vector3,i._parentQuaternion=new p.Quaternion,i._parentQuaternionInv=new p.Quaternion,i._parentScale=new p.Vector3,i._worldScaleStart=new p.Vector3,i._worldQuaternionInv=new p.Quaternion,i._worldScale=new p.Vector3,i._positionStart=new p.Vector3,i._quaternionStart=new p.Quaternion,i._scaleStart=new p.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(uv(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(uv(i)),i._onPointerHover=function(e){if(this.enabled)switch(e.pointerType){case"mouse":case"pen":this.pointerHover(this._getPointer(e))}}.bind(uv(i)),i._onPointerMove=function(e){this.enabled&&this.pointerMove(this._getPointer(e))}.bind(uv(i)),i._onPointerUp=function(e){this.enabled&&(this.domElement.releasePointerCapture(e.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.pointerUp(this._getPointer(e)))}.bind(uv(i)),i.domElement.addEventListener("pointerdown",i._onPointerDown),i.domElement.addEventListener("pointermove",i._onPointerHover),i.domElement.addEventListener("pointerup",i._onPointerUp),i}return nv(t,[{key:"updateMatrixWorld",value:function(){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.eye.copy(this.cameraPosition).sub(this.worldPosition).normalize(),iv(lv(t.prototype),"updateMatrixWorld",this).call(this,this)}},{key:"pointerHover",value:function(e){void 0!==this.object&&!0!==this.dragging&&(cv.setFromCamera(e,this.camera),e=bv(this._gizmo.picker[this.mode],cv),this.axis=e?e.object.name:null)}},{key:"pointerDown",value:function(e){void 0!==this.object&&!0!==this.dragging&&0===e.button&&null!==this.axis&&(cv.setFromCamera(e,this.camera),(e=bv(this._plane,cv,!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,yv.mode=this.mode,this.dispatchEvent(yv))}},{key:"pointerMove",value:function(e){var t=this.axis,r=this.mode,n=this.object,i=this.space;"scale"===r?i="local":"E"!==t&&"XYZE"!==t&&"XYZ"!==t||(i="world"),void 0!==n&&null!==t&&!1!==this.dragging&&-1===e.button&&(cv.setFromCamera(e,this.camera),(e=bv(this._plane,cv,!0))&&(this.pointEnd.copy(e.point).sub(this.worldPositionStart),"translate"===r?(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),n.position.copy(this._offset).add(this._positionStart),this.translationSnap&&("local"===i&&(n.position.applyQuaternion(pv.copy(this._quaternionStart).invert()),-1!==t.search("X")&&(n.position.x=Math.round(n.position.x/this.translationSnap)*this.translationSnap),-1!==t.search("Y")&&(n.position.y=Math.round(n.position.y/this.translationSnap)*this.translationSnap),-1!==t.search("Z")&&(n.position.z=Math.round(n.position.z/this.translationSnap)*this.translationSnap),n.position.applyQuaternion(this._quaternionStart)),"world"===i&&(n.parent&&n.position.add(hv.setFromMatrixPosition(n.parent.matrixWorld)),-1!==t.search("X")&&(n.position.x=Math.round(n.position.x/this.translationSnap)*this.translationSnap),-1!==t.search("Y")&&(n.position.y=Math.round(n.position.y/this.translationSnap)*this.translationSnap),-1!==t.search("Z")&&(n.position.z=Math.round(n.position.z/this.translationSnap)*this.translationSnap),n.parent&&n.position.sub(hv.setFromMatrixPosition(n.parent.matrixWorld))))):"scale"===r?(-1!==t.search("XYZ")?(e=this.pointEnd.length()/this.pointStart.length(),this.pointEnd.dot(this.pointStart)<0&&(e*=-1),fv.set(e,e,e)):(hv.copy(this.pointStart),fv.copy(this.pointEnd),hv.applyQuaternion(this._worldQuaternionInv),fv.applyQuaternion(this._worldQuaternionInv),fv.divide(hv),-1===t.search("X")&&(fv.x=1),-1===t.search("Y")&&(fv.y=1),-1===t.search("Z")&&(fv.z=1)),n.scale.copy(this._scaleStart).multiply(fv),this.scaleSnap&&(-1!==t.search("X")&&(n.scale.x=Math.round(n.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),-1!==t.search("Y")&&(n.scale.y=Math.round(n.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),-1!==t.search("Z")&&(n.scale.z=Math.round(n.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))):"rotate"===r&&(this._offset.copy(this.pointEnd).sub(this.pointStart),e=20/this.worldPosition.distanceTo(hv.setFromMatrixPosition(this.camera.matrixWorld)),"E"===t?(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):"XYZE"===t?(this.rotationAxis.copy(this._offset).cross(this.eye).normalize(),this.rotationAngle=this._offset.dot(hv.copy(this.rotationAxis).cross(this.eye))*e):"X"!==t&&"Y"!==t&&"Z"!==t||(this.rotationAxis.copy(dv[t]),hv.copy(dv[t]),"local"===i&&hv.applyQuaternion(this.worldQuaternion),this.rotationAngle=this._offset.dot(hv.cross(this.eye).normalize())*e),this.rotationSnap&&(this.rotationAngle=Math.round(this.rotationAngle/this.rotationSnap)*this.rotationSnap),"local"===i&&"E"!==t&&"XYZE"!==t?(n.quaternion.copy(this._quaternionStart),n.quaternion.multiply(pv.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this._parentQuaternionInv),n.quaternion.copy(pv.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),n.quaternion.multiply(this._quaternionStart).normalize())),this.dispatchEvent(mv),this.dispatchEvent(gv)))}},{key:"pointerUp",value:function(e){0===e.button&&(this.dragging&&null!==this.axis&&(vv.mode=this.mode,this.dispatchEvent(vv)),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(mv),this.dispatchEvent(gv),this.pointStart.copy(this.pointEnd))}},{key:"getRaycaster",value:function(){return cv}},{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}},{key:"update",value:function(){console.warn("THREE.TransformControls: update function has no more functionality and therefore has been deprecated.")}}]),t}(),c.prototype.isTransformControls=!0;var wv=new p.Euler,xv=new p.Vector3(0,1,0),Sv=new p.Vector3(0,0,0),_v=new p.Matrix4,Tv=new p.Quaternion,Ev=new p.Quaternion,Ov=new p.Vector3,Mv=new p.Matrix4,Pv=new p.Vector3(1,0,0),Rv=new p.Vector3(0,1,0),kv=new p.Vector3(0,0,1),jv=new p.Vector3,Av=new p.Vector3,Cv=new p.Vector3,Dv=function(){ov(t,p.Object3D);var e=sv(t);function t(){tv(this,t),(r=e.call(this)).type="TransformControlsGizmo";var r,n=new p.MeshBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),i=new p.LineBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),o=n.clone(),a=((((o.opacity=.15,i=i.clone()).opacity=.5,w=n.clone()).color.setHex(16711680),x=n.clone()).color.setHex(65280),n.clone()),s=(a.color.setHex(255),n.clone()),u=(s.color.setHex(16711680),s.opacity=.5,n.clone()),l=(u.color.setHex(65280),u.opacity=.5,n.clone()),c=(l.color.setHex(255),l.opacity=.5,n.clone());(c.opacity=.25,g=n.clone()).color.setHex(16776960),g.opacity=.25,n.clone().color.setHex(16776960);var h=(((n=n.clone()).color.setHex(7895160),m=new p.CylinderGeometry(0,.04,.1,12)).translate(0,.05,0),new p.BoxGeometry(.08,.08,.08)),f=(h.translate(0,.04,0),new p.BufferGeometry);function d(e,t){return(e=new p.TorusGeometry(e,.0075,3,64,t*Math.PI*2)).rotateY(Math.PI/2),e.rotateX(Math.PI/2),e}(f.setAttribute("position",new p.Float32BufferAttribute([0,0,0,1,0,0],3)),S=new p.CylinderGeometry(.0075,.0075,.5,3)).translate(0,.25,0);var m={X:[[new p.Mesh(m,w),[.5,0,0],[0,0,-Math.PI/2]],[new p.Mesh(m,w),[-.5,0,0],[0,0,Math.PI/2]],[new p.Mesh(S,w),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new p.Mesh(m,x),[0,.5,0]],[new p.Mesh(m,x),[0,-.5,0],[Math.PI,0,0]],[new p.Mesh(S,x)]],Z:[[new p.Mesh(m,a),[0,0,.5],[Math.PI/2,0,0]],[new p.Mesh(m,a),[0,0,-.5],[-Math.PI/2,0,0]],[new p.Mesh(S,a),null,[Math.PI/2,0,0]]],XYZ:[[new p.Mesh(new p.OctahedronGeometry(.1,0),c.clone()),[0,0,0]]],XY:[[new p.Mesh(new p.BoxGeometry(.15,.15,.01),l.clone()),[.15,.15,0]]],YZ:[[new p.Mesh(new p.BoxGeometry(.15,.15,.01),s.clone()),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new p.Mesh(new p.BoxGeometry(.15,.15,.01),u.clone()),[.15,0,.15],[-Math.PI/2,0,0]]]},y={X:[[new p.Mesh(new p.CylinderGeometry(.2,0,.6,4),o),[.3,0,0],[0,0,-Math.PI/2]],[new p.Mesh(new p.CylinderGeometry(.2,0,.6,4),o),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new p.Mesh(new p.CylinderGeometry(.2,0,.6,4),o),[0,.3,0]],[new p.Mesh(new p.CylinderGeometry(.2,0,.6,4),o),[0,-.3,0],[0,0,Math.PI]]],Z:[[new p.Mesh(new p.CylinderGeometry(.2,0,.6,4),o),[0,0,.3],[Math.PI/2,0,0]],[new p.Mesh(new p.CylinderGeometry(.2,0,.6,4),o),[0,0,-.3],[-Math.PI/2,0,0]]],XYZ:[[new p.Mesh(new p.OctahedronGeometry(.2,0),o)]],XY:[[new p.Mesh(new p.BoxGeometry(.2,.2,.01),o),[.15,.15,0]]],YZ:[[new p.Mesh(new p.BoxGeometry(.2,.2,.01),o),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new p.Mesh(new p.BoxGeometry(.2,.2,.01),o),[.15,0,.15],[-Math.PI/2,0,0]]]},v={START:[[new p.Mesh(new p.OctahedronGeometry(.01,2),i),null,null,null,"helper"]],END:[[new p.Mesh(new p.OctahedronGeometry(.01,2),i),null,null,null,"helper"]],DELTA:[[new p.Line(((v=new p.BufferGeometry).setAttribute("position",new p.Float32BufferAttribute([0,0,0,1,1,1],3)),v),i),null,null,null,"helper"]],X:[[new p.Line(f,i.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new p.Line(f,i.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new p.Line(f,i.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},g=(n={XYZE:[[new p.Mesh(d(.5,1),n),null,[0,Math.PI/2,0]]],X:[[new p.Mesh(d(.5,.5),w)]],Y:[[new p.Mesh(d(.5,.5),x),null,[0,0,-Math.PI/2]]],Z:[[new p.Mesh(d(.5,.5),a),null,[0,Math.PI/2,0]]],E:[[new p.Mesh(d(.75,1),g),null,[0,Math.PI/2,0]]]},{AXIS:[[new p.Line(f,i.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]}),b={XYZE:[[new p.Mesh(new p.SphereGeometry(.25,10,8),o)]],X:[[new p.Mesh(new p.TorusGeometry(.5,.1,4,24),o),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new p.Mesh(new p.TorusGeometry(.5,.1,4,24),o),[0,0,0],[Math.PI/2,0,0]]],Z:[[new p.Mesh(new p.TorusGeometry(.5,.1,4,24),o),[0,0,0],[0,0,-Math.PI/2]]],E:[[new p.Mesh(new p.TorusGeometry(.75,.1,2,24),o)]]},w={X:[[new p.Mesh(h,w),[.5,0,0],[0,0,-Math.PI/2]],[new p.Mesh(S,w),[0,0,0],[0,0,-Math.PI/2]],[new p.Mesh(h,w),[-.5,0,0],[0,0,Math.PI/2]]],Y:[[new p.Mesh(h,x),[0,.5,0]],[new p.Mesh(S,x)],[new p.Mesh(h,x),[0,-.5,0],[0,0,Math.PI]]],Z:[[new p.Mesh(h,a),[0,0,.5],[Math.PI/2,0,0]],[new p.Mesh(S,a),[0,0,0],[Math.PI/2,0,0]],[new p.Mesh(h,a),[0,0,-.5],[-Math.PI/2,0,0]]],XY:[[new p.Mesh(new p.BoxGeometry(.15,.15,.01),l),[.15,.15,0]]],YZ:[[new p.Mesh(new p.BoxGeometry(.15,.15,.01),s),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new p.Mesh(new p.BoxGeometry(.15,.15,.01),u),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new p.Mesh(new p.BoxGeometry(.1,.1,.1),c.clone())]]},x={X:[[new p.Mesh(new p.CylinderGeometry(.2,0,.6,4),o),[.3,0,0],[0,0,-Math.PI/2]],[new p.Mesh(new p.CylinderGeometry(.2,0,.6,4),o),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new p.Mesh(new p.CylinderGeometry(.2,0,.6,4),o),[0,.3,0]],[new p.Mesh(new p.CylinderGeometry(.2,0,.6,4),o),[0,-.3,0],[0,0,Math.PI]]],Z:[[new p.Mesh(new p.CylinderGeometry(.2,0,.6,4),o),[0,0,.3],[Math.PI/2,0,0]],[new p.Mesh(new p.CylinderGeometry(.2,0,.6,4),o),[0,0,-.3],[-Math.PI/2,0,0]]],XY:[[new p.Mesh(new p.BoxGeometry(.2,.2,.01),o),[.15,.15,0]]],YZ:[[new p.Mesh(new p.BoxGeometry(.2,.2,.01),o),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new p.Mesh(new p.BoxGeometry(.2,.2,.01),o),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new p.Mesh(new p.BoxGeometry(.2,.2,.2),o),[0,0,0]]]},S={X:[[new p.Line(f,i.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new p.Line(f,i.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new p.Line(f,i.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]};function _(e){var t,r=new p.Object3D;for(t in e)for(var n=e[t].length;n--;){var i=e[t][n][0].clone(),o=e[t][n][1],a=e[t][n][2],s=e[t][n][3],u=e[t][n][4];(i.name=t,i.tag=u,o&&i.position.set(o[0],o[1],o[2]),a&&i.rotation.set(a[0],a[1],a[2]),s&&i.scale.set(s[0],s[1],s[2]),i.updateMatrix(),u=i.geometry.clone()).applyMatrix4(i.matrix),i.geometry=u,i.renderOrder=1/0,i.position.set(0,0,0),i.rotation.set(0,0,0),i.scale.set(1,1,1),r.add(i)}return r}return r.gizmo={},r.picker={},r.helper={},r.add(r.gizmo.translate=_(m)),r.add(r.gizmo.rotate=_(n)),r.add(r.gizmo.scale=_(w)),r.add(r.picker.translate=_(y)),r.add(r.picker.rotate=_(b)),r.add(r.picker.scale=_(x)),r.add(r.helper.translate=_(v)),r.add(r.helper.rotate=_(g)),r.add(r.helper.scale=_(S)),r.picker.translate.visible=!1,r.picker.rotate.visible=!1,r.picker.scale.visible=!1,r}return nv(t,[{key:"updateMatrixWorld",value:function(e){var r=this,n="local"===("scale"===this.mode?"local":this.space)?this.worldQuaternion:Ev,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 o=0;o<i.length;o++)!function(e){var t=i[e];if(t.visible=!0,t.rotation.set(0,0,0),e=void t.position.copy(r.worldPosition),e=r.camera.isOrthographicCamera?(r.camera.top-r.camera.bottom)/r.camera.zoom:r.worldPosition.distanceTo(r.cameraPosition)*Math.min(1.9*Math.tan(Math.PI*r.camera.fov/360)/r.camera.zoom,7),t.scale.set(1,1,1).multiplyScalar(e*r.size/4),"helper"===t.tag)return t.visible=!1,"AXIS"===t.name?(t.position.copy(r.worldPositionStart),t.visible=!!r.axis,"X"===r.axis&&(pv.setFromEuler(wv.set(0,0,0)),t.quaternion.copy(n).multiply(pv),.9<Math.abs(xv.copy(Pv).applyQuaternion(n).dot(r.eye))&&(t.visible=!1)),"Y"===r.axis&&(pv.setFromEuler(wv.set(0,0,Math.PI/2)),t.quaternion.copy(n).multiply(pv),.9<Math.abs(xv.copy(Rv).applyQuaternion(n).dot(r.eye))&&(t.visible=!1)),"Z"===r.axis&&(pv.setFromEuler(wv.set(0,Math.PI/2,0)),t.quaternion.copy(n).multiply(pv),.9<Math.abs(xv.copy(kv).applyQuaternion(n).dot(r.eye))&&(t.visible=!1)),"XYZE"===r.axis&&(pv.setFromEuler(wv.set(0,Math.PI/2,0)),xv.copy(r.rotationAxis),t.quaternion.setFromRotationMatrix(_v.lookAt(Sv,xv,Rv)),t.quaternion.multiply(pv),t.visible=r.dragging),"E"===r.axis&&(t.visible=!1)):"START"===t.name?(t.position.copy(r.worldPositionStart),t.visible=r.dragging):"END"===t.name?(t.position.copy(r.worldPosition),t.visible=r.dragging):"DELTA"===t.name?(t.position.copy(r.worldPositionStart),t.quaternion.copy(r.worldQuaternionStart),hv.set(1e-10,1e-10,1e-10).add(r.worldPositionStart).sub(r.worldPosition).multiplyScalar(-1),hv.applyQuaternion(r.worldQuaternionStart.clone().invert()),t.scale.copy(hv),t.visible=r.dragging):(t.quaternion.copy(n),r.dragging?t.position.copy(r.worldPositionStart):t.position.copy(r.worldPosition),r.axis&&(t.visible=-1!==r.axis.search(t.name)));t.quaternion.copy(n),"translate"===r.mode||"scale"===r.mode?("X"===t.name&&.99<Math.abs(xv.copy(Pv).applyQuaternion(n).dot(r.eye))&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"Y"===t.name&&.99<Math.abs(xv.copy(Rv).applyQuaternion(n).dot(r.eye))&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"Z"===t.name&&.99<Math.abs(xv.copy(kv).applyQuaternion(n).dot(r.eye))&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"XY"===t.name&&Math.abs(xv.copy(kv).applyQuaternion(n).dot(r.eye))<.2&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"YZ"===t.name&&Math.abs(xv.copy(Pv).applyQuaternion(n).dot(r.eye))<.2&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"XZ"===t.name&&Math.abs(xv.copy(Rv).applyQuaternion(n).dot(r.eye))<.2&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1)):"rotate"===r.mode&&(Tv.copy(n),xv.copy(r.eye).applyQuaternion(pv.copy(n).invert()),-1!==t.name.search("E")&&t.quaternion.setFromRotationMatrix(_v.lookAt(r.eye,Sv,Rv)),"X"===t.name&&(pv.setFromAxisAngle(Pv,Math.atan2(-xv.y,xv.z)),pv.multiplyQuaternions(Tv,pv),t.quaternion.copy(pv)),"Y"===t.name&&(pv.setFromAxisAngle(Rv,Math.atan2(xv.x,xv.z)),pv.multiplyQuaternions(Tv,pv),t.quaternion.copy(pv)),"Z"===t.name&&(pv.setFromAxisAngle(kv,Math.atan2(xv.y,xv.x)),pv.multiplyQuaternions(Tv,pv),t.quaternion.copy(pv))),t.visible=t.visible&&(-1===t.name.indexOf("X")||r.showX),t.visible=t.visible&&(-1===t.name.indexOf("Y")||r.showY),t.visible=t.visible&&(-1===t.name.indexOf("Z")||r.showZ),t.visible=t.visible&&(-1===t.name.indexOf("E")||r.showX&&r.showY&&r.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,r.enabled&&r.axis&&(t.name===r.axis||r.axis.split("").some((function(e){return t.name===e})))&&(t.material.color.setHex(16776960),t.material.opacity=1)}(o);iv(lv(t.prototype),"updateMatrixWorld",this).call(this,e)}}]),t}(),Lv=(Dv.prototype.isTransformControlsGizmo=!0,function(){ov(t,p.Mesh);var e=sv(t);function t(){var r;return tv(this,t),(r=e.call(this,new p.PlaneGeometry(1e5,1e5,2,2),new p.MeshBasicMaterial({visible:!1,wireframe:!0,side:p.DoubleSide,transparent:!0,opacity:.1,toneMapped:!1}))).type="TransformControlsPlane",r}return nv(t,[{key:"updateMatrixWorld",value:function(e){var r=this.space;switch(this.position.copy(this.worldPosition),"scale"===this.mode&&(r="local"),jv.copy(Pv).applyQuaternion("local"===r?this.worldQuaternion:Ev),Av.copy(Rv).applyQuaternion("local"===r?this.worldQuaternion:Ev),Cv.copy(kv).applyQuaternion("local"===r?this.worldQuaternion:Ev),xv.copy(Av),this.mode){case"translate":case"scale":switch(this.axis){case"X":xv.copy(this.eye).cross(jv),Ov.copy(jv).cross(xv);break;case"Y":xv.copy(this.eye).cross(Av),Ov.copy(Av).cross(xv);break;case"Z":xv.copy(this.eye).cross(Cv),Ov.copy(Cv).cross(xv);break;case"XY":Ov.copy(Cv);break;case"YZ":Ov.copy(jv);break;case"XZ":xv.copy(Cv),Ov.copy(Av);break;case"XYZ":case"E":Ov.set(0,0,0)}break;default:Ov.set(0,0,0)}0===Ov.length()?this.quaternion.copy(this.cameraQuaternion):(Mv.lookAt(hv.set(0,0,0),Ov,xv),this.quaternion.setFromRotationMatrix(Mv)),iv(lv(t.prototype),"updateMatrixWorld",this).call(this,e)}}]),t}());Lv.prototype.isTransformControlsPlane=!0;class zv extends c{constructor(e,t){super(e,t),this.transGizmo=this.children[0],this.scaleCoefficient=new p.Vector3,this.beginScale=new p.Vector3,this.posStart=new p.Vector2,this.posEnd=new p.Vector2,this.deleteRedundantParts()}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),super.pointerDown(e))}pointerMove(e){if(super.pointerMove(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)}}}class Iv{constructor(e){this.grid=null,this.transContro=null,this.boxHelper=null,this.deepIsHelper=e=>"Scene"===e.type||!this.isHelper(e)&&!!e.parent&&this.deepIsHelper(e.parent),this.getBoxHelper=e=>(e=new p.BoxHelper(e),this.setHelper(e),this.runScene.assetsEx.get().scene.add(e),e),this.runScene=e,"running"!==this.runScene.optionsEx.options.mode&&(this.transContro=new class{constructor(e){this.tansControls=null,this.controlsMode="position",this.isDraggingChange=!1,this.modelNewVal=new _i.Vector3,this.transControlsStatusMap={position:"translate",rotation:"rotate",scale:"scale"},this.multipObj=null,this.worldOldVal=new _i.Vector3,this.draggingChanged=e=>{const t=this.runScene.assetsEx.get().controls;var r=this.controlsMode;let n=this.runScene.modelEx.select;if(e.value){if(!this.runScene.multipSelector.isEmpty()){t.enabled=!1;const e=this.runScene.multipSelector.getLast();this.multipSelectLast=e,this.worldOldVal=Ao(e,this.runScene.sceneEx.get())}}else if(!t.enabled&&!this.runScene.multipSelector.isEmpty()&&this.multipSelectLast){const e=this.multipSelectLast;this.multipObj=e,this.runScene.events.mouse.enableUp=!1,this.runScene.helperEx.boxHelper.setFromObject(this.runScene.assetsEx.get().scene);var i=Ao(e,this.runScene.sceneEx.get());this.runScene.multipSelector.setInfo(e,r,this.modelNewVal,e[r],i,this.worldOldVal),this.runScene.modelEx.selectNull(),this.multipSelectLast=void 0}if(this.runScene.multipSelector.isEmpty()?this.runScene.events.mouse.enableUp=!0:this.runScene.events.mouse.enableUp=!1,!n){if(this.runScene.multipSelector.isEmpty())return;n=this.runScene.multipSelector.getLast()}t.enabled?(this.modelNewVal=this.runScene.modelEx.cloneV3(n[r]),this.isDraggingChange=!0,this.worldOldVal=Ao(n,this.runScene.sceneEx.get())):(this.runScene.multipSelector.isEmpty()?this.runScene.modelEx.setV3({model:n,info:r,newV3:this.runScene.modelEx.cloneV3(n[r]),oldV3:this.modelNewVal},!0,!1):(this.multipObj=n,this.runScene.events.mouse.enableUp=!1,this.runScene.helperEx.boxHelper.setFromObject(this.runScene.assetsEx.get().scene),i=Ao(n,this.runScene.sceneEx.get()),this.runScene.multipSelector.setInfo(n,r,this.modelNewVal,n[r],i,this.worldOldVal)),this.isDraggingChange=!1),this.runScene.assetsEx.get().controls.enabled=!e.value},this.runScene=e}init(){const{camera:e,renderer:t,scene:r}=this.runScene.assetsEx;this.tansControls=new zv(e,t.domElement),this.tansControls.addEventListener("dragging-changed",this.draggingChanged),this.tansControls.addEventListener("change",this.transChangeFn.bind(this)),this.tansControls.name="helper",r.add(this.tansControls),this.tansControls.traverse((e=>e.isHelper=!0))}changeMode(e){this.controlsMode=e,this.tansControls.setMode(this.transControlsStatusMap[e])}transControSize(e){this.tansControls.setSize(e?this.tansControls.size+.1:Math.max(this.tansControls.size-.1,.1))}changeState(e){this.tansControls.enabled=e}addObject(e){this.removeFocus(),this.tansControls.attach(e)}removeFocus(){this.tansControls.detach()}changeSpaceState(){this.tansControls.setSpace("local"===this.tansControls.space?"world":"local"),this.tansControls.detach()}transChangeFn(e){var t=this.runScene.modelEx.select;t&&(this.runScene.lightEx.update(t),this.runScene.helperEx.boxHelper.setFromObject(t))}close(){this.tansControls.enabled=!1}open(){this.tansControls.enabled=!0}reset(){this.dispose(),this.init()}dispose(){this.tansControls&&(this.tansControls.removeEventListener("dragging-changed",this.draggingChanged),this.tansControls.removeEventListener("change",this.transChangeFn),this.tansControls.dispose(),this.runScene.assetsEx.get().scene.remove(this.tansControls))}}(e),this.grid=this.createGrid(),this.init())}init(){this.transContro.init(),this.runScene.assetsEx.get().scene.add(this.grid)}createGrid(){const e=new _i.GridHelper(20,10);return e.name="helper",e.position.y=0,e.material instanceof p.Material&&(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,r){return e.userData.isHelper=!0,t&&e.traverse((e=>{e.userData.isHelper=!0,r&&r(e)})),e}focus(e){"running"!==this.runScene.optionsEx.options.mode&&(this.boxHelper||(this.boxHelper=this.getBoxHelper(e)),this.transContro.addObject(e),this.boxHelper.setFromObject(e),this.focusModelId=this.runScene.uniqueEx.getId(e))}unfocus(){var e;"running"!==this.runScene.optionsEx.options.mode&&(this.transContro.removeFocus(),null!=(e=this.boxHelper)&&e.setFromObject(this.runScene.assetsEx.get().scene),this.focusModelId=void 0)}}function Bv(e){return(Bv="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 Uv(e,t){return(Uv=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Nv(e){return(Nv=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Fv=new WeakMap,Vv=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Uv(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Nv(e);if(r=t?(r=Nv(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Bv(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(e){if(this instanceof n)return(e=r.call(this,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=n,(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,r,n){var i=this,o=new p.FileLoader(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,(function(e){var r={attributeIDs:i.defaultAttributeIDs,attributeTypes:i.defaultAttributeTypes,useUniqueIDs:!1};i.decodeGeometry(e,r).then(t).catch(n)}),r,n)}},{key:"decodeDracoFile",value:function(e,t,r,n){n={attributeIDs:r||this.defaultAttributeIDs,attributeTypes:n||this.defaultAttributeTypes,useUniqueIDs:!!r},this.decodeGeometry(e,n).then(t)}},{key:"decodeGeometry",value:function(e,t){var r,n=this;for(r in t.attributeTypes){var i=t.attributeTypes[r];void 0!==i.BYTES_PER_ELEMENT&&(t.attributeTypes[r]=i.name)}var o,a=JSON.stringify(t);if(Fv.has(e)){if((u=Fv.get(e)).key===a)return u.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 s=this.workerNextTaskID++,u=e.byteLength;return u=this._getWorker(s,u).then((function(r){return o=r,new Promise((function(r,n){o._callbacks[s]={resolve:r,reject:n},o.postMessage({type:"decode",id:s,taskConfig:t,buffer:e},[e])}))})).then((function(e){return n._createGeometry(e.geometry)})),u.catch((function(){return!0})).then((function(){o&&s&&n._releaseTask(o,s)})),Fv.set(e,{key:a,promise:u}),u}},{key:"_createGeometry",value:function(e){var t=new p.BufferGeometry;e.index&&t.setIndex(new p.BufferAttribute(e.index.array,1));for(var r=0;r<e.attributes.length;r++){var n=(o=e.attributes[r]).name,i=o.array,o=o.itemSize;t.setAttribute(n,new p.BufferAttribute(i,o))}return t}},{key:"_loadLibrary",value:function(e,t){var r=new p.FileLoader(this.manager);return r.setPath(this.decoderPath),r.setResponseType(t),r.setWithCredentials(this.withCredentials),new Promise((function(t,n){r.load(e,t,void 0,n)}))}},{key:"preload",value:function(){return this._initDecoder(),this}},{key:"_initDecoder",value:function(){var e=this;if(this.decoderPending)return this.decoderPending;var t="object"!==("undefined"==typeof WebAssembly?"undefined":Bv(WebAssembly))||"js"===this.decoderConfig.type,r=[];return t?r.push(this._loadLibrary("draco_decoder.js","text")):(r.push(this._loadLibrary("draco_wasm_wrapper.js","text")),r.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(r).then((function(r){var n=r[0];t||(e.decoderConfig.wasmBinary=r[1]),r=function(){var e,t;onmessage=function(r){var n=r.data;switch(n.type){case"init":e=n.decoderConfig,t=new Promise((function(t){e.onModuleLoaded=function(e){t({draco:e})},DracoDecoderModule(e)}));break;case"decode":var i=n.buffer,o=n.taskConfig;t.then((function(e){var t=new(e=e.draco).Decoder,r=new e.DecoderBuffer;r.Init(new Int8Array(i),i.byteLength);try{var a=function(e,t,r,n){var i,o=n.attributeIDs,a=n.attributeTypes,s=t.GetEncodedGeometryType(r);if(s===e.TRIANGULAR_MESH)i=new e.Mesh,v=t.DecodeBufferToMesh(r,i);else{if(s!==e.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");i=new e.PointCloud,v=t.DecodeBufferToPointCloud(r,i)}if(!v.ok()||0===i.ptr)throw new Error("THREE.DRACOLoader: Decoding failed: "+v.error_msg());var u,l,c,h,f,p,d,m,y,v,g,b,w,x={index:null,attributes:[]};for(u in o){var S=self[a[u]],_=void 0,T=void 0;if(n.useUniqueIDs)T=o[u],_=t.GetAttributeByUniqueId(i,T);else{if(-1===(T=t.GetAttributeId(i,e[o[u]])))continue;_=t.GetAttribute(i,T)}x.attributes.push((T=e,l=t,c=i,h=u,f=_.num_components(),d=(p=c.num_points()*f)*S.BYTES_PER_ELEMENT,m=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}}(T,S),y=T._malloc(d),l.GetAttributeDataArrayForAllPoints(c,_,m,d,y),l=new S(T.HEAPF32.buffer,y,p).slice(),T._free(y),{name:h,array:l,itemSize:f}))}return s===e.TRIANGULAR_MESH&&(x.index=(r=e,v=t,b=4*(g=3*(s=i).num_faces()),w=r._malloc(b),v.GetTrianglesUInt32Array(s,b,w),v=new Uint32Array(r.HEAPF32.buffer,w,g).slice(),r._free(w),{array:v,itemSize:1})),e.destroy(i),x}(e,t,r,o),s=a.attributes.map((function(e){return e.array.buffer}));a.index&&s.push(a.index.array.buffer),self.postMessage({type:"decode",id:n.id,geometry:a},s)}catch(e){console.error(e),self.postMessage({type:"error",id:n.id,error:e.message})}finally{e.destroy(r),e.destroy(t)}}))}}}.toString(),n=["/* draco decoder */",n,"","/* worker */",r.substring(r.indexOf("{")+1,r.lastIndexOf("}"))].join("\n"),e.workerSourceURL=URL.createObjectURL(new Blob([n]))})),this.decoderPending}},{key:"_getWorker",value:function(e,t){var r=this;return this._initDecoder().then((function(){r.workerPool.length<r.workerLimit?((n=new Worker(r.workerSourceURL))._callbacks={},n._taskCosts={},n._taskLoad=0,n.postMessage({type:"init",decoderConfig:r.decoderConfig}),n.onmessage=function(e){var t=e.data;switch(t.type){case"decode":n._callbacks[t.id].resolve(t);break;case"error":n._callbacks[t.id].reject(t);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+t.type+'"')}},r.workerPool.push(n)):r.workerPool.sort((function(e,t){return e._taskLoad>t._taskLoad?-1:1}));var n,i=r.workerPool[r.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}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),n}(p.Loader),Hv={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 Gv=new(function(e,t,r){return Object.defineProperty(e,"prototype",{writable:!1}),e}((function e(t,r,n){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");var i=this,o=!1,a=0,s=0,u=void 0,l=[];this.onStart=void 0,this.onLoad=t,this.onProgress=r,this.onError=n,this.itemStart=function(e){s++,!1===o&&void 0!==i.onStart&&i.onStart(e,a,s),o=!0},this.itemEnd=function(e){a++,void 0!==i.onProgress&&i.onProgress(e,a,s),a===s&&(o=!1,void 0!==i.onLoad&&i.onLoad())},this.itemError=function(e){void 0!==i.onError&&i.onError(e)},this.resolveURL=function(e){return u?u(e):e},this.setURLModifier=function(e){return u=e,this},this.addHandler=function(e,t){return l.push(e,t),this},this.removeHandler=function(e){return-1!==(e=l.indexOf(e))&&l.splice(e,2),this},this.getHandler=function(e){for(var t=0,r=l.length;t<r;t+=2){var n=l[t],i=l[t+1];if(n.global&&(n.lastIndex=0),n.test(e))return i}return null}})));var Wv=function(){function e(t){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");this.manager=void 0!==t?t:Gv,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}var t,r;return t=e,(r=[{key:"load",value:function(){}},{key:"loadAsync",value:function(e,t){var r=this;return new Promise((function(n,i){r.load(e,n,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 r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,r),Object.defineProperty(t,"prototype",{writable:!1}),e}();function Xv(e){return(Xv="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 qv(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Yv(e,t){return(Yv=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Zv(e){return(Zv=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Qv=function(){var e=n,t=Wv;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&&Yv(e,t);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Zv(e);if(r=t?(r=Zv(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Xv(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(e){if(this instanceof n)return e=r.call(this,e),"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=n,(t=[{key:"setOptions",value:function(e){return this.options=e,this}},{key:"load",value:function(e,t,r,n,i){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var o=this,a=Hv.get(e);if(void 0!==a)return o.manager.itemStart(e),setTimeout((function(){t&&t(a),o.manager.itemEnd(e)}),0),a;var s={};s.credentials="anonymous"===this.crossOrigin?"same-origin":"include",s.headers=this.requestHeader,fetch(e,s).then((function(e){return e.blob()})).then((function(e){return Promise.all([new Promise((function(t){var r,n=o.options.textureQuality,a=i.notCompress;t(i.size&&1!==n?(r=(t=i.size).w,t=t.h,a=a?1:n,createImageBitmap(e,Object.assign(o.options,{imageOrientation:"flipY",resizeHeight:t*a,resizeWidth:r*a}))):createImageBitmap(e,Object.assign(o.options,{imageOrientation:"flipY"})))})),Promise.resolve(e)])})).then((function(r){r=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o=[],a=!0,s=!1;try{for(r=r.call(e);!(a=(n=r.next()).done)&&(o.push(n.value),2!==o.length);a=!0);}catch(e){s=!0,i=e}finally{try{a||null==r.return||r.return()}finally{if(s)throw i}}return o}}(e)||function(e,t){if(e){if("string"==typeof e)return qv(e,2);var r=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(r="Object"===r&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?qv(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.")}()}(r);var n=r[0];r=r[1],Hv.add(e,n),t&&t(n,r),o.manager.itemEnd(e)})).catch((function(t){n&&n(t),o.manager.itemError(e),o.manager.itemEnd(e)})),o.manager.itemStart(e)}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),n}();function Kv(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o=[],a=!0,s=!1;try{for(r=r.call(e);!(a=(n=r.next()).done)&&(o.push(n.value),!t||o.length!==t);a=!0);}catch(e){s=!0,i=e}finally{try{a||null==r.return||r.return()}finally{if(s)throw i}}return o}}(e,t)||$v(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 Jv(e,t){var r,n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=$v(e))||t&&e&&"number"==typeof e.length)return n&&(e=n),r=0,{s:t=function(){},n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},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,o=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){a=!0,i=e},f:function(){try{o||null==n.return||n.return()}finally{if(a)throw i}}}}function $v(e,t){if(e){if("string"==typeof e)return eg(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(r="Object"===r&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?eg(e,t):void 0}}function eg(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function tg(e){return(tg="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 rg(){return(rg="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=cg(e)););return e}(e,t);if(n)return(n=Object.getOwnPropertyDescriptor(n,t)).get?n.get.call(arguments.length<3?e:r):n.value}).apply(this,arguments)}function ng(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ig(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function og(e,t,r){return t&&ig(e.prototype,t),r&&ig(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function ag(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&&sg(e,t)}function sg(e,t){return(sg=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ug(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=cg(e);if(r=t?(r=cg(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===tg(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return lg(n)}}function lg(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function cg(e){return(cg=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}Qv.prototype.isImageBitmapLoader=!0;var hg=function(){ag(t,p.Loader);var e=ug(t);function t(r){return ng(this,t),(r=e.call(this,r)).dracoLoader=null,r.ktx2Loader=null,r.meshoptDecoder=null,r.pluginCallbacks=[],r.register((function(e){return new yg(e)})),r.register((function(e){return new Sg(e)})),r.register((function(e){return new _g(e)})),r.register((function(e){return new vg(e)})),r.register((function(e){return new gg(e)})),r.register((function(e){return new bg(e)})),r.register((function(e){return new wg(e)})),r.register((function(e){return new xg(e)})),r.register((function(e){return new dg(e)})),r.register((function(e){return new Tg(e)})),r}return og(t,[{key:"load",value:function(e,t,r,n){function i(t){n?n(t):console.error(t),o.manager.itemError(e),o.manager.itemEnd(e)}var o=this,a=""!==this.resourcePath?this.resourcePath:""!==this.path?this.path:p.LoaderUtils.extractUrlBase(e),s=(this.manager.itemStart(e),new p.FileLoader(this.manager));s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,(function(r){try{o.parse(r,a,(function(r){t(r),o.manager.itemEnd(e)}),i)}catch(r){i(r)}}),r,i)}},{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,r,n,i){var o,a={},s={};if("string"==typeof e)o=e;else if(p.LoaderUtils.decodeText(new Uint8Array(e,0,4))===Eg){try{a[pg.KHR_BINARY_GLTF]=new Og(e)}catch(e){return void(n&&n(e))}o=a[pg.KHR_BINARY_GLTF].content}else o=p.LoaderUtils.decodeText(new Uint8Array(e));var u=JSON.parse(o);if(void 0===u.asset||u.asset.version[0]<2)n&&n(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));else{i.helper.beforeLoader(u);var l=new Xg(u,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder,myOptions:i});l.fileLoader.setRequestHeader(this.requestHeader);for(var c=0;c<this.pluginCallbacks.length;c++){var h=this.pluginCallbacks[c](l);a[(s[h.name]=h).name]=!0}if(u.extensionsUsed)for(var f=0;f<u.extensionsUsed.length;++f){var d=u.extensionsUsed[f],m=u.extensionsRequired||[];switch(d){case pg.KHR_MATERIALS_UNLIT:a[d]=new mg;break;case pg.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:a[d]=new kg;break;case pg.KHR_DRACO_MESH_COMPRESSION:a[d]=new Mg(u,this.dracoLoader);break;case pg.KHR_TEXTURE_TRANSFORM:a[d]=new Pg;break;case pg.KHR_MESH_QUANTIZATION:a[d]=new jg;break;default:0<=m.indexOf(d)&&void 0===s[d]&&console.warn('THREE.GLTFLoader: Unknown extension "'+d+'".')}}l.setExtensions(a),l.setPlugins(s),l.parse(r,n)}}},{key:"parseAsync",value:function(e,t){var r=this;return new Promise((function(n,i){r.parse(e,t,n,i)}))}}]),t}();function fg(){var e={};return{get:function(t){return e[t]},add:function(t,r){e[t]=r},remove:function(t){delete e[t]},removeAll:function(){e={}}}}var pg={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_PBR_SPECULAR_GLOSSINESS:"KHR_materials_pbrSpecularGlossiness",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",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",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression"},dg=function(){function e(t){ng(this,e),this.parser=t,this.name=pg.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}return og(e,[{key:"_markDefs",value:function(){for(var e=this.parser,t=this.parser.json.nodes||[],r=0,n=t.length;r<n;r++){var i=t[r];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,r="light:"+e,n=t.cache.get(r);if(n)return n;var i,o=t.json,a=((o.extensions&&o.extensions[this.name]||{}).lights||[])[e],s=new p.Color(16777215),u=(void 0!==a.color&&s.fromArray(a.color),void 0!==a.range?a.range:0);switch(a.type){case"directional":(i=new p.DirectionalLight(s)).target.position.set(0,0,-1),i.add(i.target);break;case"point":(i=new p.PointLight(s)).distance=u;break;case"spot":(i=new p.SpotLight(s)).distance=u,a.spot=a.spot||{},a.spot.innerConeAngle=void 0!==a.spot.innerConeAngle?a.spot.innerConeAngle:0,a.spot.outerConeAngle=void 0!==a.spot.outerConeAngle?a.spot.outerConeAngle:Math.PI/4,i.angle=a.spot.outerConeAngle,i.penumbra=1-a.spot.innerConeAngle/a.spot.outerConeAngle,i.target.position.set(0,0,-1),i.add(i.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+a.type)}return i.position.set(0,0,0),i.decay=2,void 0!==a.intensity&&(i.intensity=a.intensity),i.name=t.createUniqueName(a.name||"light_"+e),n=Promise.resolve(i),t.cache.add(r,n),n}},{key:"createNodeAttachment",value:function(e){var t=this,r=this.parser,n=((e=r.json.nodes[e]).extensions&&e.extensions[this.name]||{}).light;return void 0===n?null:this._loadLight(n).then((function(e){return r._getNodeRef(t.cache,n,e)}))}}]),e}(),mg=function(){function e(){ng(this,e),this.name=pg.KHR_MATERIALS_UNLIT}return og(e,[{key:"getMaterialType",value:function(){return p.MeshBasicMaterial}},{key:"extendParams",value:function(e,t,r){var n,i=[];return e.color=new p.Color(1,1,1),e.opacity=1,(t=t.pbrMetallicRoughness)&&(Array.isArray(t.baseColorFactor)&&(n=t.baseColorFactor,e.color.fromArray(n),e.opacity=n[3]),void 0!==t.baseColorTexture&&i.push(r.assignTexture(e,"map",t.baseColorTexture))),Promise.all(i)}}]),e}(),yg=function(){function e(t){ng(this,e),this.parser=t,this.name=pg.KHR_MATERIALS_CLEARCOAT}return og(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?p.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){var r=this.parser;if(!(e=r.json.materials[e]).extensions||!e.extensions[this.name])return Promise.resolve();var n=[];return void 0!==(e=e.extensions[this.name]).clearcoatFactor&&(t.clearcoat=e.clearcoatFactor),void 0!==e.clearcoatTexture&&n.push(r.assignTexture(t,"clearcoatMap",e.clearcoatTexture)),void 0!==e.clearcoatRoughnessFactor&&(t.clearcoatRoughness=e.clearcoatRoughnessFactor),void 0!==e.clearcoatRoughnessTexture&&n.push(r.assignTexture(t,"clearcoatRoughnessMap",e.clearcoatRoughnessTexture)),void 0!==e.clearcoatNormalTexture&&(n.push(r.assignTexture(t,"clearcoatNormalMap",e.clearcoatNormalTexture)),void 0!==e.clearcoatNormalTexture.scale&&(r=e.clearcoatNormalTexture.scale,t.clearcoatNormalScale=new p.Vector2(r,r))),Promise.all(n)}}]),e}(),vg=function(){function e(t){ng(this,e),this.parser=t,this.name=pg.KHR_MATERIALS_SHEEN}return og(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?p.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){var r=this.parser;if(!(e=r.json.materials[e]).extensions||!e.extensions[this.name])return Promise.resolve();var n=[];return void 0!==(t.sheenColor=new p.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&&n.push(r.assignTexture(t,"sheenColorMap",e.sheenColorTexture)),void 0!==e.sheenRoughnessTexture&&n.push(r.assignTexture(t,"sheenRoughnessMap",e.sheenRoughnessTexture)),Promise.all(n)}}]),e}(),gg=function(){function e(t){ng(this,e),this.parser=t,this.name=pg.KHR_MATERIALS_TRANSMISSION}return og(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?p.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){var r=this.parser;if(!(e=r.json.materials[e]).extensions||!e.extensions[this.name])return Promise.resolve();var n=[];return void 0!==(e=e.extensions[this.name]).transmissionFactor&&(t.transmission=e.transmissionFactor),void 0!==e.transmissionTexture&&n.push(r.assignTexture(t,"transmissionMap",e.transmissionTexture)),Promise.all(n)}}]),e}(),bg=function(){function e(t){ng(this,e),this.parser=t,this.name=pg.KHR_MATERIALS_VOLUME}return og(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?p.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){if(!(e=(n=this.parser).json.materials[e]).extensions||!e.extensions[this.name])return Promise.resolve();var r=[],n=(e=e.extensions[this.name],t.thickness=void 0!==e.thicknessFactor?e.thicknessFactor:0,void 0!==e.thicknessTexture&&r.push(n.assignTexture(t,"thicknessMap",e.thicknessTexture)),t.attenuationDistance=e.attenuationDistance||0,e.attenuationColor||[1,1,1]);return t.attenuationColor=new p.Color(n[0],n[1],n[2]),Promise.all(r)}}]),e}(),wg=function(){function e(t){ng(this,e),this.parser=t,this.name=pg.KHR_MATERIALS_IOR}return og(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?p.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}(),xg=function(){function e(t){ng(this,e),this.parser=t,this.name=pg.KHR_MATERIALS_SPECULAR}return og(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?p.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){var r=this.parser;if(!(e=r.json.materials[e]).extensions||!e.extensions[this.name])return Promise.resolve();var n=[],i=(e=e.extensions[this.name],t.specularIntensity=void 0!==e.specularFactor?e.specularFactor:1,void 0!==e.specularTexture&&n.push(r.assignTexture(t,"specularIntensityMap",e.specularTexture)),e.specularColorFactor||[1,1,1]);return t.specularColor=new p.Color(i[0],i[1],i[2]),void 0!==e.specularColorTexture&&n.push(r.assignTexture(t,"specularColorMap",e.specularColorTexture).then((function(e){e.encoding=p.sRGBEncoding}))),Promise.all(n)}}]),e}(),Sg=function(){function e(t){ng(this,e),this.parser=t,this.name=pg.KHR_TEXTURE_BASISU}return og(e,[{key:"loadTexture",value:function(e){var t=this.parser,r=t.json;if(!(n=r.textures[e]).extensions||!n.extensions[this.name])return null;var n=n.extensions[this.name],i=t.options.ktx2Loader;if(i)return t.loadTextureImage(e,n.source,i);if(r.extensionsRequired&&0<=r.extensionsRequired.indexOf(this.name))throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}}]),e}(),_g=function(){function e(t){ng(this,e),this.parser=t,this.name=pg.EXT_TEXTURE_WEBP,this.isSupported=null}return og(e,[{key:"loadTexture",value:function(e){var t=this.name,r=this.parser,n=r.json;if(!(i=n.textures[e]).extensions||!i.extensions[t])return null;var i=i.extensions[t],o=n.images[i.source],a=r.textureLoader;return o.uri&&null!==(i=r.options.manager.getHandler(o.uri))&&(a=i),this.detectSupport().then((function(i){if(i)return r.loadTextureImage(e,o,a);if(n.extensionsRequired&&0<=n.extensionsRequired.indexOf(t))throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return r.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}(),Tg=function(){function e(t){ng(this,e),this.name=pg.EXT_MESHOPT_COMPRESSION,this.parser=t}return og(e,[{key:"loadBufferView",value:function(e){var t=this.parser.json;if((e=t.bufferViews[e]).extensions&&e.extensions[this.name]){var r=e.extensions[this.name],n=(e=this.parser.getDependency("buffer",r.buffer),this.parser.options.meshoptDecoder);if(n&&n.supported)return Promise.all([e,n.ready]).then((function(e){var t=r.byteOffset||0,i=r.byteLength||0,o=r.count,a=r.byteStride,s=new ArrayBuffer(o*a);return e=new Uint8Array(e[0],t,i),n.decodeGltfBuffer(new Uint8Array(s),o,a,e,r.mode,r.filter),s}));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}(),Eg="glTF",Og=og((function e(t){ng(this,e),this.name=pg.KHR_BINARY_GLTF,this.content=null,this.body=null;var r=new DataView(t,0,12);if(this.header={magic:p.LoaderUtils.decodeText(new Uint8Array(t.slice(0,4))),version:r.getUint32(4,!0),length:r.getUint32(8,!0)},this.header.magic!==Eg)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 n=this.header.length-12,i=new DataView(t,12),o=0;o<n;){var a,s=i.getUint32(o,!0),u=(o+=4,i.getUint32(o,!0));o+=4,1313821514===u?(a=new Uint8Array(t,12+o,s),this.content=p.LoaderUtils.decodeText(a)):5130562===u&&(this.body=t.slice(a=12+o,a+s)),o+=s}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")})),Mg=function(){function e(t,r){if(ng(this,e),!r)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=pg.KHR_DRACO_MESH_COMPRESSION,this.json=t,this.dracoLoader=r,this.dracoLoader.preload()}return og(e,[{key:"decodePrimitive",value:function(e,t){var r,n,i=this.json,o=this.dracoLoader,a=e.extensions[this.name].bufferView,s=e.extensions[this.name].attributes,u={},l={},c={};for(r in s){var h=Ug[r]||r.toLowerCase();u[h]=s[r]}for(n in e.attributes){var f,p,d=Ug[n]||n.toLowerCase();void 0!==s[n]&&(f=i.accessors[e.attributes[n]],p=Lg[f.componentType],c[d]=p,l[d]=!0===f.normalized)}return t.getDependency("bufferView",a).then((function(e){return new Promise((function(t){o.decodeDracoFile(e,(function(e){for(var r in e.attributes){var n=e.attributes[r];void 0!==(r=l[r])&&(n.normalized=r)}t(e)}),u,c)}))}))}}]),e}(),Pg=function(){function e(){ng(this,e),this.name=pg.KHR_TEXTURE_TRANSFORM}return og(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}(),Rg=function(){ag(t,p.MeshStandardMaterial);var e=ug(t);function t(r){ng(this,t),(n=e.call(this)).isGLTFSpecularGlossinessMaterial=!0;var n,i=["#ifdef USE_SPECULARMAP","\tuniform sampler2D specularMap;","#endif"].join("\n"),o=["#ifdef USE_GLOSSINESSMAP","\tuniform sampler2D glossinessMap;","#endif"].join("\n"),a=["vec3 specularFactor = specular;","#ifdef USE_SPECULARMAP","\tvec4 texelSpecular = texture2D( specularMap, vUv );","\t// reads channel RGB, compatible with a glTF Specular-Glossiness (RGBA) texture","\tspecularFactor *= texelSpecular.rgb;","#endif"].join("\n"),s=["float glossinessFactor = glossiness;","#ifdef USE_GLOSSINESSMAP","\tvec4 texelGlossiness = texture2D( glossinessMap, vUv );","\t// reads channel A, compatible with a glTF Specular-Glossiness (RGBA) texture","\tglossinessFactor *= texelGlossiness.a;","#endif"].join("\n"),u=["PhysicalMaterial material;","material.diffuseColor = diffuseColor.rgb * ( 1. - max( specularFactor.r, max( specularFactor.g, specularFactor.b ) ) );","vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );","float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );","material.roughness = max( 1.0 - glossinessFactor, 0.0525 ); // 0.0525 corresponds to the base mip of a 256 cubemap.","material.roughness += geometryRoughness;","material.roughness = min( material.roughness, 1.0 );","material.specularColor = specularFactor;"].join("\n"),l={specular:{value:(new p.Color).setHex(16777215)},glossiness:{value:1},specularMap:{value:null},glossinessMap:{value:null}};return n._extraUniforms=l,n.onBeforeCompile=function(e){for(var t in l)e.uniforms[t]=l[t];e.fragmentShader=e.fragmentShader.replace("uniform float roughness;","uniform vec3 specular;").replace("uniform float metalness;","uniform float glossiness;").replace("#include <roughnessmap_pars_fragment>",i).replace("#include <metalnessmap_pars_fragment>",o).replace("#include <roughnessmap_fragment>",a).replace("#include <metalnessmap_fragment>",s).replace("#include <lights_physical_fragment>",u)},Object.defineProperties(lg(n),{specular:{get:function(){return l.specular.value},set:function(e){l.specular.value=e}},specularMap:{get:function(){return l.specularMap.value},set:function(e){(l.specularMap.value=e)?this.defines.USE_SPECULARMAP="":delete this.defines.USE_SPECULARMAP}},glossiness:{get:function(){return l.glossiness.value},set:function(e){l.glossiness.value=e}},glossinessMap:{get:function(){return l.glossinessMap.value},set:function(e){(l.glossinessMap.value=e)?(this.defines.USE_GLOSSINESSMAP="",this.defines.USE_UV=""):(delete this.defines.USE_GLOSSINESSMAP,delete this.defines.USE_UV)}}}),delete n.metalness,delete n.roughness,delete n.metalnessMap,delete n.roughnessMap,n.setValues(r),n}return og(t,[{key:"copy",value:function(e){return rg(cg(t.prototype),"copy",this).call(this,e),this.specularMap=e.specularMap,this.specular.copy(e.specular),this.glossinessMap=e.glossinessMap,this.glossiness=e.glossiness,delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this}}]),t}(),kg=function(){function e(){ng(this,e),this.name=pg.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS,this.specularGlossinessParams=["color","map","lightMap","lightMapIntensity","aoMap","aoMapIntensity","emissive","emissiveIntensity","emissiveMap","bumpMap","bumpScale","normalMap","normalMapType","displacementMap","displacementScale","displacementBias","specularMap","specular","glossinessMap","glossiness","alphaMap","envMap","envMapIntensity","refractionRatio"]}return og(e,[{key:"getMaterialType",value:function(){return Rg}},{key:"extendParams",value:function(e,t,r){t=t.extensions[this.name];var n,i=(e.color=new p.Color(1,1,1),e.opacity=1,[]);return Array.isArray(t.diffuseFactor)&&(n=t.diffuseFactor,e.color.fromArray(n),e.opacity=n[3]),void 0!==t.diffuseTexture&&i.push(r.assignTexture(e,"map",t.diffuseTexture)),e.emissive=new p.Color(0,0,0),e.glossiness=void 0!==t.glossinessFactor?t.glossinessFactor:1,e.specular=new p.Color(1,1,1),Array.isArray(t.specularFactor)&&e.specular.fromArray(t.specularFactor),void 0!==t.specularGlossinessTexture&&(n=t.specularGlossinessTexture,i.push(r.assignTexture(e,"glossinessMap",n)),i.push(r.assignTexture(e,"specularMap",n))),Promise.all(i)}},{key:"createMaterial",value:function(e){var t=new Rg(e);return t.fog=!0,t.color=e.color,t.map=void 0===e.map?null:e.map,t.lightMap=null,t.lightMapIntensity=1,t.aoMap=void 0===e.aoMap?null:e.aoMap,t.aoMapIntensity=1,t.emissive=e.emissive,t.emissiveIntensity=1,t.emissiveMap=void 0===e.emissiveMap?null:e.emissiveMap,t.bumpMap=void 0===e.bumpMap?null:e.bumpMap,t.bumpScale=1,t.normalMap=void 0===e.normalMap?null:e.normalMap,t.normalMapType=p.TangentSpaceNormalMap,e.normalScale&&(t.normalScale=e.normalScale),t.displacementMap=null,t.displacementScale=1,t.displacementBias=0,t.specularMap=void 0===e.specularMap?null:e.specularMap,t.specular=e.specular,t.glossinessMap=void 0===e.glossinessMap?null:e.glossinessMap,t.glossiness=e.glossiness,t.alphaMap=null,t.envMap=void 0===e.envMap?null:e.envMap,t.envMapIntensity=1,t.refractionRatio=.98,t}}]),e}(),jg=og((function e(){ng(this,e),this.name=pg.KHR_MESH_QUANTIZATION})),Ag=function(){ag(t,p.Interpolant);var e=ug(t);function t(r,n,i,o){return ng(this,t),e.call(this,r,n,i,o)}return og(t,[{key:"copySampleValue_",value:function(e){for(var t=this.resultBuffer,r=this.sampleValues,n=this.valueSize,i=e*n*3+n,o=0;o!==n;o++)t[o]=r[i+o];return t}}]),t}(),Cg=(Ag.prototype.beforeStart_=Ag.prototype.copySampleValue_,Ag.prototype.afterEnd_=Ag.prototype.copySampleValue_,Ag.prototype.interpolate_=function(e,t,r,n){for(var i=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=2*a,u=3*a,l=n-t,c=e*u,h=c-u,f=-2*(t=(r=(n=(r-t)/l)*n)*n)+3*r,p=t-r,d=1-f,m=p-r+n,y=0;y!==a;y++){var v=o[h+y+a],g=o[h+y+s]*l,b=o[c+y+a],w=o[c+y]*l;i[y]=d*v+m*g+f*b+p*w}return i},new p.Quaternion),Dg=function(){ag(t,Ag);var e=ug(t);function t(){return ng(this,t),e.apply(this,arguments)}return og(t,[{key:"interpolate_",value:function(e,r,n,i){return e=rg(cg(t.prototype),"interpolate_",this).call(this,e,r,n,i),Cg.fromArray(e).normalize().toArray(e),e}}]),t}(),Lg={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},zg={9728:p.NearestFilter,9729:p.LinearFilter,9984:p.NearestMipmapNearestFilter,9985:p.LinearMipmapNearestFilter,9986:p.NearestMipmapLinearFilter,9987:p.LinearMipmapLinearFilter},Ig={33071:p.ClampToEdgeWrapping,33648:p.MirroredRepeatWrapping,10497:p.RepeatWrapping},Bg={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Ug={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},Ng={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},Fg={CUBICSPLINE:void 0,LINEAR:p.InterpolateLinear,STEP:p.InterpolateDiscrete};function Vg(e,t,r){for(var n in r.extensions)void 0===e[n]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[n]=r.extensions[n])}function Hg(e,t){void 0!==t.extras&&("object"===tg(t.extras)?Object.assign(e.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function Gg(e){for(var t="",r=Object.keys(e).sort(),n=0,i=r.length;n<i;n++)t+=r[n]+":"+e[r[n]]+";";return t}function Wg(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 Xg=function(){function e(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};ng(this,e),this.json=t,this.extensions={},this.plugins={},this.options=r,this.cache=new fg,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 createImageBitmap&&!1===/Firefox|^((?!chrome|android).)*safari/i.test(navigator.userAgent)?this.textureLoader=new Qv(this.options.manager):this.textureLoader=new p.TextureLoader(this.options.manager),this.options.myOptions.helper.options.setTextureLoader(this.textureLoader),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new p.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}return og(e,[{key:"setExtensions",value:function(e){this.extensions=e}},{key:"setPlugins",value:function(e){this.plugins=e}},{key:"parse",value:function(e,t){var r=this,n=this.json,i=this.extensions;this.cache.removeAll(),this._invokeAll((function(e){return e._markDefs&&e._markDefs()})),Promise.all([this.options.myOptions.helper.processInput(n,this)].concat(function(e){return function(e){if(Array.isArray(e))return eg(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||$v(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.")}()}(this._invokeAll((function(e){return e.beforeRoot&&e.beforeRoot()}))))).then((function(){return Promise.all([r.getDependencies("scene"),r.getDependencies("animation"),r.getDependencies("camera")])})).then((function(t){var o={scene:t[0][n.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:n.asset,parser:r,userData:{}};Vg(i,o,n),Hg(o,n),Promise.all(r._invokeAll((function(e){return e.afterRoot&&e.afterRoot(o)}))).then((function(){e(o)}))})).catch(t)}},{key:"_markDefs",value:function(){for(var e=this.json.nodes||[],t=this.json.skins||[],r=this.json.meshes||[],n=0,i=t.length;n<i;n++)for(var o=t[n].joints,a=0,s=o.length;a<s;a++)e[o[a]].isBone=!0;for(var u=0,l=e.length;u<l;u++){var c=e[u];void 0!==c.mesh&&(this._addNodeRef(this.meshCache,c.mesh),void 0!==c.skin&&(r[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,r){var n=this;if(e.refs[t]<=1)return r;var i=r.clone();return function e(t,r){var i,o=n.associations.get(t),a=(null!=o&&n.associations.set(r,o),Jv(t.children.entries()));try{for(a.s();!(i=a.n()).done;){var s=Kv(i.value,2),u=s[0];e(s[1],r.children[u])}}catch(e){a.e(e)}finally{a.f()}}(r,i),i.name+="_instance_"+e.uses[t]++,i}},{key:"_invokeOne",value:function(e){var t=Object.values(this.plugins);t.push(this);for(var r=0;r<t.length;r++){var n=e(t[r]);if(n)return n}return null}},{key:"_invokeAll",value:function(e){for(var t=Object.values(this.plugins),r=(t.unshift(this),[]),n=0;n<t.length;n++){var i=e(t[n]);i&&r.push(i)}return r}},{key:"getDependency",value:function(e,t){var r=e+":"+t,n=this.cache.get(r);if(!n){switch(e){case"scene":n=this.loadScene(t);break;case"node":n=this.loadNode(t);break;case"mesh":n=this._invokeOne((function(e){return e.loadMesh&&e.loadMesh(t)}));break;case"accessor":n=this.loadAccessor(t);break;case"bufferView":n=this._invokeOne((function(e){return e.loadBufferView&&e.loadBufferView(t)}));break;case"buffer":n=this.loadBuffer(t);break;case"material":n=this._invokeOne((function(e){return e.loadMaterial&&e.loadMaterial(t)}));break;case"texture":n=this._invokeOne((function(e){return e.loadTexture&&e.loadTexture(t)}));break;case"skin":n=this.loadSkin(t);break;case"animation":n=this.loadAnimation(t);break;case"camera":n=this.loadCamera(t);break;default:throw new Error("Unknown type: "+e)}this.cache.add(r,n)}return n}},{key:"getDependencies",value:function(e){var t,r,n=this.cache.get(e);return n||(r=(t=this).json[e+("mesh"===e?"es":"s")]||[],n=Promise.all(r.map((function(r,n){return t.getDependency(e,n)}))),this.cache.add(e,n)),n}},{key:"loadBuffer",value:function(e){var t=this.json.buffers[e],r=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[pg.KHR_BINARY_GLTF].body);var n=this.options;return new Promise((function(e,i){r.load(p.LoaderUtils.resolveURL(t.uri,n.path),e,void 0,(function(){i(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 r=t.byteLength||0,n=t.byteOffset||0;return e.slice(n,n+r)}))}},{key:"loadAccessor",value:function(e){var t=this,r=this.json,n=this.json.accessors[e];return void 0===n.bufferView&&void 0===n.sparse?Promise.resolve(null):(e=[],void 0!==n.bufferView?e.push(this.getDependency("bufferView",n.bufferView)):e.push(null),void 0!==n.sparse&&(e.push(this.getDependency("bufferView",n.sparse.indices.bufferView)),e.push(this.getDependency("bufferView",n.sparse.values.bufferView))),Promise.all(e).then((function(e){var i,o=e[0],a=Bg[n.type],s=Lg[n.componentType],u=s.BYTES_PER_ELEMENT,l=n.byteOffset||0,c=void 0!==n.bufferView?r.bufferViews[n.bufferView].byteStride:void 0,h=!0===n.normalized,f=c&&c!==u*a?(d=Math.floor(l/c),m="InterleavedBuffer:"+n.bufferView+":"+n.componentType+":"+d+":"+n.count,(y=t.cache.get(m))||(i=new s(o,d*c,n.count*c/u),y=new p.InterleavedBuffer(i,c/u),t.cache.add(m,y)),new p.InterleavedBufferAttribute(y,a,l%c/u,h)):(i=null===o?new s(n.count*a):new s(o,l,n.count*a),new p.BufferAttribute(i,a,h));if(void 0!==n.sparse){var d=Lg[n.sparse.indices.componentType],m=n.sparse.indices.byteOffset||0,y=n.sparse.values.byteOffset||0,v=new d(e[1],m,n.sparse.count*Bg.SCALAR),g=new s(e[2],y,n.sparse.count*a);null!==o&&(f=new p.BufferAttribute(f.array.slice(),f.itemSize,f.normalized));for(var b=0,w=v.length;b<w;b++){var x=v[b];if(f.setX(x,g[b*a]),2<=a&&f.setY(x,g[b*a+1]),3<=a&&f.setZ(x,g[b*a+2]),4<=a&&f.setW(x,g[b*a+3]),5<=a)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return f})))}},{key:"loadTexture",value:function(e){var t=this.json,r=this.options,n=t.textures[e].source,i=(t=t.images[n],this.textureLoader);return t.uri&&null!==(r=r.manager.getHandler(t.uri))&&(i=r),this.loadTextureImage(e,n,i)}},{key:"loadTextureImage",value:function(e,t,r){var n=this,i=this.json,o=i.textures[e],a=((a=i.images[t]).uri||a.bufferView)+":"+o.sampler;return this.textureCache[a]?this.textureCache[a]:(t=this.loadImageSource(t,r,e).then((function(t){t.flipY=!1,o.name&&(t.name=o.name);var r=(i.samplers||{})[o.sampler]||{};return t.magFilter=zg[r.magFilter]||p.LinearFilter,t.minFilter=zg[r.minFilter]||p.LinearMipmapLinearFilter,t.wrapS=Ig[r.wrapS]||p.RepeatWrapping,t.wrapT=Ig[r.wrapT]||p.RepeatWrapping,n.associations.set(t,{textures:e}),n.options.myOptions.helper.material.processTexture({texture:t,textureDef:o}),t})).catch((function(){return null})),this.textureCache[a]=t)}},{key:"loadImageSource",value:function(e,t,r){var n=this.json,i=this.options,o=n.textures[r];if(void 0!==this.sourceCache[e])return this.sourceCache[e].then((function(e){return e.clone()})).catch((function(e){throw e}));var a=n.images[e],s=self.URL||self.webkitURL,u=a.uri||"";if(void 0!==a.bufferView)u=this.getDependency("bufferView",a.bufferView).then((function(e){return e=new Blob([e],{type:a.mimeType}),u=s.createObjectURL(e)}));else if(void 0===a.uri)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");return r=Promise.resolve(u).then((function(e){return new Promise((function(r,n){var a;!0===t.isImageBitmapLoader?(a=function(e,t){(e=new p.Texture(e)).needsUpdate=!0,r({texture:e,blob:t})},t.load(p.LoaderUtils.resolveURL(e,i.path),a,void 0,n,o)):ka(e).then((function(e){var t=e.ctx,n=e.canvas;e=e.img,t.translate(0,n.height),t.scale(1,-1),t.drawImage(e,0,0,n.width,n.height),t=new p.Texture(n),r(t)})).cathe(n)}))})).then((function(e){var r=(e=t.isImageBitmapLoader?e:{texture:e,blob:null}).texture;return e=e.blob,!0===t.isImageBitmapLoader&&(r.userData.url=u,r.userData.blob=e),r.url=u,r})).catch((function(e){throw console.log(e,"error"),console.error("THREE.GLTFLoader: Couldn't load texture",u),e})),this.sourceCache[e]=r}},{key:"assignTexture",value:function(e,t,r){var n=this;return this.getDependency("texture",r.index).then((function(i){var o,a;return void 0===r.texCoord||0==r.texCoord||"aoMap"===t&&1==r.texCoord||console.warn("THREE.GLTFLoader: Custom UV set "+r.texCoord+" for texture "+t+" not yet supported."),n.extensions[pg.KHR_TEXTURE_TRANSFORM]&&(o=void 0!==r.extensions?r.extensions[pg.KHR_TEXTURE_TRANSFORM]:void 0)&&(a=n.associations.get(i),i=n.extensions[pg.KHR_TEXTURE_TRANSFORM].extendTexture(i,o),n.associations.set(i,a)),e[t]=i}))}},{key:"assignFinalMaterial",value:function(e){var t,r,n=e.geometry,i=e.material,o=void 0===n.attributes.tangent,a=void 0!==n.attributes.color,s=void 0===n.attributes.normal;e.isPoints?(t="PointsMaterial:"+i.uuid,(r=this.cache.get(t))||(r=new p.PointsMaterial,p.Material.prototype.copy.call(r,i),r.color.copy(i.color),r.map=i.map,r.sizeAttenuation=!1,this.cache.add(t,r)),i=r):e.isLine&&(t="LineBasicMaterial:"+i.uuid,(r=this.cache.get(t))||(r=new p.LineBasicMaterial,p.Material.prototype.copy.call(r,i),r.color.copy(i.color),this.cache.add(t,r)),i=r),(o||a||s)&&(t="ClonedMaterial:"+i.uuid+":",i.isGLTFSpecularGlossinessMaterial&&(t+="specular-glossiness:"),o&&(t+="derivative-tangents:"),a&&(t+="vertex-colors:"),s&&(t+="flat-shading:"),(r=this.cache.get(t))||(r=i.clone(),a&&(r.vertexColors=!0),s&&(r.flatShading=!0),o&&(r.normalScale&&(r.normalScale.y*=-1),r.clearcoatNormalScale&&(r.clearcoatNormalScale.y*=-1)),this.cache.add(t,r),this.associations.set(r,this.associations.get(i))),i=r),i.aoMap&&void 0===n.attributes.uv2&&void 0!==n.attributes.uv&&n.setAttribute("uv2",n.attributes.uv),this.options.myOptions.helper.material.process({material:i,materialDef:i.userData,model:e}),e.material=i}},{key:"getMaterialType",value:function(){return p.MeshStandardMaterial}},{key:"loadMaterial",value:function(e){var t,r=this,n=this.json,i=this.extensions,o=n.materials[e],a={},s=[],u=((n=o.extensions||{})[pg.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]?(u=i[pg.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS],t=u.getMaterialType(),s.push(u.extendParams(a,o,r))):n[pg.KHR_MATERIALS_UNLIT]?(u=i[pg.KHR_MATERIALS_UNLIT],t=u.getMaterialType(),s.push(u.extendParams(a,o,r))):(n=o.pbrMetallicRoughness||{},a.color=new p.Color(1,1,1),a.opacity=1,Array.isArray(n.baseColorFactor)&&(u=n.baseColorFactor,a.color.fromArray(u),a.opacity=u[3]),void 0!==n.baseColorTexture&&s.push(r.assignTexture(a,"map",n.baseColorTexture)),a.metalness=void 0!==n.metallicFactor?n.metallicFactor:1,a.roughness=void 0!==n.roughnessFactor?n.roughnessFactor:1,void 0!==n.metallicRoughnessTexture&&(s.push(r.assignTexture(a,"metalnessMap",n.metallicRoughnessTexture)),s.push(r.assignTexture(a,"roughnessMap",n.metallicRoughnessTexture))),t=this._invokeOne((function(t){return t.getMaterialType&&t.getMaterialType(e)})),s.push(Promise.all(this._invokeAll((function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,a)}))))),!0===o.doubleSided&&(a.side=p.DoubleSide),o.alphaMode||"OPAQUE");return"BLEND"===u?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,"MASK"===u&&(a.alphaTest=void 0!==o.alphaCutoff?o.alphaCutoff:.5)),void 0!==o.normalTexture&&t!==p.MeshBasicMaterial&&(s.push(r.assignTexture(a,"normalMap",o.normalTexture)),a.normalScale=new p.Vector2(1,1),void 0!==o.normalTexture.scale&&(n=o.normalTexture.scale,a.normalScale.set(n,n))),void 0!==o.occlusionTexture&&t!==p.MeshBasicMaterial&&(s.push(r.assignTexture(a,"aoMap",o.occlusionTexture)),void 0!==o.occlusionTexture.strength&&(a.aoMapIntensity=o.occlusionTexture.strength)),void 0!==o.emissiveFactor&&t!==p.MeshBasicMaterial&&(a.emissive=(new p.Color).fromArray(o.emissiveFactor)),void 0!==o.emissiveTexture&&t!==p.MeshBasicMaterial&&s.push(r.assignTexture(a,"emissiveMap",o.emissiveTexture)),Promise.all(s).then((function(){var n=t===Rg?i[pg.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(a):new t(a);return o.name&&(n.name=o.name),n.map&&(n.map.encoding=p.sRGBEncoding),n.emissiveMap&&(n.emissiveMap.encoding=p.sRGBEncoding),Hg(n,o),r.associations.set(n,{materials:e}),o.extensions&&Vg(i,n,o),n}))}},{key:"createUniqueName",value:function(e){for(var t=p.PropertyBinding.sanitizeNodeName(e||""),r=t,n=1;this.nodeNamesUsed[r];++n)r=t+"_"+n;return this.nodeNamesUsed[r]=!0,r}},{key:"loadGeometries",value:function(e){for(var t=this,r=this.extensions,n=this.primitiveCache,i=[],o=0,a=e.length;o<a;o++){var s=e[o],u=(l=void 0,l=(l=(u=s).extensions&&u.extensions[pg.KHR_DRACO_MESH_COMPRESSION])?"draco:"+l.bufferView+":"+l.indices+":"+Gg(l.attributes):u.indices+":"+Gg(u.attributes)+":"+u.mode),l=n[u];l?i.push(l.promise):(l=void 0,l=s.extensions&&s.extensions[pg.KHR_DRACO_MESH_COMPRESSION]?function(e){return r[pg.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then((function(r){return qg(r,e,t)}))}(s):qg(new p.BufferGeometry,s,t),n[u]={primitive:s,promise:l},i.push(l))}return Promise.all(i)}},{key:"loadMesh",value:function(e){for(var t=this,r=this.json,n=this.extensions,i=r.meshes[e],o=i.primitives,a=[],s=0,u=o.length;s<u;s++){var l=void 0===o[s].material?(void 0===(l=this.cache).DefaultMaterial&&(l.DefaultMaterial=new p.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:p.FrontSide})),l.DefaultMaterial):this.getDependency("material",o[s].material);l.then((function(e){})),a.push(l)}return a.push(t.loadGeometries(o)),Promise.all(a).then((function(r){for(var a=r.slice(0,r.length-1),s=r[r.length-1],u=[],l=0,c=s.length;l<c;l++){var h=s[l],f=o[l],d=void 0,m=a[l];if(4===f.mode||5===f.mode||6===f.mode||void 0===f.mode)!0!==(d=new(!0===i.isSkinnedMesh?p.SkinnedMesh:p.Mesh)(h,m)).isSkinnedMesh||d.geometry.attributes.skinWeight.normalized||d.normalizeSkinWeights(),5===f.mode?d.geometry=Yg(d.geometry,p.TriangleStripDrawMode):6===f.mode&&(d.geometry=Yg(d.geometry,p.TriangleFanDrawMode));else if(1===f.mode)d=new p.LineSegments(h,m);else if(3===f.mode)d=new p.Line(h,m);else if(2===f.mode)d=new p.LineLoop(h,m);else{if(0!==f.mode)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+f.mode);d=new p.Points(h,m)}if(0<Object.keys(d.geometry.morphAttributes).length){S=x=w=b=g=y=void 0;var y=d,v=i;if(y.updateMorphTargets(),void 0!==v.weights)for(var g=0,b=v.weights.length;g<b;g++)y.morphTargetInfluences[g]=v.weights[g];if(v.extras&&Array.isArray(v.extras.targetNames)){var w=v.extras.targetNames;if(y.morphTargetInfluences.length===w.length){y.morphTargetDictionary={};for(var x=0,S=w.length;x<S;x++)y.morphTargetDictionary[w[x]]=x}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}d.name=t.createUniqueName(i.name||"mesh_"+e),Hg(d,i),f.extensions&&Vg(n,d,f),t.assignFinalMaterial(d),u.push(d)}for(var _=0,T=u.length;_<T;_++)t.associations.set(u[_],{meshes:e,primitives:_});if(1===u.length)return u[0];var E=new p.Group;t.associations.set(E,{meshes:e});for(var O=0,M=u.length;O<M;O++)E.add(u[O]);return E}))}},{key:"loadCamera",value:function(e){var t,r=(e=this.json.cameras[e])[e.type];if(r)return"perspective"===e.type?t=new p.PerspectiveCamera(p.MathUtils.radToDeg(r.yfov),r.aspectRatio||1,r.znear||1,r.zfar||2e6):"orthographic"===e.type&&(t=new p.OrthographicCamera(-r.xmag,r.xmag,r.ymag,-r.ymag,r.znear,r.zfar)),e.name&&(t.name=this.createUniqueName(e.name)),Hg(t,e),Promise.resolve(t);console.warn("THREE.GLTFLoader: Missing camera parameters.")}},{key:"loadSkin",value:function(e){var t={joints:(e=this.json.skins[e]).joints};return void 0===e.inverseBindMatrices?Promise.resolve(t):this.getDependency("accessor",e.inverseBindMatrices).then((function(e){return t.inverseBindMatrices=e,t}))}},{key:"loadAnimation",value:function(e){for(var t=this.json.animations[e],r=[],n=[],i=[],o=[],a=[],s=0,u=t.channels.length;s<u;s++){var l=t.channels[s],c=t.samplers[l.sampler],h=void 0!==(l=l.target).node?l.node:l.id,f=void 0!==t.parameters?t.parameters[c.input]:c.input,d=void 0!==t.parameters?t.parameters[c.output]:c.output;r.push(this.getDependency("node",h)),n.push(this.getDependency("accessor",f)),i.push(this.getDependency("accessor",d)),o.push(c),a.push(l)}return Promise.all([Promise.all(r),Promise.all(n),Promise.all(i),Promise.all(o),Promise.all(a)]).then((function(r){for(var n=r[0],i=r[1],o=r[2],a=r[3],s=r[4],u=[],l=0,c=n.length;l<c;l++)!function(e){var t=n[e],r=i[e],l=o[e],c=a[e],h=s[e];if(void 0!==t){t.updateMatrix(),t.matrixAutoUpdate=!0;var f=void 0;switch(Ng[h.path]){case Ng.weights:f=p.NumberKeyframeTrack;break;case Ng.rotation:f=p.QuaternionKeyframeTrack;break;default:f=p.VectorKeyframeTrack}e=t.name||t.uuid;var d=void 0!==c.interpolation?Fg[c.interpolation]:p.InterpolateLinear,m=[],y=(Ng[h.path]===Ng.weights?t.traverse((function(e){e.morphTargetInfluences&&m.push(e.name||e.uuid)})):m.push(e),l.array);if(l.normalized){for(var v=Wg(y.constructor),g=new Float32Array(y.length),b=0,w=y.length;b<w;b++)g[b]=y[b]*v;y=g}for(var x=0,S=m.length;x<S;x++){var _=new f(m[x]+"."+Ng[h.path],r.array,y,d);"CUBICSPLINE"===c.interpolation&&(_.createInterpolant=function(e){return new(this instanceof p.QuaternionKeyframeTrack?Dg:Ag)(this.times,this.values,this.getValueSize()/3,e)},_.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0),u.push(_)}}}(l);return r=t.name||"animation_"+e,new p.AnimationClip(r,void 0,u)}))}},{key:"createNodeMesh",value:function(e){var t=this.json,r=this,n=t.nodes[e];return void 0===n.mesh?null:r.getDependency("mesh",n.mesh).then((function(e){return e=r._getNodeRef(r.meshCache,n.mesh,e),void 0!==n.weights&&e.traverse((function(e){if(e.isMesh)for(var t=0,r=n.weights.length;t<r;t++)e.morphTargetInfluences[t]=n.weights[t]})),e}))}},{key:"loadNode",value:function(e){var t,r=this.json,n=this.extensions,i=this,o=r.nodes[e],a=o.name?i.createUniqueName(o.name):"";return t=[],(r=i._invokeOne((function(t){return t.createNodeMesh&&t.createNodeMesh(e)})))&&t.push(r),void 0!==o.camera&&t.push(i.getDependency("camera",o.camera).then((function(e){return i._getNodeRef(i.cameraCache,o.camera,e)}))),i._invokeAll((function(t){return t.createNodeAttachment&&t.createNodeAttachment(e)})).forEach((function(e){t.push(e)})),Promise.all(t).then((function(t){var r,s=!0===o.isBone?new p.Bone:1<t.length?new p.Group:1===t.length?t[0]:new p.Object3D;if(s!==t[0])for(var u=0,l=t.length;u<l;u++)s.add(t[u]);return o.name&&(s.userData.name=o.name,s.name=a),Hg(s,o),o.extensions&&Vg(n,s,o),void 0!==o.matrix?((r=new p.Matrix4).fromArray(o.matrix),s.applyMatrix4(r)):(void 0!==o.translation&&s.position.fromArray(o.translation),void 0!==o.rotation&&s.quaternion.fromArray(o.rotation),void 0!==o.scale&&s.scale.fromArray(o.scale)),i.associations.has(s)||i.associations.set(s,{}),i.associations.get(s).nodes=e,i.options.myOptions.helper.processNode({node:s,nodeDef:o})||s}))}},{key:"loadScene",value:function(e){for(var t=this.json,r=this.extensions,n=(e=this.json.scenes[e],this),i=new p.Group,o=(i.isLoadScene=!0,e.name&&(i.name=n.createUniqueName(e.name)),Hg(i,e),e.extensions&&Vg(r,i,e),e.nodes||[]),a=[],s=0,u=o.length;s<u;s++)a.push(function e(t,r,n,i){var o=n.nodes[t];return i.getDependency("node",t).then((function(e){return void 0===o.skin?e:i.getDependency("skin",o.skin).then((function(e){for(var r=[],n=0,o=(t=e).joints.length;n<o;n++)r.push(i.getDependency("node",t.joints[n]));return Promise.all(r)})).then((function(r){return e.traverse((function(e){if(e.isMesh){for(var n=[],i=[],o=0,a=r.length;o<a;o++){var s=r[o];s?(n.push(s),s=new p.Matrix4,void 0!==t.inverseBindMatrices&&s.fromArray(t.inverseBindMatrices.array,16*o),i.push(s)):console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[o])}e.bind(new p.Skeleton(n,i),e.matrixWorld)}})),e}));var t})).then((function(t){r.isLoadScene&&null!=(a=n.asset.ex)&&a.type,r.add(t);var a,s=[];if(o.children)for(var u=o.children,l=0,c=u.length;l<c;l++){var h=u[l];s.push(e(h,t,n,i))}return Promise.all(s)}))}(o[s],i,t,n));return Promise.all(a).then((function(){return n.options.myOptions&&n.options.myOptions.models.push(i),n.associations=function(e){var t,r=new Map,i=Jv(n.associations);try{for(i.s();!(t=i.n()).done;){var o=Kv(t.value,2),a=o[0],s=o[1];(a instanceof p.Material||a instanceof p.Texture)&&r.set(a,s)}}catch(e){i.e(e)}finally{i.f()}return e.traverse((function(e){var t=n.associations.get(e);null!=t&&r.set(e,t)})),r}(i),i}))}}]),e}();function qg(e,t,r){var n,i=t.attributes,o=[];for(n in i){var a=Ug[n]||n.toLowerCase();a in e.attributes||o.push(function(t,n){return r.getDependency("accessor",t).then((function(t){e.setAttribute(n,t)}))}(i[n],a))}void 0===t.indices||e.index||(s=r.getDependency("accessor",t.indices).then((function(t){e.setIndex(t)})),o.push(s)),Hg(e,t);var s=e,u=t,l=r,c=u.attributes,h=new p.Box3;if(void 0!==c.POSITION){var f=(c=l.json.accessors[c.POSITION]).min,d=c.max;if(void 0===f||void 0===d)console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");else{h.set(new p.Vector3(f[0],f[1],f[2]),new p.Vector3(d[0],d[1],d[2])),c.normalized&&(f=Wg(Lg[c.componentType]),h.min.multiplyScalar(f),h.max.multiplyScalar(f));var m=u.targets;if(void 0!==m){for(var y=new p.Vector3,v=new p.Vector3,g=0,b=m.length;g<b;g++){var w,x,S=m[g];void 0!==S.POSITION&&(x=(S=l.json.accessors[S.POSITION]).min,w=S.max,void 0!==x&&void 0!==w?(v.setX(Math.max(Math.abs(x[0]),Math.abs(w[0]))),v.setY(Math.max(Math.abs(x[1]),Math.abs(w[1]))),v.setZ(Math.max(Math.abs(x[2]),Math.abs(w[2]))),S.normalized&&(x=Wg(Lg[S.componentType]),v.multiplyScalar(x)),y.max(v)):console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION."))}h.expandByVector(y)}s.boundingBox=h,d=new p.Sphere,h.getCenter(d.center),d.radius=h.min.distanceTo(h.max)/2,s.boundingSphere=d}}return Promise.all(o).then((function(){if(void 0===t.targets)return e;for(var n=e,i=t.targets,o=r,a=!1,s=!1,u=!1,l=0,c=i.length;l<c;l++){var h=i[l];if(void 0!==h.POSITION&&(a=!0),void 0!==h.NORMAL&&(s=!0),void 0!==h.COLOR_0&&(u=!0),a&&s&&u)break}if(!a&&!s&&!u)return Promise.resolve(n);for(var f=[],p=[],d=[],m=0,y=i.length;m<y;m++){var v,g=i[m];a&&(v=void 0!==g.POSITION?o.getDependency("accessor",g.POSITION):n.attributes.position,f.push(v)),s&&(v=void 0!==g.NORMAL?o.getDependency("accessor",g.NORMAL):n.attributes.normal,p.push(v)),u&&(g=void 0!==g.COLOR_0?o.getDependency("accessor",g.COLOR_0):n.attributes.color,d.push(g))}return Promise.all([Promise.all(f),Promise.all(p),Promise.all(d)]).then((function(e){var t=e[0],r=e[1];return e=e[2],a&&(n.morphAttributes.position=t),s&&(n.morphAttributes.normal=r),u&&(n.morphAttributes.color=e),n.morphTargetsRelative=!0,n}))}))}function Yg(e,t){var r=e.getIndex();if(null===r){var n=[],i=e.getAttribute("position");if(void 0===i)return console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(var o=0;o<i.count;o++)n.push(o);e.setIndex(n),r=e.getIndex()}var a=r.count-2,s=[];if(t===p.TriangleFanDrawMode)for(var u=1;u<=a;u++)s.push(r.getX(0)),s.push(r.getX(u)),s.push(r.getX(u+1));else for(var l=0;l<a;l++)l%2==0?(s.push(r.getX(l)),s.push(r.getX(l+1)),s.push(r.getX(l+2))):(s.push(r.getX(l+2)),s.push(r.getX(l+1)),s.push(r.getX(l)));return s.length/3!=a&&console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Unable to generate correct amount of triangles."),(t=e.clone()).setIndex(s),t}class Zg{constructor(e,t){this.materialMap={},this.textureMap={},this.materialIns={},this.textureIns={},this.pending=[],this.parser=null,this.processTextureMap=(()=>{const e=e=>{const{target:t,data:r}=e;var n;r&&(({x:e,y:n}="object"==typeof r?r:{x:r,y:r}),t.x=e,t.y=n)};return t=>{(0,et.js)(t,((t,r)=>{var{format:r,center:n,rotation:i,offset:o,repeat:a}=r;const s=this.textureIns[t];s&&(s.format=r,e({target:s.repeat,data:a}),e({target:s.center,data:n}),e({target:s.offset,data:o}),i&&(s.rotation=i),this.runScene.textureEx.initTextureAndAddtoAll(s))}))}})(),this.processMaterialMap=(()=>{const e=e=>{const{textures:t,normal:r,models:n,material:i}=e;this.runScene.optionsEx.options.texture.load&&this.processBaseMaterialTextures({material:i,textures:t}),this.runScene.materialEx.parseNromals(r,i),n.map((e=>e.material=i))},t=e=>{const{textures:t,normal:r,models:n,material:i}=e;e=(0,et.js)(t,((e,t)=>({type:e,texture:this.textureIns[t]})));const o=this.runScene.materialEx.getDataByType(r.type,{normal:r,textures:e,models:n,material:i});this.runScene.materialEx.parseNromals(r,o),o&&n.map((e=>e.material=o))};return r=>{(0,et.js)(r,((r,n)=>{const{material:i,models:o}=this.materialIns[r];i&&(({normal:r,textures:n}=n),(r.type?t:e)({textures:n,models:o,material:i,normal:r}),i.needsUpdate=!0)}))}})(),this.baseMaterialTextures=[],this.processBaseMaterialTextures=e=>{const{textures:t,material:r}=e;(0,et.js)(t,((e,t)=>{var n;(t=this.textureIns[t])&&(this.runScene.optionsEx.options.texture.lazyLoad.open&&"scene"===(null==(n=this.parser)?void 0:n.json.asset.ex.type)&&(null==(n=this.parser)?void 0:n.json.asset.ex.sceneEx.materialId)!==r.userData.id?this.baseMaterialTextures.push({material:r,type:e,texture:t}):(this.runScene.uniqueEx.texture.addMaterial(t,{material:r,type:e}),as({material:r,type:e,texture:t})))}))},this.lazyLoad=(()=>{const e=()=>{this.loadConfig.triggerCb&&this.runScene.optionsEx.cb.load.lazyLoadedTexture.cb(""),this.runScene.optionsEx.log("贴图懒加载完毕","base","success")},t=(r,n)=>{var i=this.baseMaterialTextures[r];if(!i)return n(),e();const{texture:o,type:a,material:s}=i;this.runScene.uniqueEx.texture.addMaterial(o,{material:s,type:a}),as({material:s,type:a,texture:o}),s.needsUpdate=!0,setTimeout((()=>t(++r,n)),this.runScene.optionsEx.options.texture.lazyLoad.intervalTime)};return()=>new Promise((r=>{if(!this.runScene.optionsEx.options.texture.lazyLoad.open)return r(0),e();t(0,r)}))})(),this.runScene=e}processInput(e,t){return function(e,t,r,n){return new(r=r||Promise)((function(t,i){function o(e){try{s(n.next(e))}catch(e){i(e)}}function a(e){try{s(n.throw(e))}catch(e){i(e)}}function s(e){var n;e.done?t(e.value):((n=e.value)instanceof r?n:new r((function(e){e(n)}))).then(o,a)}s((n=n.apply(e,[])).next())}))}(this,0,void 0,(function*(){this.parser=t}))}processTexture(e){const{textureDef:t,texture:r}=e;var{md5:e,format:n,size:i}=t;r.userData.md5=e,n&&(r.format=n,r.userData.format=n),r.userData.size=i,this.textureIns[t.id]=this.runScene.textureEx.getSameTexture(e,r)||r}process(e){var{materialDef:e,material:t,model:r}=e;ss(t),this.materialIns[e.id]||(this.materialIns[e.id]={material:t,models:[]}),this.materialIns[e.id].models.push(r)}done(e){var{materialMap:e,textureMap:t}=e.asset.ex||{};return this.processTextureMap(t||{}),this.processMaterialMap(e||{}),this.pending.push(this.lazyLoad()),Promise.all(this.pending)}}class Qg{constructor(e,t){this.runScene=e}done(e){var t,r,n,i;e.asset.ex&&(({camera:e,lights:t,sceneEx:r,options:n,controls:i}=e.asset.ex),this.camera(e),this.controls(i),this.lights(t),this.ex(r),this.options(n))}controls(e){var t,r;e&&(({x:e,y:t,z:r}=e),this.runScene.assetsEx.controls.target.set(e,t,r),this.runScene.assetsEx.controls.update())}camera(e){var{position:e,far:t,near:r,fov:n,name:i,userData:o}=this.runScene.loaderer.object.parse(e);const a=this.runScene.assetsEx.get().camera;a.position.copy(e),a.far=t,a.near=r,a.fov=n,a.name=i,a.updateProjectionMatrix(),a.userData.id=o.id,this.runScene.uniqueEx.model.add(a),this.runScene.assetsEx.get().controls.update()}lights(e){e.map((e=>{var t=e.type;(t=this.runScene.lightEx.lightExMap[t].parseJSON(e)).target&&this.runScene.modelEx.setSelectByModel(t.target),this.runScene.lightEx.setNull(t)}))}ex(e){var t,r;e=e.fog;const n=this.runScene.sceneEx.get();e&&(({color:e,near:t,far:r}=e),n.fog=new p.Fog(e,t,r),this.runScene.optionsEx.cb.setScene.cb({scene:n,type:"fog"}))}options(e){e.map((e=>{var{type:e,data:t}=e;const r=this.runScene.exporter.gltf.options.getParse(e);null!=r&&r.parse(t)}))}}class Kg{constructor(e,t){this.runScene=e}setTextureLoader(e){this.textureLoader=e,this.initTextureLoader(e)}initTextureLoader(e){e instanceof Qv&&e.setOptions({textureQuality:this.runScene.optionsEx.options.texture.quality})}}class Jg{constructor(e,t){this.helperModels=[],this.pending=[],this.nodeType={MySpriteMaterial:us},this.cloneMap={},this.runScene=e,this.material=new Zg(e,t),this.scene=new Qg(e,t),this.options=new Kg(e,t)}processInput(e,t){return function(e,t,r,n){return new(r=r||Promise)((function(t,i){function o(e){try{s(n.next(e))}catch(e){i(e)}}function a(e){try{s(n.throw(e))}catch(e){i(e)}}function s(e){var n;e.done?t(e.value):((n=e.value)instanceof r?n:new r((function(e){e(n)}))).then(o,a)}s((n=n.apply(e,[])).next())}))}(this,0,void 0,(function*(){this.material.processInput(e,t)}))}beforeLoader(e){this.runScene.loaderer.gltf.beforeParse(null==(e=null==(e=e.asset)?void 0:e.ex)?void 0:e.type)}processNode(e){var t;let{node:r,nodeDef:n}=e;if((0,et.js)(this.runScene.modelEx.defNodeMap,((e,t)=>{var i=n[e];null!=i&&(r[e]=i)})),n.extras){const{layers:o,normal:a,local:s,cloneId:u,id:l,animations:c}=n.extras;if(c&&this.runScene.anima.parse(r,c),u&&(this.cloneMap[u]||(this.cloneMap[u]=new Set),l&&this.cloneMap[u].add(l)),s&&([e,t,i]=s.split(","),r.position.set(e,t,i)),o&&(r.layers.enable(1),this.runScene.optionsEx.cb.model.setLayers.cb({model:r,val:1})),n.extras.isHelper&&this.helperModels.push(r),a){const n=this.nodeType[null==a?void 0:a.type].modelTools.parseData(r,a);var i=null==(t=null==(e=null==r?void 0:r.material)?void 0:e.userData)?void 0:t.id;if(i){const e=this.material.materialIns[i];if(e){const t=[];e.models.map((e=>{e===r?t.push(n):t.push(e)})),e.models=t}}r=n}}return n.wireframe&&(r.material.wireframe=!0),r}done(e){var t;return this.pending.push(this.material.done(e)),"scene"===(null==(t=e.asset.ex)?void 0:t.type)&&(this.scene.done(e),this.sceneEx(e)),this.removeHelperModel(),Promise.all(this.pending)}mergeGeometry(){}mergeClone(){this.runScene.optionsEx.options.instanceClone&&(0,et.js)(this.cloneMap,((e,t)=>{const r=this.runScene.uniqueEx.model.get(e);(e=[...t].map((e=>{if((null==(e=this.runScene.uniqueEx.model.get(e))?void 0:e.material)===r.material)return this.runScene.modelEx.remove(e,!1),e})).filter((e=>e))).length&&(t=vs(r,e),this.runScene.modelEx.add(t,r.parent),this.runScene.modelEx.remove(r,!1))}))}sceneEx(e){const t=this.runScene.sceneEx.get();var r=this.material.materialIns,{materialId:e,backgroundMapping:n,backgroundColor:i,fog:o}=e.asset.ex.sceneEx;if(e&&(e=null==(r=r[e])?void 0:r.material)){const{map:r,envMap:i}=e;r&&(r.mapping=n||300,r.needsUpdate=!0,this.runScene.sceneEx.setBackground(r,!1),r.userData.isBackgroud=!0),i&&(t.environment=Ni(i))}i&&(t.background=new p.Color("#"+i)),o&&(({color:r,far:e,near:n}=o),t.fog=new p.Fog("#"+r,n,e),t.fog.open="true"),this.runScene.optionsEx.cb.setScene.cb({scene:t,type:"any"})}removeHelperModel(){this.helperModels.map((e=>{var t;return null==(t=e.parent)?void 0:t.remove(e)}))}}class $g{constructor(e){this.dracoPath="./draco/",this._gltf=new hg,this.runScene=e;const t=new Vv;t.setDecoderPath(this.runScene.optionsEx.options.decodePath),this._gltf.setDRACOLoader(t)}load(e,t){return function(e,t,r,n){return new(r=r||Promise)((function(t,i){function o(e){try{s(n.next(e))}catch(e){i(e)}}function a(e){try{s(n.throw(e))}catch(e){i(e)}}function s(e){var n;e.done?t(e.value):((n=e.value)instanceof r?n:new r((function(e){e(n)}))).then(o,a)}s((n=n.apply(e,[])).next())}))}(this,0,void 0,(function*(){var r=yield oa(e);return r?this.parse(r,t):Promise.resolve()}))}parse(e,t){const r=aa({addToScene:!0,cleanJSON:!0,triggerCb:!1},t||{});return new Promise((t=>{try{e instanceof ArrayBuffer&&this._gltf.parse(e,"",(e=>{e=this.afterParse(e.parser.options.myOptions,e,r),t(e)}),(e=>{console.log(e,"_a")}),{rootModel:this.runScene.assetsEx.get().scene,models:[],helper:new Jg(this.runScene,r),runScene:this.runScene})}catch(e){throw this.runScene.optionsEx.log("加载场景出错:"+e),TypeError(e)}}))}beforeParse(e){"scene"===e&&this.runScene.optionsEx.sceneOptions.loaded&&this.runScene.sceneEx.clean()}afterParse(e,t,r){var n;const i=e.helper.done(t),{addToScene:o,cleanJSON:a,triggerCb:s}=r;var u=e.models;let l=[];return"material"===(null==(n=t.asset.ex)?void 0:n.type)?this.parseMaterial(u):(l="model"===(null==(n=t.asset.ex)?void 0:n.type)?this.parseModel(u[0],o):this.parseScene({model:u[0],json:t,config:r}),this.runScene.modelEx.selectNull(),e.helper.mergeClone(),this.runScene.optionsEx.log(t,"detail"),i.then((()=>{s&&this.runScene.optionsEx.cb.load.complete.cb("")}))),!1!==a&&this.disposeJSON(t),this.runScene.optionsEx.sceneOptions.loaded=!0,l}parseMaterial(e){var t,[e]=e;(e=this.runScene.sceneEx.cleanUnlessLevel(e).material)&&(this.runScene.materialEx.add(e),(t=this.runScene.modelEx.select)&&this.runScene.materialEx.resetMaterial(t,e))}parseModel(e,t){return e="glb_model"===e.name&&(null==e?void 0:e.children[0])||e,t&&this.runScene.modelEx.add(e,void 0,{addUndo:!1,select:!1,isClone:!0}),[e]}parseScene(e){const{model:t,json:r,config:n}=e;var{addToScene:e,triggerCb:i}=n,o=t.children.filter((e=>this.runScene.modelEx.isUnless(e)?void 0:e));return!1!==e&&this.runScene.modelEx.add(o,void 0,{addUndo:!1,select:!1}),this.runScene.timeLineEx.parseSavedGroupMap((null==(e=r.asset.ex)?void 0:e.timeLine)||{}),i&&this.runScene.optionsEx.cb.load.loaded.cb(""),o}disposeJSON(e){(0,et.js)(e,(t=>delete e[t])),e=null}}class eb{constructor(e){this.imgBitMap=new p.ImageBitmapLoader,this.object=new p.ObjectLoader,this.runScene=e,this.gltf=new $g(e)}}const tb=new class{constructor(){this.load=new p.AnimationLoader}parse(e){return this.load.parse(e)}};var rb=a(3185);class nb{constructor(e){this.selectors={},this.boxHelperMap={},(this.runScene=e).events.mouse.bindEvent({type:"up",local:"local",name:"MultipSelector",fn:t=>{e.events.key.ctrl||this.setEmpty()}})}add(e,t=!1){if("array"===(0,rb.getType)(e))return e.map((e=>this.add(e)));var r=this.runScene.modelEx.select;if(r&&(this.runScene.modelEx.selectNull(),delete this.selectors[e.uuid],this.add(r)),"BoxHelper"!==e.type){if(this.selectors[e.uuid]){if(this.remove(e),this.removeBoxHelper(e),!t)return;this.add(e)}this.addBoxHelper(e),this.selectors[e.uuid]=e,this.runScene.optionsEx.cb.model.focus.cb({model:e,status:!0,domActive:!0}),this.runScene.helperEx.focus(e)}}setInfo(e,t,r,n,i,o){"position"!==t&&(i=n,o=r);const a=this.getSelectedList("value");var{x:i,y:s,z:u}=i;const l=i-o.x,c=s-o.y,h=u-o.z,f=[new ps({target:e,info:t,oldV3:this.runScene.modelEx.cloneV3(r),newV3:n,runScene:this.runScene}).execute()];a.map((r=>{if(r!==e){var{x:n,y:i,z:o}=r[t],n=n+=l,i=i+=c,o=o+=h;let e=r[t].clone();e.x=n,e.y=i,e.z=o,n=new ps({target:r,info:t,oldV3:this.runScene.modelEx.cloneV3(r[t]),newV3:e,runScene:this.runScene}).execute(),f.push(n),this.boxHelperMap[r.uuid].setFromObject(r)}})),this.runScene.undoEx.addUndo(f)}getLast(){var e=this.getSelectedList("value");return e[e.length-1]}addBoxHelper(e){var t=this.runScene.helperEx.getBoxHelper(e);this.boxHelperMap[e.uuid]=t}removeBoxHelper(e){this.runScene.assetsEx.get().scene.remove(this.boxHelperMap[e.uuid]),this.boxHelperMap[e.uuid]=null,delete this.selectors[e.uuid]}remove(e){if(e instanceof Array)return e.map((e=>this.remove(e)));this.runScene.optionsEx.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(){var e=Object.values(this.boxHelperMap);this.runScene.assetsEx.get().scene.remove(...e),this.boxHelperMap={}}setEmpty(){this.getSelectedList("value").map((e=>{this.runScene.optionsEx.cb.model.unFocus.cb(e)})),this.setBoxHelperEmpty(),this.selectors={}}createGroup(){this.runScene.helperEx.unfocus(),this.runScene.modelEx.selectNull();var e=new p.Group;const t=new p.Group;this.runScene.modelEx.add(e,void 0,{addUndo:!1}),this.runScene.modelEx.add(t);var r=[...this.getSelectedList("value")],n=(this.runScene.optionsEx.cb.model.multipDrop.cb(this.getSelectedList("value"),e),Da().group.getCenter(e));t.position.copy(n),this.runScene.optionsEx.cb.model.multipDrop.cb(r,t),this.runScene.modelEx.remove(e,!1),this.runScene.modelEx.select=t}getSelectorGroup(){const e=this.getSelectedList("value"),t=new p.Group;return e.forEach((e=>t.add(e.clone()))),this.setEmpty(),t}}function ib(){var e=0,t=document.createElement("div");function r(e){return t.appendChild(e.dom),e}function n(r){for(var n=0;n<t.children.length;n++)t.children[n].style.display=n===r?"block":"none";e=r}t.style.cssText="position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000",t.addEventListener("click",(function(r){r.preventDefault(),n(++e%t.children.length)}),!1);var i,o=(performance||Date).now(),a=o,s=0,u=r(new ib.Panel("FPS","#0ff","#002")),l=r(new ib.Panel("MS","#0f0","#020"));return self.performance&&self.performance.memory&&(i=r(new ib.Panel("MB","#f08","#201"))),n(0),{REVISION:16,dom:t,addPanel:r,showPanel:n,begin:function(){o=(performance||Date).now()},end:function(){s++;var e,t=(performance||Date).now();return l.update(t-o,200),a+1e3<=t&&(u.update(1e3*s/(t-a),100),a=t,s=0,i&&(e=performance.memory,i.update(e.usedJSHeapSize/1048576,e.jsHeapSizeLimit/1048576))),t},update:function(){o=this.end()},domElement:t,setMode:n}}ib.Panel=function(e,t,r){var n=1/0,i=0,o=Math.round,a=o(window.devicePixelRatio||1),s=80*a,u=48*a,l=3*a,c=2*a,h=3*a,f=15*a,p=74*a,d=30*a,m=document.createElement("canvas"),y=(m.width=s,m.height=u,m.style.cssText="width:80px;height:48px",m.getContext("2d"));return y.font="bold "+9*a+"px Helvetica,Arial,sans-serif",y.textBaseline="top",y.fillStyle=r,y.fillRect(0,0,s,u),y.fillStyle=t,y.fillText(e,l,c),y.fillRect(h,f,p,d),y.fillStyle=r,y.globalAlpha=.9,y.fillRect(h,f,p,d),{dom:m,update:function(u,v){n=Math.min(n,u),i=Math.max(i,u),y.fillStyle=r,y.globalAlpha=1,y.fillRect(0,0,s,f),y.fillStyle=t,y.fillText(o(u)+" "+e+" ("+o(n)+"-"+o(i)+")",l,c),y.drawImage(m,h+a,f,p-a,d,h,f,p-a,d),y.fillRect(h+p-a,f,a,d),y.fillStyle=r,y.globalAlpha=.9,y.fillRect(h+p-a,f,a,o((1-u/v)*d))}}};const ob=ib;class ab{constructor(e){this.options={msg:{show:!1,level:"base"},run:!0,decodePath:"./draco/",showFps:!1,loadInterval:2e3,mode:"running",hideLocal:!1,instanceClone:!1,render2:!1,render3:!1,texture:{load:!0,lazyLoad:{open:!1,intervalTime:16.6},quality:1}},this.exporterOptions={compressTexture:!1,notMaterial:!1},this.sceneOptions={loaded:!1},this.setLoadInterval=(()=>{let e=null;return t=>{const{inputInterval:r,cb:n}=t;e&&clearTimeout(e),e=setTimeout((()=>{n(),e=null,clearTimeout(e)}),r)}})(),this.runScene=e,this.cb=e.cb}init(e){this.options=Oa(this.options,e||{}),this.options.showFps&&(this.addFps(),this.cb.render.add("optionx-ex-render",this.render.bind(this)))}addFps(){this.stats=ob(),this.stats.showPanel(0),this.runScene.assetsEx.engineDom.appendChild(this.stats.dom)}render(){var e;null!=(e=this.stats)&&e.update()}log(e,t="detail",r="success"){var n;null!=(n=null==(n=this.options)?void 0:n.msg)&&n.show&&("base"===this.options.msg.level&&"base"===t&&this.cb.baseLog.cb(e,r),console.log(e))}}class sb{constructor(e,t){this.showTransform=!1,this.data=new Proxy({},{set:(e,t,r)=>(e[t]=r,!0)}),this.uuid="",this.getAnimaByModelData=(()=>{const e=(e,t,r,n)=>{const i={},o={};if(e=sb.isNotNow(e)?this.getAllData():e,(0,et.js)(n,((r,n)=>{void 0!==e[r]&&("number"===(n=n.type)?(i[r]=t[r],o[r]=e[r]):"color"===n&&(0,et.js)(e[r],((e,n)=>{var a=r+e;i[a]=t[r][e],o[a]=n})))})),!(0,et.CV)(i))return{begin:i,end:o}};return(t,r,n,i=!1,o)=>{let a=i?n.time:0;const s=Object.keys(t).sort(((e,t)=>i?Number(t)-Number(e):Number(e)-Number(t)));var u=(0,La.lastArrayEle)(s),l=i?"0.00":String(n.time);return u!==l&&(t[l]=Object.assign({},u),s.push(l)),s.map((s=>{var u=t[String(s)],l=.001*((l=i?a-s:s-a)<=0?.001:l)*n.speed;a=s;{var c=r,h=u,f=l,p=o;const t={color(e){const{animaData:t,defType:r}=e,n={};(0,et.js)(t,(e=>{var i;-1!==e.indexOf(r)&&(i=e.substring(r.length),["r","g","b"].includes(i)&&(n[i]=t[e]))}));var{r:e,g:i,b:o}=n;if((0,rb.isTrue)(e)&&(0,rb.isTrue)(i)&&(0,rb.isTrue)(o))return n}};return()=>{let r;return{promise:new Promise((n=>{var i;if(!(i=e(h,c,0,p)))return n(0);var{begin:i,end:o}=i;return r=jo(i,o,f,(e=>{(0,et.js)(p,((r,n)=>{n=n.type;var i,o=e[r];"number"===n?c[r]=o:"color"===n&&(o=t.color({animaData:e,defType:r}))&&(({r:n,g:o,b:i}=o),c[r].setRGB(n,o,i))}))}),n)})),anima:r}}}}))}})(),this.runScene=t,this.target=e,this.target.userData.isTimeLineUsed=!0,this.uuid=this.getId(e)}toJSON(){var{data:e,type:t}=this;return{data:e,type:t}}addData(e,t,r=!1){return 1e3<Number(e)&&(e="1000.00"),r?this.data[e]=this.getAllData():(this.data[e]||(this.data[e]={}),this.data[e][t]=this.getData(t)),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,r=!1){const n={};return(0,et.js)(e,(i=>{n[i]=r?"notNow":sb.getValByType(t,i,e)})),n}static getValByType(e,t,r){var n,i;return r=r[t].type,e=e[t],"number"===r?e:"color"===r?(({r:t,g:n,b:i}=e),{r:t,g:n,b:i}):"V3"===r?Da().model.v3ToMap(e):""}static SetTargetByData(e){const{baseType:t,data:r,defType:n,target:i}=e;var o,a;"number"===t?i[n]=r:"color"===t&&(({r:e,g:o,b:a}=r),i[n].setRGB(e,o,a))}getAllData(e=!1){return sb.getAllDefValByType(this.defOptions,this.target,e)}getData(e){return sb.getValByType(this.target,e,this.defOptions)}static getTarget(e,t){}getAnima(e,t){return this.getAnimaByModelData(this.data,this.target,e,t,this.defOptions)}setTargetByBetween(e,t,r){sb.setTargetByBetween(e,t,r,this.defOptions,this.target)}clone(e){var{data:t,type:r}=this;const n=new(0,lb[r])(e);return n.data=t,n}reset(){(0,et.js)(this.defOptions,((e,t)=>{sb.SetTargetByData({baseType:t.type,data:sb.getValByType(this.beginData,e,this.defOptions),target:this.target,defType:e})}))}remove(){delete this.target.userData.isTimeLineUsed}}sb.setTargetByBetween=(()=>{const e=(e,t,r)=>e!==t?(t-e)*r+e:e;return(t,r,n,i,o)=>{(0,et.js)(i,((i,a)=>{var s,u,l,c,h,f;a=a.type,void 0!==t[i]&&void 0!==r[i]&&sb.SetTargetByData({baseType:a,data:(s=t[i],u=r[i],l=n,"number"===a?e(s,u,l):"color"===a?(({r:a,g:s,b:c}=s),({r:u,g:h,b:f}=u),{r:e(a,u,l),g:e(s,h,l),b:e(c,f,l)}):void 0),defType:i,target:o})}))}})();const ub=sb,lb={model:class extends ub{constructor(e,t){super(e,t),this.type="model",this.defOptions={position:{type:"V3"},scale:{type:"V3"},rotation:{type:"V3"}},this.setTargetByBetween=(()=>{const e=(e,t,r)=>{var{x:e,y:n,z:i}=e,{x:t,y:o,z:a}=t;return{x:e!==t?(t-e)*r+e:e,y:n!==o?(o-n)*r+n:n,z:i!==a?(a-i)*r+i:i}};return(t,r,n)=>{var i,{position:t,scale:o,rotation:a}=t,{position:r,scale:s,rotation:u}=r;t&&r&&(({x:t,y:r,z:i}=e(t,r,n)),this.target.position.set(t,r,i)),o&&s&&(({x:t,y:r,z:i}=e(o,s,n)),this.target.scale.set(t,r,i)),a&&u&&(({x:o,y:s,z:t}=e(a,u,n)),this.target.rotation.set(o,s,t))}})(),this.getAnimaByModelData=(()=>{const e=(e,t,r)=>{var{position:t,scale:n,rotation:i}=t,{position:e,scale:o,rotation:a}=ub.isNotNow(e)?this.getAllData():e;return{begin:Object.assign({},e?{px:t.x,py:t.y,pz:t.z}:{},o?{sx:n.x,sy:n.y,sz:n.z}:{},a?{rx:i.x,ry:i.y,rz:i.z}:{}),end:Object.assign({},r.curve?{ease:"none"}:{},e?{px:e.x,py:e.y,pz:e.z}:{},o?{sx:o.x,sy:o.y,sz:o.z}:{},a?{rx:a.x,ry:a.y,rz:a.z}:{})}};return(t,r,n,i=!1)=>{let o=i?n.time:0;const a=Object.keys(t).sort(((e,t)=>i?Number(t)-Number(e):Number(e)-Number(t)));var s=(0,La.lastArrayEle)(a),u=i?"0.00":String(n.time)+".00";return s!==u&&(t[u]={position:"notNow",rotation:"notNow",scale:"notNow"},a.push(u)),a.map((a=>{var s,u,l,c,h=t[String(a)],f=.001*((f=i?o-a:a-o)<=0?.001:f)*n.speed;return o=a,s=r,u=h,l=f,c=n,()=>{let t;return{promise:new Promise((r=>{var{begin:n,end:i}=e(u,s,c);return t=jo(n,i,l,(e=>{var{px:e,py:t,pz:r,sx:n,sy:i,sz:o,rx:a,ry:l,rz:c}=e;u.position&&s.position.set(e,t,r),u.scale&&s.scale.set(n,i,o),u.rotation&&s.rotation.set(a,l,c)}),r)})),anima:t}}}))}})(),this.beginData=this.getAllData()}static getTarget(e,t){return t.uniqueEx.model.get(e)}isRemoved(){return!(this.target&&this.target.parent)}getAnima(e,t=!1){return this.getAnimaByModelData(this.data,this.target,e,t)}getId(){return this.runScene.uniqueEx.getId(this.target)}reset(){var{position:e,scale:t,rotation: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(r.x,r.y,r.z)}},camera:class extends ub{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,r)=>{var{x:e,y:n,z:i}=e,{x:t,y:o,z:a}=t;return{x:e!==t?(t-e)*r+e:e,y:n!==o?(o-n)*r+n:n,z:i!==a?(a-i)*r+i:i}};return(t,r,n)=>{var i,{position:t,scale:o,rotation:a,target:s}=t,{position:r,scale:u,rotation:l,target:c}=r;t&&r&&(({x:t,y:r,z:i}=e(t,r,n)),this.target.position.set(t,r,i)),o&&u&&(({x:t,y:r,z:i}=e(o,u,n)),this.target.scale.set(t,r,i)),a&&l&&(({x:o,y:u,z:t}=e(a,l,n)),this.target.rotation.set(o,u,t)),s&&c&&(({x:r,y:i,z:a}=e(s,c,n)),this.controls.target.set(r,i,a))}})(),this.getAnimaByModelData=(()=>{const e=(e,t,r)=>{var{position:t,scale:n,rotation:i}=t,{position:e,scale:o,rotation:a,target:s}=ub.isNotNow(e)?this.getAllData():e;return{begin:Object.assign({},e?{px:t.x,py:t.y,pz:t.z}:{},o?{sx:n.x,sy:n.y,sz:n.z}:{},a?{rx:i.x,ry:i.y,rz:i.z}:{},s?{tx:this.controls.target.x,ty:this.controls.target.y,tz:this.controls.target.z}:{}),end:Object.assign({},r.curve?{ease:"none"}:{},e?{px:e.x,py:e.y,pz:e.z}:{},o?{sx:o.x,sy:o.y,sz:o.z}:{},a?{rx:a.x,ry:a.y,rz:a.z}:{},s?{tx:s.x,ty:s.y,tz:s.z}:{})}},t=(t,r,n,i)=>()=>{let o;return{promise:new Promise((a=>{var{begin:s,end:u}=e(r,t,i);return o=jo(s,u,n,(e=>{var{px:e,py:n,pz:i,sx:o,sy:a,sz:s,rx:u,ry:l,rz:c,tx:h,ty:f,tz:p}=e;r.position&&t.position.set(e,n,i),r.scale&&t.scale.set(o,a,s),r.rotation&&t.rotation.set(u,l,c),r.target&&this.controls.target.set(h,f,p)}),a)})),anima:jo}};return(e,r,n,i=!1)=>{let o=i?n.time:0;const a=Object.keys(e).sort(((e,t)=>i?Number(t)-Number(e):Number(e)-Number(t)));var s=(0,La.lastArrayEle)(a),u=i?"0.00":String(n.time);return s!==u&&(e[u]=Object.assign({},s),a.push(u)),a.map((a=>{var s=e[String(a)],u=.001*((u=i?o-a:a-o)<=0?.001:u)*n.speed;return o=a,t(r,s,u,n)}))}})(),this.controls=this.runScene.assetsEx.get().controls,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:r,rotation:n}=this.target;return{position:e?"notNow":Da().model.v3ToMap(t),scale:e?"notNow":Da().model.v3ToMap(r),rotation:e?"notNow":Da().model.v3ToMap(n),target:e?"notNow":Da().model.v3ToMap(this.controls.target)}}getData(e){var{position:t,scale:r,rotation:n}=this.target;let i;if("position"===e)i=Da().model.v3ToMap(t);else if("scale"===e)i=Da().model.v3ToMap(r);else if("rotation"===e)i=Da().model.v3ToMap(n);else{if("target"!==e)throw TypeError("输入值不存在");i=Da().model.v3ToMap(this.controls.target)}return i}getAnima(e,t=!1){return this.getAnimaByModelData(this.data,this.target,e,t)}getId(){return this.runScene.uniqueEx.getId(this.target)}reset(){var{position:e,scale:t,rotation:r,target:n}=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(r.x,r.y,r.z),this.controls.target.set(n.x,n.y,n.z)}},material:class extends ub{constructor(e,t){super(e,t),this.type="material",this.defOptions={roughness:{type:"number"},metalness:{type:"number"},opacity:{type:"number"},emissive:{type:"color"},color:{type:"color"}},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)}}};class cb{constructor(e){this.map={},this.removes=[],this.unique=e}add(e,t,r){if(e&&e.userData){let n=e.userData.id;n||(n=(0,f.getId)(),e.userData.id=n),this.map[n]||(this.map[n]={material:e,models:new Set},this.unique.runScene.optionsEx.cb.unique.material.add.cb(e),t&&this.addModel(t,e,r))}}addModel(e,t,r){t&&t.userData&&(t=t.userData.id,null!=(t=this.map[t])&&t.models.add(e)),r&&null!=(t=this.map[r.userData.id])&&t.models.delete(e)}get(e){return null==(e=this.map[e])?void 0:e.material}remove(e){delete this.map[e]}addRemoved(e){this.map[e.uuid]&&this.removes.push(e.uuid)}dispose(){(0,et.js)(this.map,((e,t)=>{t.material.dispose()})),this.map={}}}var hb=a(6001);class fb extends class{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,f.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]}}{constructor(){super(...arguments),this.nameMap={},this.parseName=(()=>{const e=e=>{var t=e.lastIndexOf("_");return-1===t?-1:(e=e.slice(t+1),hb.type.isNumber(e)?Number.parseInt(e):-1)},t=(r,n)=>{var i=(t=>{if(-1===e(t))return t;var r=t.lastIndexOf("_");return-1===r?t:t.slice(0,r)})(r)+"_"+n++;return this.nameMap[i]?t(r,n):i},r=e=>Object.keys(this.nameMap).find((t=>this.nameMap[t]===e)),n=["PerspectiveCamera"];return i=>{if(n.includes(i.type))return i.name=i.type;let o=i.name;if(hb.valid.isTrue(o)||(o=i.type),!this.nameMap[o])return a=this.unique.getId(i),(s=r(a))&&delete this.nameMap[s],void(this.nameMap[o]=a);var a,s=this.nameMap[o];return this.unique.model.get(s)!==i?(a=e(o),a=t(o,s=-1===a?0:a),this.nameMap[a]=this.unique.getId(i),i.name=a):void 0}})()}add(e,t){var{reset:r,hasReset:n}=t||{};if(e instanceof Array)return e.map((e=>this.add(e,t)));if(e){let i=e.userData.id;if(i&&!r||(i=(0,f.getId)(),e.userData.id=i),this.map[i]){if(!n)return;i=(0,f.getId)(),e.userData.id=i}return this.map[i]=e,this.parseName(e),e.material&&this.unique.material.add(e.material,e),e.children.length?this.add(e.children,t):i}}get(e){return this.map[e]}getByName(e){return this.nameMap[e]}remove(e){if(e instanceof Array)return e.map((e=>this.remove(e)));e.traverse((e=>{delete this.nameMap[e.name]})),delete this.map[e.userData.id]}dispose(){this.map={},this.nameMap={}}}class pb{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,f.getId)(),e.userData.id=t),this.map[t]?void 0:(this.map[t]={texture:e,materialMap:{}},t)}getLength(){return Object.keys(this.map).length}addMaterial(e,t,r){var n=e.userData.id;this.map[n]||this.add(e),t&&(({material:e,type:t}=t),this.map[n].materialMap[e.userData.id]||(this.map[n].materialMap[e.userData.id]=new Set),this.map[n].materialMap[e.userData.id].add(t)),r&&(({material:e,type:t}=r),this.map[n].materialMap[e.userData.id]&&this.map[n].materialMap[e.userData.id].delete(t))}get(e){return null==(e=this.map[e])?void 0:e.texture}getMaterials(e){return null==(e=this.map[e])?void 0:e.materialMap}remove(e){if(e instanceof Array)return e.map((e=>this.remove(e)));delete this.map[e.userData.id]}dispose(){(0,et.js)(this.map,((e,t)=>{t.texture.dispose()})),this.map={}}}class db{constructor(e){this.runScene=e,this.model=new fb(this),this.material=new cb(this),this.texture=new pb(this)}getId(e){return e.userData.id}dispose(){this.material.dispose(),this.model.dispose(),this.texture.dispose()}}class mb extends Ca{constructor(e){super(e),this.map={},this.clock=new p.Clock,this.tickIndex=void 0,this.playings=new Set,this.updates={},this.setModelAnimaNames=(e,t)=>{0!==e.animations.length&&e.animations.map(((e,r)=>{(r=t[r])&&e&&(e.name=r)}))},e.optionsEx.cb.model.add.add("anima-parse",(({model:e})=>{this.parses(e)}))}parses(e){e.traverse((e=>this.parse(e)))}parse(e,t){if(0!==e.animations.length||t){const n=e.animations.length?e.animations:tb.parse(t);for(const t of n){var r=this.map[t.name];if(r&&e!==r.model)return void this.runScene.optionsEx.log("该动画已存在","base","info");const n=new p.AnimationMixer(e);r=n.clipAction(t);const i={finished:()=>{},loop:()=>{}};n.addEventListener("finished",(()=>i.finished())),n.addEventListener("loop",(()=>i.loop())),this.map[t.name]={mixer:n,action:r,model:e,time:0,clip:t,eventMap:i}}n.map((t=>{e.animations.find((e=>e.uuid===t.uuid))||e.animations.push(t)}))}}play(e,t){const r=this.map[e];if(r&&!this.playings.has(r)){t=aa({onLoop:()=>{},onProgress:()=>{},onFinished:()=>{},loop:!1,lastFrame:!0,reset:!1},t);const{onProgress:n,onLoop:i,onFinished:o,lastFrame:a,loop:s,reset:u}=t,{action:l,clip:c,eventMap:h}=(this.map[e].options=t,r);l.stop(),t=u?0:r.time,l.time=t,this.setPlayState(r,!0),l.play(),this.setUpdates(e,(()=>{n(Pa(l.time,c.duration,!0))})),s?(l.loop=_i.LoopRepeat,h.loop=i):(a&&(l.clampWhenFinished=!0),l.loop=_i.LoopOnce,h.finished=()=>{this.setPlayState(r,!1),n(100),o()})}}pause(e){(e=this.map[e])&&this.playings.has(e)&&(this.updateTime(e),this.setPlayState(e,!1))}resume(e){this.play(e,null==(e=this.map[e])?void 0:e.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((r=>{const{mixer:n,action:i}=this.map[r];i.play(),i.time=e,n.update(t)}))}getDetal(){return this.clock.getDelta()}update(e){const t=e||this.getDetal();(0,et.js)(this.updates,((e,r)=>r(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:r}=e;r.reset(),r.stop(),t.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.name],0===this.playings.size&&this.closeAnima())}close(e){const t=this.map[e];t&&this.playings.has(t)&&(this.resetItem(t),this.updateTime(t,0),this.setPlayState(t,!1),t.options={})}setUpdates(e,t){this.updates[e]=t}}class yb{constructor(){this.cbs=[]}cb(e,t){return Promise.all(this.cbs.map((r=>{var n;return null==(n=r.fn)?void 0:n.call(r,e,t)})))}add(e,t){return this.cbs.push({fn:t,name: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)}}class vb{constructor(){this.resize=new yb,this.setSelectMaterial=new yb,this.setScene=new yb,this.reset=new yb,this.render=new yb,this.baseLog=new yb,this.inited=new yb,this.texture={add:new yb,remove:new yb},this.model={setSelect:new yb,add:new yb,remove:new yb,multipDrop:new yb,focus:new yb,unFocus:new yb,changeName:new yb,setOpen:new yb,setMainStatue:new yb,setVisible:new yb,setParent:new yb,setLayers:new yb,clone:new yb,dispose:new yb},this.material={add:new yb,dispose:new yb,setName:new yb},this.unique={material:{add:new yb}},this.undo={addUndos:new yb,removeUndos:new yb,undoByIndex:new yb,reset:new yb},this.scene={save:new yb,saveNet:new yb},this.timeLine={setProgress:new yb,playGroup:new yb,setGroupMap:new yb,reset:new yb,closeGroup:new yb},this.events={key:{g:new yb},mouse:{move:new yb,down:new yb,up:new yb},pointer:{down:new yb,up:new yb}},this.bloom={glow:{setData:new yb,setStatus:new yb}},this.load={lazyLoadedTexture:new yb,loaded:new yb,models:new yb,progress:new yb,getArrayBuffer:new yb,complete:new yb}}}const gb={RunScene:class{constructor(e){this.cb=new vb,this.uniqueEx=new db(this),this.fileEx=new $y(this),this.optionsEx=new ab(this),this.undoEx=new Ba(this),this.textureEx=new Ri(this),this.controlsEx=new Je,this.assetsEx=new W(this),this.renderEx=new ws(this),this.events=new class{constructor(e){this.key=new ja(this),this.mouse=new Aa(this),this.drag=new $e(this),this.mouseEventMap={move:{timeLineMove:e=>{}},down:{},up:{timeLineUp:e=>{}}},this.mouseDown=e=>{},this.mouseUp=e=>{this.runScene.optionsEx.cb.events.mouse.up.cb(e),Object.values(this.mouseEventMap.up).map((t=>t(e)))},this.mouseMove=e=>{this.runScene.optionsEx.cb.events.mouse.move.cb(e),Object.values(this.mouseEventMap.move).map((t=>t(e)))},this.runScene=e}init(e){this.key.init(e),this.mouse.init(e),window.addEventListener("resize",(()=>{this.runScene.renderEx.setSize(),this.runScene.optionsEx.cb.resize.cb("")})),window.addEventListener("mousemove",this.mouseMove),window.addEventListener("mousedown",this.mouseDown),window.addEventListener("mouseup",this.mouseUp)}}(this),this.multipSelector=new nb(this),this.helperEx=null,this.materialEx=new es(this),this.cameraEx=new Ve(this),this.sceneEx=new Ss(this),this.modelEx=new ds(this),this.loaderer=new eb(this),this.exporter=new wu(this),this.lightEx=new Us(this),this.timeLineEx=new class{constructor(e){this.timerMap={},this.animaMap={},this.groupMap={},this.setModelLocal=(e,t)=>{Object.values(e.data).map((e=>{var r,n,i=((e,t)=>{let r=-1,n=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<n&&(n=e,r=i)})),-1!==r)){var o=i[r],a=i[r+1],s=e[o];if(e=e[a],s&&e){var u=Object.values(s)[0],l=Object.values(e)[0];if("notNow"!==u&&"notNow"!==l)return{left:s,right:e,progress:(t-Number(o))/(Number(a)-Number(o))}}}})(e.data,t);i&&(({left:i,right:r,progress:n}=i),e.setTargetByBetween(i,r,n))}))},this.runScene=e}reset(){this.timerMap={},this.animaMap={},this.groupMap={},this.runScene.optionsEx.cb.timeLine.reset.cb("")}closeGroup(e){var t,r;this.timerMap[e]&&(({setProgressTime:t,awaitRuned:r}=this.timerMap[e]),t&&clearInterval(t),r&&clearInterval(r)),this.groupMap[e].run=!1,this.runScene.optionsEx.cb.timeLine.closeGroup.cb(e);const n=this.animaMap[e];n&&n.length&&n.map((e=>{e.controls.clean=!0}))}resetGroup(e){var t=this.groupMap[e];t&&(this.closeGroup(e),this.runScene.optionsEx.cb.timeLine.setProgress.cb(0),Object.values(t.data).map((e=>e.reset())))}getSavedData(){return(0,et.js)(this.groupMap,((e,t)=>{t.run=!1})),this.groupMap}parseSavedGroupMap(e){Object.keys(e).map((t=>{const r=e[t],n={};(0,et.js)(r.data,((e,t)=>{var{type:t,data:r}=t;const i=lb[t];if(t=i.getTarget(e,this.runScene)){const o=new i(t,this.runScene);o.data=r,n[e]=o}})),r.data=n,this.groupMap[t]=r,this.runScene.optionsEx.cb.timeLine.setGroupMap.cb({group:r,groupName:t})}))}playGroup(e){this.runScene.helperEx.unfocus();const t=this.groupMap[e];if(t&&!t.run){t.run=!0;const n=Object.keys(t.data).map((e=>{const r=t.data[e],n=(r.data=new Proxy(r.data,{set:(e,t,r)=>(e[t]=r,!0)}),r.getAnima(t));return t.reverse&&(e=r.getAnima(t,!0),n.push(...e)),n})),i=(this.animaMap[e]||(this.animaMap[e]=[]),this.animaMap[e]=n.map((e=>(0,La.eachTriggerArrGetControls)(e))),t.time*t.speed*(t.reverse?2:1)),o=(new Date).valueOf(),a=i;var r=setInterval((()=>{var t=((new Date).valueOf()-o)/a;this.runScene.optionsEx.cb.timeLine.playGroup.cb({groupName:e,progress:t})}),16.6);let s;const u=new Promise((e=>s=setTimeout(e,i)));return this.timerMap[e]={setProgressTime:r,awaitRuned:s},u.then((()=>{if(clearInterval(this.timerMap[e].setProgressTime),t.run)return t.run=!1,t.loop?this.playGroup(e):void 0}))}}}(this),this.anima=new mb(this),this.bloom={glow:new Fe(this)};var{rootDom:t,options:r}=e;if(!t)throw TypeError("根节点或路径不可为空");this.optionsEx.init(r),(t=(r||{}).loadInterval)?this.optionsEx.setLoadInterval({inputInterval:t,cb:this.load.bind(this,e)}):this.load(e)}load(e){var{path:e,rootDom:t}=e;this.events.init(t),this.assetsEx.init(t),this.helperEx=new Iv(this);const{camera:r,controls:n}=this.assetsEx.get();this.uniqueEx.model.add(r),this.renderEx.setSize(),n.update(),this.bloom.glow.init(this.assetsEx.get()),this.optionsEx.cb.inited.cb(0),this.cameraEx.reset(r),this.loadScene(e)}loadScene(e){return function(e,t,r,n){return new(r=r||Promise)((function(t,i){function o(e){try{s(n.next(e))}catch(e){i(e)}}function a(e){try{s(n.throw(e))}catch(e){i(e)}}function s(e){var n;e.done?t(e.value):((n=e.value)instanceof r?n:new r((function(e){e(n)}))).then(o,a)}s((n=n.apply(e,[])).next())}))}(this,0,void 0,(function*(){if(e instanceof ArrayBuffer)return this.optionsEx.log("正在解析二进制文件","base","info"),this.loaderer.gltf.parse(e,{triggerCb:!0});this.optionsEx.log("正在拉取场景","base","info");var t=yield h().get(e,{responseType:"arraybuffer",onUploadProgress:e=>{var{total:e,loaded:t}=e;let r=t/e;1<(r=r<0?0:r)&&(r=1),t=100*Number(r.toFixed(2)),this.optionsEx.log("下载场景进度:"+t,"detail"),this.optionsEx.cb.load.progress.cb(t)}}).then((e=>e.data)).catch((e=>{this.optionsEx.log("下载场景失败:",e)}));return t?(this.optionsEx.cb.load.getArrayBuffer.cb(t),this.optionsEx.log("拉取场景成功、正在解析","base","success"),this.loaderer.gltf.parse(t,{triggerCb:!0})):void 0}))}render(){var e;if(null!=(e=this.optionsEx.options)&&e.run){const{render2:e,render3:t,scene:r,camera:n}=this.assetsEx;this.optionsEx.cb.render.cb(""),this.bloom.glow.update(),null!=t&&t.render(r,n),null!=e&&e.render(r,n)}}dispose(){this.assetsEx.dispose(),this.sceneEx.clean()}on(e,t){return null!=(e=this.optionsEx.cb.load[e])&&e.add("load-callback"+(0,f.getId)(),t),this}setSize(e,t){const{camera:r,render3:n,render2:i,renderer:o}=this.assetsEx;r.aspect=e/t,r.updateProjectionMatrix(),null!=n&&n.setSize(e,t),null!=i&&i.setSize(e,t),o.setSize(e,t),this.bloom.glow.setSize(e,t)}},Utils:t,ModelEx:n,MaterialEx:r,TextureEx:e}})(),l.default;function a(e){var t=u[e];return void 0!==t||(t=u[e]={id:e,loaded:!1,exports:{}},s[e].call(t.exports,t,t.exports,a),t.loaded=!0),t.exports}var s,u,l}));
|