run-scene-v2 0.0.38 → 0.0.39
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 +1 -1
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 A(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,g=(l(m={},o,(function(){return this})),(v=(v=Object.getPrototypeOf)&&v(v(S([]))))&&v!==t&&r.call(v,o)&&(m=v),f.prototype=p.prototype=Object.create(m));function y(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 A(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(x,this),this.reset(!0)}function S(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:B}}function B(){return{value:void 0,done:!0}}return l(g,"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(g),e},e.awrap=function(e){return{__await:e}},y(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()}))},y(g),l(g,s,"Generator"),l(g,o,(function(){return this})),l(g,"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,A.prototype={constructor:A,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:S(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:()=>Rf});var e={},t=(a.r(e),a.d(e,{angleToNum:()=>Yo,anima:()=>ui,arrayBufferToBase64:()=>di,arrayBufferToBlobUr:()=>pi,arrayToVector3:()=>Xo,base64ToArrayBuffer:()=>ci,base64ToBlob:()=>mi,bitMapToCanvas:()=>Ji,blobToFile:()=>gi,bufferToArrayBuffer:()=>Ii,canvasToBlob:()=>Si,changeModelOpc:()=>No,changeModelOpcs:()=>zo,clone:()=>Ti,compressImgToUrl:()=>Hi,deepMergeObject:()=>Di,domTo2Dui:()=>jo,domTo3DSprite:()=>Ho,domTo3Dui:()=>Go,fileAndBlobToCanvas:()=>wi,fileToBlob:()=>vi,getArrIndexByItem:()=>Ri,getCamAnimaData:()=>qo,getCurve:()=>Qo,getDistance:()=>Uo,getFilesByDataTransfer:()=>Ai,getImg:()=>Qi,getImgPixels:()=>zi,getImgPixels1:()=>Ni,getLine2:()=>Wo,getMacro:()=>Ci,getMd5:()=>xi,getModelMap:()=>Zo,getNamesByNum:()=>Ei,getProgress:()=>Pi,getRes:()=>Bi,getTruthBase64:()=>hi,getType:()=>_i,getTypeByBase64:()=>yi,getVideoTexture:()=>Ko,getWorldLocal:()=>Lo,hslToRgb:()=>Ki,imgArrayBufferToBlobUrl:()=>ji,imgBitMapToBase64:()=>Li,imgBitMapToBlob:()=>ki,imgBitMapToBlobAndBase64:()=>Gi,mergeObject:()=>Mi,removeUnLess:()=>Vo,reverseImg:()=>Ui,rgbToHsl:()=>Vi,textureToThreeD:()=>Jo,transByte:()=>bi,urlToBlob:()=>fi,urlToCanvas:()=>Oi,vector:()=>ko}),{}),r=(a.r(t),a.d(t,{bindTextureBaseData:()=>oa,default:()=>ea,disposeTexture:()=>ia,getBlobByTexture:()=>aa,getMimeByTexture:()=>ra,getSizeByTexture:()=>pa,getTextureGpuMemory:()=>na,getUrlByTexture:()=>ca,initTexture:()=>sa,isTexture:()=>da,loadTexture:()=>ua,parseImageBitMapByBlob:()=>la,setTextureMapping:()=>ha,textureNameMap:()=>ta}),{}),n=(a.r(r),a.d(r,{createDefMaterial:()=>qa,defAllMaterialMap:()=>Ya,defBaseMaterialMap:()=>Wa,default:()=>Za,disposeMaterial:()=>es,getBaseTextures:()=>ns,getTextures:()=>rs,getTexturesByMaterial:()=>ts,initMaterial:()=>os,isColor:()=>as,mergeMaterial:()=>$a,setMaterialTexture:()=>is}),{}),i=(a.r(n),a.d(n,{createDefModel:()=>Ms,default:()=>Bs,disposeModel:()=>Cs,getDeepModels:()=>Rs,hasSkeleton:()=>Ps,instanceModel:()=>Ts,setHelper:()=>_s,setLayers:()=>Ds,withAnima:()=>Es}),{}),o=(a.r(i),a.d(i,{AsyncCompress:()=>Bc,AsyncDecompress:()=>Gc,AsyncDeflate:()=>vc,AsyncGunzip:()=>Ec,AsyncGzip:()=>Bc,AsyncInflate:()=>xc,AsyncUnzipInflate:()=>lh,AsyncUnzlib:()=>Fc,AsyncZipDeflate:()=>ih,AsyncZlib:()=>Pc,Compress:()=>Sc,DecodeUTF8:()=>Vc,Decompress:()=>Uc,Deflate:()=>mc,EncodeUTF8:()=>Kc,Gunzip:()=>Tc,Gzip:()=>Sc,Inflate:()=>bc,Unzip:()=>uh,UnzipInflate:()=>sh,UnzipPassThrough:()=>ah,Unzlib:()=>Ic,Zip:()=>oh,ZipDeflate:()=>nh,ZipPassThrough:()=>rh,Zlib:()=>Rc,compress:()=>Mc,compressSync:()=>Cc,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]?_c:8!=(15&e[0])||7<e[0]>>4||(e[0]<<8|e[1])%31?wc:Lc)(e,t,r)},decompressSync:()=>function(e,t){return(31==e[0]&&139==e[1]&&8==e[2]?Dc:8!=(15&e[0])||7<e[0]>>4||(e[0]<<8|e[1])%31?Ac:kc)(e,t)},deflate:()=>gc,deflateSync:()=>yc,gunzip:()=>_c,gunzipSync:()=>Dc,gzip:()=>Mc,gzipSync:()=>Cc,inflate:()=>wc,inflateSync:()=>Ac,strFromU8:()=>Xc,strToU8:()=>Qc,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!=ac(e,o);--o)if(!o||65558<e.length-o)return void t("invalid zip file",null);var a=oc(e,o+8);a||t(null,{});var s=a,l=ac(e,o+16),u=4294967295==l;if(u){if(o=ac(e,o-12),101075792!=ac(e,o))return void t("invalid zip file",null);s=a=ac(e,o+32),l=ac(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=Zc(e,l,u))[0],h=m[1],p=m[2],d=m[3],f=m[4],m=m[5];if(m=Yc(e,m),l=f,c)if(8==c)if(f=e.subarray(m,m+h),h<32e4)try{s(null,Ac(f,new ru(p)))}catch(o){s(o,null)}else r.push(wc(f,{size:p},s));else s("unknown compression type "+c,null);else s(null,_u(e,m,m+h))},h=0;h<s;++h)c();return n},unzipSync:()=>function(e){for(var t={},r=e.length-22;101010256!=ac(e,r);--r)if(!r||65558<e.length-r)throw"invalid zip file";var n=oc(e,r+8);if(!n)return{};var i=ac(e,r+16),o=4294967295==i;if(o){if(r=ac(e,r-12),101075792!=ac(e,r))throw"invalid zip file";n=ac(e,r+32),i=ac(e,r+48)}for(var a=0;a<n;++a){var s=(p=Zc(e,i,o))[0],l=p[1],u=p[2],c=p[3],h=p[4],p=p[5];if(p=Yc(e,p),i=h,s){if(8!=s)throw"unknown compression type "+s;t[c]=Ac(e.subarray(p,p+l),new ru(u))}else t[c]=_u(e,p,p+l)}return t},unzlib:()=>Lc,unzlibSync:()=>kc,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 ru(u+22),t=l,n=u-l,i=u=0;i<c;++i){var o=h[i];try{var a=o.c.length,s=(eh(e,u,o,o.f,o.u,a),30+o.f.length+$c(o.extra)),p=u+s;e.set(o.c,p),eh(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)}}th(e,l,h.length,n,t),r(null,e)}var o={},a=(jc(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]=Ku(m,{size:g,crc:v.d(),c:o,f:y,m:w,u:b!=c.length||w&&x.length!=A,compression:B}),l+=30+b+S+t,u+=76+2*(b+S)+(A||0)+t,--s||i())}var c=a[e],d=o[c],f=d[0],m=d[1],v=zu(),g=f.length,y=(v.p(f),Qc(c)),b=y.length,x=m.comment,w=x&&Qc(x),A=w&&w.length,S=$c(m.extra),B=0==m.level?0:8;if(65535<b&&t("filename too long",null),B)if(g<16e4)try{t(null,yc(f,m))}catch(d){t(d,null)}else p.push(gc(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=(jc(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=Qc(r)).length,h=s.comment,p=h&&Qc(h),d=p&&p.length,f=$c(s.extra);if(65535<c)throw"filename too long";var m=u?yc(l,s):l,v=m.length,g=zu();g.p(l),i.push(Ku(s,{size:l.length,crc:g.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 y=new ru(a+22),b=(e=o,t=a-o,0);b<i.length;++b){var x=i[b],w=(eh(y,x.o,x,x.f,x.u,x.c.length),30+x.f.length+$c(x.extra));y.set(x.c,x.o+w),eh(y,o,x,x.f,x.u,x.c.length,x.o,x.m),o+=16+w+(x.m?x.m.length:0)}return th(y,o,i.length,t,e),y},zlib:()=>function(e,t,r){if(r||(r=t,t={}),"function"!=typeof r)throw"no callback";return ic(e,t,[Zu,ec,function(){return[Oc]}],(function(e){return rc(Oc(e.data[0],e.data[1]))}),4,r)},zlibSync:()=>Oc}),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&&g(e,t)}function g(e,t){return(g=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function y(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,A=new c.Vector3,S=function(){v(t,c.Object3D);var e=y(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}(),B=(S.prototype.isCSS3DObject=!0,function(){v(t,S);var e=y(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=(B.prototype.isCSS3DSprite=!0,new c.Matrix4),C=new c.Matrix4,T=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(C.makeRotationZ(t.rotation2D)),t.matrixWorld.decompose(x,w,A),M.setPosition(x),M.scale(A),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 E(e){return(E="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,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 R(e,t,r){return t&&D(e.prototype,t),r&&D(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function P(){return(P="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 O(e,t){return(O=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 F=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&&O(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"===E(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 _(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 R(n,[{key:"copy",value:function(e,t){return P(I(n.prototype),"copy",this).call(this,e,t),this.element=e.element.cloneNode(!0),this}}]),n}(c.Object3D),L=(F.prototype.isCSS2DObject=!0,new c.Vector3),k=new c.Matrix4,U=new c.Matrix4,G=new c.Vector3,j=new c.Vector3,H=R((function e(){var t,r,n,i,o=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},a=(_(this,e),this),s={objects:new WeakMap},l=void 0!==o.element?o.element:document.createElement("div");function u(e,t){return G.setFromMatrixPosition(e.matrixWorld),j.setFromMatrixPosition(t.matrixWorld),G.distanceToSquared(j)}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(),k.copy(t.matrixWorldInverse),U.multiplyMatrices(t.projectionMatrix,k),function e(t,r,o){var c;t.isCSS2DObject&&(L.setFromMatrixPosition(t.matrixWorld),L.applyMatrix4(U),c=!0===t.visible&&-1<=L.z&&L.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(L.x*n+n)+"px,"+Math.round(-L.y*i+i)+"px)":c.style.transform="translate(-50%,-50%) translate("+(L.x*n+n)+"px,"+(-L.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 N{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 T;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 H;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)}setRender2(e){e?this.render2=this.initRender2():this.render2&&(this.disposeRender(this.render2),this.render2=null)}setRender3(e){e?this.render3=this.initRender3():this.render3&&(this.disposeRender(this.render3),this.render3=null)}init(e){var t=this.runScene.sceneEx.create(),r=this.runScene.cameraEx.create(),n=this.runScene.renderEx.create(e),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(),console.log(o,a,"render2,render3"),this.setRender2(o),this.setRender3(a),{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 z={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 J(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function V(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 K(e,t,r){t&&V(e.prototype,t),r&&V(e,r),Object.defineProperty(e,"prototype",{writable:!1})}var Q=function(){function e(){J(this,e),this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}return K(e,[{key:"setSize",value:function(){}},{key:"render",value:function(){console.error("THREE.Pass: .render() must be implemented in derived pass.")}}]),e}(),X=new c.OrthographicCamera(-1,1,1,-1,0,1),W=new c.BufferGeometry,Y=(W.setAttribute("position",new c.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3)),W.setAttribute("uv",new c.Float32BufferAttribute([0,2,0,0,2,0],2)),function(){function e(t){J(this,e),this._mesh=new c.Mesh(W,t)}return K(e,[{key:"dispose",value:function(){this._mesh.geometry.dispose()}},{key:"render",value:function(e){e.render(this._mesh,X)}},{key:"material",get:function(){return this._mesh.material},set:function(e){this._mesh.material=e}}]),e}());function Z(e){return(Z="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function q(e,t){return(q=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&&q(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"===Z(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 Y(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=z,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 Y(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 ge=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(z),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 ye(e){return(ye="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"===ye(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=z,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 Y(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=Ae[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}(),Ae=[[[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 Se(e){return(Se="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(){return(Be="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 Me(e,t){return(Me=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 Te=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=Ce(e);if(r=t?(r=Ce(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Se(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 Be(Ce(n.prototype),"render",this).call(this,e,t,r,i),void(this.accumulateIndex=-1);var o=Ee[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&&(Be(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),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}(),Ee=[[[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 _e 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 Y(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 De 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 Re={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 Pe{constructor(e){this.modelLength=new Set,this.runScene=e,this.init()}init(){const{setLayers:e,add:t,remove:r}=this.runScene.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.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.cb.bloom.glow.setStatus.cb(!1),this.runScene.bloom.glow.bloomParams.isBloom=!1)}}var Oe=a(594);const Ie=c,Fe=["map","normalMap","aoMap"],Le=["map","metalnessMap","roughnessMap","normalMap","aoMap","emissiveMap","alphaMap","lightMap","envMap","displacementMap"];class ke{}const Ue=class extends ke{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,Le.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 Ge=a(129),je=a(685);function He(){return(He="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=Ke(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 Ne(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&&ze(e,t)}function ze(e,t){return(ze=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=Ke(e);if(r=t?(r=Ke(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===qe(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return Ve(n)}}function Ve(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ke(e){return(Ke=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Qe(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 Xe(e,t,r){return t&&Qe(e.prototype,t),r&&Qe(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function We(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ye(e){return function(e){if(Array.isArray(e))return Ze(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 Ze(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)?Ze(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 Ze(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 qe(e){return(qe="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(e){return void 0===e}function et(){return"undefined"!=typeof window}function tt(e){return Tr(e)||Cr(e)}function rt(e){return(Hr=ht(e,jr))&&si}function nt(e,t){return!t&&console.warn(e)}function it(e,t){return e&&(jr[e]=t)&&Hr&&(Hr[e]=t)||jr}function ot(){return 0}function at(e,t,r){return(r=e[t])&&Tr(r)?e[t]():$e(r)&&e.getAttribute&&e.getAttribute(t)||r}function st(e,t){(e=e.split(",")).forEach(t)}function lt(e,t,r,n){Jr.length&&en(),e.render(t,r,n),Jr.length&&en()}function ut(e){var t=parseFloat(e);return(t||0===t)&&(e+"").match(Ur).length<2?t:Cr(e)?e.trim():e}function ct(e){return e}function ht(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]=_r(t[r])?pt(e[r]||(e[r]={}),t[r]):t[r]);return e}function dt(e){var t,r=e.parent||Kt,n=e.keyframes?(t=Pr(e.keyframes),function(e,r){for(var n in r)n in e||"duration"===n&&t||"ease"===n||(e[n]=r[n])}):tn;if(Dr(e.inherit))for(;r;)n(e,r.vars.defaults),r=r.parent||r._dp;return e}function ft(e){return!e||e._ts&&ft(e.parent)}function mt(e){return e._repeat?vt(e._tTime,e=e.duration()+e._rDelay)*e:0}function vt(e,t){return t=Math.floor(e/=t),e&&t===e?t-1:t}function gt(e,t){return(e-t._start)*t._ts+(0<=t._ts?0:t._dirty?t.totalDuration():t._tDur)}function yt(e,t){var r;if((t._time||t._initted&&!t._dur)&&(r=gt(e.rawTime(),t),(!t._dur||Et(0,t.totalDuration(),r)-t._tTime>br)&&t.render(r,!0)),an(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=-br}}function bt(e,t,r,n){return t.parent&&on(t),t._start=$r((Er(r)?r:r||e!==Kt?Ct(e,r,t):e._time)+t._delay),t._end=$r(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),St(t)||(e._recent=t),n||yt(e,t),e}function xt(e,t){(jr.ScrollTrigger||Nr("scrollTrigger",t))&&jr.ScrollTrigger.create(t,e)}function wt(e,t,r,n){return Pn(e,t),e._initted?!r&&e._pt&&(e._dur&&!1!==e.vars.lazy||!e._dur&&e.vars.lazy)&&Zt!==Sn.frame?(Jr.push(e),e._lazy=[t,n]):void 0:1}function At(e){return(e=e.parent)&&e._ts&&e._initted&&!e._lock&&(e.rawTime()<0||At(e))}function St(e){return"isFromStart"===(e=e.data)||"isStart"===e}function Bt(e,t,r,n){var i=e._repeat,o=$r(t)||0;return(t=e._tTime/e._tDur)&&!n&&(e._time*=o/e._dur),e._dur=o,e._tDur=i?i<0?1e10:$r(o*(i+1)+e._rDelay*i):o,0<t&&!n?ln(e,e._tTime=e._tDur*t):e.parent&&sn(e),r||an(e.parent,e),e}function Mt(e){return e instanceof Jn?an(e):Bt(e,e._dur)}function Ct(e,t,r){var n,i,o,a=e.labels,s=e._recent||un,l=e.duration()>=yr?s.endTime(!1):e._dur;return Cr(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*(Pr(r)?r[0]:r).totalDuration()),1<n?Ct(e,t.substr(0,n-1),r)+i:l+i)):null==t?l:+t}function Tt(e,t,r){var n,i,o=Er(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=Dr(i.vars.inherit)&&i.parent;s.immediateRender=Dr(n.immediateRender),e<2?s.runBackwards=1:s.startAt=t[a-1]}return new Yn(t[0],s,t[1+a])}function Et(e,t,r){return r<e?e:t<r?t:r}function _t(e){if(Tr(e))return e;var t=_r(e)?e:{each:e},r=_n(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 Cr(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,g,y,b,x=(h||t).length,w=o[x];if(!w){if(!(b="auto"===t.grid?0:(t.grid||[1,yr])[1])){for(g=-yr;g<(g=h[b++].getBoundingClientRect().left)&&b<x;);b--}for(w=o[x]=[],p=a?Math.min(b,x)*l-.5:n%b,d=b===yr?0:a?x*u/b-.5:n/b|0,y=yr,v=g=0;v<x;v++)m=v%b-p,f=d-(v/b|0),w[v]=m=s?Math.abs("y"===s?f:m):Sr(m*m+f*f),g<m&&(g=m),m<y&&(y=m);"random"===n&&mn(w),w.max=g-y,w.min=y,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=hn(t.amount||t.each)||0,r=r&&x<0?En(r):r}return x=(w[e]-w.min)/w.max||0,$r(w.b+(r?r(x):x)*w.v)+w.u}}function Dt(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+(Er(r)?0:hn(r))}}function Rt(e,t){var r,n,i=Pr(e);return!i&&_r(e)&&(r=i=e.radius||yr,e.values?(e=fn(e.values),(n=!Er(e[0]))&&(r*=r)):e=Dt(e.increment)),cn(t,i?Tr(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=yr,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||Er(t)?u:u+hn(t)}:Dt(e))}function Pt(e,t,r,n){return cn(Pr(e)?!t:!0===r?!!(r=0):!n,(function(){return Pr(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 Ot(e,t,r){return cn(r,(function(r){return e[~~t(r)]}))}function It(e,t,r,n,i){var o=t-e,a=n-r;return cn(i,(function(t){return r+((t-e)/o*a||0)}))}function Ft(e,t,r){var n,i,o,a=e.labels,s=yr;for(n in a)(i=a[n]-t)<0==!!r&&i&&s>(i=Math.abs(i))&&(o=n,s=i);return o}function Lt(e,t,r){var n=e.vars,i=n[t];i&&(t=n[t+"Params"],n=n.callbackScope||e,r&&Jr.length&&en(),t?i.apply(n,t):i.call(n))}function kt(e){return on(e),e.scrollTrigger&&e.scrollTrigger.kill(!1),e.progress()<1&&Lt(e,"onInterrupt"),e}function Ut(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)*gn+.5|0}function Gt(e,t,r){var n,i,o,a,s="",l=(e+s).match(wn),u=t?"hsla(":"rgba(",c=0;if(!l)return e;if(l=l.map((function(e){return(e=bn(e,t,1))&&u+(t?e[0]+","+e[1]+"%,"+e[2]+"%,"+e[3]:e.join(","))+")"})),r&&(o=xn(e),(n=r.c).join(s)!==o.c.join(s)))for(a=(i=e.replace(wn,"1").split(Fr)).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(wn)).length-1;c<a;c++)s+=i[c]+l[c];return s+i[a]}function jt(e,t){for(var r,n=e._first;n;)n instanceof Jn?jt(n,t):!n.vars.yoyoEase||n._yoyo&&n._repeat||n._yoyo===t||(n.timeline?jt(n.timeline,t):(r=n._ease,n._ease=n._yEase,n._yEase=r,n._yoyo=t)),n=n._next}function Ht(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}};st(e,(function(e){for(var t in Mn[e]=jr[e]=i,Mn[r=e.toLowerCase()]=n,i)Mn[r+("easeIn"===t?".in":"easeOut"===t?".out":".inOut")]=Mn[e+"."+t]=i[t]}))}function Nt(e){return function(t){return t<.5?(1-e(1-2*t))/2:.5+e(2*(t-.5))/2}}function zt(e,t,r){function n(e){return 1===e?1:i*Math.pow(2,-10*e)*Mr((e-o)*a)+1}var i=1<=t?t:1,o=(a=(r||(e?.3:.45))/(t<1?t:1))/xr*(Math.asin(1/i)||0),a=(r="out"===e?n:"in"===e?function(e){return 1-n(1-e)}:Nt(n),xr/a);return r.config=function(t,r){return zt(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)}:Nt(t);return n.config=function(t){return Jt(e,t)},n}var Vt,Kt,Qt,Xt,Wt,Yt,Zt,qt,$t,er,tr,rr,nr,ir,or,ar,sr,lr,ur,cr,hr,pr,dr,fr,mr,vr={autoSleep:120,force3D:"auto",nullTargetWarn:1,units:{lineHeight:""}},gr={duration:.5,overwrite:!1,delay:0},yr=1e8,br=1/yr,xr=2*Math.PI,wr=xr/4,Ar=0,Sr=Math.sqrt,Br=Math.cos,Mr=Math.sin,Cr=function(e){return"string"==typeof e},Tr=function(e){return"function"==typeof e},Er=function(e){return"number"==typeof e},_r=function(e){return"object"==qe(e)},Dr=function(e){return!1!==e},Rr="function"==typeof ArrayBuffer&&ArrayBuffer.isView||function(){},Pr=Array.isArray,Or=/(?:-?\.?\d|\.)+/gi,Ir=/[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g,Fr=/[-+=.]*\d+[.e-]*\d*[a-z%]*/g,Lr=/[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi,kr=/[+-]=-?[.\d]+/,Ur=/[^,'"\[\]\s]+/gi,Gr=/[\d.+\-=]+(?:e[-+]\d*)*/i,jr={},Hr={},Nr=function(e,t){return console.warn("Invalid property",e,"set to",t,"Missing plugin? gsap.registerPlugin()")},zr={},Jr=[],Vr={},Kr={},Qr={},Xr=30,Wr=[],Yr="",Zr=function(e){var t,r,n=e[0];if(_r(n)||Tr(n)||(e=[e]),!(t=(n._gsap||{}).harness)){for(r=Wr.length;r--&&!Wr[r].targetTest(n););t=Wr[r]}for(r=e.length;r--;)e[r]&&(e[r]._gsap||(e[r]._gsap=new Nn(e[r],t)))||e.splice(r,1);return e},qr=function(e){return e._gsap||Zr(fn(e))[0]._gsap},$r=function(e){return Math.round(1e7*e)/1e7||0},en=function(){var e,t,r=Jr.length,n=Jr.slice(0);for(Vr={},e=Jr.length=0;e<r;e++)(t=n[e])&&t._lazy&&(t.render(t._lazy[0],t._lazy[1],!0)._lazy=0)},tn=function(e,t){for(var r in t)r in e||(e[r]=t[r]);return e},rn=function(e,t){var r,n={};for(r in e)r in t||(n[r]=e[r]);return n},nn=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},on=function(e,t){!e.parent||t&&!e.parent.autoRemoveChildren||e.parent.remove(e),e._act=0},an=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=$r(e._start+(e._tDur/Math.abs(e._ts||e._rts||br)||0))},ln=function(e,t){var r=e._dp;return r&&r.smoothChildTiming&&e._ts&&(e._start=$r(r._time-(0<e._ts?t/e._ts:((e._dirty?e.totalDuration():e._tDur)-t)/-e._ts)),sn(e),r._dirty||an(r,e)),e},un={_start:0,endTime:ot,totalDuration:ot},cn=function(e,t){return e||0===e?t(e):t},hn=function(e,t){return Cr(e)&&(t=Gr.exec(e))?e.substr(t.index+t[0].length):""},pn=[].slice,dn=function(e,t){return e&&_r(e)&&"length"in e&&(!t&&!e.length||e.length-1 in e&&_r(e[0]))&&!e.nodeType&&e!==Qt},fn=function(e,t,r){return!Cr(e)||r||!Xt&&Bn()?Pr(e)?function(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:[];return e.forEach((function(e){return Cr(e)&&!t||dn(e,1)?r.push.apply(r,Ye(fn(e))):r.push(e)}))||r}(e,r):dn(e)?pn.call(e,0):e?[e]:[]:pn.call((t||Wt).querySelectorAll(e),0)},mn=function(e){return e.sort((function(){return.5-Math.random()}))},vn=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?Ur:Or),a+=e.substr(o,t-o)+Pt(i?r:+r[0],i?0:+r[1],+r[2]||1e-5),o=n+1;return a+e.substr(o,e.length-o)},gn=255,yn={aqua:[0,gn,gn],lime:[0,gn,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,gn],navy:[0,0,128],white:[gn,gn,gn],olive:[128,128,0],yellow:[gn,gn,0],orange:[gn,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[gn,0,0],pink:[gn,192,203],cyan:[0,gn,gn],transparent:[gn,gn,gn,0]},bn=function(e,t,r){var n,i,o,a,s,l,u,c=e?Er(e)?[e>>16,e>>8&gn,e&gn]:0:yn.black;if(!c){if(","===e.substr(-1)&&(e=e.substr(0,e.length-1)),yn[e])c=yn[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&gn,c&gn,parseInt(e.substr(7),16)/255];c=[(e=parseInt(e.substr(1),16))>>16,e>>8&gn,e&gn]}else if("hsl"===e.substr(0,3))if(c=u=e.match(Or),t){if(~e.indexOf("="))return c=e.match(Ir),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]=Ut(a+1/3,n,i),c[1]=Ut(a,n,i),c[2]=Ut(a-1/3,n,i);else c=e.match(Or)||yn.transparent;c=c.map(Number)}return t&&!u&&(n=c[0]/gn,i=c[1]/gn,o=c[2]/gn,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},xn=function(e){var t=[],r=[],n=-1;return e.split(wn).forEach((function(e){e=e.match(Fr)||[],t.push.apply(t,Ye(e)),r.push(n+=e.length+1)})),t.c=r,t},wn=function(){var e,t="(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3,4}){1,2}\\b";for(e in yn)t+="|"+e+"\\b";return new RegExp(t+")","gi")}(),An=/hsl[a]?\(/,Sn=(or=Date.now,ar=500,sr=33,lr=or(),ur=lr,hr=cr=1e3/240,dr={time:0,frame:0,tick:function(){Dn(!0)},deltaRatio:function(e){return nr/(1e3/(e||60))},wake:function(){Yt&&(!Xt&&et()&&(Qt=Xt=window,Wt=Qt.document||{},jr.gsap=si,(Qt.gsapVersions||(Qt.gsapVersions=[])).push(si.version),rt(Hr||Qt.GreenSockGlobals||!Qt.gsap&&Qt||{}),rr=Qt.requestAnimationFrame),er&&dr.sleep(),tr=rr||function(e){return setTimeout(e,hr-1e3*dr.time+1|0)},$t=1,Dn(2))},sleep:function(){(rr?Qt.cancelAnimationFrame:clearTimeout)(er),$t=0,tr=ot},lagSmoothing:function(e,t){ar=e||1/br,sr=Math.min(t,ar,0)},fps:function(e){cr=1e3/(e||240),hr=1e3*dr.time+cr},add:function(e){pr.indexOf(e)<0&&pr.push(e),Bn()},remove:function(e,t){~(t=pr.indexOf(e))&&pr.splice(t,1)&&t<=ir&&ir--},_listeners:pr=[]}),Bn=function(){return!$t&&Sn.wake()},Mn={},Cn=/^[\d.\-M][\d.\-,\s]/,Tn=/["']/g,En=function(e){return function(t){return 1-e(1-t)}},_n=function(e,t){return e&&(Tr(e)?e:Mn[e]||function(e){var t,r,n,i=(e+"").split("("),o=Mn[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(Tn,"").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(ut))):Mn._CE&&Cn.test(e)?Mn._CE("",e):o}(e))||t};function Dn(e){var t,r,n,i=or()-ur,o=!0===e;if(ar<i&&(lr+=i-sr),(0<(i=(r=(ur+=i)-lr)-hr)||o)&&(n=++dr.frame,nr=r-1e3*dr.time,dr.time=r/=1e3,hr+=i+(cr<=i?4:cr-i),t=1),o||(er=tr(Dn)),t)for(ir=0;ir<pr.length;ir++)pr[ir](r,nr,n,e)}function Rn(e){return e<mr?fr*e*e:e<.7272727272727273?fr*Math.pow(e-1.5/2.75,2)+.75:e<.9090909090909092?fr*(e-=2.25/2.75)*e+.9375:fr*Math.pow(e-2.625/2.75,2)+.984375}function Pn(e,t){var r,n,i,o,a,s,l,u,c,h,p,d,f,m=e.vars,v=m.ease,g=m.startAt,y=m.immediateRender,b=m.lazy,x=m.onUpdate,w=m.onUpdateParams,A=m.callbackScope,S=m.runBackwards,B=m.yoyoEase,M=m.keyframes,C=m.autoRevert,T=e._dur,E=e._startAt,_=e._targets,D=e.parent,R=D&&"nested"===D.data?D.parent._targets:_,P="auto"===e._overwrite&&!Vt,O=e.timeline;if(e._ease=_n(v=!O||M&&v?v:"none",gr.ease),e._yEase=B?En(_n(!0===B?v:B,gr.ease)):0,B&&e._yoyo&&!e._repeat&&(B=e._yEase,e._yEase=e._ease,e._ease=B),e._from=!O&&!!m.runBackwards,!O||M&&!m.stagger){if(d=(u=_[0]?qr(_[0]).harness:0)&&m[u.prop],r=rn(m,zr),E&&on(E.render(-1,!0)),g)if(on(e._startAt=Yn.set(_,tn({data:"isStart",overwrite:!1,parent:D,immediateRender:!0,lazy:Dr(b),startAt:null,delay:0,onUpdate:x,onUpdateParams:w,callbackScope:A,stagger:0},g))),t<0&&!y&&!C&&e._startAt.render(-1,!0),y){if(0<t&&!C&&(e._startAt=0),T&&t<=0)return void(t&&(e._zTime=t))}else!1===C&&(e._startAt=0);else if(S&&T)if(E)C||(e._startAt=0);else if(i=tn({overwrite:!1,data:"isFromStart",lazy:(y=!t&&y)&&Dr(b),immediateRender:y,stagger:0,parent:D},r),d&&(i[u.prop]=d),on(e._startAt=Yn.set(_,i)),t<0&&e._startAt.render(-1,!0),e._zTime=t,y){if(!t)return}else Pn(e._startAt,br);for(e._pt=0,b=T&&Dr(b)||b&&!T,n=0;n<_.length;n++){if(l=(a=_[n])._gsap||Zr(_)[n]._gsap,e._ptLookup[n]=h={},Vr[l.id]&&Jr.length&&en(),p=R===_?n:R.indexOf(a),u&&!1!==(c=new u).init(a,d||r,e,p,R)&&(e._pt=o=new ii(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)Kr[i]&&(c=Qn(i,r,e,p,a,R))?c.priority&&(s=1):h[i]=o=Kn.call(e,a,i,"get",r[i],p,R,0,m.stringFilter);e._op&&e._op[n]&&e.kill(a,e._op[n]),P&&e._pt&&(Hn=e,Kt.killTweensOf(a,h,e.globalTime(t)),f=!e.parent,Hn=0),e._pt&&b&&(Vr[l.id]=1)}s&&ni(e),e._onInit&&e._onInit(e)}e._onUpdate=x,e._initted=(!e._op||e._pt)&&!f,M&&t<=0&&O.render(yr,!0,!0)}function On(e,t,r,n,i){return Tr(e)?e.call(t,r,n,i):Cr(e)&&~e.indexOf("random(")?vn(e):e}function In(e,t,r){return e.setAttribute(t,r)}function Fn(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 Ln(e,t){for(var r=t._pt;r;)r.r(e,r.d),r=r._next}function kn(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 Un(e){for(var t,r,n=this._pt;n;)r=n._next,n.p===e&&!n.op||n.op===e?nn(this,n,"_pt"):n.dep||(t=1),n=r;return!t}function Gn(e,t,r,n){n.mSet(e,t,n.m.call(n.tween,r,n.mt),n)}function jn(e,t){return{name:e,rawVars:1,init:function(e,r,n){n._onInit=function(e){var n,i;if(Cr(r)&&(n={},st(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?ai(s,o):s)&&s.modifier&&s.modifier(u[o],l,c[a],o)}}}}st("Linear,Quad,Cubic,Quart,Quint,Strong",(function(e,t){var r=t<5?t+1:t;Ht(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}))})),Mn.Linear.easeNone=Mn.none=Mn.Linear.easeIn,Ht("Elastic",zt("in"),zt("out"),zt()),fr=7.5625,mr=1/2.75,Ht("Bounce",(function(e){return 1-Rn(1-e)}),Rn),Ht("Expo",(function(e){return e?Math.pow(2,10*(e-1)):0})),Ht("Circ",(function(e){return-(Sr(1-e*e)-1)})),Ht("Sine",(function(e){return 1===e?1:1-Br(e*wr)})),Ht("Back",Jt("in"),Jt("out"),Jt()),Mn.SteppedEase=Mn.steps=jr.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-br;return function(e){return((n*Et(0,o,e)|0)+i)*r}}},gr.ease=Mn["quad.out"],st("onComplete,onUpdate,onStart,onRepeat,onReverseComplete,onInterrupt",(function(e){return Yr+=e+","+e+"Params,"}));var Hn,Nn=Xe((function e(t,r){We(this,e),this.id=Ar++,(t._gsap=this).target=t,this.harness=r,this.get=r?r.get:at,this.set=r?r.getSetter:ei})),zn=function(){function e(t){We(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,Bt(this,+t.duration,1,1),this.data=t.data,$t||Sn.wake()}return Xe(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,Bt(this,this._repeat<0?e:(e-this._repeat*this._rDelay)/(this._repeat+1))):this._tDur}},{key:"totalTime",value:function(e,t){if(Bn(),!arguments.length)return this._tTime;var r=this._dp;if(r&&r.smoothChildTiming&&this._ts){for(ln(this,e),r._dp&&!r.parent&&yt(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)&&bt(this._dp,this,this._start-this._delay)}return(this._tTime!==e||!this._dur&&!t||this._initted&&Math.abs(this._zTime)===br||!e&&!this._initted&&(this.add||this._ptLookup))&&(this._ts||(this._pTime=e),lt(this,e,t)),this}},{key:"time",value:function(e,t){return arguments.length?this.totalTime(Math.min(this.totalDuration(),e+mt(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)+mt(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?vt(this._tTime,r)+1:1}},{key:"timeScale",value:function(e){if(!arguments.length)return this._rts===-br?0:this._rts;if(this._rts===e)return this;for(var t=this.parent&&this._ts?gt(this.parent._time,this):this._tTime,r=(this._rts=+e||0,this._ts=this._ps||e===-br?0:this._rts,e=this.totalTime(Et(-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):(Bn(),this._ts=this._rts,this.totalTime(this.parent&&!this.parent.smoothChildTiming?this.rawTime():this._tTime||this._pTime,1===this.progress()&&Math.abs(this._zTime)!==br&&(this._tTime-=br)))),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||bt(t,this,e-this._delay),this):this._start}},{key:"endTime",value:function(e){return this._start+(Dr(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?gt(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,Mt(this)):-2===this._repeat?1/0:this._repeat}},{key:"repeatDelay",value:function(e){var t;return arguments.length?(t=this._time,this._rDelay=e,Mt(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(Ct(this,e),Dr(t))}},{key:"restart",value:function(e,t){return this.play().totalTime(e?-this._delay:0,Dr(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?-br:0)),this):this._rts<0}},{key:"invalidate",value:function(){return this._initted=this._act=0,this._zTime=-br,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)-br))}},{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,Tr(i)&&(i=i(t))&&(i.then||i===t)&&(t.then=e),r(i),t.then=e}var i=Tr(e)?e:ct;t._initted&&1===t.totalProgress()&&0<=t._ts||!t._tTime&&t._ts<0?n():t._prom=n}))}},{key:"kill",value:function(){kt(this)}}]),e}(),Jn=(tn(zn.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:-br,_prom:0,_ps:!1,_rts:1}),function(){Ne(t,zn);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 We(this,t),(r=e.call(this,n)).labels={},r.smoothChildTiming=!!n.smoothChildTiming,r.autoRemoveChildren=!!n.autoRemoveChildren,r._sort=Dr(n.sortChildren),Kt&&bt(n.parent||Kt,Ve(r),i),n.reversed&&r.reverse(),n.paused&&r.paused(!0),n.scrollTrigger&&xt(Ve(r),n.scrollTrigger),r}return Xe(t,[{key:"to",value:function(e,t,r){return Tt(0,arguments,this),this}},{key:"from",value:function(e,t,r){return Tt(1,arguments,this),this}},{key:"fromTo",value:function(e,t,r,n){return Tt(2,arguments,this),this}},{key:"set",value:function(e,t,r){return t.duration=0,t.parent=this,dt(t).repeatDelay||(t.repeat=0),t.immediateRender=!!t.immediateRender,new Yn(e,t,Ct(this,r),1),this}},{key:"call",value:function(e,t,r){return bt(this,Yn.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 Yn(e,r,Ct(this,i)),this}},{key:"staggerFrom",value:function(e,t,r,n,i,o,a){return r.runBackwards=1,dt(r).immediateRender=Dr(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,dt(n).immediateRender=Dr(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:$r(e),g=this._zTime<0!=e<0&&(this._initted||!m);if((v=this!==Kt&&f<v&&0<=e?f:v)!==this._tTime||r||g){if(d!==this._time&&m&&(v+=this._time-d,e+=this._time-d),n=v,c=this._start,s=!(u=this._ts),g&&(m||(d=this._zTime),!e&&t||(this._zTime=e)),this._repeat){if(g=this._yoyo,a=m+this._rDelay,this._repeat<-1&&e<0)return this.totalTime(100*a+e,t,r);if(n=$r(v%a),v===f?(o=this._repeat,n=m):((o=~~(v/a))&&o===v/a&&(n=m,o--),m<n&&(n=m)),h=vt(this._tTime,a),g&&1&o&&(n=m-n,p=1),o!==(h=!d&&this._tTime&&h!==o?o:h)&&!this._lock){var y=g&&1&h;if(g=y===(g&&1&o),d=(y=o<h?!y:y)?0:m,this._lock=1,this.render(d||(p?0:$r(o*a)),t,!m)._lock=0,this._tTime=v,!t&&this.parent&&Lt(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,g&&(this._lock=2,this.render(d=y?m:-1e-4,!0),this.vars.repeatRefresh&&!p&&this.invalidate()),this._lock=0,!this._ts&&!s)return this;jt(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,$r(d),$r(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&&(Lt(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=-br);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?-br:br);break}}b=i}if(l&&!t&&(this.pause(),l.render(d<=n?0:-br)._zTime=d<=n?1:-1,this._ts))return this._start=c,sn(this),this.render(e,t,r);this._onUpdate&&!t&&Lt(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)||on(this,1),t||e<0&&!d||!v&&!d&&f||(Lt(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(Er(t)||(t=Ct(this,t,e)),!(e instanceof zn)){if(Pr(e))return e.forEach((function(e){return r.add(e,t)})),this;if(Cr(e))return this.addLabel(e,t);if(!Tr(e))return this;e=Yn.delayedCall(0,e)}return this!==e?bt(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]:-yr,i=[],o=this._first;o;)o._start>=n&&(o instanceof Yn?t&&i.push(o):(r&&i.push(o),e&&i.push.apply(i,Ye(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 Cr(e)?this.removeLabel(e):Tr(e)?this.killTweensOf(e):(nn(this,e),e===this._recent&&(this._recent=this._last),an(this))}},{key:"totalTime",value:function(e,r){return arguments.length?(this._forcing=1,!this._dp&&this._ts&&(this._start=$r(Sn.time-(0<this._ts?e/this._ts:(this.totalDuration()-e)/-this._ts))),He(Ke(t.prototype),"totalTime",this).call(this,e,r),this._forcing=0,this):this._tTime}},{key:"addLabel",value:function(e,t){return this.labels[e]=Ct(this,t),this}},{key:"removeLabel",value:function(e){return delete this.labels[e],this}},{key:"addPause",value:function(e,t,r){return(t=Yn.delayedCall(0,t||ot,r)).data="isPause",this._hasPause=1,bt(this,t,Ct(this,e))}},{key:"removePause",value:function(e){var t=this._first;for(e=Ct(this,e);t;)t._start===e&&"isPause"===t.data&&on(t),t=t._next}},{key:"killTweensOf",value:function(e,t,r){for(var n=this.getTweensOf(e,r),i=n.length;i--;)Hn!==n[i]&&n[i].kill(e,t);return this}},{key:"getTweensOf",value:function(e,t){for(var r,n=[],i=fn(e),o=this._first,a=Er(t);o;)o instanceof Yn?function(e,t){for(var r=t.length,n=0;e.indexOf(t[n])<0&&++n<r;);return n<r}(o._targets,i)&&(a?(!Hn||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,Ye(r)),o=o._next;return n}},{key:"tweenTo",value:function(e,t){t=t||{};var r,n=this,i=Ct(n,e),o=(e=t).startAt,a=e.onStart,s=e.onStartParams,l=(e=e.immediateRender,Yn.to(n,tn({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())||br,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&&Bt(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,tn({startAt:{time:Ct(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 Ft(this,Ct(this,e))}},{key:"previousLabel",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this._time;return Ft(this,Ct(this,e),1)}},{key:"currentLabel",value:function(e){return arguments.length?this.seek(e,!0):this.previousLabel(this._time+br)}},{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 an(this)}},{key:"invalidate",value:function(){var e=this._first;for(this._lock=0;e;)e.invalidate(),e=e._next;return He(Ke(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={}),an(this)}},{key:"totalDuration",value:function(e){var t,r,n,i=0,o=this,a=o._last,s=yr;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,bt(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;Bt(o,o===Kt&&o._time>i?o._time:i,1,1),o._dirty=0}return o._tDur}}],[{key:"updateRoot",value:function(e){if(Kt._ts&&(lt(Kt,gt(e,Kt)),Zt=Sn.frame),Sn.frame>=Xr){Xr+=vr.autoSleep||120;var t=Kt._first;if((!t||!t._ts)&&vr.autoSleep&&Sn._listeners.length<2){for(;t&&!t._ts;)t=t._next;t||Sn.sleep()}}}}]),t}()),Vn=(tn(Jn.prototype,{_lock:0,_hasPause:0,_forcing:0}),function(e,t,r,n,i,o,a){var s,l,u,c,h,p=new ii(this._pt,e,t,0,1,Fn,null,i),d=0,f=0;for(p.b=r,p.e=n,r+="",(i=~(n+="").indexOf("random("))&&(n=vn(n)),o&&(o(o=[r,n],e,t),r=o[0],n=o[1]),s=r.match(Lr)||[];c=Lr.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=Lr.lastIndex);return p.c=d<n.length?n.substring(d,n.length):"",p.fp=a,(kr.test(n)||i)&&(p.e=0),this._pt=p}),Kn=function(e,t,r,n,i,o,a,s,l){var u;if(Tr(n)&&(n=n(i||0,e,o)),i=e[t],o="get"!==r?r:Tr(i)?l?e[t.indexOf("set")||!Tr(e["get"+t.substr(3)])?t:"get"+t.substr(3)](l):e[t]():i,r=Tr(i)?l?$n:qn:Zn,Cr(n)&&"="===(n=~n.indexOf("random(")?vn(n):n).charAt(1)&&(!(u=parseFloat(o)+parseFloat(n.substr(2))*("-"===n.charAt(0)?-1:1)+(hn(o)||0))&&0!==u||(n=u)),o!==n)return isNaN(o*n)||""===n?(i||t in e||Nr(t,n),Vn.call(this,e,t,o,n,r,s||vr.stringFilter,l)):(u=new ii(this._pt,e,t,+o||0,n-(o||0),"boolean"==typeof i?ri:ti,0,r),l&&(u.fp=l),a&&u.modifier(a,this,e),this._pt=u)},Qn=function(e,t,r,n,i,o){var a,s,l,u;if(Kr[e]&&!1!==(a=new Kr[e]).init(i,a.rawVars?t[e]:function(e,t,r,n,i){if(Tr(e)&&(e=On(e,i,t,r,n)),!_r(e)||e.style&&e.nodeType||Pr(e)||Rr(e))return Cr(e)?On(e,i,t,r,n):e;var o,a={};for(o in e)a[o]=On(e[o],i,t,r,n);return a}(t[e],n,i,o,r),r,n,o)&&(r._pt=s=new ii(r._pt,i,e,0,1,a.render,a,0,a.priority),r!==qt))for(l=r._ptLookup[r._targets.indexOf(i)],u=a._props.length;u--;)l[a._props[u]]=s;return a},Xn=Yr+"repeat,repeatDelay,yoyo,repeatRefresh,yoyoEase",Wn={},Yn=(st(Xn+",id,stagger,delay,duration,paused,scrollTrigger",(function(e){return Wn[e]=1})),function(){Ne(t,zn);var e=Je(t);function t(r,n,i,o){We(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:dt(n))).vars).duration,v=o.delay,g=o.immediateRender,y=o.stagger,b=o.overwrite,x=o.keyframes,w=o.defaults,A=o.scrollTrigger,S=o.yoyoEase,B=(o=n.parent||Kt,(Pr(r)||Rr(r)?Er(r[0]):"length"in n)?[r]:fn(r));if(a._targets=B.length?Zr(B):nt("GSAP target "+r+" not found. https://greensock.com",!vr.nullTargetWarn)||[],a._ptLookup=[],a._overwrite=b,x||y||tt(m)||tt(v)){if(n=a.vars,(s=a.timeline=new Jn({data:"nested",defaults:w||{}})).kill(),s.parent=s._dp=Ve(a),s._start=0,y||tt(m)||tt(v)){if(c=B.length,d=y&&_t(y),_r(y))for(h in y)~Xn.indexOf(h)&&((f=f||{})[h]=y[h]);for(l=0;l<c;l++)(u=rn(n,Wn)).stagger=0,S&&(u.yoyoEase=S),f&&ht(u,f),p=B[l],u.duration=+On(m,Ve(a),l,p,B),u.delay=(+On(v,Ve(a),l,p,B)||0)-a._delay,!y&&1===c&&u.delay&&(a._delay=v=u.delay,a._start+=v,u.delay=0),s.to(p,u,d?d(l,p,B):0),s._ease=Mn.none;s.duration()?m=v=0:a.timeline=0}else if(x){dt(tn(s.vars.defaults,{ease:"none"})),s._ease=_n(x.ease||n.ease||"none");var M,C,T,E=0;if(Pr(x))x.forEach((function(e){return s.to(B,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(Pr(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=E=0;l<M.length;l++)(T={ease:(C=M[l]).e,duration:(C.t-(l?M[l-1].t:0))/100*m})[h]=C.v,s.to(B,T,E),E+=T.duration;s.duration()<m&&s.to({},{duration:m-s.duration()})}}m||a.duration(m=s.duration())}else a.timeline=0;return!0!==b||Vt||(Hn=Ve(a),Kt.killTweensOf(B),Hn=0),bt(o,Ve(a),i),n.reversed&&a.reverse(),n.paused&&a.paused(!0),(g||!m&&!x&&a._start===$r(o._time)&&Dr(g)&&ft(Ve(a))&&"nested"!==o.data)&&(a._tTime=-br,a.render(Math.max(0,-v))),A&&xt(Ve(a),A),a}return Xe(t,[{key:"render",value:function(e,t,r){var n,i,o=this._time,a=this._tDur,s=this._dur,l=a-br<e&&0<=e?a:e<br?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=$r(l%h),l===a?(g=this._repeat,m=s):((g=~~(l/h))&&g===l/h&&(m=s,g--),s<m&&(m=s)),(d=this._yoyo&&1&g)&&(p=this._yEase,m=s-m),y=vt(this._tTime,h),m===o&&!r&&this._initted)return this;g!==y&&(f&&this._yEase&&jt(f,d),!this.vars.repeatRefresh||d||this._lock||(this._lock=r=1,this.render($r(h*g),!0).invalidate()._lock=0))}if(!this._initted){if(wt(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&&(Lt(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?-br: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),Lt(this,"onUpdate")),this._repeat&&g!==y&&this.vars.onRepeat&&!t&&this.parent&&Lt(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)||on(this,1),t||e<0&&!o||!l&&!o||(Lt(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&&At(h)&&(h._initted||!St(h))||(h._ts<0||h._dp._ts<0)&&!St(h))?0:1,g=h._rDelay,y=0;if(g&&h._repeat&&(c=vt(y=Et(0,h._tDur,p),g),h._yoyo&&1&c&&(v=1-v),c!==vt(h._tTime,g)&&(m=1-v,h.vars.repeatRefresh&&h._initted&&h.invalidate())),v!==m||f||h._zTime===br||!p&&h._zTime){if(h._initted||!wt(h,p,f,d)){for(c=h._zTime,h._zTime=p||(d?br:0),d=d||p&&!c,h.ratio=v,h._from&&(v=1-v),h._time=0,h._tTime=y,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&&Lt(h,"onUpdate"),y&&h._repeat&&!d&&h.parent&&Lt(h,"onRepeat"),(p>=h._tDur||p<0)&&h.ratio===v&&(v&&on(h,1),d||(Lt(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(),He(Ke(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?kt(this):this;if(this.timeline)return p=this.timeline.totalDuration(),this.timeline.killTweensOf(e,t,Hn&&!0!==Hn.vars.overwrite)._first||kt(this),this.parent&&p!==this.timeline.totalDuration()&&Bt(this,this._dur*this.timeline._tDur/p,0,1),this;var r,n,i,o,a,s,l,u=this._targets,c=e?fn(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),kt(this);for(r=this._op=this._op||[],"all"!==t&&(Cr(t)&&(a={},st(t,(function(e){return a[e]=1})),t=a),t=function(e,t){var r,n,i,o,a=(e=e[0]?qr(e[0]).harness:0)&&e.aliases;if(!a)return t;for(n in r=ht({},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)||nn(this,s,"_pt"),delete n[a]),"all"!==i&&(i[a]=1);return this._initted&&!this._pt&&p&&kt(this),this}}],[{key:"to",value:function(e,r){return new t(e,r,arguments[2])}},{key:"from",value:function(e,t){return Tt(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 Tt(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 Kt.killTweensOf(e,t,r)}}]),t}()),Zn=(tn(Yn.prototype,{_targets:[],_lazy:0,_startAt:0,_op:0,_onInit:0}),st("staggerTo,staggerFrom,staggerFromTo",(function(e){Yn[e]=function(){var t=new Jn,r=pn.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}),qn=function(e,t,r){return e[t](r)},$n=function(e,t,r,n){return e[t](n.fp,r)},ei=function(e,t){return Tr(e[t])?qn:$e(e[t])&&e.setAttribute?In:Zn},ti=function(e,t){return t.set(t.t,t.p,Math.round(1e6*(t.s+t.c*e))/1e6,t)},ri=function(e,t){return t.set(t.t,t.p,!!(t.s+t.c*e),t)},ni=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},ii=function(){function e(t,r,n,i,o,a,s,l,u){We(this,e),this.t=r,this.s=i,this.c=o,this.p=n,this.r=a||ti,this.d=s||this,this.set=l||Zn,this.pr=u||0,(this._next=t)&&(t._prev=this)}return Xe(e,[{key:"modifier",value:function(e,t,r){this.mSet=this.mSet||this.set,this.set=Gn,this.m=e,this.mt=r,this.tween=t}}]),e}(),oi=(st(Yr+"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 zr[e]=1})),jr.TweenMax=jr.TweenLite=Yn,jr.TimelineLite=jr.TimelineMax=Jn,Kt=new Jn({sortChildren:!1,defaults:gr,autoRemoveChildren:!0,id:"root",smoothChildTiming:!0}),vr.stringFilter=function(e){var t=e.join(" ");if(wn.lastIndex=0,wn.test(t))return t=An.test(t),e[1]=Gt(e[1],t),e[0]=Gt(e[0],t,xn(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=Tr(e),n=(r=t&&!r&&e.init?function(){this._props=[]}:e,{init:ot,render:Ln,add:Kn,kill:Un,modifier:kn,rawVars:0}),i={targetTest:0,get:0,getSetter:ei,aliases:{},register:0};if(Bn(),e!==r){if(Kr[t])return;tn(r,tn(rn(e,n),i)),ht(r.prototype,ht(n,rn(e,i))),Kr[r.prop=t]=r,e.targetTest&&(Wr.push(r),zr[t]=1),t=("css"===t?"CSS":t.charAt(0).toUpperCase()+t.substr(1))+"Plugin"}it(t,r),e.register&&e.register(si,r,ii)}))},timeline:function(e){return new Jn(e)},getTweensOf:function(e,t){return Kt.getTweensOf(e,t)},getProperty:function(e,t,r,n){Cr(e)&&(e=fn(e)[0]);var i=qr(e||{}).get,o=r?ct:ut;return"native"===r&&(r=""),e&&(t?o((Kr[t]&&Kr[t].get||i)(e,t,r,n)):function(t,r,n){return o((Kr[t]&&Kr[t].get||i)(e,t,r,n))})},quickSetter:function(e,t,r){var n,i;if(1<(e=fn(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=Kr[t],a=qr(e),s=a.harness&&(a.harness.aliases||{})[t]||t,l=o?function(t){var n=new o;qt._pt=0,n.init(e,r?t+r:t,qt,0,[e]),n.render(1,n),qt._pt&&Ln(1,qt)}:a.set(e,s);return o?l:function(t){return l(e,s,r?t+r:t,a,1)}},isTweening:function(e){return 0<Kt.getTweensOf(e,!0).length},defaults:function(e){return e&&e.ease&&(e.ease=_n(e.ease,gr.ease)),pt(gr,e||{})},config:function(e){return pt(vr,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&&!Kr[e]&&!jr[e]&&nt(t+" effect requires "+e+" plugin.")})),Qr[t]=function(e,t,n){return r(fn(e),tn(t||{},i),n)},e&&(Jn.prototype[t]=function(e,r,n){return this.add(Qr[t](e,_r(r)?r:(n=r)&&{},this),n)})},registerEase:function(e,t){Mn[e]=_n(t)},parseEase:function(e,t){return arguments.length?_n(e,t):Mn},getById:function(e){return Kt.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=Dr(r.smoothChildTiming),Kt.remove(i),i._dp=0,i._time=i._tTime=Kt._time,e=Kt._first;e;)t=e._next,!n&&!e._dur&&e instanceof Yn&&e.vars.onComplete===e._targets[0]||bt(i,e,e._start-e._delay),e=t;return bt(Kt,i,0),i},utils:{wrap:function e(t,r,n){var i=r-t;return Pr(t)?Ot(t,e(0,t.length),r):cn(n,(function(e){return(i+(e-t)%i)%i+t}))},wrapYoyo:function e(t,r,n){var i=r-t,o=2*i;return Pr(t)?Ot(t,e(0,t.length-1),r):cn(n,(function(e){return t+(i<(e=(o+(e-t)%o)%o||0)?o-e:e)}))},distribute:_t,random:Pt,snap:Rt,normalize:function(e,t,r){return It(e,t,0,1,r)},getUnit:hn,clamp:function(e,t,r){return cn(r,(function(r){return Et(e,t,r)}))},splitColor:bn,toArray:fn,selector:function(e){return e=fn(e)[0]||nt("Invalid scope")||{},function(t){var r=e.current||e.nativeElement||e;return fn(t,r.querySelectorAll?r:r===e?nt("Invalid scope")||Wt.createElement("div"):e)}},mapRange:It,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||hn(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=Cr(t),p={};if(!0===n&&(i=1)&&(n=null),h)t={p:t},r={p:r};else if(Pr(t)&&!Pr(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=ht(Pr(t)?[]:{},t));if(!l){for(a in r)Kn.call(p,t,a,"get",r[a]);o=function(e){return Ln(e,p),h?t.p:t}}}return cn(n,o)},shuffle:mn},install:rt,effects:Qr,ticker:Sn,updateRoot:Jn.updateRoot,plugins:Kr,globalTimeline:Kt,core:{PropTween:ii,globals:it,Tween:Yn,Timeline:Jn,Animation:zn,getCache:qr,_removeLinkedListItem:nn,suppressOverwrites:function(e){return Vt=e}}}),ai=(st("to,from,fromTo,delayedCall,set,killTweensOf",(function(e){return oi[e]=Yn[e]})),Sn.add(Jn.updateRoot),qt=oi.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=oi.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])}},jn("roundProps",Dt),jn("modifiers"),jn("snap",Rt))||oi,li=(Yn.version=Jn.version=si.version="3.9.1",Yt=1,et()&&Bn(),Mn.Power0,Mn.Power1,Mn.Power2,Mn.Power3,Mn.Power4,Mn.Linear,Mn.Quad,Mn.Cubic,Mn.Quart,Mn.Quint,Mn.Strong,Mn.Elastic,Mn.Back,Mn.SteppedEase,Mn.Bounce,Mn.Sine,Mn.Expo,Mn.Circ,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 ui=(e,t,r,n,i)=>{let o=Object.assign({},e),a=new Yn(o,r,t).eventCallback("onUpdate",(e=>n&&n(o))).eventCallback("onComplete",(e=>{i&&i(),Yn.killTweensOf(a)}));return a},ci=e=>li(void 0,void 0,void 0,(function*(){-1!==e.indexOf(",")&&(e=hi(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})),hi=e=>e.substring(e.indexOf(",")+1),pi=e=>URL.createObjectURL(new Blob([e])),di=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)},fi=e=>li(void 0,void 0,void 0,(function*(){return(yield s().get(e,{responseType:"blob"})).data})),mi=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})},vi=e=>li(void 0,void 0,void 0,(function*(){return mi(yield(0,je.toResult)(e,"base64"))})),gi=(e,t)=>new File([e],t),yi=e=>e.substring(e.indexOf(":")+1,e.indexOf(";")),bi=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},xi=e=>(0,Ge.md5)(e),wi=(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})}}))},Ai=e=>new Array(e.files.length).fill(0).map(((t,r)=>e.files.item(r))).filter((e=>null!==e)),Si=e=>new Promise((t=>{e.toBlob((e=>{t(e)}))})),Bi=(e,t)=>s().get(e,{responseType:t||"arraybuffer"}).then((e=>e.data)).catch((e=>{console.log(e,"加载出错")})),Mi=(e,t)=>Object.assign(e,t||{}),Ci=(e,t=0)=>{let r=setTimeout((()=>(null!==r&&clearTimeout(r),r=null,e())),t)},Ti=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},Ei=(e,t,r=1,n)=>new Array(t).fill("").map(((t,i)=>e+(i+r)+(n||""))),_i=e=>e.toString().replace(/(\[object )([a-zA-Z]+)(])/,"$2"),Di=(e,t)=>((0,Oe.js)(e,((r,n)=>{let i=t[r];void 0!==i&&("Object"===_i(n)&&"Object"===_i(i)&&(i=Di(n,i)),e[r]=i)})),e),Ri=(e,t)=>e.find((e=>e===t)),Pi=(e,t,r=!1)=>{let n=e/t;return r&&(n*=100),Number(n.toFixed(2))},Oi=e=>li(void 0,void 0,void 0,(function*(){if(!e)throw TypeError("该参数为空");var t=yield Qi(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}})),Ii=e=>{for(var t=new ArrayBuffer(e.length),r=new Uint8Array(t),n=0;n<e.length;++n)r[n]=e[n];return t};var Fi=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 Li=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()},ki=e=>Fi(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)}))}))})),Ui=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)},Gi=e=>Fi(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=ra(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)}))})),ji=(e,t)=>URL.createObjectURL(new Blob([e],t)),Hi=(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)}))},Ni=e=>Fi(void 0,void 0,void 0,(function*(){var{bitmap:t,texture:r}=e;const{ctx:n,canvas:i}=yield wi(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=Vi(o.data[a],o.data[a+1],o.data[a+2]))[0]/100,u=c[1]/100,c=c[2]/100;l=Ki(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 Ie.Texture(i)})),zi=e=>{for(var t=(e=e.bitmap).width,r=e.height,n=Ji(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)))},Ji=e=>{const t=document.createElement("canvas"),r=t.getContext("2d");return r.drawImage(e,0,0,e.width,e.height),{ctx:r,canvas:t}},Vi=(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]},Ki=(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]},Qi=e=>{const t=new Image;return t.src=e,new Promise((e=>{t.onload=()=>{e(t)}}))};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 Wi(e,t){return(Wi=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)}var Zi=new c.Box3,qi=new c.Vector3,$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&&Wi(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;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),Zi.setFromBufferAttribute(t),this.boundingBox.union(Zi))}},{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++)qi.fromBufferAttribute(e,i),n=Math.max(n,r.distanceToSquared(qi)),qi.fromBufferAttribute(t,i),n=Math.max(n,r.distanceToSquared(qi));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 eo(e){return(eo="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 to(e,t){return(to=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ro(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function no(e){return(no=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}$i.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 io=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&&to(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=no(e);if(r=t?(r=no(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===eo(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return ro(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(ro(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 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 ao(e,t){return(ao=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function so(e){return(so=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}io.prototype.isLineMaterial=!0;var lo,uo,co,ho,po=new c.Vector3,fo=new c.Vector3,mo=new c.Vector4,vo=new c.Vector4,go=new c.Vector4,yo=new c.Vector3,bo=new c.Matrix4,xo=new c.Line3,wo=new c.Vector3,Ao=new c.Box3,So=new c.Sphere,Bo=new c.Vector4;function Mo(e,t,r){return Bo.set(0,0,-t,1).applyMatrix4(e.projectionMatrix),Bo.multiplyScalar(1/Bo.w),Bo.x=ho/r.width,Bo.y=ho/r.height,Bo.applyMatrix4(e.projectionMatrixInverse),Bo.multiplyScalar(1/Bo.w),Math.abs(Math.max(Bo.x,Bo.y))}var Co=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ao(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=so(e);if(r=t?(r=so(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 $i,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new io({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)po.fromBufferAttribute(t,i),fo.fromBufferAttribute(r,i),n[o]=0===o?0:n[o-1],n[o+1]=n[o]+po.distanceTo(fo);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=(lo=e.ray,e=this.matrixWorld,this.geometry),a=this.material;if(ho=a.linewidth+i,uo=o.attributes.instanceStart,co=o.attributes.instanceEnd,null===o.boundingSphere&&o.computeBoundingSphere(),So.copy(o.boundingSphere).applyMatrix4(e),i=r?.5*ho:Mo(n,Math.max(n.near,So.distanceToPoint(lo.origin)),a.resolution),So.radius+=i,!1!==lo.intersectsSphere(So)&&(null===o.boundingBox&&o.computeBoundingBox(),Ao.copy(o.boundingBox).applyMatrix4(e),i=r?.5*ho:Mo(n,Math.max(n.near,Ao.distanceToPoint(lo.origin)),a.resolution),Ao.expandByScalar(i),!1!==lo.intersectsBox(Ao)))if(r)for(var s=t,l=0,u=uo.count;l<u;l++){xo.start.fromBufferAttribute(uo,l),xo.end.fromBufferAttribute(co,l);var h=new c.Vector3,p=new c.Vector3;lo.distanceSqToSegment(xo.start,xo.end,p,h),p.distanceTo(h)<.5*ho&&s.push({point:p,pointOnLine:h,distance:lo.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,g=d.matrixWorld,y=(e=d.geometry).attributes.instanceStart,b=e.attributes.instanceEnd,x=-o.near;lo.at(1,go),go.w=1,go.applyMatrix4(o.matrixWorldInverse),go.applyMatrix4(m),go.multiplyScalar(1/go.w),go.x*=v.x/2,go.y*=v.y/2,go.z=0,yo.copy(go),bo.multiplyMatrices(o.matrixWorldInverse,g);for(var w,A,S,B,M=0,C=y.count;M<C;M++)mo.fromBufferAttribute(y,M),vo.fromBufferAttribute(b,M),mo.w=1,vo.w=1,mo.applyMatrix4(bo),vo.applyMatrix4(bo),mo.z>x&&vo.z>x||(mo.z>x?(w=mo.z-vo.z,w=(mo.z-x)/w,mo.lerp(vo,w)):vo.z>x&&(w=vo.z-mo.z,A=(vo.z-x)/w,vo.lerp(mo,A)),mo.applyMatrix4(m),vo.applyMatrix4(m),mo.multiplyScalar(1/mo.w),vo.multiplyScalar(1/vo.w),mo.x*=v.x/2,mo.y*=v.y/2,vo.x*=v.x/2,vo.y*=v.y/2,xo.start.copy(mo),xo.start.z=0,xo.end.copy(vo),xo.end.z=0,A=xo.closestPointToPointParameter(yo,!0),xo.at(A,wo),S=-1<=(S=c.MathUtils.lerp(mo.z,vo.z,A))&&S<=1,B=yo.distanceTo(wo)<.5*ho,S&&B&&(xo.start.fromBufferAttribute(y,M),xo.end.fromBufferAttribute(b,M),xo.start.applyMatrix4(g),xo.end.applyMatrix4(g),S=new c.Vector3,B=new c.Vector3,lo.distanceSqToSegment(xo.start,xo.end,B,S),f.push({point:B,pointOnLine:S,distance:lo.origin.distanceTo(B),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 To(e){return(To="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(){return(Eo="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=Do(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 Do(e){return(Do=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}Co.prototype.isLineSegments2=!0;var Ro=function(){var e=n,t=$i;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=Do(e);if(r=t?(r=Do(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===To(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 Eo(Do(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 Eo(Do(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 Po(e){return(Po="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 Oo(e,t){return(Oo=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Io(e){return(Io=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}Ro.prototype.isLineGeometry=!0;var Fo=function(){var e=n,t=Co;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&&Oo(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=Io(e);if(r=t?(r=Io(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Po(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 Ro,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new io({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}();Fo.prototype.isLine2=!0;const Lo=(e,t)=>(t.updateMatrixWorld(!0),t=new Ie.Vector3,e.getWorldPosition(t),t),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:e,y:t,z:r}=e;return null==r?{x:e,y:t}:{x:e,y:t,z:r}}},Uo=(e,t)=>e.distanceTo(t),Go=e=>new S(e),jo=e=>new F(e),Ho=e=>new B(e),No=(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)},zo=(e,t,r)=>{"Group"===e.type||"Object3D"===e.type?e.children.forEach((e=>zo(e,t,r))):No(e,t,r)},Jo=e=>(e.mapping=c.EquirectangularReflectionMapping,e),Vo=e=>{let t=e=>"Group"!==e.type&&"Object3D"!==e.type||1!==e.children.length?e:t(e.children[0]);return t(e)},Ko=(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)},Qo=(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}},Xo=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},Wo=e=>{var{pointArray:e,material:t,lineWidth:r,colorArray:n}=e;const i=new Ro,o=(i.setPositions(e),t||new io({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 Fo(i,o));return a.name="gw",a.computeLineDistances(),a},Yo=e=>3.1415926*e/180,Zo=(e,t="name",r)=>{const n={};return e.traverse((e=>{"id"===t?n[e.userData.id]=e:n[e[t]]=e,null!=r&&r(e)})),n},qo=(e,t,r,n,i,o)=>({cx:e,cy:t,cz:r,tx:n,ty:i,tz:o});var $o=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 ea{constructor(e){this.allTextures=new Set,this.setAnima=e=>{const{texture:t,type:r,val:n}=e,i=t.userData.uvScript||{};t.userData.uvScript||(t.userData.uvScript=i),0===n?delete i[r]:i[r]=n,this.runScene.cb.texture.setAnima.cb({texture:t,uvScript:i})},this.runScene=e}load(e){return $o(this,void 0,void 0,(function*(){var t=yield fi(e);return this.parse(t)}))}parse(e){return $o(this,void 0,void 0,(function*(){var t="Blob"===_i(e)?e:yield vi(e);return this.afterLoad(t,yield ua(t))}))}clone(e){const t=new c.Texture(e.image);return t.userData=Object.assign(Object.assign({},e.userData),{id:(0,l.getId)()}),oa(t),this.getSameAndAddtoAll(t)}getDef(e){return e=new c.Texture(e),oa(e),this.getSameAndAddtoAll(e)}getSameAndAddtoAll(e){var t=e.userData.md5;return(t=this.getSameTexture(t,e))?(ia(e),t):(this.initTextureAndAddtoAll(e),e)}afterLoad(e,t){return $o(this,void 0,void 0,(function*(){return this.getSameAndAddtoAll(yield oa(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 $o(this,void 0,void 0,(function*(){return sa(e),oa(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.cb.texture.add.cb(e)}getBlobAndBase64(e){return e.userData.blob?e.userData:Gi(e)}coverByImage(e,t){return $o(this,void 0,void 0,(function*(){let r;r=da(t)?t:t?yield this.parse(t):null;var n=this.runScene.uniqueEx.texture.getMaterials(this.runScene.uniqueEx.getId(e));if(n){const t=[];(0,Oe.js)(n,((n,i)=>{const o=this.runScene.uniqueEx.material.get(n);o&&i.forEach((n=>{t.push(new Ue({target:o,info:n,newVal:r,oldVal:e,runScene:this.runScene}).execute())}))})),this.runScene.undoEx.addUndo(t)}}))}removeTexture(e){this.runScene.cb.texture.remove.cb(e),this.runScene.uniqueEx.texture.remove(e)}}const ta={环境遮蔽:"aoMap",法线:"normalMap",金属度:"metalnessMap",粗糙度:"roughnessMap",自发光:"emissiveMap",颜色:"map",置换:"displacementMap",光照贴图:"lightMap",环境:"envMap",透明度:"alphaMap"},ra=e=>1023===e.format?"image/png":"image/jpeg",na=e=>{var{width:e,height:t}=e.image;return e*t*4*1.33},ia=e=>{var t,r,n;e&&(r=e.image,n=e.userData.url,null!=(t=r.close)&&t.call(r),URL.revokeObjectURL(n),e.dispose())},oa=(e,t)=>$o(void 0,void 0,void 0,(function*(){const r=t||e.userData.blob||(yield aa(e));var{md5:n,url:i}=e.userData;return e.userData.blob=r,n||(e.userData.md5=xi(yield r.arrayBuffer())),i||(e.userData.url=URL.createObjectURL(r)),e.userData.gm=na(e),e.format=e.userData.format||-1!==r.type.indexOf("png")?1023:1022,e})),aa=e=>e.userData.blob||ki(e.image),sa=e=>(e.magFilter=1003,e.wrapS=Ie.RepeatWrapping,e.wrapT=Ie.RepeatWrapping,e.encoding=3e3,e.version=3,e.flipY=!1,e.minFilter=Ie.LinearMipmapLinearFilter,e.needsUpdate=!0,e),la=e=>createImageBitmap(e,{imageOrientation:"flipY",resizeQuality:"pixelated"}),ua=e=>$o(void 0,void 0,void 0,(function*(){var t=yield la(e instanceof Blob?e:yield fi(e));return new c.Texture(t)})),ca=e=>null==(e=e.userData)?void 0:e.url,ha=(e,t="repeat")=>(e.mapping="repeat"===t?Ie.EquirectangularReflectionMapping:300,e.needsUpdate=!0,e),pa=e=>{var{width:e,height:t}=e.image;return{width:e,height:t}},da=e=>null==e?void 0:e.isTexture;class fa{constructor(e){this.bloomParams={isBloom:!1,bloomStrength:2,bloomThreshold:0,bloomRadius:0},this.runScene=e,this.info=new Pe(this.runScene),this.BLOOM_SCENE=1,this.bloomParams.isBloom=!1,this.isUpdate=!0,this.sceneFogColor=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)}}),this.runScene.cb.setScene.add("glow",(({type:e,val:t})=>{"fog"===e&&t&&(this.sceneFogColor=new c.Color(0),this.sceneFogColor.copy(t.color)),"background"===e&&(this.sceneBackground&&da(this.sceneBackground)&&this.sceneBackground.dispose(),this.sceneBackground=t,this.bloomRenderPass&&(this.bloomRenderPass.sceneBg=this.sceneBackground))}))}static getInstance(e){return fa.instance||(fa.instance=new fa(e)),fa.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.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))}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 Te(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 De(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 _e(Re,"baseTexture","bloomTexture"),this.mixingPass.renderToScreen=!1),this.effectCopy||(this.effectCopy=new ee(z),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 ge(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.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}}class ma{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 va(e){return(va="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 ga(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&&ya(e,t)}function ya(e,t){return(ya=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ba(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function xa(e){return(xa=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var wa={type:"change"},Aa={type:"start"},Sa={type:"end"},Ba=function(){ga(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=xa(e);if(r=t?(r=xa(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===va(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return ba(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(wa),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&&O(2*Math.PI/60/60*p.autoRotateSpeed),p.enableDamping?(v.theta+=g.theta*p.dampingFactor,v.phi+=g.phi*p.dampingFactor):(v.theta+=g.theta,v.phi+=g.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*=y,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?(g.theta*=1-p.dampingFactor,g.phi*=1-p.dampingFactor,b.multiplyScalar(1-p.dampingFactor)):(g.set(0,0,0),b.set(0,0,0)),y=1,!(!(x||l.distanceToSquared(p.object.position)>m||8*(1-u.dot(p.object.quaternion))>m)||(p.dispatchEvent(wa),l.copy(p.object.position),u.copy(p.object.quaternion),x=!1))}),i.dispose=function(){p.domElement.removeEventListener("contextmenu",ne),p.domElement.removeEventListener("pointerdown",Z),p.domElement.removeEventListener("pointercancel",ee),p.domElement.removeEventListener("wheel",te),p.domElement.removeEventListener("pointermove",q),p.domElement.removeEventListener("pointerup",$),null!==p._domElementKeyEvents&&p._domElementKeyEvents.removeEventListener("keydown",re)};var i,o,a,s,l,u,h,p=ba(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,g=new c.Spherical,y=1,b=new c.Vector3,x=!1,w=new c.Vector2,A=new c.Vector2,S=new c.Vector2,B=new c.Vector2,M=new c.Vector2,C=new c.Vector2,T=new c.Vector2,E=new c.Vector2,_=new c.Vector2,D=[],R={};function P(){return Math.pow(.95,p.zoomSpeed)}function O(e){g.theta-=e}function I(e){g.phi-=e}F=new c.Vector3;var F,L,k,U=function(e,t){F.setFromMatrixColumn(t,0),F.multiplyScalar(-e),b.add(F)},G=(L=new c.Vector3,function(e,t){!0===p.screenSpacePanning?L.setFromMatrixColumn(t,1):(L.setFromMatrixColumn(t,0),L.crossVectors(p.object.up,L)),L.multiplyScalar(e),b.add(L)}),j=(k=new c.Vector3,function(e,t){var r,n=p.domElement;p.object.isPerspectiveCamera?(r=p.object.position,k.copy(r).sub(p.target),r=k.length(),r*=Math.tan(p.object.fov/2*Math.PI/180),U(2*e*r/n.clientHeight,p.object.matrix),G(2*t*r/n.clientHeight,p.object.matrix)):p.object.isOrthographicCamera?(U(e*(p.object.right-p.object.left)/p.object.zoom/n.clientWidth,p.object.matrix),G(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 H(e){p.object.isPerspectiveCamera?y/=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 N(e){p.object.isPerspectiveCamera?y*=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 z(e){w.set(e.clientX,e.clientY)}function J(e){B.set(e.clientX,e.clientY)}function V(){var e,t;1===D.length?w.set(D[0].pageX,D[0].pageY):(e=.5*(D[0].pageX+D[1].pageX),t=.5*(D[0].pageY+D[1].pageY),w.set(e,t))}function K(){var e,t;1===D.length?B.set(D[0].pageX,D[0].pageY):(e=.5*(D[0].pageX+D[1].pageX),t=.5*(D[0].pageY+D[1].pageY),B.set(e,t))}function Q(){var e=D[0].pageX-D[1].pageX,t=D[0].pageY-D[1].pageY;e=Math.sqrt(e*e+t*t),T.set(0,e)}function X(e){1==D.length?A.set(e.pageX,e.pageY):(r=ae(e),t=.5*(e.pageX+r.x),e=.5*(e.pageY+r.y),A.set(t,e)),S.subVectors(A,w).multiplyScalar(p.rotateSpeed);var t,r=p.domElement;O(2*Math.PI*S.x/r.clientHeight),I(2*Math.PI*S.y/r.clientHeight),w.copy(A)}function W(e){var t,r;1===D.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)),C.subVectors(M,B).multiplyScalar(p.panSpeed),j(C.x,C.y),B.copy(M)}function Y(e){var t=ae(e),r=e.pageX-t.x;e=e.pageY-t.y,t=Math.sqrt(r*r+e*e),E.set(0,t),_.set(0,Math.pow(E.y/T.y,p.zoomSpeed)),H(_.y),T.copy(E)}function Z(e){if(!1!==p.enabled)if(0===D.length&&(p.domElement.setPointerCapture(e.pointerId),p.domElement.addEventListener("pointermove",q),p.domElement.addEventListener("pointerup",$)),D.push(e),"touch"===e.pointerType){switch(oe(e),D.length){case 1:switch(p.touches.ONE){case c.TOUCH.ROTATE:if(!1===p.enableRotate)return;V(),f=d.TOUCH_ROTATE;break;case c.TOUCH.PAN:if(!1===p.enablePan)return;K(),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&&K(),f=d.TOUCH_DOLLY_PAN;break;case c.TOUCH.DOLLY_ROTATE:if(!1===p.enableZoom&&!1===p.enableRotate)return;p.enableZoom&&Q(),p.enableRotate&&V(),f=d.TOUCH_DOLLY_ROTATE;break;default:f=d.NONE}break;default:f=d.NONE}f!==d.NONE&&p.dispatchEvent(Aa)}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){T.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;J(r),f=d.PAN}else{if(!1===p.enableRotate)return;z(r),f=d.ROTATE}break;case c.MOUSE.PAN:if(r.ctrlKey||r.metaKey||r.shiftKey){if(!1===p.enableRotate)return;z(r),f=d.ROTATE}else{if(!1===p.enablePan)return;J(r),f=d.PAN}break;default:f=d.NONE}f!==d.NONE&&p.dispatchEvent(Aa)}}function q(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;X(t),p.update();break;case d.TOUCH_PAN:if(!1===p.enablePan)return;W(t),p.update();break;case d.TOUCH_DOLLY_PAN:if(!1===p.enableZoom&&!1===p.enablePan)return;!function(e){p.enableZoom&&Y(e),p.enablePan&&W(e)}(t),p.update();break;case d.TOUCH_DOLLY_ROTATE:if(!1===p.enableZoom&&!1===p.enableRotate)return;!function(e){p.enableZoom&&Y(e),p.enableRotate&&X(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){A.set(e.clientX,e.clientY),S.subVectors(A,w).multiplyScalar(p.rotateSpeed),e=p.domElement,O(2*Math.PI*S.x/e.clientHeight),I(2*Math.PI*S.y/e.clientHeight),w.copy(A),p.update()}(r);break;case d.DOLLY:if(!1===p.enableZoom)return;!function(e){E.set(e.clientX,e.clientY),_.subVectors(E,T),0<_.y?H(P()):_.y<0&&N(P()),T.copy(E),p.update()}(r);break;case d.PAN:if(!1===p.enablePan)return;!function(e){M.set(e.clientX,e.clientY),C.subVectors(M,B).multiplyScalar(p.panSpeed),j(C.x,C.y),B.copy(M),p.update()}(r)}}}function $(e){ie(e),0===D.length&&(p.domElement.releasePointerCapture(e.pointerId),p.domElement.removeEventListener("pointermove",q),p.domElement.removeEventListener("pointerup",$)),p.dispatchEvent(Sa),f=d.NONE}function ee(e){ie(e)}function te(e){!1!==p.enabled&&!1!==p.enableZoom&&f===d.NONE&&(e.preventDefault(),p.dispatchEvent(Aa),e.deltaY<0?N(P()):0<e.deltaY&&H(P()),p.update(),p.dispatchEvent(Sa))}function re(e){if(!1!==p.enabled&&!1!==p.enablePan){var t=!1;switch(e.code){case p.keys.UP:j(0,p.keyPanSpeed),t=!0;break;case p.keys.BOTTOM:j(0,-p.keyPanSpeed),t=!0;break;case p.keys.LEFT:j(p.keyPanSpeed,0),t=!0;break;case p.keys.RIGHT:j(-p.keyPanSpeed,0),t=!0}t&&(e.preventDefault(),p.update())}}function ne(e){!1!==p.enabled&&e.preventDefault()}function ie(e){delete R[e.pointerId];for(var t=0;t<D.length;t++)if(D[t].pointerId==e.pointerId)return void D.splice(t,1)}function oe(e){var t=R[e.pointerId];void 0===t&&(t=new c.Vector2,R[e.pointerId]=t),t.set(e.pageX,e.pageY)}function ae(e){return e=e.pointerId===D[0].pointerId?D[1]:D[0],R[e.pointerId]}return p.domElement.addEventListener("contextmenu",ne),p.domElement.addEventListener("pointerdown",Z),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 Ma{create(e,t){return new Ba(e,t)}static toJSON(e){return e.target}}class Ca{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}}class Ta{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.cb.scene.saveNet.cb("")})),d_exporter_Gltf:()=>{this.events.runScene.exporter.gltf.scene()},alt_selectDom:()=>{console.log("多选dom")},r_runScript:()=>{console.log("运行脚本")},d_copyModel:()=>{var e,t=this.events.runScene.modelEx.select;t&&(this.events.runScene.modelEx.selectNull(),(e=this.events.runScene.modelEx.clone(t,!1))&&this.events.runScene.modelEx.add(e,t.parent,{isClone:!0}))},g_createGroup:()=>{console.log("生成组")},meta_showMateriallLibrary:()=>{console.log("弹出材质库窗口")},f_focusModel:()=>{var e=this.events.runScene.modelEx.select;e&&this.events.runScene.modelEx.focus(e)},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,Oe.js)(this.eventsMap.down,((r,n)=>{n(t,e)})),t){case"s":this.ctrl&&(e.preventDefault(),this.allFn.s_saveScene());break;case"d":this.ctrl&&(e.preventDefault(),this.allFn.d_copyModel());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.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();var r=this.events.runScene.multipSelector.getSelectedList("value");this.events.runScene.sceneEx.remove(this.events.runScene.modelEx.select||r),r&&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,Oe.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 Ea{constructor(e){this.downPosition={x:0,y:0},this.enableUp=!0,this.fnMap={global:{down:{},up:{}},local:{down:{},up:{}}},this.down=e=>{(0,Oe.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,Oe.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.cb.events.pointer.down.cb(e)})),window.addEventListener("pointerup",(e=>{this.events.runScene.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.runScene.cb.model.click.cb(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 Da=a.n(o),Ra=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 Le)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,depthTest:!0,depthWrite:!0,opacity:1};class Ia{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.cb.undo.addUndos.cb({undoVal:e,undos:this.undos}),t}removeUndos(e){var t;return this.undos.splice(e),t=this.dataMap.history.splice(e),this.dataMap.index=this.undos.length-1,this.runScene.cb.undo.removeUndos.cb({index:e}),t}undoByIndex(e){e>this.dataMap.index?this.undos.slice(this.dataMap.index+1,e+1).map((e=>{e instanceof Array?e.map((e=>e.redo())):e.redo()})):e<this.dataMap.index&&this.undos.slice(e+1,this.dataMap.index+1).reverse().map((e=>{e instanceof Array?e.map((e=>e.undo())):e.undo()})),this.dataMap.index=e,this.runScene.cb.undo.undoByIndex.cb(e)}addUndo(e){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.cb.undo.reset.cb("")}}function Fa(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=Fa(e[t]),n[t]=r);return n}}const La=class extends ke{constructor(e){super(),this.type="多层级修改",this.target=e.target,this.typeList=e.typeList,this.new=e.newVal,this.cb=e.cb,this.old=(0,Oe.qR)(e.target,this.typeList)[(0,Ra.lastArrayEle)(e.typeList)]}execute(){return this.redo(),this}_execute(e){const t=(0,Oe.qR)(this.target,this.typeList);t[(0,Ra.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 ka{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:Fa(Ua.uniforms),vertexShader:Ua.vertexShader,fragmentShader:Ua.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=>!ka.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=qa(),r=(t.userData=Object.assign(Object.assign({},t.userData),{normal:{type:this.tools.type,uniforms:{}},textures:this.tools.getTextures(e)}),{}),n=e.uniforms,i=Ua.uniforms;return Object.keys(n).filter((e=>!ka.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:Fa(Ua.uniforms),vertexShader:Ua.vertexShader,fragmentShader:Ua.fragmentShader});return e.userData.tools=this.tools,e}undo(e){var{material:e,list:t,val:r}=e;this.runScene.undoEx.addUndo(new La({target:e,typeList:["uniforms",...t],newVal:r}).execute())}}ka.TextureNames=["sideWallTex","backWallTex","floorTex","ceilingTex"];const Ua={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)},depthTest:{value:!0},depthWrite:{value:!0}},vertexShader:"\n varying vec2 vUv;\n varying vec3 vPos;\n varying mat4 vModelMatrix;\n \n void main() {\n vUv = uv;\n vPos = position;\n vModelMatrix = modelMatrix;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }\n ",fragmentShader:"\n uniform float roomIntensity;\n uniform vec4 roomColorTint;\n \n uniform sampler2D sideWallTex;\n uniform sampler2D backWallTex;\n uniform sampler2D floorTex;\n uniform sampler2D ceilingTex;\n \n uniform float sideWallTexTiling;\n uniform float backWallTexTiling;\n uniform float floorTexTiling;\n uniform float ceilingTexTiling;\n \n uniform float roomTile;\n uniform vec4 roomsXYZPropsW;\n uniform vec4 positionOffsetRoomsXYZPropsW;\n \n varying vec2 vUv;\n varying vec3 vPos;\n varying mat4 vModelMatrix;\n \n void main() {\n vec4 interpVertexPos = vec4(vPos.xyz, vPos.z);\n // 将相机世界空间坐标转换为对象空间坐标\n vec4 cameraObjectPos = inverse(vModelMatrix) * vec4(cameraPosition, 1.0);\n vec4 transCameraPos = vec4(cameraObjectPos.xyz, cameraObjectPos.z);\n \n vec4 temp1 = (interpVertexPos - positionOffsetRoomsXYZPropsW);\n vec4 temp2 = ((roomsXYZPropsW + vec4(-1E-05, -1E-05, -1E-05, -1E-05)) * roomTile);\n vec4 V2 = transCameraPos - positionOffsetRoomsXYZPropsW;\n vec4 V1 = temp1 - V2;\n vec4 middleman = ((floor(temp2 * temp1) + step(vec4(0, 0, 0, 0), V1)) / temp2 - V2) / V1;\n \n // Side Walls\n vec2 sideWallUv = (middleman.x * V1 + V2).zy * sideWallTexTiling;\n vec4 sideWallColor = texture2D(sideWallTex, sideWallUv);\n \n // Back Wall\n vec2 backWallUv = (middleman.z * V1 + V2).xy * backWallTexTiling;\n vec4 backWallColor = texture2D(backWallTex, backWallUv);\n \n // Floor Ceiling\n vec2 floorUv = ((middleman.y * V1) + V2).xz * floorTexTiling;\n vec2 ceilingUv = ((middleman.y * V1) + V2).xz * ceilingTexTiling;\n vec4 floorColor = texture2D(floorTex, floorUv);\n vec4 ceilingColor = texture2D(ceilingTex, ceilingUv);\n vec4 cfColor = mix(floorColor, ceilingColor, step(0.0, V1.y));\n \n // Mix\n float compareXZ = 0.0;\n float stepXZ = step(middleman.z, middleman.x);\n if(stepXZ <= 0.0)\n compareXZ = middleman.x;\n else\n compareXZ = middleman.z;\n \n vec4 wallColor = vec4(0);\n if(stepXZ <= 0.0)\n wallColor = sideWallColor;\n else\n wallColor = backWallColor;\n \n vec4 finalColor = vec4(0);\n if(middleman.y <= compareXZ)\n finalColor = cfColor;\n else\n finalColor = wallColor;\n \n // Tint Room\n vec4 tintColor = roomColorTint * finalColor * roomIntensity;\n \n gl_FragColor = tintColor;\n }\n "};class Ga{constructor(e){this.tools={type:"Fresnel",getTextures(e){const t=[];return e.envMap&&t.push({type:"envMap",texture:e.envMap}),e.displacementMap&&t.push({type:"displacementMap",texture:e.displacementMap}),t},parseData:e=>{const{textures:t,normal:r,material:n}=e,i=$a(n,new ja(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=>!Ga.TextureNames.includes(e))).map((e=>{i[e]=r.uniforms[e]})),i.insertFresnelShader(),i.userData.tools=this.tools,i},toNormal:e=>{const t=$a(e,qa()),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=Ha.uniforms;return Object.keys(n).filter((e=>!Ga.TextureNames.includes(e))).map((t=>{var i=e[t],o=n[t].value;"fresnelBias"===t||"fresnelScale"===t||"fresnelPower"===t||"isSurge"===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 ja(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 La({target:e,typeList:[...t],newVal:r}).execute())}}Ga.TextureNames=["envMap","displacementMap"];class ja extends c.MeshPhysicalMaterial{constructor(e,t,r){if(e?super(e):(super(),this.emissive=new c.Color(65535),this.envMap=null,this.displacementMap=null,this.metalness=0,this.roughness=0,this.ior=1.5,this.transmission=1,this.opacity=1,this.transparent=!0,this.thickness=0),this.runScene=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(Ha.uniforms.fresnelBias.value),this.fresnelScale=new c.Uniform(Ha.uniforms.fresnelScale.value),this.fresnelPower=new c.Uniform(Ha.uniforms.fresnelPower.value)),this.clock=new c.Clock,this.isSurge=new c.Uniform(!1),this.deltaTime=new c.Uniform(0),!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.cb.render.add("Fresnel",(()=>{this.update()}))}}insertFresnelShader(){this.onBeforeCompile=e=>{e.uniforms.isSurge=this.isSurge,e.uniforms.deltaTime=this.deltaTime,e.uniforms.fresnelBias=this.fresnelBias,e.uniforms.fresnelScale=this.fresnelScale,e.uniforms.fresnelPower=this.fresnelPower,e.vertexShader=e.vertexShader.replace(/varying vec3 vWorldPosition;/g,Ha.vertexParas),e.vertexShader=e.vertexShader.replace(/#include <begin_vertex>/g,Ha.vertexShader1),e.vertexShader=e.vertexShader.replace(/vWorldPosition = worldPosition.xyz;/g,Ha.vertexShader2),e.fragmentShader=e.fragmentShader.replace(/#include <transmission_pars_fragment>/g,Ha.fragmentParas),e.fragmentShader=e.fragmentShader.replace(/vec3 totalEmissiveRadiance = emissive;/g,Ha.fragmentShaderEmissive)}}update(){this.clock&&(this.deltaTime.value+=3*this.clock.getDelta()),this.cubeCamera&&(this.cubeCamera.position.copy(this.runScene.assetsEx.camera.position),this.cubeCamera.update(this.runScene.assetsEx.renderer,this.runScene.assetsEx.scene))}}const Ha={uniforms:{depthTest:new c.Uniform(!0),depthWrite:new c.Uniform(!0),isSurge:new c.Uniform(!1),deltaTime:new c.Uniform(0),fresnelBias:new c.Uniform(0),fresnelScale:new c.Uniform(1),fresnelPower:new c.Uniform(3)},vertexParas:"\n uniform bool isSurge;\n uniform float deltaTime;\n varying vec3 vWorldPosition;\n varying vec3 vWorldNormal;\n ",vertexShader1:"\n vec3 transformed = vec3(position);\n if(isSurge) {\n // 0.15作为系数控制气泡表面波纹的稀疏程度,数值越大越密\n float wobbleValue = 0.15 * transformed.y + deltaTime;\n // 三角函数的系数控制气泡表面波纹的波动幅度,数值越大波幅越大\n vec3 wobblePos = vec3(0.75 * cos(wobbleValue) + 0.25 * sin(wobbleValue));\n transformed += wobblePos;\n }\n ",vertexShader2:"\n 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 "};class Na{constructor(e){this.tools={type:"Physical",getTextures(e){const t=[];return Na.TextureNames.forEach((r=>{e[r]&&t.push({type:r,texture:e[r]})})),t},parseData:e=>{const{normal:t,textures:r,material:n}=e,i=$a(n,new c.MeshPhysicalMaterial);return i.name=n.name,r.forEach((e=>{i[e.type]=e.texture})),Object.keys(t.uniforms).filter((e=>!Na.IgnoredAttributes.includes(e))).map((e=>{var r=t.uniforms[e];i[e]="attenuationColor"===e||"sheenColor"===e||"specularColor"===e?new c.Color(r):"clearcoatNormalScale"===e?new c.Vector2(r.x,r.y):r})),i.userData.tools=this.tools,i},toNormal:e=>{const t=$a(e,qa()),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=new c.MeshPhysicalMaterial;return Object.keys(e).filter((e=>!Na.TextureNames.includes(e))).filter((e=>!Na.IgnoredAttributes.includes(e))).filter((e=>void 0===t[e])).map((t=>{const i=e[t],o=n[t];"attenuationColor"===t||"sheenColor"===t||"specularColor"===t?i.getHexString()!==o.getHexString()&&(r[t]=i.getHexString()):"clearcoatNormalScale"===t?i.x===o.x&&i.y===o.y||(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 c.MeshPhysicalMaterial;return t.userData.tools=this.tools,(e=e||this.runScene.modelEx.select)&&(t.name="MeshPhysicalMaterial-"+e.name),t}undo(e){var{material:e,list:t,val:r}=e;this.runScene.undoEx.addUndo(new La({target:e,typeList:[...t],newVal:r}).execute())}}Na.IgnoredAttributes=["_listeners","version"],Na.TextureNames=["alphaMap","aoMap","bumpMap","displacementMap","emissiveMap","envMap","lightMap","map","metalnessMap","normalMap","roughnessMap","clearcoatMap","clearcoatNormalMap","clearcoatRoughnessMap","sheenRoughnessMap","sheenColorMap","specularIntensityMap","specularColorMap","thicknessMap","transmissionMap"];const za={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}"},Ja={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 Va{constructor(e){this.materials={},this.render=()=>{(0,Oe.js)(this.materials,((e,t)=>{const{model:r,material:n}=t;n.update(r)}))},this.tools={type:"Reflector",getTextures:e=>ts(e),parseData:e=>{const{textures:t,normal:r,models:n,material:i}=e,o=$a(i,new Ka(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=>!Va.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=$a(e,qa()),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=>!Va.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.cb.render.add("Reflector-render",this.render),this.runScene.cb.model.add.add("",(({model:e})=>{var t;e.material&&"Reflector"===(null==(t=null==(t=e.material.userData)?void 0:t.tools)?void 0:t.type)&&(t=e.material,this.materials[t.userData.id]||(this.materials[t.userData.id]={model:e,material:t}))})),this.runScene.cb.model.remove.add("",(({model:e})=>{var t;e.material&&"Reflector"===(null==(t=null==(t=e.material.userData)?void 0:t.tools)?void 0:t.type)&&(t=e.material,delete this.materials[t.userData.id])}))}bindData(e){const t=e.material;var r=(0,l.getId)();t.userData.id=r,this.materials[r]=e}create(e){const t=new Ka(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 La({target:e,typeList:[...t],newVal:r}).execute())}dispose(){this.materials={}}}Va.TextureNames=["map","normalMap","roughnessMap","metalnessMap","tDiffuse","tDiffuseBlur"];class Ka extends c.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 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=Qa.uniforms.resolution.value,this.blurSize=Qa.uniforms.blurSize.value,this.mirror=new c.Uniform(Qa.uniforms.mirror.value),this.mixBlur=new c.Uniform(Qa.uniforms.mixBlur.value),this.mixStrength=new c.Uniform(Qa.uniforms.mixStrength.value),this.mixContrast=new c.Uniform(Qa.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(za),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(Ja),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 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),depthTest:new c.Uniform(!0),depthWrite:new c.Uniform(!0)},vertexParas:"\n uniform mat4 textureMatrix;\n varying vec4 my_vUv;\n ",vertexShader:"\n #include <project_vertex>\n my_vUv = textureMatrix * vec4(position, 1.0);\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n ",fragmentParas:"\n uniform sampler2D tDiffuse;\n uniform sampler2D tDiffuseBlur;\n uniform sampler2D tDepth;\n uniform sampler2D distortionMap;\n uniform float distortion;\n uniform float mirror;\n uniform float mixBlur;\n uniform float mixStrength;\n uniform float mixContrast;\n uniform float minDepthThreshold;\n uniform float maxDepthThreshold;\n uniform float depthScale;\n uniform float depthToBlurRatioBias;\n varying vec4 my_vUv;\n ",fragmentShader:"\n #include <emissivemap_fragment>\n float distortionFactor = 0.0;\n #ifdef USE_DISTORTION\n distortionFactor = texture2D(distortionMap, vUv).r * distortion;\n #endif\n \n vec4 new_vUv = my_vUv;\n new_vUv.x += distortionFactor;\n new_vUv.y += distortionFactor;\n \n vec4 base = texture2DProj(tDiffuse, new_vUv);\n vec4 blur = texture2DProj(tDiffuseBlur, new_vUv);\n \n vec4 merge = base;\n \n #ifdef USE_NORMALMAP\n vec2 normal_uv = vec2(0.0);\n vec4 normalColor = texture2D(normalMap, vUv * normalScale);\n vec3 my_normal = normalize( vec3( normalColor.r * 2.0 - 1.0, normalColor.b, normalColor.g * 2.0 - 1.0 ) );\n vec3 coord = new_vUv.xyz / new_vUv.w;\n normal_uv = coord.xy + coord.z * my_normal.xz * 0.05;\n vec4 base_normal = texture2D(tDiffuse, normal_uv);\n vec4 blur_normal = texture2D(tDiffuseBlur, normal_uv);\n merge = base_normal;\n blur = blur_normal;\n #endif\n \n float blurFactor = 0.0;\n float depthFactor = 0.0001;\n \n #ifdef USE_DEPTH\n vec4 depth = texture2DProj(tDepth, new_vUv);\n depthFactor = smoothstep(minDepthThreshold, maxDepthThreshold, 1.0-(depth.r * depth.a));\n depthFactor *= depthScale;\n depthFactor = max(0.0001, min(1.0, depthFactor));\n #ifdef USE_BLUR\n blur = blur * min(1.0, depthFactor + depthToBlurRatioBias);\n merge = merge * min(1.0, depthFactor + 0.5);\n #else\n merge = merge * depthFactor;\n #endif\n #endif\n \n float reflectorRoughnessFactor = roughness;\n #ifdef USE_ROUGHNESSMAP\n vec4 reflectorTexelRoughness = texture2D( roughnessMap, vUv );\n reflectorRoughnessFactor *= reflectorTexelRoughness.g;\n #endif\n \n #ifdef USE_BLUR\n blurFactor = min(1.0, mixBlur * reflectorRoughnessFactor);\n merge = mix(merge, blur, blurFactor);\n #endif\n \n vec4 newMerge = vec4(0.0, 0.0, 0.0, 1.0);\n newMerge.r = (merge.r - 0.5) * mixContrast + 0.5;\n newMerge.g = (merge.g - 0.5) * mixContrast + 0.5;\n newMerge.b = (merge.b - 0.5) * mixContrast + 0.5;\n \n diffuseColor.rgb = diffuseColor.rgb * ((1.0 - min(1.0, mirror)) + newMerge.rgb * mixStrength);\n "},Xa=class extends ke{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.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.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)}},Wa={depthTest:!0,depthWrite:!0,alphaTest:0,side:0,displacementScale:1,visible:!0,normalScale:{x:1,y:1},aoMapIntensity:1,lightMapIntensity:1,envMapIntensity:1},Ya=["color","emissive","roughness","metalness","normalScale","aoMapIntensity","displacementScale","transparent","lightMapIntensity","envMapIntensity","opacity","alphaTest"];class Za{constructor(e){this.defMaterialMap={BaseMaterial:Oa,SpriteMaterial:fs,FakeInterior:ka,Reflector:Va,Fresnel:Ga,Physical:Na},this.defMaterial=qa(),this.addCb=e=>{this.runScene.cb.material.add.cb(e)},this.setParses=[],this.runScene=e,this.runScene.cb.unique.material.add.add("engine-material-add",(e=>{"SpriteMaterial"!==e.type&&this.addCb(e)})),this.defMaterialMap={BaseMaterial:Oa,SpriteMaterial:fs,FakeInterior:new ka(e),Reflector:new Va(e),Fresnel:new Ga(e),Physical:new Na(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 Ue(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&&ha(e.newVal),new Ue(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 Xa({target:e,runScene:this.runScene,info:"material",newVal:t,oldVal:e.material}).execute(),this.runScene.modelEx.select===e&&this.runScene.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.select=e,this.runScene.cb.setSelectMaterial.cb(e)}getDataByType(e,t){return this.defMaterialMap[e].tools.parseData(t)}dispose(){this.defMaterialMap.Reflector.dispose(),this.runScene.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,Oe.js)(Wa,((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,Oe.js)(e,((e,r)=>{var n,i,o,a,s;void 0!==Wa[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 qa=()=>{const e=new c.MeshStandardMaterial;return e.userData.id=(0,l.getId)(),e},$a=(e,t)=>(Ya.map((r=>{const n=e[r];"object"==typeof n&&(t[r]=n.clone()),t[r]=n})),t),es=e=>{e.dispose();const t=ts(e);0!==t.length&&t.map((e=>{e=e.texture,ia(e)}))},ts=e=>{var t=e.userData.textures||ns(e);return delete e.userData.textures,t},rs=e=>{var t;return(null==(t=null==(t=e.userData)?void 0:t.tools)?void 0:t.getTextures(e))||ns(e)},ns=e=>Le.map((t=>({type:t,texture:e[t]}))).filter((e=>e.texture)),is=e=>{const{material:t,type:r,texture:n}=e;"envMap"===r&&ha(n),t[r]=n,t.needsUpdate=!0},os=e=>{e.vertexColors=!1,e.needsUpdate=!1},as=e=>null==e?void 0:e.isColor;class ss{constructor(e){this.setSize=(e,t)=>{var{w:r,h:n}=this.getDomSize();this.runScene.setSize(e||r,t||n)},this.runScene=e,this.runScene.cb.resize.add("render-ex-resize",this.setSize)}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 ls=(e,t)=>{t=(t||{}).removeDom,!(e.render=()=>{})!==t&&e.domElement.remove(),e.setAnimationLoop(null),e.dispose(),e.renderLists&&e.renderLists.dispose()};class us{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.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.cb.model.add.cb({model:t,parent:r,isClone:i}),this.cb(t,"add"),o.uniqueEx.material.addModel(t,t.material)}}class cs extends us{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}}class hs{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,Ra.multiArrToArr)(i(e)))}t.push(new cs({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();Es(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,this.runScene.cb.setScene.cb({scene:e,type:"any",val:null})}setBackground(e,t=!0){da(e)&&(e.userData.isBackgroud=!0);var r=this.get(),n=new Xa({target:r,info:"background",newVal:e,oldVal:r.background,runScene:this.runScene,cb:e=>{}}).execute();return t&&this.runScene.undoEx.addUndo(n),this.runScene.cb.setScene.cb({scene:r,type:"background",val:r.background}),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=>{Cs(e,{remove:!1}),this.runScene.cb.model.dispose.cb(e)})),ls(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.cb.reset.cb(this.get())}dispose(){const{renderer:e,controls:t}=this.runScene.assetsEx.get();this.clean(),ls(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=ha(yield this.runScene.textureEx.parse(t))),null!=t&&t.isTexture&&(r=ha(this.runScene.textureEx.clone(t))),this.setNormal({model:e,info:"environment",val:r}),this.runScene.cb.setScene.cb({scene:e,type:"environment",val:r}),r}))}setNormal(e,t=!0){var{model:e,info:r,val:n}=e;e=new Xa({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.cb.setScene.cb({scene:r,type:"fog",val:r.fog})}setFog(e){var{scene:e,type:t,val:r}=e;e=new La({target:e,typeList:["fog",t],newVal:r}).execute(),this.runScene.undoEx.addUndo(e)}sreenShotDefFile(e,t){e=e||Number(prompt("请输入截图的宽"))||1920,t=t||Number(prompt("请输入截图的高"))||1080;var{w:r,h:n}=(this.runScene.helperEx.unfocus(),this.runScene.renderEx.getDomSize());const i=this.runScene.assetsEx.get().renderer.domElement,{renderer:o,scene:a,camera:s}=(i.width=e,i.height=t,this.runScene.renderEx.setSize(e,t),this.runScene.assetsEx.get());return o.render(a,s),e=i.toDataURL("image/png",1),t=(0,je.base64ToFile)(e,"screenShot.png"),i.width=r,i.height=n,this.runScene.renderEx.setSize(),o.render(a,s),t}static toJSON(e){const t=Object.assign({},e.userData.ex);return e.fog&&(t.fog=ds(e.fog)),as(e.background)&&(t.backgroundColor=e.background.getHexString()),t}}const ps=(e,t,r)=>{e.userData[t]=r},ds=e=>{const{color:t,far:r,near:n}=e;return{color:t.getHexString(),far:r,near:n}};class fs{static create(){const e=new c.SpriteMaterial;return e.userData.tools=this.tools,e}}fs.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,t.name=e.name,ps(e,"name",e.name),Ds(t,1===e.layers.mask?0:1)},toNormal:(e,t)=>{const r=Ms("Box");return r.userData.normal={type:"MySpriteMaterial"},r.material=e.material,fs.modelTools.merge(e,r),r},parseData:(e,t)=>{const r=Ms("Sprite");var n=e.userData.layers;return Ds(r,n),fs.modelTools.merge(e,r),r.material=e.material,r}},fs.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=$a(r,fs.create());var{depthWrite:e,depthTest:i}=r.userData.normal;return void 0!==e&&(n.depthWrite=e),void 0!==i&&(n.depthTest=i),t.map((e=>{var{type:e,texture:t}=e;n[e]=t})),n},toNormal:e=>{const t=$a(e,qa()),r=Object.assign(Object.assign({},t.userData),{normal:{type:fs.tools.type},textures:fs.tools.getTextures(e)});return e.depthWrite!==Wa.depthWrite&&(r.normal.depthWrite=e.depthWrite),e.depthTest!==Wa.depthTest&&(r.normal.depthTest=e.depthTest),t.userData=r,t},clone:function(e,t){return e}};class ms extends us{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 vs=class extends ke{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.cb.model.setParent.cb({model:this.target,parent:e})}undo(){this._execute(this.oldParent)}redo(){this._execute(this.newParent)}},gs=class extends ke{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.cb.model.setSelect.cb(null),this.runScene.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 ys{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.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,Oe.js)(this.map,((e,t)=>{t.material.dispose()})),this.map={}}}var bs=a(1);class xs 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),bs.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(bs.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 ws{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,Oe.js)(this.map,((e,t)=>{t.texture.dispose()})),this.map={}}}class As{constructor(e){this.runScene=e,this.model=new xs(this),this.material=new ys(this),this.texture=new ws(this)}getId(e){return e.userData.id}dispose(){this.material.dispose(),this.model.dispose(),this.texture.dispose()}}const Ss=e=>{if(e.userData)return e.userData.id;throw TypeError("该目标不包含userData")};class Bs{constructor(e){this._selectModel=void 0,this.defNodeMap={castShadow:!1,receiveShadow:!1,renderOrder:0,visible:!0},this.add=(()=>{const e=(e,t)=>{t?(this.runScene.uniqueEx.model.add(e,{hasReset:!0}),this.runScene.cb.model.clone.cb(e)):this.runScene.uniqueEx.model.add(e)};return(t,r,n)=>{var{addUndo:i,isClone:o,select:a}=Mi({addUndo:!0,isClone:!1,select:!0},n);if(t instanceof Array)return t.map((e=>this.add(e,r,n)));e(t,o);var s=new ms({model:t,parent:r||this.runScene.sceneEx.get(),isClone:o,runScene:this.runScene}).execute();!0===i&&this.runScene.undoEx.addUndo(s),a&&this.setSelectByModel(t,{isDomTreeActive:!1,isClone:o})}})(),this.deepIsVisible=e=>"Scene"===e.type||!!e.visible&&!!e.parent&&this.deepIsVisible(e.parent),this.runScene=e,this.clone=(e=>(t,r=!0)=>{if(e.lightEx.isLight(t))return e.lightEx.clone(t);var n,i,o=Ps(t),a=(e=>{const t={};return Zo(e,"id",(e=>{0<e.animations.length&&(t[Ss(e)]=e.animations)})),t})(t),s=(o=o?function(e){var t=new Map,r=new Map,n=e.clone();return function e(t,r,n){n(t,r);for(var i=0;i<t.children.length;i++)e(t.children[i],r.children[i],n)}(e,n,(function(e,n){t.set(n,e),r.set(e,n)})),n.traverse((function(e){var n,i;e.isSkinnedMesh&&(i=(n=t.get(e)).skeleton.bones,e.skeleton=n.skeleton.clone(),e.bindMatrix.copy(n.bindMatrix),e.skeleton.bones=i.map((function(e){return r.get(e)})),e.bind(e.skeleton,e.bindMatrix))})),n}(t):t.clone(),ps(s=o,"cloneId",(l=t).userData.id),Zo(o,"id"));l=o,null!=(n=null==(i=null==t?void 0:t.material)?void 0:i.userData)&&n.tools&&(n=null==(n=i.userData.tools)?void 0:n.clone(i,l))&&n.uuid!==i.uuid&&(e.materialEx.resetMaterial(l,n,!0),e.materialEx.add(n,t,i));{var l={newModel:o,newModelMap:s,animaMap:a};const{animaMap:e,newModelMap:t}=l;(0,Oe.js)(e,((e,r)=>{const n=t[e];n&&(n.animations=[...r.map((e=>e.clone()))])}))}return r&&e.uniqueEx.model.add(o,{reset:!0}),o})(e)}get select(){return this._selectModel}set select(e){this.setSelectByModel(e)}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))&&(this.runScene.multipSelector.add([...r,e],!0),!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.cb.model.unFocus.cb(this._selectModel)}e&&(e.isCamera||(this.runScene.helperEx.focus(e),this.runScene.lightEx.setSelect(e)),this.runScene.cb.model.focus.cb({model:e,status:!0,domActive:!t}),this.runScene.materialEx.setSelect(e.material),this.runScene.cb.model.setSelect.cb(e),this._selectModel=e)}}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 cs({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&&!Es(e)}create(){return Da().model.getModelByType("Box")}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.cb.model.unFocus.cb(e),this.runScene.materialEx.setSelect(null),this.runScene.lightEx.setNull(e)),this._selectModel=void 0,this.runScene.cb.model.setSelect.cb(null),this.runScene.helperEx.unfocus()}cloneV3(e){return e.clone()}setParent(e,t,r=!0){if(t=new vs({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 gs({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 Xa({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 Xa({target:e,info:"material",runScene:this.runScene,oldVal:e.material,newVal:t}).execute();this.select===e&&this.runScene.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 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 La({target:e,typeList:t,newVal:r}).execute())}createGroup(e,t,r){const n=t||new c.Group,i=[];i.push(new ms({model:n,runScene:this.runScene,parent:r||this.runScene.assetsEx.get().scene}).execute()),e instanceof Array?i.push(...e.map((e=>new vs({target:e,oldParent:e.parent,newParent:n,runScene:this.runScene}).execute()))):i.push(new vs({target:e,oldParent:e.parent,newParent:n,runScene:this.runScene}).execute()),r&&this.runScene.cb.model.setOpen.cb({isOpen:!0,model:r}),this.runScene.cb.model.setOpen.cb({isOpen:!0,model:n}),this.runScene.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,Ra.multiArrToArr)(e.map((e=>(this.runScene.cb.model.unFocus.cb(e),this.cleanGroup(e,!1)))).filter((e=>e)));return this.runScene.undoEx.addUndo(t),t}if(this.runScene.cb.model.unFocus.cb(e),0!==e.children.length){const r=[],n=e.children.map((e=>{if(e.parent.parent)return new vs({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 cs({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 Xa({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 Xa({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 cs({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=>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 ui(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.cb.model.setLayers.cb({model:e,val:t})}beforeLoad(e){return e instanceof Array?e.map((e=>this.beforeLoad(e))):e}focus(e){const{scene:t,camera:r,renderer:n,controls:i}=this.runScene.assetsEx.get(),o=new c.Vector3,a=new c.Vector3;if("Mesh"===e.type||"Group"===e.type||"Object3D"===e.type){const e=this.runScene.helperEx.boxHelper;if(e.update(),!e||!e.object)return;var s=n.domElement.getBoundingClientRect();let t=s.width/s.height;const i=new c.Vector3;s=e.geometry.attributes.position.array,i.set(Math.abs(s[0]-s[3]),Math.abs(s[1]-s[7]),Math.abs(s[2]-s[14])),a.x=.5*(s[0]+s[3]),a.y=.5*(s[1]+s[7]),a.z=.5*(s[2]+s[14]);let l=new c.Vector3;l.subVectors(r.position,a),l.projectOnPlane(new c.Vector3(0,1,0)),l.normalize(),1<t&&(t=1/t),s=2*Math.tan(.5*r.fov*Math.PI/180),s=i.length()/t/s,o.addVectors(a,l.multiplyScalar(s))}else{t.updateMatrixWorld(!0),s=new c.Vector3,e.getWorldPosition(s),a.set(s.x,s.y,s.z);let n=new c.Vector3;n.subVectors(r.position,a),n.projectOnPlane(new c.Vector3(0,1,0)),n.normalize(),o.addVectors(a,n.multiplyScalar(3))}ui({positionX:r.position.x,positionY:r.position.y,positionZ:r.position.z,targetX:i.target.x,targetY:i.target.y,targetZ:i.target.z},{positionX:o.x,positionY:o.y,positionZ:o.z,targetX:a.x,targetY:a.y,targetZ:a.z},.5,(e=>{r.position.set(e.positionX,e.positionY,e.positionZ),r.lookAt(e.targetX,e.targetY,e.targetZ),i.target.set(e.targetX,e.targetY,e.targetZ),i.update()}))}}const Ms=e=>{if(Pa.includes(e)){const t=Da().model.getModelByType(e);return"Sprite"===t.type&&(t.material.userData.tools=fs.tools),t}throw TypeError("")},Cs=(e,t)=>{t=(t||{}).remove;const{geomerty:r,material:n}=e;r&&(null!=r&&r.dispose(),delete e.geometry),n&&(es(e.material),e.material.dispose(),delete e.material),!1!==t&&e.parent&&e.parent.remove(e)},Ts=(e,t)=>{var{material:r,geometry:n}=e;const i=new Ie.InstancedMesh(n,r,t.length+1);return[e,...t].map(((e,t)=>{i.setMatrixAt(t,e.matrix)})),i},Es=e=>0!==e.animations.length,_s=e=>{e&&e.userData&&(e.userData.isHelper=!0)},Ds=(e,t)=>{null!=t&&(0===t?e.layers.set(0):e.layers.enable(1),ps(e,"layers",t))},Rs=e=>{const t=[];e.traverse((e=>{t.push(e)}))},Ps=e=>{let t=!1;return e.traverse((e=>{e.isSkinnedMesh&&(t=!0)})),t};var Os=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 Is{constructor(e){this.materialMap={},this.textureMap={},this.modelType={Sprite:fs};var{type:e,runScene:t,helper:r}=e;this.type=e,this.helper=r,this.runScene=t}parse(e){return Os(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(da(t.background)||da(t.environment)){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=qa();i.material=o,e.add(i),e=(0,l.getId)(),t.userData.ex.materialId=e,o.userData.id=e,this.materialMap[e]={material:o},da(r)&&(r.userData.notCompress=!0,303===(o.map=r).mapping&&(t.userData.ex.backgroundMapping=303)),da(n)&&(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=e.material,t=t||this.runScene.optionsEx.exporterOptions.notMaterial?this.runScene.materialEx.defMaterial:this.runScene.materialEx.toNromal(e.material),e.material=t,this.materialMap[t.userData.id]={oldMaterial:r,material:t,normalMaterial:t,models:[e]},t)}}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){Es(e)&&(n=e.animations.map((e=>e.toJSON())),ps(e,"animations",n));const r=this.modelType[e.type];if(!r)return e;var n=e.material;n=this.materialMap[null==(n=null==n?void 0:n.userData)?void 0:n.id].oldMaterial;const i=r.modelTools.toNormal(e,n);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,Oe.js)(this.materialMap,((e,t)=>Os(this,void 0,void 0,(function*(){var e=t.material,r=ts(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 Os(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=qa();r.material=n,e.add(r);for(const e of Fe){if(!t.length)return;var i=t.pop();if(!i)return;n[e]=this.textureMap[i].texture}t.length&&this.setMultipMaterial(e,t)}}class Fs{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))}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.uvScript=t.userData.uvScript,r.md5=t.userData.md5,r.id=t.userData.id,r.format=t.userData.format,pa(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 Ls(e){return(Ls="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 ks(e,t){return(ks=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Us(e){return(Us=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Gs=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&&ks(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=Us(e);if(r=t?(r=Us(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Ls(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 js{constructor(e){this.runScene=e}}class Hs 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 Ie.Color("#"+o),t}}class Ns 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: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 Ie.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 zs 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 Ie.Color("#"+o),t.groundColor=new Ie.Color("#"+a),t.position.set(s.x,s.y,s.z),t}}class Js 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: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 Ie.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 Vs{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 Ie.Color("#"+o),t.position.set(a.x,a.y,a.z),t}}class Ks{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:g,radius:y}=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:g.x,camera:{near:m},radius:y},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:g,radius:y}=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 Ie.Color("#"+n),t.position.set(d.x,d.y,d.z),t.shadow.mapSize.x=g,t.shadow.mapSize.y=g,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=y,t.shadow.camera.updateProjectionMatrix(),t}}const Qs={DirectionalLight:Ns,PointLight:Js,SpotLight:Ks,RectAreaLight:Vs,HemisphereLight:zs,AmbientLight:Hs};class Xs{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 Ns(e),PointLight:new Js(e),SpotLight:new Ks(e),RectAreaLight:new Vs(e),HemisphereLight:new zs(e),AmbientLight:new Hs(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}=Mi({isClone:!1,id:(0,l.getId)(),addUndo:!0,addToScene:!0},t);let o=new Ie[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 ms(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 cs({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 cs({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 Gs(t,16773120);break;case"DirectionalLight":if(n=new Ie.DirectionalLightHelper(t,1,16711680),t.children[0])t.target=t.children[0];else{let e=new Ie.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 Ie.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 Ie.PointLightHelper(t,1,16711935);break;case"SpotLight":n=new Ie.SpotLightHelper(t);let o=new Ie.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 Ie.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 Ie.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 Xa({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 La({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 La({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 Qs[t].toJSON(e)}))}}class Ws{constructor(e){this.helperModels=[];var{type:e,runScene:t}=e;this.runScene=t,this.type=e,this.material=new Fs({runScene:t,helper:this}),this.before=new Is({helper:this,type:e,runScene:t})}init(e){return this.before.parse(e)}parseNode(e){const{object:t,nodeDef:r}=e;(0,Oe.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:Xs.toJSON(this.runScene.lightEx.getLightsByScene()),camera:n.toJSON(),sceneEx:hs.toJSON(t),timeLine:this.runScene.timeLineEx.getSavedData(),controls:Ma.toJSON(r),options:this.runScene.exporter.gltf.options.getOptions(t)})}}class Ys{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 Zs(){Zs=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 g(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"==$s(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 y(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function b(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(y,this),this.reset(!0)}function w(e){if(e){var t,i=e[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:A}}function A(){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(g.prototype),a(g.prototype,i,(function(){return this})),e.AsyncIterator=g,e.async=function(t,r,n,i,o){void 0===o&&(o=Promise);var a=new g(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 qs(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 $s(e){return($s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function el(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function tl(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 rl(e,t,r){t&&tl(e.prototype,t),r&&tl(e,r),Object.defineProperty(e,"prototype",{writable:!1})}var nl=function(){function e(){el(this,e),this.pluginCallbacks=[],this.register((function(e){return new wl(e)})),this.register((function(e){return new Al(e)})),this.register((function(e){return new Sl(e)})),this.register((function(e){return new Ml(e)})),this.register((function(e){return new Cl(e)})),this.register((function(e){return new Bl(e)}))}return rl(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"===$s(r)&&(console.warn("THREE.GLTFExporter: parse() expects options as the fourth argument now."),n=r);for(var i=new xl,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}(),il=5121,ol=5123,al=(o=9728,9729),sl=9984,ll=9985,ul=9986,cl=9987,hl=33071,pl=33648,dl=10497,fl={},ml=(fl[c.NearestFilter]=o,fl[c.NearestMipmapNearestFilter]=sl,fl[c.NearestMipmapLinearFilter]=ul,fl[c.LinearFilter]=al,fl[c.LinearMipmapNearestFilter]=ll,fl[c.LinearMipmapLinearFilter]=cl,fl[c.ClampToEdgeWrapping]=hl,fl[c.RepeatWrapping]=dl,fl[c.MirroredRepeatWrapping]=pl,{scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"});function vl(e,t){return e.length===t.length&&e.every((function(e,r){return e===t[r]}))}function gl(e){return 4*Math.ceil(e/4)}function yl(e,t){var r=1<arguments.length&&void 0!==t?t:0,n=gl(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 bl=null,xl=function(){function e(){el(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 rl(e,[{key:"setPlugins",value:function(e){this.plugins=e}},{key:"write",value:(t=Zs().mark((function e(t,r,n){var i,o,a,s,l,u,c;return Zs().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=yl(u.result),t=new DataView(new ArrayBuffer(8)),n=(t.setUint32(0,e.byteLength,!0),t.setUint32(4,5130562,!0),yl(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){qs(o,n,i,a,s,"next",e)}function s(e){qs(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===il?1:t===ol?2:4,gl(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===ol?l.setUint16(u,p,!0):t===il&&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=yl(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=ol;else{if(e.array.constructor!==Uint8Array)throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type.");i=il}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=bl=bl||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:fl[e.magFilter],minFilter:fl[e.minFilter],wrapS:fl[e.wrapS],wrapT:fl[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=(vl((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=[],g={uv:"TEXCOORD_0",uv2:"TEXCOORD_1",color:"COLOR_0",skinWeight:"WEIGHTS_0",skinIndex:"JOINTS_0"},y=s.getAttribute("normal"),b=(void 0===y||this.isNormalizedNormalAttribute(y)||(console.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."),s.setAttribute("normal",this.createNormalizedNormalAttribute(y))),null);for(h in s.attributes)"morph"!==h.slice(0,5)&&(u=s.attributes[h],h=g[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!==y&&s.setAttribute("normal",y),0===Object.keys(f).length)return null;if(void 0!==e.morphTargetInfluences&&0<e.morphTargetInfluences.length){var x=[],w=[],A={};if(void 0!==e.morphTargetDictionary)for(var S in e.morphTargetDictionary)A[e.morphTargetDictionary[S]]=S;for(var B=0;B<e.morphTargetInfluences.length;++B){var M,C={},T=!1;for(M in s.morphAttributes)if("position"!==M&&"normal"!==M)T||(console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."),T=!0);else{var E=s.morphAttributes[M][B],_=M.toUpperCase(),D=s.attributes[M];if(t.attributes.has(this.getUID(E)))C[_]=t.attributes.get(this.getUID(E));else{var R=E.clone();if(!s.morphTargetsRelative)for(var P=0,O=E.count;P<O;P++)R.setXYZ(P,E.getX(P)-D.getX(P),E.getY(P)-D.getY(P),E.getZ(P)-D.getZ(P));C[_]=this.processAccessor(R,s),t.attributes.set(this.getUID(D),C[_])}}v.push(C),x.push(e.morphTargetInfluences[B]),void 0!==e.morphTargetDictionary&&w.push(A[B])}d.weights=x,0<w.length&&(d.extras={},d.extras.targetNames=w)}if((y=Array.isArray(e.material))&&0===s.groups.length)return null;for(var I=y?e.material:[e.material],F=y?s.groups:[{materialIndex:0,start:void 0,count:void 0}],L=0,k=F.length;L<k;L++){var U={mode:l,attributes:f},G=(this.serializeUserData(s,U),0<v.length&&(U.targets=v),null!==s.index&&(G=this.getUID(s.index),void 0===F[L].start&&void 0===F[L].count||(G+=":"+F[L].start+":"+F[L].count),t.attributes.has(G)?U.indices=t.attributes.get(G):(U.indices=this.processAccessor(s.index,s,F[L].start,F[L].count),t.attributes.set(G,U.indices)),null===U.indices&&delete U.indices),this.processMaterial(I[F[L].materialIndex]));null!==G&&(U.material=G),m.push(U)}return d.primitives=m,r.meshes||(r.meshes=[]),this._invokeAll((function(t){t.writeMesh&&t.writeMesh(e,d)})),y=r.meshes.push(d)-1,t.meshes.set(a,y),y}},{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=nl.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=ml[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===ml.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(),vl(r,[0,0,0,1])||(a.rotation=r),vl(h,[0,0,0])||(a.translation=h),vl(t,[1,1,1])||(a.scale=t)):(e.matrixAutoUpdate&&e.updateMatrix(),!1===vl(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}(),wl=function(){function e(t){el(this,e),this.writer=t,this.name="KHR_lights_punctual"}return rl(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}(),Al=function(){function e(t){el(this,e),this.writer=t,this.name="KHR_materials_unlit"}return rl(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}(),Sl=function(){function e(t){el(this,e),this.writer=t,this.name="KHR_materials_pbrSpecularGlossiness"}return rl(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}(),Bl=function(){function e(t){el(this,e),this.writer=t,this.name="KHR_materials_clearcoat"}return rl(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}(),Ml=function(){function e(t){el(this,e),this.writer=t,this.name="KHR_materials_transmission"}return rl(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}(),Cl=function(){function e(t){el(this,e),this.writer=t,this.name="KHR_materials_volume"}return rl(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}();function Tl(){Tl=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 g(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"==_l(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 y(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function b(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(y,this),this.reset(!0)}function w(e){if(e){var t,i=e[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:A}}function A(){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(g.prototype),a(g.prototype,i,(function(){return this})),e.AsyncIterator=g,e.async=function(t,r,n,i,o){void 0===o&&(o=Promise);var a=new g(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 El(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 _l(e){return(_l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Dl(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Rl(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 Pl(e,t,r){t&&Rl(e.prototype,t),r&&Rl(e,r),Object.defineProperty(e,"prototype",{writable:!1})}nl.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 g=0;g<a.times.length;g++){var y=this.insertKeyframe(p,a.times[g]);p.values[y*u+h]=a.values[g]}}}}return e.tracks=r,e}};var Ol=function(){function e(){Dl(this,e),this.pluginCallbacks=[],this.register((function(e){return new Jl(e)})),this.register((function(e){return new Vl(e)})),this.register((function(e){return new Kl(e)})),this.register((function(e){return new Xl(e)})),this.register((function(e){return new Wl(e)})),this.register((function(e){return new Ql(e)}))}return Pl(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"===_l(r)&&(console.warn("THREE.GLTFExporter: parse() expects options as the fourth argument now."),n=r);for(var i=new zl,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}(),Il=5121,Fl=5123,Ll=(o=9728,sl=9729,ul=9984,al=9985,ll=9986,cl=9987,hl=33071,dl=33648,pl=10497,{}),kl=(Ll[c.NearestFilter]=o,Ll[c.NearestMipmapNearestFilter]=ul,Ll[c.NearestMipmapLinearFilter]=ll,Ll[c.LinearFilter]=sl,Ll[c.LinearMipmapNearestFilter]=al,Ll[c.LinearMipmapLinearFilter]=cl,Ll[c.ClampToEdgeWrapping]=hl,Ll[c.RepeatWrapping]=pl,Ll[c.MirroredRepeatWrapping]=dl,{scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"});function Ul(e,t){return e.length===t.length&&e.every((function(e,r){return e===t[r]}))}function Gl(e){return 4*Math.ceil(e/4)}function jl(e,t){var r=1<arguments.length&&void 0!==t?t:0,n=Gl(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 Hl=null;function Nl(){return Hl=Hl||("undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"))}var zl=function(){function e(){Dl(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 Pl(e,[{key:"setPlugins",value:function(e){this.plugins=e}},{key:"write",value:(t=Tl().mark((function e(t,r,n){var i,o,a,s,l;return Tl().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:o=(a=this).buffers,i=a.json,n=a.options,a=a.extensionsUsed,o=new Blob(o,{type:"application/octet-stream"}),0<(a=Object.keys(a)).length&&(i.extensionsUsed=a),i.buffers&&0<i.buffers.length&&(i.buffers[0].byteLength=o.size),!0===n.binary?((s=new FileReader).readAsArrayBuffer(o),s.onloadend=function(){var e=jl(s.result),t=new DataView(new ArrayBuffer(8)),n=(t.setUint32(0,e.byteLength,!0),t.setUint32(4,5130562,!0),jl((n=JSON.stringify(i),(new TextEncoder).encode(n).buffer),32)),o=new DataView(new ArrayBuffer(8)),a=(o.setUint32(0,n.byteLength,!0),o.setUint32(4,1313821514,!0),new ArrayBuffer(12)),l=((u=new DataView(a)).setUint32(0,1179937895,!0),u.setUint32(4,2,!0),12+o.byteLength+n.byteLength+t.byteLength+e.byteLength),u=(u.setUint32(8,l,!0),new Blob([a,o,n,t,e],{type:"application/octet-stream"})),c=new FileReader;c.readAsArrayBuffer(u),c.onloadend=function(){r(c.result)}}):i.buffers&&0<i.buffers.length?((l=new FileReader).readAsDataURL(o),l.onloadend=function(){var e=l.result;i.buffers[0].uri=e,r(i)}):r(i);case 15: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){El(o,n,i,a,s,"next",e)}function s(e){El(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:"buildMetalRoughTexture",value:function(e,t){if(e===t)return e;console.warn("THREE.GLTFExporter: Merged metalnessMap and roughnessMap textures.");var r=null==e?void 0:e.image,n=null==t?void 0:t.image,i=Math.max((null==r?void 0:r.width)||0,(null==n?void 0:n.width)||0),o=Math.max((null==r?void 0:r.height)||0,(null==n?void 0:n.height)||0),a=Nl(),s=(a.width=i,a.height=o,a.getContext("2d")),l=(s.fillStyle="#00ffff",s.fillRect(0,0,i,o),s.getImageData(0,0,i,o));if(r){s.drawImage(r,0,0,i,o);for(var u=s.getImageData(0,0,i,o).data,h=2;h<u.length;h+=4)l.data[h]=u[h]}if(n){s.drawImage(n,0,0,i,o);for(var p=s.getImageData(0,0,i,o).data,d=1;d<p.length;d+=4)l.data[d]=p[d]}return s.putImageData(l,0,0),(r=(e||t).clone()).source=new c.Source(a),r}},{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===Il?1:t===Fl?2:4,Gl(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===Fl?l.setUint16(u,p,!0):t===Il&&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){var i=new FileReader;i.readAsArrayBuffer(e),i.onloadend=function(){var e=jl(i.result),o={buffer:t.processBuffer(e),byteOffset:t.byteOffset,byteLength:e.byteLength};t.byteOffset+=e.byteLength,n(r.bufferViews.push(o)-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=Fl;else{if(e.array.constructor!==Uint8Array)throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type.");i=Il}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){var n=3<arguments.length&&void 0!==arguments[3]?arguments[3]:"image/png",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),n+":flipY/"+r.toString());if(void 0!==o[u])return o[u];a.images||(a.images=[]);var h={mimeType:n};if(s.embedImages){var p=Nl(),d=(p.width=Math.min(e.width,s.maxTextureSize),p.height=Math.min(e.height,s.maxTextureSize),p.getContext("2d"));if(!0===r&&(d.translate(0,p.height),d.scale(1,-1)),void 0!==e.data){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)}else d.drawImage(e,0,0,p.width,p.height);!0===s.binary?(r=void 0!==p.toBlob?new Promise((function(e){return p.toBlob(e,n)})):p.convertToBlob({type:n}),l.push(r.then((function(e){return i.processBufferViewImage(e).then((function(e){h.bufferView=e}))})))):h.uri=p.toDataURL(n)}else h.uri=e.src;return t=a.images.push(h)-1,o[u]=t}},{key:"processSampler",value:function(e){var t=this.json;return t.samplers||(t.samplers=[]),e={magFilter:Ll[e.magFilter],minFilter:Ll[e.minFilter],wrapS:Ll[e.wrapS],wrapT:Ll[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=("image/webp"===(i=e.userData.mimeType)&&(i="image/png"),{sampler:this.processSampler(e),source:this.processImage(e.image,e.format,e.flipY,i)}),i=(e.name&&(n.name=e.name),this._invokeAll((function(t){t.writeTexture&&t.writeTexture(e,n)})),r.textures.push(n)-1);return t.textures.set(e,i),i}},{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={pbrMetallicRoughness:{}},i=(!0!==e.isMeshStandardMaterial&&!0!==e.isMeshBasicMaterial&&console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results."),e.color.toArray().concat([e.opacity])),o=(Ul(i,[1,1,1,1])||(n.pbrMetallicRoughness.baseColorFactor=i),e.isMeshStandardMaterial?(n.pbrMetallicRoughness.metallicFactor=e.metalness,n.pbrMetallicRoughness.roughnessFactor=e.roughness):(n.pbrMetallicRoughness.metallicFactor=.5,n.pbrMetallicRoughness.roughnessFactor=.5),(e.metalnessMap||e.roughnessMap)&&(i=this.buildMetalRoughTexture(e.metalnessMap,e.roughnessMap),o={index:this.processTexture(i)},this.applyTextureTransform(o,i),n.pbrMetallicRoughness.metallicRoughnessTexture=o),e.map&&(i={index:this.processTexture(e.map)},this.applyTextureTransform(i,e.map),n.pbrMetallicRoughness.baseColorTexture=i),e.emissive&&(o=e.emissive.clone().multiplyScalar(e.emissiveIntensity),1<(i=Math.max(o.r,o.g,o.b))&&(o.multiplyScalar(1/i),console.warn("THREE.GLTFExporter: Some emissive components exceed 1; emissive has been limited")),0<i&&(n.emissiveFactor=o.toArray()),e.emissiveMap&&(i={index:this.processTexture(e.emissiveMap)},this.applyTextureTransform(i,e.emissiveMap),n.emissiveTexture=i)),e.normalMap&&(o={index:this.processTexture(e.normalMap)},e.normalScale&&1!==e.normalScale.x&&(o.scale=e.normalScale.x),this.applyTextureTransform(o,e.normalMap),n.normalTexture=o),e.aoMap&&(i={index:this.processTexture(e.aoMap),texCoord:1},1!==e.aoMapIntensity&&(i.strength=e.aoMapIntensity),this.applyTextureTransform(i,e.aoMap),n.occlusionTexture=i),e.transparent?n.alphaMode="BLEND":0<e.alphaTest&&(n.alphaMode="MASK",n.alphaCutoff=e.alphaTest),e.side===c.DoubleSide&&(n.doubleSided=!0),""!==e.name&&(n.name=e.name),this.serializeUserData(e,n),this._invokeAll((function(t){t.writeMaterial&&t.writeMaterial(e,n)})),r.materials.push(n)-1);return 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=[],g={uv:"TEXCOORD_0",uv2:"TEXCOORD_1",color:"COLOR_0",skinWeight:"WEIGHTS_0",skinIndex:"JOINTS_0"},y=s.getAttribute("normal"),b=(void 0===y||this.isNormalizedNormalAttribute(y)||(console.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."),s.setAttribute("normal",this.createNormalizedNormalAttribute(y))),null);for(h in s.attributes)"morph"!==h.slice(0,5)&&(u=s.attributes[h],h=g[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!==y&&s.setAttribute("normal",y),0===Object.keys(f).length)return null;if(void 0!==e.morphTargetInfluences&&0<e.morphTargetInfluences.length){var x=[],w=[],A={};if(void 0!==e.morphTargetDictionary)for(var S in e.morphTargetDictionary)A[e.morphTargetDictionary[S]]=S;for(var B=0;B<e.morphTargetInfluences.length;++B){var M,C={},T=!1;for(M in s.morphAttributes)if("position"!==M&&"normal"!==M)T||(console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."),T=!0);else{var E=s.morphAttributes[M][B],_=M.toUpperCase(),D=s.attributes[M];if(t.attributes.has(this.getUID(E)))C[_]=t.attributes.get(this.getUID(E));else{var R=E.clone();if(!s.morphTargetsRelative)for(var P=0,O=E.count;P<O;P++)R.setXYZ(P,E.getX(P)-D.getX(P),E.getY(P)-D.getY(P),E.getZ(P)-D.getZ(P));C[_]=this.processAccessor(R,s),t.attributes.set(this.getUID(D),C[_])}}v.push(C),x.push(e.morphTargetInfluences[B]),void 0!==e.morphTargetDictionary&&w.push(A[B])}d.weights=x,0<w.length&&(d.extras={},d.extras.targetNames=w)}if((y=Array.isArray(e.material))&&0===s.groups.length)return null;for(var I=y?e.material:[e.material],F=y?s.groups:[{materialIndex:0,start:void 0,count:void 0}],L=0,k=F.length;L<k;L++){var U={mode:l,attributes:f},G=(this.serializeUserData(s,U),0<v.length&&(U.targets=v),null!==s.index&&(G=this.getUID(s.index),void 0===F[L].start&&void 0===F[L].count||(G+=":"+F[L].start+":"+F[L].count),t.attributes.has(G)?U.indices=t.attributes.get(G):(U.indices=this.processAccessor(s.index,s,F[L].start,F[L].count),t.attributes.set(G,U.indices)),null===U.indices&&delete U.indices),this.processMaterial(I[F[L].materialIndex]));null!==G&&(U.material=G),m.push(U)}return d.primitives=m,r.meshes||(r.meshes=[]),this._invokeAll((function(t){t.writeMesh&&t.writeMesh(e,d)})),y=r.meshes.push(d)-1,t.meshes.set(a,y),y}},{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=Ol.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=kl[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===kl.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=t.nodes[r.get(e)],i=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)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.trs?(r=e.quaternion.toArray(),h=e.position.toArray(),t=e.scale.toArray(),Ul(r,[0,0,0,1])||(a.rotation=r),Ul(h,[0,0,0])||(a.translation=h),Ul(t,[1,1,1])||(a.scale=t)):(e.matrixAutoUpdate&&e.updateMatrix(),!1===Ul(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 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){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=this.options,r=(e=e instanceof Array?e:[e],this._invokeAll((function(t){t.beforeParse&&t.beforeParse(e)})),[]),n=0;n<e.length;n++)e[n]instanceof c.Scene?this.processScene(e[n]):r.push(e[n]);0<r.length&&this.processObjects(r);for(var i=0;i<this.skins.length;++i)this.processSkin(this.skins[i]);for(var o=0;o<t.animations.length;++o)this.processAnimation(t.animations[o],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}(),Jl=function(){function e(t){Dl(this,e),this.writer=t,this.name="KHR_lights_punctual"}return Pl(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}(),Vl=function(){function e(t){Dl(this,e),this.writer=t,this.name="KHR_materials_unlit"}return Pl(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}(),Kl=function(){function e(t){Dl(this,e),this.writer=t,this.name="KHR_materials_pbrSpecularGlossiness"}return Pl(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}(),Ql=function(){function e(t){Dl(this,e),this.writer=t,this.name="KHR_materials_clearcoat"}return Pl(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}(),Xl=function(){function e(t){Dl(this,e),this.writer=t,this.name="KHR_materials_transmission"}return Pl(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}(),Wl=function(){function e(t){Dl(this,e),this.writer=t,this.name="KHR_materials_volume"}return Pl(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}(),Yl=(Ol.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 g=0;g<a.times.length;g++){var y=this.insertKeyframe(p,a.times[g]);p.values[y*u+h]=a.values[g]}}}}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 Zl extends _a{constructor(){super(...arguments),this._gltf=new nl,this._originGltf=new Ol,this.options=new Ys}getArrayBuffer(e=this.runScene.sceneEx.getClear(),t="scene"){return Yl(this,void 0,void 0,(function*(){const r=new Ws({type:t,runScene:this.runScene});return yield r.init(e),new Promise((t=>{this._gltf.parse(e,(e=>{t(e)}),{binary:!0,onlyVisible:!1,includeCustomExtensions:!0,myOptions:{helper:r,optionsEx:this.runScene.optionsEx}})}))}))}getOriginArrayBuffer(e){return Yl(this,void 0,void 0,(function*(){return new Promise((t=>{this._originGltf.parse(e,(e=>{t(e)}),(()=>{}),{binary:!0,onlyVisible:!1,includeCustomExtensions:!0,animations:[...e.animations]})}))}))}export(e){return Yl(this,void 0,void 0,(function*(){var t=yield this.getArrayBuffer(e);(0,je.downloadFile)(new Blob([t]),"scene.glb")}))}model(e){return Yl(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,je.downloadFile)(new Blob([n]),r+".glb"))}))}material(e){var t;return Yl(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,je.downloadFile)(new Blob([n]),r+".glb")}}))}scene(e=!0){return Yl(this,void 0,void 0,(function*(){var t=yield this.getArrayBuffer();return e&&(0,je.downloadFile)(new Blob([t]),"scene.glb"),t}))}originModel(e){return Yl(this,void 0,void 0,(function*(){var t,r;e&&(t=e.name||e.type,r=yield this.getOriginArrayBuffer(e),(0,je.downloadFile)(new Blob([r]),t+".glb"))}))}}class ql extends _a{constructor(e){super(e),this.gltf=new Zl(e)}}var $l={},eu=function(e){return URL.createObjectURL(new Blob([e],{type:"text/javascript"}))},tu=function(e){return new Worker(e)};try{URL.revokeObjectURL(eu(""))}catch(du){eu=function(e){return"data:application/javascript;charset=UTF-8,"+encodeURI(e)},tu=function(e){return new Worker(e,{type:"module"})}}for(var ru=Uint8Array,nu=Uint16Array,iu=Uint32Array,ou=new ru([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]),au=new ru([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]),su=new ru([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),lu=(o=function(e,t){for(var r=new nu(31),n=0;n<31;++n)r[n]=t+=1<<e[n-1];var i=new iu(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]},(ul=o(ou,2))[0]),uu=ul[1],cu=(lu[28]=258,uu[258]=28,ll=o(au,0))[0],hu=ll[1],pu=new nu(32768),du=0;du<32768;++du){var fu=(43690&du)>>>1|(21845&du)<<1;pu[du]=((65280&(fu=(61680&(fu=(52428&fu)>>>2|(13107&fu)<<2))>>>4|(3855&fu)<<4))>>>8|(255&fu)<<8)>>>1}var mu=function(e,t,r){for(var n=e.length,i=0,o=new nu(t);i<n;++i)++o[e[i]-1];var a=new nu(t);for(i=0;i<t;++i)a[i]=a[i-1]+o[i-1]<<1;if(r){var s=new nu(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[pu[h]>>>l]=u}else for(s=new nu(n),i=0;i<n;++i)e[i]&&(s[i]=pu[a[e[i]-1]++]>>>15-e[i]);return s},vu=new ru(288);for(du=0;du<144;++du)vu[du]=8;for(du=144;du<256;++du)vu[du]=9;for(du=256;du<280;++du)vu[du]=7;for(du=280;du<288;++du)vu[du]=8;var gu=new ru(32);for(du=0;du<32;++du)gu[du]=5;function yu(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 bu(e,t,r,n,i){var o,a=Wu(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 xu(e,t){return ac(e,t)+4294967296*ac(e,t+4)}var wu=mu(vu,9,0),Au=mu(vu,9,1),Su=mu(gu,5,0),Bu=mu(gu,5,1),Mu=function(e){for(var t=e[0],r=1;r<e.length;++r)e[r]>t&&(t=e[r]);return t},Cu=function(e,t,r){var n=t/8|0;return(e[n]|e[1+n]<<8)>>(7&t)&r},Tu=function(e,t){var r=t/8|0;return(e[r]|e[1+r]<<8|e[2+r]<<16)>>(7&t)},Eu=function(e){return(e/8|0)+(7&e&&1)},_u=function(e,t,r){(null==r||r>e.length)&&(r=e.length);var n=new(e instanceof nu?nu:e instanceof iu?iu:ru)(r-(t=null==t||t<0?0:t));return n.set(e.subarray(t,r)),n},Du=function(e,t,r){var n=e.length;if(!n||r&&!r.l&&n<5)return t||new ru(0);function i(e){var r=t.length;r<e&&((r=new ru(Math.max(2*r,e))).set(t),t=r)}var o=!t||r,a=!r||r.i,s=(r=r||{},t=t||new ru(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=Cu(e,l,1);var m=Cu(e,l+1,3);if(l+=3,!m){var v=e[(M=Eu(l)+4)-4]|e[M-3]<<8;if(n<(A=M+v)){if(a)throw"unexpected EOF";break}o&&i(u+v),t.set(e.subarray(M,A),u),r.b=u+=v,r.p=l=8*A;continue}if(1==m)c=Au,h=Bu,p=9,d=5;else{if(2!=m)throw"invalid block type";v=Cu(e,l,31)+257;for(var g=Cu(e,l+10,15)+4,y=v+Cu(e,l+5,31)+1,b=(l+=14,new ru(y)),x=new ru(19),w=0;w<g;++w)x[su[w]]=Cu(e,l+3*w,7);l+=3*g;var A,S=(1<<(A=Mu(x)))-1,B=mu(x,A,1);for(w=0;w<y;){var M,C=B[Cu(e,l,S)];if(l+=15&C,(M=C>>>4)<16)b[w++]=M;else{var T=0,E=0;for(16==M?(E=3+Cu(e,l,3),l+=2,T=b[w-1]):17==M?(E=3+Cu(e,l,7),l+=3):18==M&&(E=11+Cu(e,l,127),l+=7);E--;)b[w++]=T}}m=b.subarray(0,v);var _=b.subarray(v);p=Mu(m),d=Mu(_),c=mu(m,p,1),h=mu(_,d,1)}if(f<l){if(a)throw"unexpected EOF";break}}o&&i(u+131072);for(var D=(1<<p)-1,R=(1<<d)-1,P=l;;P=l){var O=(T=c[Tu(e,l)&D])>>>4;if(f<(l+=15&T)){if(a)throw"unexpected EOF";break}if(!T)throw"invalid length/literal";if(O<256)t[u++]=O;else{if(256==O){P=l,c=null;break}var I,F=O-254,L=(264<O&&(I=ou[w=O-257],F=Cu(e,l,(1<<I)-1)+lu[w],l+=I),(O=h[Tu(e,l)&R])>>>4);if(!O)throw"invalid distance";if(l+=15&O,_=cu[L],3<L&&(I=au[L],_+=Tu(e,l)&(1<<I)-1,l+=I),f<l){if(a)throw"unexpected EOF";break}o&&i(u+131072);for(var k=u+F;u<k;u+=4)t[u]=t[u-_],t[u+1]=t[u+1-_],t[u+2]=t[u+2-_],t[u+3]=t[u+3-_];u=k}}r.l=c,r.p=P,r.b=u,c&&(s=1,r.m=p,r.d=h,r.n=d)}while(!s);return u==t.length?t:_u(t,0,u)},Ru=function(e,t,r){var n=t/8|0;e[n]|=r<<=7&t,e[1+n]|=r>>>8},Pu=function(e,t,r){var n=t/8|0;e[n]|=r<<=7&t,e[1+n]|=r>>>8,e[2+n]|=r>>>16},Ou=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[ju,0];if(1==i)return(m=new ru(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 nu(h+1),d=Iu(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 g=o[n].s;if(!(p[g]>t))break;f+=v-(1<<d-p[g]),p[g]=t}for(f>>>=m;0<f;){var y=o[n].s;p[y]<t?f-=1<<t-p[y]++-1:++n}for(;0<=n&&f;--n){var b=o[n].s;p[b]==t&&(--p[b],++f)}d=t}return[new ru(p),d]},Iu=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},Fu=function(e){for(var t=e.length;t&&!e[--t];);for(var r=new nu(++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]},Lu=function(e,t){for(var r=0,n=0;n<t.length;++n)r+=e[n]*t[n];return r},ku=function(e,t,r){var n=r.length,i=Eu(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)},Uu=function(e,t,r,n,i,o,a,s,l,u,c){Ru(t,c++,r),++i[256];for(var h=(r=Ou(i,15))[0],p=(r=r[1],(d=Ou(o,15))[0]),d=d[1],f=(m=Fu(h))[0],m=m[1],v=(g=Fu(p))[0],g=g[1],y=new nu(19),b=0;b<f.length;++b)y[31&f[b]]++;for(b=0;b<v.length;++b)y[31&v[b]]++;for(var x=(w=Ou(y,7))[0],w=w[1],A=19;4<A&&!x[su[A-1]];--A);var S,B=u+5<<3,M=Lu(i,vu)+Lu(o,gu)+a;if(i=Lu(i,h)+Lu(o,p)+a+14+3*A+Lu(y,x)+(2*y[16]+3*y[17]+7*y[18]),B<=M&&B<=i)return ku(t,c,e.subarray(l,l+u));if(Ru(t,c,1+(i<M)),c+=2,i<M){var C=mu(h,r,0),T=h,E=mu(p,d,0),_=p,D=mu(x,w,0);for(Ru(t,c,m-257),Ru(t,c+5,g-1),Ru(t,c+10,A-4),c+=14,b=0;b<A;++b)Ru(t,c+3*b,x[su[b]]);c+=3*A;for(var R=[f,v],P=0;P<2;++P){var O=R[P];for(b=0;b<O.length;++b){var I=31&O[b];Ru(t,c,D[I]),c+=x[I],15<I&&(Ru(t,c,O[b]>>>5&127),c+=O[b]>>>12)}}}else C=wu,T=vu,E=Su,_=gu;for(b=0;b<s;++b)255<n[b]?(I=n[b]>>>18&31,Pu(t,c,C[I+257]),c+=T[I+257],7<I&&(Ru(t,c,n[b]>>>23&31),c+=ou[I]),S=31&n[b],Pu(t,c,E[S]),c+=_[S],3<S&&(Pu(t,c,n[b]>>>5&8191),c+=au[S])):(Pu(t,c,C[n[b]]),c+=T[n[b]]);return Pu(t,c,C[256]),c+T[256]},Gu=new iu([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),ju=new ru(0),Hu=function(e,t,r,n,i,o){var a=e.length,s=new ru(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?ku(l,u,e.subarray(c,h)):(l[c]=o,ku(l,u,e.subarray(c,a)))}else{for(var p=(t=Gu[t-1])>>>13,d=8191&t,f=(1<<r)-1,m=new nu(32768),v=new nu(1+f),g=Math.ceil(r/3),y=2*g,b=function(t){return(e[t]^e[t+1]<<g^e[t+2]<<y)&f},x=new iu(25e3),w=new nu(288),A=new nu(32),S=0,B=0,M=(c=0,0),C=0,T=0;c<a;++c){var E=b(c),_=32767&c,D=v[E];if(m[_]=D,v[E]=_,C<=c){var R=a-c;if((7e3<S||24576<M)&&423<R){u=Uu(e,l,0,x,w,A,B,M,T,c-T,u),M=S=B=0,T=c;for(var P=0;P<286;++P)w[P]=0;for(P=0;P<30;++P)A[P]=0}var O=2,I=0,F=d,L=_-D&32767;if(2<R&&E==b(c-L))for(var k=Math.min(p,R)-1,U=Math.min(32767,c),G=Math.min(258,R);L<=U&&--F&&_!=D;){if(e[c+O]==e[c+O-L]){for(var j=0;j<G&&e[c+j]==e[c+j-L];++j);if(O<j){if(I=L,k<(O=j))break;var H=Math.min(L,j-2),N=0;for(P=0;P<H;++P){var z=c-L+P+32768&32767,J=z-m[z]+32768&32767;N<J&&(N=J,D=z)}}}L+=(_=D)-(D=m[_])+32768&32767}I?(x[M++]=268435456|uu[O]<<18|hu[I],E=31&uu[O],R=31&hu[I],B+=ou[E]+au[R],++w[257+E],++A[R],C=c+O,++S):(x[M++]=e[c],++w[e[c]])}}u=Uu(e,l,o,x,w,A,B,M,T,c-T,u),!o&&7&u&&(u=ku(l,u+1,ju))}return _u(s,0,n+Eu(u)+i)},Nu=function(){for(var e=new iu(256),t=0;t<256;++t){for(var r=t,n=9;--n;)r=(1&r&&3988292384)^r>>>1;e[t]=r}return e}(),zu=function(){var e=-1;return{p:function(t){for(var r=e,n=0;n<t.length;++n)r=Nu[255&r^t[n]]^r>>>8;e=r},d:function(){return~e}}},Ju=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}}},Vu=function(e,t,r,n,i){return Hu(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)},Ku=function(e,t){var r,n={};for(r in e)n[r]=e[r];for(r in t)n[r]=t[r];return n},Qu=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]},Xu=[],Wu=function(e,t,r,n){var i;if(!Xu[r]){for(var o="",a={},s=e.length-1,l=0;l<s;++l)o=(i=Qu(e[l],o,a))[0],a=i[1];Xu[r]=Qu(e[s],o,a)}var u=Ku({},Xu[r][1]);return function(e,t,r,n,i){return(t=tu($l[t]||($l[t]=eu(e)))).onerror=function(e){return i(e.error,null)},t.onmessage=function(e){return i(null,e.data)},t.postMessage(r,n),t}(Xu[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 ru||e[t]instanceof nu||e[t]instanceof iu)&&r.push((e[t]=new e[t].constructor(e[t])).buffer);return r}(u),n)},Yu=function(){return[ru,nu,iu,ou,au,su,lu,cu,Au,Bu,pu,mu,Mu,Cu,Tu,Eu,_u,Du,Ac,rc,nc]},Zu=function(){return[ru,nu,iu,ou,au,su,uu,hu,wu,vu,Su,gu,pu,Gu,ju,mu,Ru,Pu,Ou,Iu,Fu,Lu,ku,Uu,Eu,_u,Hu,Vu,yc,rc]},qu=function(){return[lc,hc,sc,zu,Nu]},$u=function(){return[uc,cc]},ec=function(){return[pc,sc,Ju]},tc=function(){return[dc]},rc=function(e){return postMessage(e,[e.buffer])},nc=function(e){return e&&e.size&&new ru(e.size)},ic=function(e,t,r,n,i,o){var a=Wu(r,n,i,(function(e,t){a.terminate(),o(e,t)}));return a.postMessage([e,t],t.consume?[e.buffer]:[]),function(){a.terminate()}},oc=function(e,t){return e[t]|e[t+1]<<8},ac=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},sc=function(e,t,r){for(;r;++t)e[t]=r,r>>>=8},lc=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&&sc(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)}},uc=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)},cc=function(e){var t=e.length;return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0},hc=function(e){return 10+(e.filename&&e.filename.length+1||0)},pc=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)},dc=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 fc(e,t){return t||"function"!=typeof e||(t=e,e={}),this.ondata=t,e}var mc=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(Vu(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}(),vc=function(e,t){bu([Zu,function(){return[yu,mc]}],this,fc.call(this,e,t),(function(e){e=new mc(e.data),onmessage=yu(e)}),6)};function gc(e,t,r){if(r||(r=t,t={}),"function"!=typeof r)throw"no callback";return ic(e,t,[Zu],(function(e){return rc(yc(e.data[0],e.data[1]))}),0,r)}function yc(e,t){return Vu(e,t||{},0,0)}var bc=function(){function e(e){this.s={},this.p=new ru(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 ru(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=Du(this.p,this.o,this.s);this.ondata(_u(t,e,this.s.b),this.d),this.o=_u(t,this.s.b-32768),this.s.b=this.o.length,this.p=_u(this.p,this.s.p/8|0),this.s.p&=7},e.prototype.push=function(e,t){this.e(e),this.c(t)},e}(),xc=function(e){this.ondata=e,bu([Yu,function(){return[yu,bc]}],this,0,(function(){var e=new bc;onmessage=yu(e)}),7)};function wc(e,t,r){if(r||(r=t,t={}),"function"!=typeof r)throw"no callback";return ic(e,t,[Yu],(function(e){return rc(Ac(e.data[0],nc(e.data[1])))}),1,r)}function Ac(e,t){return Du(e,t)}var Sc=function(){function e(e,t){this.c=zu(),this.l=0,this.v=1,mc.call(this,e,t)}return e.prototype.push=function(e,t){mc.prototype.push.call(this,e,t)},e.prototype.p=function(e,t){this.c.p(e),this.l+=e.length,e=Vu(e,this.o,this.v&&hc(this.o),t&&8,!t),this.v&&(lc(e,this.o),this.v=0),t&&(sc(e,e.length-8,this.c.d()),sc(e,e.length-4,this.l)),this.ondata(e,t)},e}(),Bc=function(e,t){bu([Zu,qu,function(){return[yu,mc,Sc]}],this,fc.call(this,e,t),(function(e){e=new Sc(e.data),onmessage=yu(e)}),8)};function Mc(e,t,r){if(r||(r=t,t={}),"function"!=typeof r)throw"no callback";return ic(e,t,[Zu,qu,function(){return[Cc]}],(function(e){return rc(Cc(e.data[0],e.data[1]))}),2,r)}function Cc(e,t){t=t||{};var r=zu(),n=e.length,i=(r.p(e),e=Vu(e,t,hc(t),8)).length;return lc(e,t),sc(e,i-8,r.d()),sc(e,i-4,n),e}var Tc=function(){function e(e){this.v=1,bc.call(this,e)}return e.prototype.push=function(e,t){if(bc.prototype.e.call(this,e),this.v){if((e=3<this.p.length?uc(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)}bc.prototype.c.call(this,t)},e}(),Ec=function(e){this.ondata=e,bu([Yu,$u,function(){return[yu,bc,Tc]}],this,0,(function(){var e=new Tc;onmessage=yu(e)}),9)};function _c(e,t,r){if(r||(r=t,t={}),"function"!=typeof r)throw"no callback";return ic(e,t,[Yu,$u,function(){return[Dc]}],(function(e){return rc(Dc(e.data[0]))}),3,r)}function Dc(e,t){return Du(e.subarray(uc(e),-8),t||new ru(cc(e)))}var Rc=function(){function e(e,t){this.c=Ju(),this.v=1,mc.call(this,e,t)}return e.prototype.push=function(e,t){mc.prototype.push.call(this,e,t)},e.prototype.p=function(e,t){this.c.p(e),e=Vu(e,this.o,this.v&&2,t&&4,!t),this.v&&(pc(e,this.o),this.v=0),t&&sc(e,e.length-4,this.c.d()),this.ondata(e,t)},e}(),Pc=function(e,t){bu([Zu,ec,function(){return[yu,mc,Rc]}],this,fc.call(this,e,t),(function(e){e=new Rc(e.data),onmessage=yu(e)}),10)};function Oc(e,t){t=t||{};var r=Ju();return r.p(e),e=Vu(e,t,2,4),pc(e,t),sc(e,e.length-4,r.d()),e}var Ic=function(){function e(e){this.v=1,bc.call(this,e)}return e.prototype.push=function(e,t){if(bc.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)}bc.prototype.c.call(this,t)},e}(),Fc=function(e){this.ondata=e,bu([Yu,tc,function(){return[yu,bc,Ic]}],this,0,(function(){var e=new Ic;onmessage=yu(e)}),11)};function Lc(e,t,r){if(r||(r=t,t={}),"function"!=typeof r)throw"no callback";return ic(e,t,[Yu,tc,function(){return[kc]}],(function(e){return rc(kc(e.data[0],nc(e.data[1])))}),5,r)}function kc(e,t){return Du((dc(e),e.subarray(2,-4)),t)}var Uc=function(){function e(e){this.G=Tc,this.I=bc,this.Z=Ic,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 ru(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}(),Gc=function(){function e(e){this.G=Ec,this.I=xc,this.Z=Fc,this.ondata=e}return e.prototype.push=function(e,t){Uc.prototype.push.call(this,e,t)},e}(),jc=function e(t,r,n,i){for(var o in t){var a=t[o];o=r+o,a instanceof ru?n[o]=[a,i]:Array.isArray(a)?n[o]=[a[0],Ku(i,a[1])]:e(a,o+"/",n,i)}},Hc="undefined"!=typeof TextEncoder&&new TextEncoder,Nc="undefined"!=typeof TextDecoder&&new TextDecoder,zc=0;try{Nc.decode(ju,{stream:!0}),zc=1}catch(du){}var Jc=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,_u(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)}},Vc=function(){function e(e){this.ondata=e,zc?this.t=new TextDecoder:this.p=ju}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 ru(this.p.length+e.length)).set(this.p),r.set(e,this.p.length),e=Jc(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}(),Kc=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(Qc(e),this.d=t||!1)},e}();function Qc(e,t){if(t){for(var r=new ru(e.length),n=0;n<e.length;++n)r[n]=e.charCodeAt(n);return r}if(Hc)return Hc.encode(e);var i=e.length,o=new ru(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 ru(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 _u(o,0,a)}function Xc(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(Nc)return Nc.decode(e);var i=(t=Jc(e))[0];if(t[1].length)throw"invalid utf-8 data";return i}function Wc(e){return 1==e?3:e<6?2:9==e?1:0}var Yc=function(e,t){return t+30+oc(e,t+26)+oc(e,t+28)},Zc=function(e,t,r){var n=oc(e,t+28),i=Xc(e.subarray(t+46,t+46+n),!(2048&oc(e,t+8))),o=(n=t+46+n,ac(e,t+20)),a=(o=(r=r&&4294967295==o?qc(e,n):[o,ac(e,t+24),ac(e,t+42)])[0],r[1]);return r=r[2],[oc(e,t+10),o,a,i,n+oc(e,t+30)+oc(e,t+32),r]},qc=function(e,t){for(;1!=oc(e,t);t+=4+oc(e,t+2));return[xu(e,t+12),xu(e,t+4),xu(e,t+20)]},$c=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},eh=function(e,t,r,n,i,o,a,s){var l=n.length,u=r.extra,c=s&&s.length,h=$c(u),p=(sc(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(sc(e,t,p<<25|i.getMonth()+1<<21|i.getDate()<<16|i.getHours()<<11|i.getMinutes()<<5|i.getSeconds()>>>1),t+=4,null!=o&&(sc(e,t,r.crc),sc(e,t+4,o),sc(e,t+8,r.size)),sc(e,t+12,l),sc(e,t+14,h),t+=16,null!=a&&(sc(e,t,c),sc(e,t+6,r.attrs),sc(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;sc(e,t,+d),sc(e,t+2,m),e.set(f,t+4),t+=4+m}return c&&(e.set(s,t),t+=c),t},th=function(e,t,r,n,i){sc(e,t,101010256),sc(e,t+8,r),sc(e,t+10,r),sc(e,t+12,n),sc(e,t+16,i)},rh=function(){function e(e){this.filename=e,this.c=zu(),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}(),nh=function(){function e(e,t){var r=this;t=t||{},rh.call(this,e),this.d=new mc(t,(function(e,t){r.ondata(null,e,t)})),this.compression=8,this.flag=Wc(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){rh.prototype.push.call(this,e,t)},e}(),ih=function(){function e(e,t){var r=this;t=t||{},rh.call(this,e),this.d=new vc(t,(function(e,t,n){r.ondata(e,t,n)})),this.compression=8,this.flag=Wc(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){rh.prototype.push.call(this,e,t)},e}(),oh=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=Qc(e.filename),n=r.length,i=(o=e.comment)&&Qc(o),o=n!=e.filename.length||i&&o.length!=i.length,a=n+$c(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 ru(a);var l=(eh(n,0,e,r,o),[n]),u=this.d,c=(this.d=0,this.u.length),h=Ku(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 ru(16),sc(r,0,134695760),sc(r,4,e.crc),sc(r,8,p),sc(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+$c(l.extra)+(l.o?l.o.length:0);for(var o=new ru(r+22),a=0,s=this.u;a<s.length;a++){var l=s[a];eh(o,e,l,l.f,l.u,l.c,t,l.o),e+=46+l.f.length+$c(l.extra)+(l.o?l.o.length:0),t+=l.b}th(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}(),ah=function(){function e(){}return e.prototype.push=function(e,t){this.ondata(null,e,t)},e.compression=0,e}(),sh=function(){function e(){var e=this;this.i=new bc((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}(),lh=function(){function e(e,t){var r=this;t<32e4?this.i=new bc((function(e,t){r.ondata(null,e,t)})):(this.i=new xc((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=_u(e,0)),this.i.push(e,t)},e.compression=8,e}(),uh=function(){function e(e){this.onfile=e,this.k=[],this.o={0:ah},this.p=ju}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 ru(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,g,y,b=ac(l,a);return 67324752==b?(o=1,s=a,h.d=null,h.c=0,n=oc(l,a+6),e=oc(l,a+8),t=2048&n,n&=8,i=oc(l,a+26),p=oc(l,a+28),a+30+i+p<u&&(h.k.unshift(d=[]),o=2,f=ac(l,a+18),m=ac(l,a+22),v=Xc(l.subarray(a+30,a+=30+i),!t),4294967295==f?(i=n?[-2]:qc(l,a),f=i[0],m=i[1]):n&&(f=-1),a+=p,h.c=f,y={name:v,compression:e,start:function(){if(!y.ondata)throw"no callback";if(f){var t=r.o[e];if(!t)throw"unknown compression type "+e;(g=f<0?new t(v):new t(v,f,m)).ondata=function(e,t,r){y.ondata(e,t,r)};for(var n=0,i=d;n<i.length;n++)g.push(i[n],!1);r.k[0]==d&&r.c?r.d=g:g.push(ju,!0)}else y.ondata(null,ju,!0)},terminate:function(){g&&g.terminate&&g.terminate()}},0<=f&&(y.size=f,y.originalSize=m),h.onfile(y)),"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=ju,c<0&&(n=o?l.subarray(0,s-12-(-2==c&&8)-(134695760==ac(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 ch(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 hh(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 ph(e,t,r,n,i){for(var o=i<e?i:e,a=[],s=ch(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],g=h[d-m],y=(u[d][m]=v+g,u[m][d-1]/u[d][m]);u[m][d]=f+v*y,f=g*y}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,A=1,S=[],B=0;B<=r;++B)S[B]=o.slice(0);for(var M=S[0][0]=1;M<=n;++M){var C=0,T=x-M,E=r-M;M<=x&&(S[A][0]=S[w][0]/u[1+E][T],C=S[A][0]*u[T][E]);for(var _=x-1<=E?M-1:r-x,D=-1<=T?1:-T;D<=_;++D)S[A][D]=(S[w][D]-S[w][D-1])/u[1+E][T+D],C+=S[A][D]*u[T+D][E];x<=E&&(S[A][M]=-S[w][M-1]/u[1+E][x],C+=S[A][M]*u[x][E]),s[M][x]=C;var R=w;w=A,A=R}}for(var P=r,O=1;O<=n;++O){for(var I=0;I<=r;++I)s[O][I]*=P;P*=r-O}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 g=o+1;g<=i+1;++g)a[g]=new c.Vector4(0,0,0);return a}function dh(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 fh(e){return(fh="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 vh(e){return(vh=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var gh,yh,bh,xh=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=vh(e);if(r=t?(r=vh(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===fh(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=ch(e,n,t),o=hh(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]),dh(ph(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 wh(e){return(wh="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 Ah(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Sh(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 Bh(e,t,r){t&&Sh(e.prototype,t),r&&Sh(e,r),Object.defineProperty(e,"prototype",{writable:!1})}function Mh(e,t){return(Mh=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Ch(e){return(Ch=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Th=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=Ch(e);if(r=t?(r=Ch(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===wh(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 Ah(this,n),r.call(this,e)}return Bh(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===Jh(r,0,n.length))gh=(new Ph).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=Jh(e)))throw new Error("THREE.FBXLoader: Unknown format.");if(Fh(r)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+Fh(r));gh=(new Rh).parse(r)}var r,n=new c.TextureLoader(this.manager).setPath(this.resourcePath||t).setCrossOrigin(this.crossOrigin);return new Eh(n,this.manager).parse(gh)}}]),n}(c.Loader),Eh=function(){function e(t,r){Ah(this,e),this.textureLoader=t,this.manager=r}return Bh(e,[{key:"parse",value:function(){yh=this.parseConnections();var e=this.parseImages(),t=(e=this.parseTextures(e),e=this.parseMaterials(e),this.parseDeformers()),r=(new _h).parse(t);return this.parseScene(t,r,e),bh}},{key:"parseConnections",value:function(){var e=new Map;return"Connections"in gh&&gh.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 gh.Objects){var n,i=gh.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 gh.Objects){var r,n=gh.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=yh.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 gh.Objects){var r,n=gh.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"===wh(o)&&(o=o.value),!yh.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 yh.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 gh.Objects&&t in gh.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),t=yh.get(t).children[0].ID),e.get(t)}},{key:"parseDeformers",value:function(){var e={},t={};if("Deformer"in gh.Objects){var r,n=gh.Objects.Deformer;for(r in n){var i,o=n[r],a=yh.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=yh.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){bh=new c.Group;var n=this.parseModels(e.skeletons,t,r),i=gh.Objects.Model,o=this;n.forEach((function(e){var t=i[e.ID];o.setLookAtProperties(e,t),yh.get(e.ID).parents.forEach((function(t){void 0!==(t=n.get(t.ID))&&t.add(e)})),null===e.parent&&bh.add(e)})),this.bindSkeleton(e.skeletons,t,n),this.createAmbientLight(),bh.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=Hh(e.userData.transformData),e.applyMatrix4(t),e.updateWorldMatrix())})),r=(new Dh).parse(),1===bh.children.length&&bh.children[0].isGroup&&(bh.children[0].animations=r,bh=bh.children[0]),bh.animations=r}},{key:"parseModels",value:function(e,t,r){var n,i=new Map,o=gh.Objects.Model;for(n in o){var a=parseInt(n),s=o[n],l=yh.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=gh.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=gh.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?Nh(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&&yh.get(e.ID).children.forEach((function(t){"LookAtProperty"===t.relationship&&"Lcl_Translation"in(t=gh.Objects.Model[t.ID])&&(t=t.Lcl_Translation.value,void 0!==e.target?(e.target.position.fromArray(t),bh.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];yh.get(parseInt(o.ID)).parents.forEach((function(e){t.has(e.ID)&&(e=e.ID,yh.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 gh.Objects){var t,r,n=gh.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 gh&&"AmbientColor"in gh.GlobalSettings&&(r=(t=gh.GlobalSettings.AmbientColor.value)[0],e=t[1],t=t[2],0===r&&0===e&&0===t||(r=new c.Color(r,e,t),bh.add(new c.AmbientLight(r,1))))}}]),e}(),_h=function(){function e(){Ah(this,e)}return Bh(e,[{key:"parse",value:function(e){var t=new Map;if("Geometry"in gh.Objects){var r,n=gh.Objects.Geometry;for(r in n){var i=yh.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 gh.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=Nh(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=Hh(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,g,y=!1,b=(p<0&&(p^=-1,y=!0),[]),x=[];if(o.push(3*p,3*p+1,3*p+2),e.color&&(g=Uh(d,r,p,e.color),s.push(g[0],g[1],g[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&&(g=Uh(d,r,p,e.normal),a.push(g[0],g[1],g[2])),e.material&&"AllSame"!==e.material.mappingType&&(f=Uh(d,r,p,e.material)[0]),e.uv&&e.uv.forEach((function(e,t){e=Uh(d,r,p,e),void 0===l[t]&&(l[t]=[]),l[t].push(e[0]),l[t].push(e[1])})),n++,y&&(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=gh.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===xh)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 xh(r,t,n,s,l).getPoints(12*n.length),(new c.BufferGeometry).setFromPoints(e)}}]),e}(),Dh=function(){function e(){Ah(this,e)}return Bh(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!==gh.Objects.AnimationCurve)return e=this.parseAnimationCurveNodes(),this.parseAnimationCurves(e),e=this.parseAnimationLayers(e),this.parseAnimStacks(e)}},{key:"parseAnimationCurveNodes",value:function(){var e,t=gh.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=gh.Objects.AnimationCurve;for(t in r){var n,i={id:r[t].id,times:r[t].KeyTime.a.map(Lh),values:r[t].KeyValueFloat.a},o=yh.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=gh.Objects.AnimationLayer,n=new Map;for(t in r)!function(t){var r=[],i=yh.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=yh.get(t.ID).parents.filter((function(e){return void 0!==e.relationship}))[0].ID;if(void 0!==o){var a=gh.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]};bh.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=yh.get(t.ID).parents.filter((function(e){return void 0!==e.relationship}))[0].ID,t=yh.get(o).parents[0].ID,t=yh.get(t).parents[0].ID,t=yh.get(t).parents[0].ID,t={modelName:(t=gh.Objects.Model[t]).attrName?c.PropertyBinding.sanitizeNodeName(t.attrName):"",morphName:gh.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=gh.Objects.AnimationStack,n={};for(t in r){var i=(1<(i=yh.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=bh.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=Vh(e.times,t,u),e.values=Vh(e.values,t,c)}}}}]),e}(),Rh=function(){function e(){Ah(this,e)}return Bh(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 Ih,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=zh(t))}}},{key:"parseNodePropertyContinued",value:function(e){var t=this.getCurrentNode();t.a+=e,","!==e.slice(-1)&&(t.a=zh(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=zh(s)}this.getPrevNode()[n]={type:i,type2:o,flag:a,value:s},this.setCurrentProp(this.getPrevNode(),n)}}]),e}(),Ph=function(){function e(){Ah(this,e)}return Bh(e,[{key:"parse",value:function(e){var t=new Oh(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 Ih;!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=kc(new Uint8Array(e.getArrayBuffer(o)));var a=new Oh(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}(),Oh=function(){function e(t,r){Ah(this,e),this.dv=new DataView(t),this.offset=0,this.littleEndian=void 0===r||r}return Bh(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}(),Ih=function(){function e(){Ah(this,e)}return Bh(e,[{key:"add",value:function(e,t){this[e]=t}}]),e}();function Fh(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 Lh(e){return e/46186158e3}var kh=[];function Uh(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=kh,l=n.buffer,u=a,c=o,h=0;c<u;c++,h++)s[h]=l[c];return s}var Gh=new c.Euler,jh=new c.Vector3;function Hh(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(jh.fromArray(e.translation)),e.preRotation&&((m=e.preRotation.map(c.MathUtils.degToRad)).push(e.eulerOrder),r.makeRotationFromEuler(Gh.fromArray(m))),e.rotation&&((m=e.rotation.map(c.MathUtils.degToRad)).push(e.eulerOrder),n.makeRotationFromEuler(Gh.fromArray(m))),e.postRotation&&((m=e.postRotation.map(c.MathUtils.degToRad)).push(e.eulerOrder),i.makeRotationFromEuler(Gh.fromArray(m)),i.invert()),e.scale&&o.scale(jh.fromArray(e.scale)),e.scalingOffset&&s.setPosition(jh.fromArray(e.scalingOffset)),e.scalingPivot&&a.setPosition(jh.fromArray(e.scalingPivot)),e.rotationOffset&&l.setPosition(jh.fromArray(e.rotationOffset)),e.rotationPivot&&u.setPosition(jh.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)),g=(v=e.clone().invert().multiply(v),o),y=new c.Matrix4;return 0===f?y.copy(e).multiply(m).multiply(v).multiply(g):1===f?y.copy(e).multiply(v).multiply(m).multiply(g):(f=(new c.Matrix4).scale((new c.Vector3).setFromMatrixScale(p)).clone().invert(),p=v.clone().multiply(f),y.copy(e).multiply(m).multiply(p).multiply(g)),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(y)).premultiply(h.invert()),e}function Nh(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 zh(e){return e.split(",").map((function(e){return parseFloat(e)}))}function Jh(e,t,r){return void 0===t&&(t=0),void 0===r&&(r=e.byteLength),c.LoaderUtils.decodeText(new Uint8Array(e,t,r))}function Vh(e,t,r){return e.slice(0,t).concat(r).concat(e.slice(t))}function Kh(e){return(Kh="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 Qh(e,t){return(Qh=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Xh(e){return(Xh=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Wh=/^[og]\s*(.+)?/,Yh=/^mtllib /,Zh=/^usemtl /,qh=/^usemap /,$h=new c.Vector3,ep=new c.Vector3,tp=new c.Vector3,rp=new c.Vector3,np=new c.Vector3,ip=new c.Color;function op(){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;$h.fromArray(n,e),ep.fromArray(n,t),tp.fromArray(n,r),np.subVectors(tp,ep),rp.subVectors($h,ep),np.cross(rp),np.normalize(),i.push(np.x,np.y,np.z),i.push(np.x,np.y,np.z),i.push(np.x,np.y,np.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 ap=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&&Qh(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=Xh(e);if(r=t?(r=Xh(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Kh(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 op,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?(ip.setRGB(parseFloat(p[4]),parseFloat(p[5]),parseFloat(p[6])).convertSRGBToLinear(),i.colors.push(ip.r,ip.g,ip.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 g=d[m];0<g.length&&(g=g.split("/"),f.push(g))}for(var y=f[0],b=1,x=f.length-1;b<x;b++){var w=f[b],A=f[b+1];i.addFace(y[0],w[0],A[0],y[1],w[1],A[1],y[2],w[2],A[2])}}else if("l"===t){var S=a.substring(1).trim().split(" "),B=[],M=[];if(-1===a.indexOf("/"))B=S;else for(var C=0,T=S.length;C<T;C++){var E=S[C].split("/");""!==E[0]&&B.push(E[0]),""!==E[1]&&M.push(E[1])}i.addLineGeometry(B,M)}else"p"===t?(r=a.slice(1).trim().split(" "),i.addPointGeometry(r)):null!==(s=Wh.exec(a))?(r=(" "+s[0].slice(1).trim()).slice(1),i.startObject(r)):Zh.test(a)?i.object.startMaterial(a.substring(7).trim(),i.materialLibraries):Yh.test(a)?i.materialLibraries.push(a.substring(7).trim()):qh.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 _,D=new c.Group;if(1==(D.materialLibraries=[].concat(i.materialLibraries),e=!(1===i.objects.length&&0===i.objects[0].geometry.vertices.length)))for(var R=0,P=i.objects.length;R<P;R++){var O=i.objects[R],I=O.geometry,F=O.materials,L="Line"===I.type,k="Points"===I.type,U=!1;if(0!==I.vertices.length){for(var G=new c.BufferGeometry,j=(G.setAttribute("position",new c.Float32BufferAttribute(I.vertices,3)),0<I.normals.length&&G.setAttribute("normal",new c.Float32BufferAttribute(I.normals,3)),0<I.colors.length&&(U=!0,G.setAttribute("color",new c.Float32BufferAttribute(I.colors,3))),!0===I.hasUVIndices&&G.setAttribute("uv",new c.Float32BufferAttribute(I.uvs,2)),[]),H=0,N=F.length;H<N;H++){var z,J=F[H],V=J.name+"_"+J.smooth+"_"+U,K=i.materials[V];null!==this.materials&&(K=this.materials.create(J.name),!L||!K||K instanceof c.LineBasicMaterial?!k||!K||K instanceof c.PointsMaterial||(z=new c.PointsMaterial({size:10,sizeAttenuation:!1}),c.Material.prototype.copy.call(z,K),z.color.copy(K.color),z.map=K.map,K=z):(z=new c.LineBasicMaterial,c.Material.prototype.copy.call(z,K),z.color.copy(K.color),K=z)),void 0===K&&((K=L?new c.LineBasicMaterial:k?new c.PointsMaterial({size:1,sizeAttenuation:!1}):new c.MeshPhongMaterial).name=J.name,K.flatShading=!J.smooth,K.vertexColors=U,i.materials[V]=K),j.push(K)}if(I=void 0,1<j.length){for(var Q=0,X=F.length;Q<X;Q++){var W=F[Q];G.addGroup(W.groupStart,W.groupCount,Q)}I=new(L?c.LineSegments:k?c.Points:c.Mesh)(G,j)}else I=new(L?c.LineSegments:k?c.Points:c.Mesh)(G,j[0]);I.name=O.name,D.add(I)}}else 0<i.vertices.length&&(e=new c.PointsMaterial({size:1,sizeAttenuation:!1}),(_=new c.BufferGeometry).setAttribute("position",new c.Float32BufferAttribute(i.vertices,3)),0<i.colors.length&&void 0!==i.colors[0]&&(_.setAttribute("color",new c.Float32BufferAttribute(i.colors,3)),e.vertexColors=!0),_=new c.Points(_,e),D.add(_));return D}}])&&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),sp=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 lp{constructor(e){this.parses={fbx:new Th,obj:new ap,object:new c.ObjectLoader},this.runScene=e}getBack(e){return e.name.substring(e.name.lastIndexOf(".")+1).toLowerCase()}parseFiles(e){return Promise.all(e.map((e=>this.parse(e))))}parse(e){return sp(this,void 0,void 0,(function*(){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 sp(this,void 0,void 0,(function*(){var t=yield(0,je.toResult)(e,"arrayBuffer");return{type:"model",result:yield this.runScene.loaderer.gltf.parse(t,{addToScene:!1})}}))}fbx(e){return sp(this,void 0,void 0,(function*(){var t=e instanceof ArrayBuffer?e:yield(0,je.toResult)(e,"arrayBuffer");const r=this.parses.fbx.parse(t,"");return r.traverse((e=>{e.material&&(e.material=this.runScene.materialEx.create())})),{type:"model",result:this.runScene.sceneEx.cleanUnlessLevel(r)}}))}obj(e){return sp(this,void 0,void 0,(function*(){var t=e instanceof File?yield(0,je.toResult)(e,"text"):e;const r=this.parses.obj.parse(t);return r.traverse((e=>{e.material&&(e.material=this.runScene.materialEx.create())})),{type:"model",result:this.runScene.sceneEx.cleanUnlessLevel(r)}}))}json(e){return sp(this,void 0,void 0,(function*(){var t=e instanceof File?yield(0,je.toResult)(e,"text"):e;return{type:"model",result:this.runScene.loaderer.json.parse(t)}}))}}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){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}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)}}function pp(e,t,r){t&&hp(e.prototype,t),r&&hp(e,r),Object.defineProperty(e,"prototype",{writable:!1})}function dp(){return(dp="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=yp(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 fp(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&&mp(e,t)}function mp(e,t){return(mp=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function vp(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"===up(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return gp(n)}}function gp(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function yp(e){return(yp=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var bp=new c.Raycaster,xp=new c.Vector3,wp=new c.Vector3,Ap=new c.Quaternion,Sp={X:new c.Vector3(1,0,0),Y:new c.Vector3(0,1,0),Z:new c.Vector3(0,0,1)},Bp={type:"change"},Mp={type:"mouseDown"},Cp={type:"mouseUp",mode:null},Tp={type:"objectChange"};function Ep(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}sl=function(){fp(t,c.Object3D);var e=vp(t);function t(r,n){cp(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 zp,a=(i._gizmo=o,i.add(o),new Jp),s=(i._plane=a,i.add(a),gp(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(Bp))}}),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,g=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",g),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(gp(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(gp(i)),i._onPointerHover=function(e){if(this.enabled)switch(e.pointerType){case"mouse":case"pen":this.pointerHover(this._getPointer(e))}}.bind(gp(i)),i._onPointerMove=function(e){this.enabled&&this.pointerMove(this._getPointer(e))}.bind(gp(i)),i._onPointerUp=function(e){this.enabled&&(this.domElement.releasePointerCapture(e.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.pointerUp(this._getPointer(e)))}.bind(gp(i)),i.domElement.addEventListener("pointerdown",i._onPointerDown),i.domElement.addEventListener("pointermove",i._onPointerHover),i.domElement.addEventListener("pointerup",i._onPointerUp),i}return pp(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(),dp(yp(t.prototype),"updateMatrixWorld",this).call(this,this)}},{key:"pointerHover",value:function(e){void 0!==this.object&&!0!==this.dragging&&(bp.setFromCamera(e,this.camera),e=Ep(this._gizmo.picker[this.mode],bp),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&&(bp.setFromCamera(e,this.camera),(e=Ep(this._plane,bp,!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,Mp.mode=this.mode,this.dispatchEvent(Mp))}},{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&&(bp.setFromCamera(e,this.camera),(e=Ep(this._plane,bp,!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(Ap.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(xp.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(xp.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),wp.set(e,e,e)):(xp.copy(this.pointStart),wp.copy(this.pointEnd),xp.applyQuaternion(this._worldQuaternionInv),wp.applyQuaternion(this._worldQuaternionInv),wp.divide(xp),-1===t.search("X")&&(wp.x=1),-1===t.search("Y")&&(wp.y=1),-1===t.search("Z")&&(wp.z=1)),n.scale.copy(this._scaleStart).multiply(wp),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(xp.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(xp.copy(this.rotationAxis).cross(this.eye))*e):"X"!==t&&"Y"!==t&&"Z"!==t||(this.rotationAxis.copy(Sp[t]),xp.copy(Sp[t]),"local"===i&&xp.applyQuaternion(this.worldQuaternion),this.rotationAngle=this._offset.dot(xp.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(Ap.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this._parentQuaternionInv),n.quaternion.copy(Ap.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),n.quaternion.multiply(this._quaternionStart).normalize())),this.dispatchEvent(Bp),this.dispatchEvent(Tp)))}},{key:"pointerUp",value:function(e){0===e.button&&(this.dragging&&null!==this.axis&&(Cp.mode=this.mode,this.dispatchEvent(Cp)),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(Bp),this.dispatchEvent(Tp),this.pointStart.copy(this.pointEnd))}},{key:"getRaycaster",value:function(){return bp}},{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}(),sl.prototype.isTransformControls=!0;var _p=new c.Euler,Dp=new c.Vector3(0,1,0),Rp=new c.Vector3(0,0,0),Pp=new c.Matrix4,Op=new c.Quaternion,Ip=new c.Quaternion,Fp=new c.Vector3,Lp=new c.Matrix4,kp=new c.Vector3(1,0,0),Up=new c.Vector3(0,1,0),Gp=new c.Vector3(0,0,1),jp=new c.Vector3,Hp=new c.Vector3,Np=new c.Vector3,zp=function(){fp(t,c.Object3D);var e=vp(t);function t(){cp(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,y=n.clone()).color.setHex(16776960),y.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)),A=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(A,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(A,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(A,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]]]},g={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(((g=new c.BufferGeometry).setAttribute("position",new c.Float32BufferAttribute([0,0,0,1,1,1],3)),g),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"]]},y=(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),y),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(A,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(A,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(A,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]]]},A={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 S(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=S(m)),r.add(r.gizmo.rotate=S(n)),r.add(r.gizmo.scale=S(x)),r.add(r.picker.translate=S(v)),r.add(r.picker.rotate=S(b)),r.add(r.picker.scale=S(w)),r.add(r.helper.translate=S(g)),r.add(r.helper.rotate=S(y)),r.add(r.helper.scale=S(A)),r.picker.translate.visible=!1,r.picker.rotate.visible=!1,r.picker.scale.visible=!1,r}return pp(t,[{key:"updateMatrixWorld",value:function(e){var r=this,n="local"===("scale"===this.mode?"local":this.space)?this.worldQuaternion:Ip,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&&(Ap.setFromEuler(_p.set(0,0,0)),t.quaternion.copy(n).multiply(Ap),.9<Math.abs(Dp.copy(kp).applyQuaternion(n).dot(r.eye))&&(t.visible=!1)),"Y"===r.axis&&(Ap.setFromEuler(_p.set(0,0,Math.PI/2)),t.quaternion.copy(n).multiply(Ap),.9<Math.abs(Dp.copy(Up).applyQuaternion(n).dot(r.eye))&&(t.visible=!1)),"Z"===r.axis&&(Ap.setFromEuler(_p.set(0,Math.PI/2,0)),t.quaternion.copy(n).multiply(Ap),.9<Math.abs(Dp.copy(Gp).applyQuaternion(n).dot(r.eye))&&(t.visible=!1)),"XYZE"===r.axis&&(Ap.setFromEuler(_p.set(0,Math.PI/2,0)),Dp.copy(r.rotationAxis),t.quaternion.setFromRotationMatrix(Pp.lookAt(Rp,Dp,Up)),t.quaternion.multiply(Ap),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),xp.set(1e-10,1e-10,1e-10).add(r.worldPositionStart).sub(r.worldPosition).multiplyScalar(-1),xp.applyQuaternion(r.worldQuaternionStart.clone().invert()),t.scale.copy(xp),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(Dp.copy(kp).applyQuaternion(n).dot(r.eye))&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"Y"===t.name&&.99<Math.abs(Dp.copy(Up).applyQuaternion(n).dot(r.eye))&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"Z"===t.name&&.99<Math.abs(Dp.copy(Gp).applyQuaternion(n).dot(r.eye))&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"XY"===t.name&&Math.abs(Dp.copy(Gp).applyQuaternion(n).dot(r.eye))<.2&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"YZ"===t.name&&Math.abs(Dp.copy(kp).applyQuaternion(n).dot(r.eye))<.2&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"XZ"===t.name&&Math.abs(Dp.copy(Up).applyQuaternion(n).dot(r.eye))<.2&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1)):"rotate"===r.mode&&(Op.copy(n),Dp.copy(r.eye).applyQuaternion(Ap.copy(n).invert()),-1!==t.name.search("E")&&t.quaternion.setFromRotationMatrix(Pp.lookAt(r.eye,Rp,Up)),"X"===t.name&&(Ap.setFromAxisAngle(kp,Math.atan2(-Dp.y,Dp.z)),Ap.multiplyQuaternions(Op,Ap),t.quaternion.copy(Ap)),"Y"===t.name&&(Ap.setFromAxisAngle(Up,Math.atan2(Dp.x,Dp.z)),Ap.multiplyQuaternions(Op,Ap),t.quaternion.copy(Ap)),"Z"===t.name&&(Ap.setFromAxisAngle(Gp,Math.atan2(Dp.y,Dp.x)),Ap.multiplyQuaternions(Op,Ap),t.quaternion.copy(Ap))),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);dp(yp(t.prototype),"updateMatrixWorld",this).call(this,e)}}]),t}(),Jp=(zp.prototype.isTransformControlsGizmo=!0,function(){fp(t,c.Mesh);var e=vp(t);function t(){var r;return cp(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 pp(t,[{key:"updateMatrixWorld",value:function(e){var r=this.space;switch(this.position.copy(this.worldPosition),"scale"===this.mode&&(r="local"),jp.copy(kp).applyQuaternion("local"===r?this.worldQuaternion:Ip),Hp.copy(Up).applyQuaternion("local"===r?this.worldQuaternion:Ip),Np.copy(Gp).applyQuaternion("local"===r?this.worldQuaternion:Ip),Dp.copy(Hp),this.mode){case"translate":case"scale":switch(this.axis){case"X":Dp.copy(this.eye).cross(jp),Fp.copy(jp).cross(Dp);break;case"Y":Dp.copy(this.eye).cross(Hp),Fp.copy(Hp).cross(Dp);break;case"Z":Dp.copy(this.eye).cross(Np),Fp.copy(Np).cross(Dp);break;case"XY":Fp.copy(Np);break;case"YZ":Fp.copy(jp);break;case"XZ":Dp.copy(Np),Fp.copy(Hp);break;case"XYZ":case"E":Fp.set(0,0,0)}break;default:Fp.set(0,0,0)}0===Fp.length()?this.quaternion.copy(this.cameraQuaternion):(Lp.lookAt(xp.set(0,0,0),Fp,Dp),this.quaternion.setFromRotationMatrix(Lp)),dp(yp(t.prototype),"updateMatrixWorld",this).call(this,e)}}]),t}());Jp.prototype.isTransformControlsPlane=!0;class Vp extends sl{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 Kp{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 Ie.Vector3,this.transControlsStatusMap={position:"translate",rotation:"rotate",scale:"scale"},this.multipObj=null,this.worldOldVal=new Ie.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=Lo(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=Lo(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=Lo(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=Lo(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 Vp(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 Ie.GridHelper(20,10);return e.name="helper",e.position.y=0,e.material.opacity=.75,e.material.transparent=!0,e}dispose(){}reset(){"running"!==this.runScene.optionsEx.options.mode&&this.transContro.reset()}isHelper(e){return"GridHelper"===e.type||"CubeCamera"===e.type||e.isTransformControls||e.userData.isHelper}setHelper(e,t=!1,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 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 Xp(e,t){return(Xp=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 Yp=new WeakMap,Zp=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&&Xp(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=Wp(e);if(r=t?(r=Wp(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){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(Yp.has(e)){if((l=Yp.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)})),Yp.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":Qp(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,g=t.DecodeBufferToMesh(r,i);else{if(s!==e.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");i=new e.PointCloud,g=t.DecodeBufferToPointCloud(r,i)}if(!g.ok()||0===i.ptr)throw new Error("THREE.DRACOLoader: Decoding failed: "+g.error_msg());var l,u,c,h,p,d,f,m,v,g,y,b,x,w={index:null,attributes:[]};for(l in o){var A=self[a[l]],S=void 0,B=void 0;if(n.useUniqueIDs)B=o[l],S=t.GetAttributeByUniqueId(i,B);else{if(-1===(B=t.GetAttributeId(i,e[o[l]])))continue;S=t.GetAttribute(i,B)}w.attributes.push((B=e,u=t,c=i,h=l,p=S.num_components(),f=(d=c.num_points()*p)*A.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}}(B,A),v=B._malloc(f),u.GetAttributeDataArrayForAllPoints(c,S,m,f,v),u=new A(B.HEAPF32.buffer,v,d).slice(),B._free(v),{name:h,array:u,itemSize:p}))}return s===e.TRIANGULAR_MESH&&(w.index=(r=e,g=t,b=4*(y=3*(s=i).num_faces()),x=r._malloc(b),g.GetTrianglesUInt32Array(s,b,x),g=new Uint32Array(r.HEAPF32.buffer,x,y).slice(),r._free(x),{array:g,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),qp={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 $p=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 ed=function(){function e(t){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");this.manager=void 0!==t?t:$p,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 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){(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 nd(e,t){return(nd=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function id(e){return(id=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var od=function(){var e=n,t=ed;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=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=id(e);if(r=t?(r=id(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){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=qp.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=(a=o.options).textureQuality,a=a.reverseTexture,s=i.notCompress;t(i.size&&1!==n?(r=(t=i.size).w,t=t.h,s=s?1:n,createImageBitmap(e,Object.assign(o.options,{imageOrientation:a?"none":"flipY",resizeHeight:t*s,resizeWidth:r*s}))):createImageBitmap(e,Object.assign(o.options,{imageOrientation:a?"none":"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 rd(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)?rd(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],qp.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 ad(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)||ld(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 sd(e,t){var r,n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=ld(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 ld(e,t){if(e){if("string"==typeof e)return ud(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)?ud(e,t):void 0}}function ud(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 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 hd(){return(hd="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=bd(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 pd(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}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 fd(e,t,r){return t&&dd(e.prototype,t),r&&dd(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function md(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&&vd(e,t)}function vd(e,t){return(vd=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function gd(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=bd(e);if(r=t?(r=bd(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");return yd(n)}}function yd(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function bd(e){return(bd=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}od.prototype.isImageBitmapLoader=!0;var xd=function(){md(t,c.Loader);var e=gd(t);function t(r){return pd(this,t),(r=e.call(this,r)).dracoLoader=null,r.ktx2Loader=null,r.meshoptDecoder=null,r.pluginCallbacks=[],r.register((function(e){return new Md(e)})),r.register((function(e){return new Rd(e)})),r.register((function(e){return new Pd(e)})),r.register((function(e){return new Cd(e)})),r.register((function(e){return new Td(e)})),r.register((function(e){return new Ed(e)})),r.register((function(e){return new _d(e)})),r.register((function(e){return new Dd(e)})),r.register((function(e){return new Sd(e)})),r.register((function(e){return new Od(e)})),r}return fd(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))===Id){try{a[Ad.KHR_BINARY_GLTF]=new Fd(e)}catch(e){return void(n&&n(e))}o=a[Ad.KHR_BINARY_GLTF].content}else o=c.LoaderUtils.decodeText(new Uint8Array(e));var l=JSON.parse(o);if(console.log(l,"json"),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 tf(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 Ad.KHR_MATERIALS_UNLIT:a[f]=new Bd;break;case Ad.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:a[f]=new Gd;break;case Ad.KHR_DRACO_MESH_COMPRESSION:a[f]=new Ld(l,this.dracoLoader);break;case Ad.KHR_TEXTURE_TRANSFORM:a[f]=new kd;break;case Ad.KHR_MESH_QUANTIZATION:a[f]=new jd;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 wd(){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 Ad={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"},Sd=function(){function e(t){pd(this,e),this.parser=t,this.name=Ad.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}return fd(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}(),Bd=function(){function e(){pd(this,e),this.name=Ad.KHR_MATERIALS_UNLIT}return fd(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}(),Md=function(){function e(t){pd(this,e),this.parser=t,this.name=Ad.KHR_MATERIALS_CLEARCOAT}return fd(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}(),Cd=function(){function e(t){pd(this,e),this.parser=t,this.name=Ad.KHR_MATERIALS_SHEEN}return fd(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}(),Td=function(){function e(t){pd(this,e),this.parser=t,this.name=Ad.KHR_MATERIALS_TRANSMISSION}return fd(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}(),Ed=function(){function e(t){pd(this,e),this.parser=t,this.name=Ad.KHR_MATERIALS_VOLUME}return fd(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}(),_d=function(){function e(t){pd(this,e),this.parser=t,this.name=Ad.KHR_MATERIALS_IOR}return fd(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}(),Dd=function(){function e(t){pd(this,e),this.parser=t,this.name=Ad.KHR_MATERIALS_SPECULAR}return fd(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}(),Rd=function(){function e(t){pd(this,e),this.parser=t,this.name=Ad.KHR_TEXTURE_BASISU}return fd(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}(),Pd=function(){function e(t){pd(this,e),this.parser=t,this.name=Ad.EXT_TEXTURE_WEBP,this.isSupported=null}return fd(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}(),Od=function(){function e(t){pd(this,e),this.name=Ad.EXT_MESHOPT_COMPRESSION,this.parser=t}return fd(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}(),Id="glTF",Fd=fd((function e(t){pd(this,e),this.name=Ad.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!==Id)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.")})),Ld=function(){function e(t,r){if(pd(this,e),!r)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=Ad.KHR_DRACO_MESH_COMPRESSION,this.json=t,this.dracoLoader=r,this.dracoLoader.preload()}return fd(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=Xd[r]||r.toLowerCase();l[h]=s[r]}for(n in e.attributes){var p,d,f=Xd[n]||n.toLowerCase();void 0!==s[n]&&(p=i.accessors[e.attributes[n]],d=Jd[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}(),kd=function(){function e(){pd(this,e),this.name=Ad.KHR_TEXTURE_TRANSFORM}return fd(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}(),Ud=function(){md(t,c.MeshStandardMaterial);var e=gd(t);function t(r){pd(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(yd(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 fd(t,[{key:"copy",value:function(e){return hd(bd(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}(),Gd=function(){function e(){pd(this,e),this.name=Ad.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 fd(e,[{key:"getMaterialType",value:function(){return Ud}},{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 Ud(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}(),jd=fd((function e(){pd(this,e),this.name=Ad.KHR_MESH_QUANTIZATION})),Hd=function(){md(t,c.Interpolant);var e=gd(t);function t(r,n,i,o){return pd(this,t),e.call(this,r,n,i,o)}return fd(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}(),Nd=(Hd.prototype.beforeStart_=Hd.prototype.copySampleValue_,Hd.prototype.afterEnd_=Hd.prototype.copySampleValue_,Hd.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 g=o[h+v+a],y=o[h+v+s]*u,b=o[c+v+a],x=o[c+v]*u;i[v]=f*g+m*y+p*b+d*x}return i},new c.Quaternion),zd=function(){md(t,Hd);var e=gd(t);function t(){return pd(this,t),e.apply(this,arguments)}return fd(t,[{key:"interpolate_",value:function(e,r,n,i){return e=hd(bd(t.prototype),"interpolate_",this).call(this,e,r,n,i),Nd.fromArray(e).normalize().toArray(e),e}}]),t}(),Jd={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Vd={9728:c.NearestFilter,9729:c.LinearFilter,9984:c.NearestMipmapNearestFilter,9985:c.LinearMipmapNearestFilter,9986:c.NearestMipmapLinearFilter,9987:c.LinearMipmapLinearFilter},Kd={33071:c.ClampToEdgeWrapping,33648:c.MirroredRepeatWrapping,10497:c.RepeatWrapping},Qd={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Xd={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},Wd={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},Yd={CUBICSPLINE:void 0,LINEAR:c.InterpolateLinear,STEP:c.InterpolateDiscrete};function Zd(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 qd(e,t){void 0!==t.extras&&("object"===cd(t.extras)?Object.assign(e.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function $d(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 ef(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 tf=function(){function e(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};pd(this,e),this.json=t,this.extensions={},this.plugins={},this.options=r,this.cache=new wd,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 od(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 fd(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 ud(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||ld(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:{}};Zd(i,o,n),qd(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),sd(t.children.entries()));try{for(a.s();!(i=a.n()).done;){var s=ad(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[Ad.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=Qd[n.type],s=Jd[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=Jd[n.sparse.indices.componentType],m=n.sparse.indices.byteOffset||0,v=n.sparse.values.byteOffset||0,g=new f(e[1],m,n.sparse.count*Qd.SCALAR),y=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=g.length;b<x;b++){var w=g[b];if(d.setX(w,y[b*a]),2<=a&&d.setY(w,y[b*a+1]),3<=a&&d.setZ(w,y[b*a+2]),4<=a&&d.setW(w,y[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=Vd[r.magFilter]||c.LinearFilter,t.minFilter=Vd[r.minFilter]||c.LinearMipmapLinearFilter,t.wrapS=Kd[r.wrapS]||c.RepeatWrapping,t.wrapT=Kd[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,s;!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)):(s=i.myOptions.loadConfig.reverseTexture,Oi(e).then((function(e){var t=e.ctx,n=e.canvas,i=(e=e.img,new c.Texture(n));s||(t.clearRect(0,0,n.width,n.height),t.translate(0,n.height),t.scale(1,-1),t.drawImage(e,0,0,n.width,n.height)),r(i)})).catch(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=l,r.userData.blob=e),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[Ad.KHR_TEXTURE_TRANSFORM]&&(o=void 0!==r.extensions?r.extensions[Ad.KHR_TEXTURE_TRANSFORM]:void 0)&&(a=n.associations.get(i),i=n.extensions[Ad.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||{})[Ad.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]?(l=i[Ad.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS],t=l.getMaterialType(),s.push(l.extendParams(a,o,r))):n[Ad.KHR_MATERIALS_UNLIT]?(l=i[Ad.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===Ud?i[Ad.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),qd(n,o),r.associations.set(n,{materials:e}),o.extensions&&Zd(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[Ad.KHR_DRACO_MESH_COMPRESSION])?"draco:"+u.bufferView+":"+u.indices+":"+$d(u.attributes):l.indices+":"+$d(l.attributes)+":"+l.mode),u=n[l];u?i.push(u.promise):(u=void 0,u=s.extensions&&s.extensions[Ad.KHR_DRACO_MESH_COMPRESSION]?function(e){return r[Ad.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then((function(r){return rf(r,e,t)}))}(s):rf(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=nf(f.geometry,c.TriangleStripDrawMode):6===d.mode&&(f.geometry=nf(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){A=w=x=b=y=v=void 0;var v=f,g=i;if(v.updateMorphTargets(),void 0!==g.weights)for(var y=0,b=g.weights.length;y<b;y++)v.morphTargetInfluences[y]=g.weights[y];if(g.extras&&Array.isArray(g.extras.targetNames)){var x=g.extras.targetNames;if(v.morphTargetInfluences.length===x.length){v.morphTargetDictionary={};for(var w=0,A=x.length;w<A;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),qd(f,i),d.extensions&&Zd(n,f,d),t.assignFinalMaterial(f),l.push(f)}for(var S=0,B=l.length;S<B;S++)t.associations.set(l[S],{meshes:e,primitives:S});if(1===l.length)return l[0];var M=new c.Group;t.associations.set(M,{meshes:e});for(var C=0,T=l.length;C<T;C++)M.add(l[C]);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)),qd(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(Wd[p.path]){case Wd.weights:d=c.NumberKeyframeTrack;break;case Wd.rotation:d=c.QuaternionKeyframeTrack;break;default:d=c.VectorKeyframeTrack}e=t.name||t.uuid;var f=void 0!==h.interpolation?Yd[h.interpolation]:c.InterpolateLinear,m=[],v=(Wd[p.path]===Wd.weights?t.traverse((function(e){e.morphTargetInfluences&&m.push(e.name||e.uuid)})):m.push(e),u.array);if(u.normalized){for(var g=ef(v.constructor),y=new Float32Array(v.length),b=0,x=v.length;b<x;b++)y[b]=v[b]*g;v=y}for(var w=0,A=m.length;w<A;w++){var S=new d(m[w]+"."+Wd[p.path],r.array,v,f);"CUBICSPLINE"===h.interpolation&&(S.createInterpolant=function(e){return new(this instanceof c.QuaternionKeyframeTrack?zd:Hd)(this.times,this.values,this.getValueSize()/3,e)},S.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0),l.push(S)}}}(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),qd(s,o),o.extensions&&Zd(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)),qd(i,e),e.extensions&&Zd(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=sd(n.associations);try{for(i.s();!(t=i.n()).done;){var o=ad(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 rf(e,t,r){var n,i=t.attributes,o=[];for(n in i){var a=Xd[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)),qd(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=ef(Jd[h.componentType]),p.min.multiplyScalar(d),p.max.multiplyScalar(d));var m=l.targets;if(void 0!==m){for(var v=new c.Vector3,g=new c.Vector3,y=0,b=m.length;y<b;y++){var x,w,A=m[y];void 0!==A.POSITION&&(w=(A=u.json.accessors[A.POSITION]).min,x=A.max,void 0!==w&&void 0!==x?(g.setX(Math.max(Math.abs(w[0]),Math.abs(x[0]))),g.setY(Math.max(Math.abs(w[1]),Math.abs(x[1]))),g.setZ(Math.max(Math.abs(w[2]),Math.abs(x[2]))),A.normalized&&(w=ef(Jd[A.componentType]),g.multiplyScalar(w)),v.max(g)):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 g,y=i[m];a&&(g=void 0!==y.POSITION?o.getDependency("accessor",y.POSITION):n.attributes.position,p.push(g)),s&&(g=void 0!==y.NORMAL?o.getDependency("accessor",y.NORMAL):n.attributes.normal,d.push(g)),l&&(y=void 0!==y.COLOR_0?o.getDependency("accessor",y.COLOR_0):n.attributes.color,f.push(y))}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 nf(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 of{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,Oe.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,Oe.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,Oe.js)(r,((r,n)=>{if(r=this.materialIns[r]){const{material:i,models:o}=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,Oe.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}),is({material:r,type:e,texture:t})))}))},this.lazyLoad=(()=>{const e=()=>{this.loadConfig.triggerCb&&this.runScene.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}),is({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,this.loadConfig=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.parser=t}))}processTexture(e){const{textureDef:t,texture:r}=e;var{md5:e,format:n,size:i,uvScript:o}=t;r.userData.md5=e,n&&(r.format=n,r.userData.format=n),o&&(r.userData.uvScript=o),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;os(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 af{constructor(e,t){this.runScene=e,this.loadConfig=t}done(e){var t,r,n;e.asset.ex&&(({camera:e,lights:t,options:r,controls:n}=e.asset.ex),this.camera(e),this.controls(n),this.lights(t),this.options(r))}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)}))}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 sf{constructor(e,t){this.runScene=e,this.loadConfig=t}setTextureLoader(e){this.textureLoader=e,this.initTextureLoader(e)}initTextureLoader(e){e instanceof od&&e.setOptions({reverseTexture:this.loadConfig.reverseTexture,textureQuality:this.runScene.optionsEx.options.texture.quality})}}class lf{constructor(e,t){this.helperModels=[],this.pending=[],this.nodeType={MySpriteMaterial:fs},this.cloneMap={},this.runScene=e,this.loadConfig=t,this.material=new of(e,t),this.scene=new af(e,t),this.options=new sf(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,Oe.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&&(r.animations=mf.parse(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.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,Oe.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=Ts(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=ha(i))}i&&(t.background=new c.Color("#"+i)),o&&(({color:r,far:e,near:n}=o),i=new c.Fog("#"+r,n,e),t.fog=i,t.fog.open="true",this.runScene.cb.setScene.cb({scene:t,type:"fog",val:i})),this.runScene.cb.setScene.cb({scene:t,type:"any",val:"any"})}removeHelperModel(){this.helperModels.map((e=>{var t;return null==(t=e.parent)?void 0:t.remove(e)}))}}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)}var cf=function(){var e=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),t=new Uint8Array([32,0,65,253,3,1,2,34,4,106,6,5,11,8,7,20,13,33,12,16,128,9,116,64,19,113,127,15,10,21,22,14,255,66,24,54,136,107,18,23,192,26,114,118,132,17,77,101,130,144,27,87,131,44,45,74,156,154,70,167]);if("object"!==("undefined"==typeof WebAssembly?"undefined":uf(WebAssembly)))return{supported:!1};var r,n="B9h9z9tFBBBF8fL9gBB9gLaaaaaFa9gEaaaB9gFaFa9gEaaaFaEMcBFFFGGGEIIILF9wFFFLEFBFKNFaFCx/IFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBF8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBGy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBEn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBIi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBKI9z9iqlBOc+x8ycGBM/qQFTa8jUUUUBCU/EBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAGTkUUUBRNCUoBAG9uC/wgBZHKCUGAKCUG9JyRVAECFJRICBRcGXEXAcAF9PQFAVAFAclAcAVJAF9JyRMGXGXAG9FQBAMCbJHKC9wZRSAKCIrCEJCGrRQANCUGJRfCBRbAIRTEXGXAOATlAQ9PQBCBRISEMATAQJRIGXAS9FQBCBRtCBREEXGXAOAIlCi9PQBCBRISLMANCU/CBJAEJRKGXGXGXGXGXATAECKrJ2BBAtCKZrCEZfIBFGEBMAKhB83EBAKCNJhB83EBSEMAKAI2BIAI2BBHmCKrHYAYCE6HYy86BBAKCFJAICIJAYJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCGJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCEJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCIJAYAmJHY2BBAI2BFHmCKrHPAPCE6HPy86BBAKCLJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCKJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCOJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCNJAYAmJHY2BBAI2BGHmCKrHPAPCE6HPy86BBAKCVJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCcJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCMJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCSJAYAmJHm2BBAI2BEHICKrHYAYCE6HYy86BBAKCQJAmAYJHm2BBAICIrCEZHYAYCE6HYy86BBAKCfJAmAYJHm2BBAICGrCEZHYAYCE6HYy86BBAKCbJAmAYJHK2BBAICEZHIAICE6HIy86BBAKAIJRISGMAKAI2BNAI2BBHmCIrHYAYCb6HYy86BBAKCFJAICNJAYJHY2BBAmCbZHmAmCb6Hmy86BBAKCGJAYAmJHm2BBAI2BFHYCIrHPAPCb6HPy86BBAKCEJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCIJAmAYJHm2BBAI2BGHYCIrHPAPCb6HPy86BBAKCLJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCKJAmAYJHm2BBAI2BEHYCIrHPAPCb6HPy86BBAKCOJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCNJAmAYJHm2BBAI2BIHYCIrHPAPCb6HPy86BBAKCVJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCcJAmAYJHm2BBAI2BLHYCIrHPAPCb6HPy86BBAKCMJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCSJAmAYJHm2BBAI2BKHYCIrHPAPCb6HPy86BBAKCQJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCfJAmAYJHm2BBAI2BOHICIrHYAYCb6HYy86BBAKCbJAmAYJHK2BBAICbZHIAICb6HIy86BBAKAIJRISFMAKAI8pBB83BBAKCNJAICNJ8pBB83BBAICTJRIMAtCGJRtAECTJHEAS9JQBMMGXAIQBCBRISEMGXAM9FQBANAbJ2BBRtCBRKAfREEXAEANCU/CBJAKJ2BBHTCFrCBATCFZl9zAtJHt86BBAEAGJREAKCFJHKAM9HQBMMAfCFJRfAIRTAbCFJHbAG9HQBMMABAcAG9sJANCUGJAMAG9sTkUUUBpANANCUGJAMCaJAG9sJAGTkUUUBpMAMCBAIyAcJRcAIQBMC9+RKSFMCBC99AOAIlAGCAAGCA9Ly6yRKMALCU/EBJ8kUUUUBAKM+OmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUFT+JUUUBpALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM+lLKFaF99GaG99FaG99GXGXAGCI9HQBAF9FQFEXGXGX9DBBB8/9DBBB+/ABCGJHG1BB+yAB1BBHE+yHI+L+TABCFJHL1BBHK+yHO+L+THN9DBBBB9gHVyAN9DBB/+hANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE86BBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG86BBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG86BBABCIJRBAFCaJHFQBSGMMAF9FQBEXGXGX9DBBB8/9DBBB+/ABCIJHG8uFB+yAB8uFBHE+yHI+L+TABCGJHL8uFBHK+yHO+L+THN9DBBBB9gHVyAN9DB/+g6ANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE87FBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG87FBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG87FBABCNJRBAFCaJHFQBMMM/SEIEaE99EaF99GXAF9FQBCBREABRIEXGXGX9D/zI818/AICKJ8uFBHLCEq+y+VHKAI8uFB+y+UHO9DB/+g6+U9DBBB8/9DBBB+/AO9DBBBB9gy+SHN+L9DBBB9P9d9FQBAN+oRVSFMCUUUU94RVMAICIJ8uFBRcAICGJ8uFBRMABALCFJCEZAEqCFWJAV87FBGXGXAKAM+y+UHN9DB/+g6+U9DBBB8/9DBBB+/AN9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRMSFMCUUUU94RMMABALCGJCEZAEqCFWJAM87FBGXGXAKAc+y+UHK9DB/+g6+U9DBBB8/9DBBB+/AK9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRcSFMCUUUU94RcMABALCaJCEZAEqCFWJAc87FBGXGX9DBBU8/AOAO+U+TANAN+U+TAKAK+U+THO9DBBBBAO9DBBBB9gy+R9DB/+g6+U9DBBB8/+SHO+L9DBBB9P9d9FQBAO+oRcSFMCUUUU94RcMABALCEZAEqCFWJAc87FBAICNJRIAECIJREAFCaJHFQBMMM9JBGXAGCGrAF9sHF9FQBEXABAB8oGBHGCNWCN91+yAGCi91CnWCUUU/8EJ+++U84GBABCIJRBAFCaJHFQBMMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEM/lFFFaGXGXAFABqCEZ9FQBABRESFMGXGXAGCT9PQBABRESFMABREEXAEAF8oGBjGBAECIJAFCIJ8oGBjGBAECNJAFCNJ8oGBjGBAECSJAFCSJ8oGBjGBAECTJREAFCTJRFAGC9wJHGCb9LQBMMAGCI9JQBEXAEAF8oGBjGBAFCIJRFAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF2BB86BBAECFJREAFCFJRFAGCaJHGQBMMABMoFFGaGXGXABCEZ9FQBABRESFMAFCgFZC+BwsN9sRIGXGXAGCT9PQBABRESFMABREEXAEAIjGBAECSJAIjGBAECNJAIjGBAECIJAIjGBAECTJREAGC9wJHGCb9LQBMMAGCI9JQBEXAEAIjGBAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF86BBAECFJREAGCaJHGQBMMABMMMFBCUNMIT9kBB";function i(e,t,n,i,o,a){var s=r.exports.sbrk,l=n+3&-4,u=s(l*i),c=s(o.length),h=new Uint8Array(r.exports.memory.buffer);if(0==(h.set(o,c),e=e(u,n,i,c,o.length))&&a&&a(u,l,i),t.set(h.subarray(u,u+n*i)),s(u-s(0)),0!=e)throw new Error("Malformed buffer data: "+e)}WebAssembly.validate(e)&&(n="B9h9z9tFBBBFiI9gBB9gLaaaaaFa9gEaaaB9gFaFaEMcBBFBFFGGGEILF9wFFFLEFBFKNFaFCx/aFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBG8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBIy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBKi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBOn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBNI9z9iqlBVc+N9IcIBTEM9+FLa8jUUUUBCTlRBCBRFEXCBRGCBREEXABCNJAGJAECUaAFAGrCFZHIy86BBAEAIJREAGCFJHGCN9HQBMAFCx+YUUBJAE86BBAFCEWCxkUUBJAB8pEN83EBAFCFJHFCUG9HQBMMk8lLbaE97F9+FaL978jUUUUBCU/KBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAG/8cBBCUoBAG9uC/wgBZHKCUGAKCUG9JyRNAECFJRKCBRVGXEXAVAF9PQFANAFAVlAVANJAF9JyRcGXGXAG9FQBAcCbJHIC9wZHMCE9sRSAMCFWRQAICIrCEJCGrRfCBRbEXAKRTCBRtGXEXGXAOATlAf9PQBCBRKSLMALCU/CBJAtAM9sJRmATAfJRKCBREGXAMCoB9JQBAOAKlC/gB9JQBCBRIEXAmAIJREGXGXGXGXGXATAICKrJ2BBHYCEZfIBFGEBMAECBDtDMIBSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAEAKDBBBDMIBAKCTJRKMGXGXGXGXGXAYCGrCEZfIBFGEBMAECBDtDMITSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAEAKDBBBDMITAKCTJRKMGXGXGXGXGXAYCIrCEZfIBFGEBMAECBDtDMIASEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAEAKDBBBDMIAAKCTJRKMGXGXGXGXGXAYCKrfIBFGEBMAECBDtDMI8wSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCIJAeDeBJAYCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCNJAeDeBJAYCx+YUUBJ2BBJRKSFMAEAKDBBBDMI8wAKCTJRKMAICoBJREAICUFJAM9LQFAERIAOAKlC/fB9LQBMMGXAEAM9PQBAECErRIEXGXAOAKlCi9PQBCBRKSOMAmAEJRYGXGXGXGXGXATAECKrJ2BBAICKZrCEZfIBFGEBMAYCBDtDMIBSEMAYAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAYAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAYAKDBBBDMIBAKCTJRKMAICGJRIAECTJHEAM9JQBMMGXAK9FQBAKRTAtCFJHtCI6QGSFMMCBRKSEMGXAM9FQBALCUGJAbJREALAbJDBGBReCBRYEXAEALCU/CBJAYJHIDBIBHdCFD9tAdCFDbHPD9OD9hD9RHdAIAMJDBIBH8ZCFD9tA8ZAPD9OD9hD9RH8ZDQBTFtGmEYIPLdKeOnHpAIAQJDBIBHyCFD9tAyAPD9OD9hD9RHyAIASJDBIBH8cCFD9tA8cAPD9OD9hD9RH8cDQBTFtGmEYIPLdKeOnH8dDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGEAeD9uHeDyBjGBAEAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJHIAeApA8dDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHeDyBjGBAIAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJHIAeAdA8ZDQNiV8ZcpMyS8cQ8df8eb8fHdAyA8cDQNiV8ZcpMyS8cQ8df8eb8fH8ZDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGED9uHeDyBjGBAIAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJHIAeAdA8ZDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHeDyBjGBAIAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJREAYCTJHYAM9JQBMMAbCIJHbAG9JQBMMABAVAG9sJALCUGJAcAG9s/8cBBALALCUGJAcCaJAG9sJAG/8cBBMAcCBAKyAVJRVAKQBMC9+RKSFMCBC99AOAKlAGCAAGCA9Ly6yRKMALCU/KBJ8kUUUUBAKMNBT+BUUUBM+KmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUF/8MBALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM/dLEK97FaF97GXGXAGCI9HQBAF9FQFCBRGEXABABDBBBHECiD+rFCiD+sFD/6FHIAECND+rFCiD+sFD/6FAID/gFAECTD+rFCiD+sFD/6FHLD/gFD/kFD/lFHKCBDtD+2FHOAICUUUU94DtHND9OD9RD/kFHI9DBB/+hDYAIAID/mFAKAKD/mFALAOALAND9OD9RD/kFHIAID/mFD/kFD/kFD/jFD/nFHLD/mF9DBBX9LDYHOD/kFCgFDtD9OAECUUU94DtD9OD9QAIALD/mFAOD/kFCND+rFCU/+EDtD9OD9QAKALD/mFAOD/kFCTD+rFCUU/8ODtD9OD9QDMBBABCTJRBAGCIJHGAF9JQBSGMMAF9FQBCBRGEXABCTJHVAVDBBBHECBDtHOCUU98D8cFCUU98D8cEHND9OABDBBBHKAEDQILKOSQfbPden8c8d8e8fCggFDtD9OD/6FAKAEDQBFGENVcMTtmYi8ZpyHECTD+sFD/6FHID/gFAECTD+rFCTD+sFD/6FHLD/gFD/kFD/lFHE9DB/+g6DYALAEAOD+2FHOALCUUUU94DtHcD9OD9RD/kFHLALD/mFAEAED/mFAIAOAIAcD9OD9RD/kFHEAED/mFD/kFD/kFD/jFD/nFHID/mF9DBBX9LDYHOD/kFCTD+rFALAID/mFAOD/kFCggEDtD9OD9QHLAEAID/mFAOD/kFCaDbCBDnGCBDnECBDnKCBDnOCBDncCBDnMCBDnfCBDnbD9OHEDQNVi8ZcMpySQ8c8dfb8e8fD9QDMBBABAKAND9OALAEDQBFTtGEmYILPdKOenD9QDMBBABCAJRBAGCIJHGAF9JQBMMM/hEIGaF97FaL978jUUUUBCTlREGXAF9FQBCBRIEXAEABDBBBHLABCTJHKDBBBHODQILKOSQfbPden8c8d8e8fHNCTD+sFHVCID+rFDMIBAB9DBBU8/DY9D/zI818/DYAVCEDtD9QD/6FD/nFHVALAODQBFGENVcMTtmYi8ZpyHLCTD+rFCTD+sFD/6FD/mFHOAOD/mFAVALCTD+sFD/6FD/mFHcAcD/mFAVANCTD+rFCTD+sFD/6FD/mFHNAND/mFD/kFD/kFD/lFCBDtD+4FD/jF9DB/+g6DYHVD/mF9DBBX9LDYHLD/kFCggEDtHMD9OAcAVD/mFALD/kFCTD+rFD9QHcANAVD/mFALD/kFCTD+rFAOAVD/mFALD/kFAMD9OD9QHVDQBFTtGEmYILPdKOenHLD8dBAEDBIBDyB+t+J83EBABCNJALD8dFAEDBIBDyF+t+J83EBAKAcAVDQNVi8ZcMpySQ8c8dfb8e8fHVD8dBAEDBIBDyG+t+J83EBABCiJAVD8dFAEDBIBDyE+t+J83EBABCAJRBAICIJHIAF9JQBMMM9jFF97GXAGCGrAF9sHG9FQBCBRFEXABABDBBBHECND+rFCND+sFD/6FAECiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMBBABCTJRBAFCIJHFAG9JQBMMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEMMMFBCUNMIT9tBB",console.log("Warning: meshopt_decoder is using experimental SIMD support")),e=WebAssembly.instantiate(function(e){for(var r=new Uint8Array(e.length),n=0;n<e.length;++n){var i=e.charCodeAt(n);r[n]=96<i?i-71:64<i?i-65:47<i?i+4:46<i?63:62}var o=0;for(n=0;n<e.length;++n)r[o++]=r[n]<60?t[r[n]]:64*(r[n]-60)+r[++n];return r.buffer.slice(0,o)}(n),{}).then((function(e){(r=e.instance).exports.__wasm_call_ctors()}));var o={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},a={0:"meshopt_decodeVertexBuffer",1:"meshopt_decodeIndexBuffer",2:"meshopt_decodeIndexSequence",ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};return{ready:e,supported:!0,decodeVertexBuffer:function(e,t,n,a,s){i(r.exports.meshopt_decodeVertexBuffer,e,t,n,a,r.exports[o[s]])},decodeIndexBuffer:function(e,t,n,o){i(r.exports.meshopt_decodeIndexBuffer,e,t,n,o)},decodeIndexSequence:function(e,t,n,o){i(r.exports.meshopt_decodeIndexSequence,e,t,n,o)},decodeGltfBuffer:function(e,t,n,s,l,u){i(r.exports[a[l]],e,t,n,s,r.exports[o[u]])}}}();class hf{constructor(e){this.dracoPath="./draco/",this._gltf=new xd,this.runScene=e;const t=new Zp;t.setDecoderPath(this.runScene.optionsEx.options.decodePath),this._gltf.setMeshoptDecoder(cf),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 Bi(e);return r?this.parse(r,t):Promise.resolve()}))}parse(e,t){const r=Mi({addToScene:!0,cleanJSON:!0,triggerCb:!1,reverseTexture:!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 lf(this.runScene,r),runScene:this.runScene,loadConfig:r})}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){const n=e.helper.done(t),{addToScene:i,cleanJSON:o,triggerCb:a}=r;var s=e.models;this.runScene.cb.load.modelLoaded.cb(s);let l=[];var u=(t.asset.ex||{}).type;return"material"===u?this.parseMaterial(s):("model"===u?l=this.parseModel(s[0]):(l=this.parseScene({model:s[0],json:t,config:r}),this.runScene.optionsEx.sceneOptions.loaded=!0),i&&this.runScene.modelEx.add(l,void 0,{addUndo:!1,select:!1,isClone:"model"===(null==(u=t.asset.ex)?void 0:u.type)}),this.runScene.modelEx.selectNull(),e.helper.mergeClone(),this.runScene.optionsEx.log(t,"detail"),n.then((()=>a&&this.runScene.cb.load.complete.cb("")))),o&&this.disposeJSON(t),l}parseMaterial(e){var t,[e]=e;if(e=this.runScene.sceneEx.cleanUnlessLevel(e).material)return this.runScene.materialEx.add(e),({select:t}=this.runScene.modelEx),t&&this.runScene.materialEx.resetMaterial(t,e),e}parseModel(e){return[e="glb_model"===e.name&&(null==e?void 0:e.children[0])||e]}parseScene(e){var t;const{model:r,json:n,config:i}=e;e=i.triggerCb;var o=r.children.filter((e=>this.runScene.modelEx.isUnless(e)?void 0:e));if(1===o.length){const[e]=o;e.animations=[...e.animations,...n.animations]}return this.runScene.timeLineEx.parseSavedGroupMap((null==(t=n.asset.ex)?void 0:t.timeLine)||{}),e&&this.runScene.cb.load.loaded.cb(""),o}disposeJSON(e){}}class pf{constructor(e){this._objectLoader=new c.ObjectLoader,this.runScene=e,this._parser=new df(e)}load(){}parse(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*(){var t=yield this._objectLoader.parseAsync(JSON.parse(e));return this._parser.afterParse(this.runScene.sceneEx.cleanUnlessLevel(t))}))}}class df{constructor(e){this.runScene=e}parseModel(e){e.material&&this.parseMaterial(e)}parseMaterial(e){var t=e.material;"SpriteMaterial"===t.type&&ps(t,"tools",fs.tools),this.runScene.uniqueEx.material.add(e.material)}afterParse(e){return e instanceof Array?e.map((e=>{e.traverse((e=>{this.parseModel(e)}))})):e.traverse((e=>{this.parseModel(e)})),e}}class ff{constructor(e){this.imgBitMap=new c.ImageBitmapLoader,this.object=new c.ObjectLoader,this.runScene=e,this.gltf=new hf(e),this.json=new pf(e)}}const mf=new class{constructor(){this.load=new c.AnimationLoader}parse(e){return this.load.parse(e)}};var vf=a(185);class gf{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,vf.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.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 gs({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 gs({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.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.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.cb.model.multipDrop.cb({models:this.getSelectedList("value"),dropModel:e}),Da().group.getCenter(e));t.position.copy(n),this.runScene.cb.model.multipDrop.cb({models:r,dropModel: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 yf(){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 yf.Panel("FPS","#0ff","#002")),u=r(new yf.Panel("MS","#0f0","#020"));return self.performance&&self.performance.memory&&(i=r(new yf.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}}yf.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,g){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/g)*f))}}};const bf=yf;class xf{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,renderMode:"tick",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}init(e){this.options=Di(this.options,e||{}),this.options.showFps&&(this.addFps(),this.runScene.cb.render.add("optionx-ex-render",this.render.bind(this)))}addFps(){this.stats=bf(),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.runScene.cb.baseLog.cb({msg:e,type:r}),console.log(e))}}class wf{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=wf.isNotNow(e)?this.getAllData():e,(0,Oe.js)(n,((r,n)=>{void 0!==e[r]&&("number"===(n=n.type)?(i[r]=t[r],o[r]=e[r]):"color"===n&&(0,Oe.js)(e[r],((e,n)=>{var a=r+e;i[a]=t[r][e],o[a]=n})))})),!(0,Oe.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,Ra.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,Oe.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,vf.isTrue)(e)&&(0,vf.isTrue)(i)&&(0,vf.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=ui(i,o,p,(e=>{(0,Oe.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,Oe.js)(e,(i=>{n[i]=r?"notNow":wf.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 wf.getAllDefValByType(this.defOptions,this.target,e)}getData(e){return wf.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){wf.setTargetByBetween(e,t,r,this.defOptions,this.target)}clone(e){var{data:t,type:r}=this;const n=new(0,Sf[r])(e);return n.data=t,n}reset(){(0,Oe.js)(this.defOptions,((e,t)=>{wf.SetTargetByData({baseType:t.type,data:wf.getValByType(this.beginData,e,this.defOptions),target:this.target,defType:e})}))}remove(){delete this.target.userData.isTimeLineUsed}}wf.setTargetByBetween=(()=>{const e=(e,t,r)=>e!==t?(t-e)*r+e:e;return(t,r,n,i,o)=>{(0,Oe.js)(i,((i,a)=>{var s,l,u,c,h,p;a=a.type,void 0!==t[i]&&void 0!==r[i]&&wf.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 Af=wf,Sf={model:class extends Af{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}=Af.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,Ra.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=ui(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 Af{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}=Af.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=ui(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:ui}};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,Ra.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":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 Af{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 Bf extends _a{constructor(e){super(e),this.map={},this.clock=new c.Clock,this.tickIndex=void 0,this.playings=new Set,this.updates={},e.cb.model.add.add("anima-parse",(({model:e})=>{this.parses(e)}))}parses(e){e.traverse((e=>this.parse(e)))}findId(e,t){for(const r of e.animations)if(r.name===t)return r.id}parse(e,t){if(0!==e.animations.length||t){const i=e.animations.length?e.animations:mf.parse(t),o=new c.AnimationMixer(e);for(const t of i){var r=(0,l.getId)(),n=(t.id=r,o.clipAction(t));const i={finished:()=>{},loop:()=>{}};o.addEventListener("finished",(()=>i.finished())),o.addEventListener("loop",(()=>i.loop())),this.map[r]={mixer:o,action:n,model:e,time:0,runState:"close",clip:t,eventMap:i}}i.map((t=>{e.animations.find((e=>e.uuid===t.uuid))||e.animations.push(t)}))}}play(e,t,r){e=this.findId(e,t);const n=this.map[e];if(n&&!this.playings.has(n)){t=Mi({onLoop:()=>{},onProgress:()=>{},onFinished:()=>{},onClose:()=>{},onPause:()=>{},onResume:()=>{},onBeforeEnd:()=>{},loop:!1,lastFrame:!0,reset:!0},r);const{onProgress:i,onBeforeEnd:o,onLoop:a,onFinished:s,lastFrame:l,loop:u,reset:c}=t,{action:h,clip:p,eventMap:d}=(this.map[e].options=t,n);h.stop(),r=c?0:n.time,h.time=r,this.setPlayState(n,!0),c&&h.reset(),h.play();let f=!(n.runState="play");this.setUpdates(e,(()=>{var e=Pi(h.time,p.duration,!0);99<=e&&!f&&(o(),f=!0),i(e)})),u?(h.loop=Ie.LoopRepeat,d.loop=a):(l&&(h.clampWhenFinished=!0),h.loop=Ie.LoopOnce,d.finished=()=>{this.setPlayState(n,!1),i(100),s()})}}pause(e,t){e=this.findId(e,t);const r=this.map[e];r&&this.playings.has(r)&&(this.updateTime(r),this.setPlayState(r,!1),r.options.onPause(),r.runState="pause")}resume(e,t){var r=this.findId(e,t);const n=this.map[r];n&&this.playings.has(n)&&(n.options.onResume(),this.play(e,t,null==(r=this.map[t])?void 0:r.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,Oe.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.id],0===this.playings.size&&this.closeAnima())}getItem(e,t){return e=this.findId(e,t),this.map[e]}close(e,t,r){e=this.findId(e,t);const n=this.map[e];n&&this.playings.has(n)&&n.options&&((t=Mi({resetAction:!0},r).resetAction)&&n.action.reset(),this.setPlayState(n,!1),this.updateTime(n,0),n.options.onClose(),n.options=null,n.runState="pause")}setUpdates(e,t){this.updates[e]=t}fadeTo(e){var{lastModel:e,lastName:t,nextModel:r,nextName:n,duration:i}=e;e=this.findId(e,t);const o=this.map[e];o&&(t=this.findId(r,n),(e=this.map[t])&&o.action.crossFadeTo(e.action,i,!0))}resetTime(e,t){const r=this.getItem(e,t);r&&(r.action.time=0)}}class Mf{constructor(){this.cbs=[]}cb(e){return Promise.all(this.cbs.map((t=>{var r;return null==(r=t.fn)?void 0:r.call(t,e)})))}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)}delete(e){e=(this.get(e)||{}).index,this.cbs.splice(e,1)}}class Cf{constructor(){this.resize=new Mf,this.setSelectMaterial=new Mf,this.setScene=new Mf,this.reset=new Mf,this.render=new Mf,this.baseLog=new Mf,this.inited=new Mf,this.texture={add:new Mf,remove:new Mf,setAnima:new Mf},this.model={setSelect:new Mf,click:new Mf,add:new Mf,remove:new Mf,multipDrop:new Mf,focus:new Mf,unFocus:new Mf,changeName:new Mf,setOpen:new Mf,setMainStatue:new Mf,setVisible:new Mf,setParent:new Mf,setLayers:new Mf,clone:new Mf,dispose:new Mf},this.material={add:new Mf,dispose:new Mf,setName:new Mf},this.unique={material:{add:new Mf}},this.undo={addUndos:new Mf,removeUndos:new Mf,undoByIndex:new Mf,reset:new Mf},this.scene={save:new Mf,saveNet:new Mf},this.timeLine={setProgress:new Mf,playGroup:new Mf,setGroupMap:new Mf,reset:new Mf,closeGroup:new Mf},this.events={key:{g:new Mf},mouse:{move:new Mf,down:new Mf,up:new Mf},pointer:{down:new Mf,up:new Mf}},this.bloom={glow:{setData:new Mf,setStatus:new Mf}},this.load={lazyLoadedTexture:new Mf,loaded:new Mf,modelLoaded:new Mf,progress:new Mf,getArrayBuffer:new Mf,complete:new Mf}}}class Tf extends _a{constructor(e){super(e),this._lastRenderMode=null,this.setRenderMode=(()=>{let e=!1;const t=()=>{e||(this.runScene.cb.load.loaded.add("global-config",(()=>{"controlsChange"===this._lastRenderMode&&this.runScene.render()})),this.runScene.cb.load.complete.add("global-config",(()=>{"controlsChange"===this._lastRenderMode&&this.runScene.render()})),e=!0)},r=()=>{const{renderer:e,controls:t}=this.runScene.assetsEx;var r=this.runScene.render;"tick"===this._lastRenderMode?e.setAnimationLoop(null):"controlsChange"===this._lastRenderMode&&t.removeEventListener("change",r)},n=e=>{var t=this.runScene.render;const{renderer:r,controls:n}=this.runScene.assetsEx;"tick"===e?r.setAnimationLoop(t):"controlsChange"===e&&n.addEventListener("change",t)};return e=>{this._lastRenderMode!==e&&(t(),r(),n(e),this._lastRenderMode=e)}})()}setGlow(e){this.runScene.bloom.glow.bloomParams.isBloom=e}setRender2(e){this.runScene.assetsEx.setRender2(e)}setRender3(e){this.runScene.assetsEx.setRender3(e)}}class Ef extends Map{toJSON(){const e={};return this.forEach(((t,r)=>{e[t]=r})),e}}class _f extends _a{constructor(e){super(e),this.map=new Ef,this.renderName="script-texture-render",this.bindEvent()}parse(e,t){var r=Ss(t);0===Object.keys(e).length?this.map.has(r)&&this.map.delete(r):this.map.set(r,{texture:t,uvScript:e})}bindEvent(){this.runScene.cb.texture.setAnima.add("script-texture-set-anima",(({uvScript:e,texture:t})=>this.parse(e,t))),this.runScene.cb.texture.add.add("script-texture-add-texture",(e=>{var t=e.userData.uvScript;t&&this.parse(t,e)}))}playAll(){this.runScene.cb.render.add(this.renderName,(()=>{this.map.forEach((e=>{const{texture:t,uvScript:r}=e;var{moveX:e,moveY:n,rotate:i}=r;e&&(t.offset.x+=e),n&&(t.offset.y+=n),i&&(t.rotation+=i)}))}))}closeAll(){this.map.forEach((e=>{const{texture:t,uvScript:r}=e;var{moveX:e,moveY:n,rotate:i}=r;0!==e&&(t.offset.x=0),0!==n&&(t.offset.y=0),0!==i&&(t.rotation=0)})),this.runScene.cb.render.delete(this.renderName)}}class Df extends _a{constructor(e){super(e),this.runAll=!1,this.texture=new _f(e)}playAll(){this.runAll||(this.runAll=!0,this.texture.playAll())}closeAll(){this.runAll&&(this.runAll=!1,this.texture.closeAll())}}const Rf={RunScene:class{constructor(e){this.cb=new Cf,this.script=new Df(this),this.uniqueEx=new As(this),this.fileEx=new lp(this),this.optionsEx=new xf(this),this.undoEx=new Ia(this),this.textureEx=new ea(this),this.controlsEx=new Ma,this.assetsEx=new N(this),this.renderEx=new ss(this),this.events=new class{constructor(e){this.key=new Ta(this),this.mouse=new Ea(this),this.drag=new Ca(this),this.mouseEventMap={move:{timeLineMove:e=>{}},down:{},up:{timeLineUp:e=>{}}},this.mouseDown=e=>{},this.mouseUp=e=>{this.runScene.cb.events.mouse.up.cb(e),Object.values(this.mouseEventMap.up).map((t=>t(e)))},this.mouseMove=e=>{this.runScene.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.cb.resize.cb(""))),window.addEventListener("mousemove",this.mouseMove),window.addEventListener("mousedown",this.mouseDown),window.addEventListener("mouseup",this.mouseUp)}}(this),this.multipSelector=new gf(this),this.helperEx=null,this.materialEx=new Za(this),this.cameraEx=new ma(this),this.sceneEx=new hs(this),this.modelEx=new Bs(this),this.loaderer=new ff(this),this.exporter=new ql(this),this.lightEx=new Xs(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.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.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.cb.timeLine.setProgress.cb(0),Object.values(t.data).map((e=>e.reset())))}getSavedData(){return(0,Oe.js)(this.groupMap,((e,t)=>{t.run=!1})),this.groupMap}parseSavedGroupMap(e){Object.keys(e).map((t=>{const r=e[t],n={};(0,Oe.js)(r.data,((e,t)=>{var{type:t,data:r}=t;const i=Sf[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.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,Ra.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.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 Bf(this),this.globalConfig=new Tf(this),this.bloom={glow:new fa(this)},this.render=()=>{var e;if(null!=(e=this.optionsEx.options)&&e.run){const{render2:e,render3:t,scene:r,camera:n}=this.assetsEx;this.cb.render.cb(""),this.bloom.glow.update(),null!=t&&t.render(r,n),null!=e&&e.render(r,n),console.log(123,"123")}};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,loadConfig:r}=e;this.events.init(t),this.assetsEx.init(t),this.globalConfig.setRenderMode(this.optionsEx.options.renderMode),this.helperEx=new Kp(this);const{camera:n,controls:i}=this.assetsEx.get();this.uniqueEx.model.add(n),this.renderEx.setSize(),i.update(),this.bloom.glow.init(this.assetsEx.get()),this.cb.inited.cb(0),this.cameraEx.reset(n),this.loadScene(e,r)}loadScene(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=Object.assign(Object.assign({},t),{triggerCb:!0});if(e instanceof ArrayBuffer)return this.optionsEx.log("正在解析二进制文件","base","info"),this.loaderer.gltf.parse(e,r);this.optionsEx.log("正在拉取场景","base","info");var n=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.cb.load.progress.cb(t)}}).then((e=>e.data)).catch((e=>{this.sceneEx.clean(),this.optionsEx.log("下载场景失败:",e)}));return n?(this.cb.load.getArrayBuffer.cb(n),this.optionsEx.log("拉取场景成功、正在解析","base","success"),this.loaderer.gltf.parse(n,r)):void 0}))}dispose(){this.assetsEx.dispose(),this.sceneEx.clean()}on(e,t){return null!=(e=this.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,!0),this.bloom.glow.setSize(e,t)}},Utils:e,ModelEx:n,MaterialEx:r,TextureEx:t,Bus:class{constructor(){this.list={}}on(e,t){this.list[e]=t}emit(...e){if(void 0===this.list[e[0]])throw Error("请先挂载在使用");return this.list[e[0]](...[...e].filter(((e,t)=>0!==t)))}off(e){this.list[e]&&delete this.list[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={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 A(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,g=(l(m={},o,(function(){return this})),(v=(v=Object.getPrototypeOf)&&v(v(S([]))))&&v!==t&&r.call(v,o)&&(m=v),f.prototype=p.prototype=Object.create(m));function y(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 A(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(x,this),this.reset(!0)}function S(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:B}}function B(){return{value:void 0,done:!0}}return l(g,"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(g),e},e.awrap=function(e){return{__await:e}},y(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()}))},y(g),l(g,s,"Generator"),l(g,o,(function(){return this})),l(g,"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,A.prototype={constructor:A,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:S(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:()=>Pf});var e={},t=(a.r(e),a.d(e,{bindTextureBaseData:()=>_,default:()=>B,disposeTexture:()=>E,getBlobByTexture:()=>D,getMimeByTexture:()=>C,getSizeByTexture:()=>L,getTextureGpuMemory:()=>T,getUrlByTexture:()=>I,initTexture:()=>R,isTexture:()=>k,loadTexture:()=>O,parseImageBitMapByBlob:()=>P,setTextureMapping:()=>F,textureNameMap:()=>M}),{}),r=(a.r(t),a.d(t,{angleToNum:()=>To,anima:()=>ln,arrayBufferToBase64:()=>pn,arrayBufferToBlobUr:()=>hn,arrayToVector3:()=>Mo,base64ToArrayBuffer:()=>un,base64ToBlob:()=>fn,bitMapToCanvas:()=>Jn,blobToFile:()=>vn,bufferToArrayBuffer:()=>On,canvasToBlob:()=>An,changeModelOpc:()=>bo,changeModelOpcs:()=>xo,clone:()=>Cn,compressImgToUrl:()=>Hn,deepMergeObject:()=>_n,domTo2Dui:()=>go,domTo3DSprite:()=>yo,domTo3Dui:()=>vo,fileAndBlobToCanvas:()=>xn,fileToBlob:()=>mn,getArrIndexByItem:()=>Dn,getCamAnimaData:()=>_o,getCurve:()=>Bo,getDistance:()=>mo,getFilesByDataTransfer:()=>wn,getImg:()=>Qn,getImgPixels:()=>zn,getImgPixels1:()=>Nn,getLine2:()=>Co,getMacro:()=>Mn,getMd5:()=>bn,getModelMap:()=>Eo,getNamesByNum:()=>Tn,getProgress:()=>Rn,getRes:()=>Sn,getTruthBase64:()=>cn,getType:()=>En,getTypeByBase64:()=>gn,getVideoTexture:()=>So,getWorldLocal:()=>po,hslToRgb:()=>Kn,imgArrayBufferToBlobUrl:()=>jn,imgBitMapToBase64:()=>Ln,imgBitMapToBlob:()=>kn,imgBitMapToBlobAndBase64:()=>Gn,isEmpty:()=>In,mergeObject:()=>Bn,removeUnLess:()=>Ao,reverseImg:()=>Un,rgbToHsl:()=>Vn,textureToThreeD:()=>wo,transByte:()=>yn,urlToBlob:()=>dn,urlToCanvas:()=>Pn,vector:()=>fo}),{}),n=(a.r(r),a.d(r,{createDefMaterial:()=>ms,defAllMaterialMap:()=>ds,defBaseMaterialMap:()=>ps,default:()=>fs,disposeMaterial:()=>gs,getBaseTextures:()=>xs,getTextures:()=>bs,getTexturesByMaterial:()=>ys,initMaterial:()=>As,isColor:()=>Ss,mergeMaterial:()=>vs,setMaterialTexture:()=>ws}),{}),i=(a.r(n),a.d(n,{createDefModel:()=>Ns,default:()=>Hs,disposeModel:()=>zs,getDeepModels:()=>Xs,hasSkeleton:()=>Ws,instanceModel:()=>Js,setHelper:()=>Ks,setLayers:()=>Qs,withAnima:()=>Vs}),{}),o=(a.r(i),a.d(i,{AsyncCompress:()=>Yh,AsyncDecompress:()=>hp,AsyncDeflate:()=>Nh,AsyncGunzip:()=>ep,AsyncGzip:()=>Yh,AsyncInflate:()=>Kh,AsyncUnzipInflate:()=>Ip,AsyncUnzlib:()=>sp,AsyncZipDeflate:()=>Dp,AsyncZlib:()=>ip,Compress:()=>Wh,DecodeUTF8:()=>gp,Decompress:()=>cp,Deflate:()=>Hh,EncodeUTF8:()=>yp,Gunzip:()=>$h,Gzip:()=>Wh,Inflate:()=>Vh,Unzip:()=>Fp,UnzipInflate:()=>Op,UnzipPassThrough:()=>Pp,Unzlib:()=>ap,Zip:()=>Rp,ZipDeflate:()=>_p,ZipPassThrough:()=>Ep,Zlib:()=>np,compress:()=>Zh,compressSync:()=>qh,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]?tp:8!=(15&e[0])||7<e[0]>>4||(e[0]<<8|e[1])%31?Qh:lp)(e,t,r)},decompressSync:()=>function(e,t){return(31==e[0]&&139==e[1]&&8==e[2]?rp:8!=(15&e[0])||7<e[0]>>4||(e[0]<<8|e[1])%31?Xh:up)(e,t)},deflate:()=>zh,deflateSync:()=>Jh,gunzip:()=>tp,gunzipSync:()=>rp,gzip:()=>Zh,gzipSync:()=>qh,inflate:()=>Qh,inflateSync:()=>Xh,strFromU8:()=>xp,strToU8:()=>bp,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!=Ph(e,o);--o)if(!o||65558<e.length-o)return void t("invalid zip file",null);var a=Rh(e,o+8);a||t(null,{});var s=a,l=Ph(e,o+16),u=4294967295==l;if(u){if(o=Ph(e,o-12),101075792!=Ph(e,o))return void t("invalid zip file",null);s=a=Ph(e,o+32),l=Ph(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=Sp(e,l,u))[0],h=m[1],p=m[2],d=m[3],f=m[4],m=m[5];if(m=Ap(e,m),l=f,c)if(8==c)if(f=e.subarray(m,m+h),h<32e4)try{s(null,Xh(f,new Ec(p)))}catch(o){s(o,null)}else r.push(Qh(f,{size:p},s));else s("unknown compression type "+c,null);else s(null,th(e,m,m+h))},h=0;h<s;++h)c();return n},unzipSync:()=>function(e){for(var t={},r=e.length-22;101010256!=Ph(e,r);--r)if(!r||65558<e.length-r)throw"invalid zip file";var n=Rh(e,r+8);if(!n)return{};var i=Ph(e,r+16),o=4294967295==i;if(o){if(r=Ph(e,r-12),101075792!=Ph(e,r))throw"invalid zip file";n=Ph(e,r+32),i=Ph(e,r+48)}for(var a=0;a<n;++a){var s=(p=Sp(e,i,o))[0],l=p[1],u=p[2],c=p[3],h=p[4],p=p[5];if(p=Ap(e,p),i=h,s){if(8!=s)throw"unknown compression type "+s;t[c]=Xh(e.subarray(p,p+l),new Ec(u))}else t[c]=th(e,p,p+l)}return t},unzlib:()=>lp,unzlibSync:()=>up,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 Ec(u+22),t=l,n=u-l,i=u=0;i<c;++i){var o=h[i];try{var a=o.c.length,s=(Cp(e,u,o,o.f,o.u,a),30+o.f.length+Mp(o.extra)),p=u+s;e.set(o.c,p),Cp(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)}}Tp(e,l,h.length,n,t),r(null,e)}var o={},a=(pp(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]=yh(m,{size:g,crc:v.d(),c:o,f:y,m:w,u:b!=c.length||w&&x.length!=A,compression:B}),l+=30+b+S+t,u+=76+2*(b+S)+(A||0)+t,--s||i())}var c=a[e],d=o[c],f=d[0],m=d[1],v=mh(),g=f.length,y=(v.p(f),bp(c)),b=y.length,x=m.comment,w=x&&bp(x),A=w&&w.length,S=Mp(m.extra),B=0==m.level?0:8;if(65535<b&&t("filename too long",null),B)if(g<16e4)try{t(null,Jh(f,m))}catch(d){t(d,null)}else p.push(zh(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=(pp(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=bp(r)).length,h=s.comment,p=h&&bp(h),d=p&&p.length,f=Mp(s.extra);if(65535<c)throw"filename too long";var m=u?Jh(l,s):l,v=m.length,g=mh();g.p(l),i.push(yh(s,{size:l.length,crc:g.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 y=new Ec(a+22),b=(e=o,t=a-o,0);b<i.length;++b){var x=i[b],w=(Cp(y,x.o,x,x.f,x.u,x.c.length),30+x.f.length+Mp(x.extra));y.set(x.c,x.o+w),Cp(y,o,x,x.f,x.u,x.c.length,x.o,x.m),o+=16+w+(x.m?x.m.length:0)}return Tp(y,o,i.length,t,e),y},zlib:()=>function(e,t,r){if(r||(r=t,t={}),"function"!=typeof r)throw"no callback";return Dh(e,t,[Sh,Ch,function(){return[op]}],(function(e){return Eh(op(e.data[0],e.data[1]))}),4,r)},zlibSync:()=>op}),a(300)),s=a.n(o),l=a(251),c=a(594),h=a(881);class p{constructor(e){this.runScene=e}}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 f(e,t){return(f=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function m(e){return(m=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var v=new WeakMap,g=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&&f(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=m(e);if(r=t?(r=m(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")}}(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 h.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(v.has(e)){if((l=v.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)})),v.set(e,{key:a,promise:l}),l}},{key:"_createGeometry",value:function(e){var t=new h.BufferGeometry;e.index&&t.setIndex(new h.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 h.BufferAttribute(i,o))}return t}},{key:"_loadLibrary",value:function(e,t){var r=new h.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":d(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,g=t.DecodeBufferToMesh(r,i);else{if(s!==e.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");i=new e.PointCloud,g=t.DecodeBufferToPointCloud(r,i)}if(!g.ok()||0===i.ptr)throw new Error("THREE.DRACOLoader: Decoding failed: "+g.error_msg());var l,u,c,h,p,d,f,m,v,g,y,b,x,w={index:null,attributes:[]};for(l in o){var A=self[a[l]],S=void 0,B=void 0;if(n.useUniqueIDs)B=o[l],S=t.GetAttributeByUniqueId(i,B);else{if(-1===(B=t.GetAttributeId(i,e[o[l]])))continue;S=t.GetAttribute(i,B)}w.attributes.push((B=e,u=t,c=i,h=l,p=S.num_components(),f=(d=c.num_points()*p)*A.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}}(B,A),v=B._malloc(f),u.GetAttributeDataArrayForAllPoints(c,S,m,f,v),u=new A(B.HEAPF32.buffer,v,d).slice(),B._free(v),{name:h,array:u,itemSize:p}))}return s===e.TRIANGULAR_MESH&&(w.index=(r=e,g=t,b=4*(y=3*(s=i).num_faces()),x=r._malloc(b),g.GetTrianglesUInt32Array(s,b,x),g=new Uint32Array(r.HEAPF32.buffer,x,y).slice(),r._free(x),{array:g,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}(h.Loader);const y=h,b=["map","normalMap","aoMap"],x=["map","metalnessMap","roughnessMap","normalMap","aoMap","emissiveMap","alphaMap","lightMap","envMap","displacementMap"];class w{}const A=class extends w{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,x.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 S=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 B{constructor(e){this.allTextures=new Set,this.setAnima=e=>{const{texture:t,type:r,val:n}=e,i=t.userData.uvScript||{};t.userData.uvScript||(t.userData.uvScript=i),0===n?delete i[r]:i[r]=n,this.runScene.cb.texture.setAnima.cb({texture:t,uvScript:i})},this.runScene=e}load(e){return S(this,void 0,void 0,(function*(){var t=yield dn(e);return this.parse(t)}))}parse(e){return S(this,void 0,void 0,(function*(){var t="Blob"===En(e)?e:yield mn(e);return this.afterLoad(t,yield O(t))}))}clone(e){const t=new h.Texture(e.image);return t.userData=Object.assign(Object.assign({},e.userData),{id:(0,l.getId)()}),_(t),this.getSameAndAddtoAll(t)}getDef(e){return e=new h.Texture(e),_(e),this.getSameAndAddtoAll(e)}getSameAndAddtoAll(e){var t=e.userData.md5;return(t=this.getSameTexture(t,e))?(E(e),t):(this.initTextureAndAddtoAll(e),e)}afterLoad(e,t){return S(this,void 0,void 0,(function*(){return this.getSameAndAddtoAll(yield _(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 S(this,void 0,void 0,(function*(){return R(e),_(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.cb.texture.add.cb(e)}getBlobAndBase64(e){return e.userData.blob?e.userData:Gn(e)}coverByImage(e,t){return S(this,void 0,void 0,(function*(){let r;r=k(t)?t:t?yield this.parse(t):null;var n=this.runScene.uniqueEx.texture.getMaterials(this.runScene.uniqueEx.getId(e));if(n){const t=[];(0,c.js)(n,((n,i)=>{const o=this.runScene.uniqueEx.material.get(n);o&&i.forEach((n=>{t.push(new A({target:o,info:n,newVal:r,oldVal:e,runScene:this.runScene}).execute())}))})),this.runScene.undoEx.addUndo(t)}}))}removeTexture(e){this.runScene.cb.texture.remove.cb(e),this.runScene.uniqueEx.texture.remove(e)}}const M={环境遮蔽:"aoMap",法线:"normalMap",金属度:"metalnessMap",粗糙度:"roughnessMap",自发光:"emissiveMap",颜色:"map",置换:"displacementMap",光照贴图:"lightMap",环境:"envMap",透明度:"alphaMap"},C=e=>1023===e.format?"image/png":"image/jpeg",T=e=>{var{width:e,height:t}=e.image;return e*t*4*1.33},E=e=>{var t,r,n;e&&(r=e.image,n=e.userData.url,null!=(t=r.close)&&t.call(r),URL.revokeObjectURL(n),e.dispose())},_=(e,t)=>S(void 0,void 0,void 0,(function*(){const r=t||e.userData.blob||(yield D(e));var{md5:n,url:i}=e.userData;return e.userData.blob=r,n||(e.userData.md5=bn(yield r.arrayBuffer())),i||(e.userData.url=URL.createObjectURL(r)),e.userData.gm=T(e),e.format=e.userData.format||-1!==r.type.indexOf("png")?1023:1022,e})),D=e=>e.userData.blob||kn(e.image),R=e=>(e.magFilter=1003,e.wrapS=y.RepeatWrapping,e.wrapT=y.RepeatWrapping,e.encoding=3e3,e.version=3,e.flipY=!1,e.minFilter=y.LinearMipmapLinearFilter,e.needsUpdate=!0,e),P=e=>createImageBitmap(e,{imageOrientation:"flipY",resizeQuality:"pixelated"}),O=e=>S(void 0,void 0,void 0,(function*(){var t=yield P(e instanceof Blob?e:yield dn(e));return new h.Texture(t)})),I=e=>null==(e=e.userData)?void 0:e.url,F=(e,t="repeat")=>(e.mapping="repeat"===t?y.EquirectangularReflectionMapping:300,e.needsUpdate=!0,e),L=e=>{var{width:e,height:t}=e.image;return{width:e,height:t}},k=e=>null==e?void 0:e.isTexture;var U=a(129),G=a(685);function j(){return(j="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=V(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 H(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&N(e,t)}function N(e,t){return(N=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function z(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=V(e);if(r=t?(r=V(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Z(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return J(n)}}function J(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function V(e){return(V=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}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 Q(e,t,r){return t&&K(e.prototype,t),r&&K(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function X(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function W(e){return function(e){if(Array.isArray(e))return Y(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 Y(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)?Y(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 Y(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 Z(e){return(Z="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function q(e){return void 0===e}function $(){return"undefined"!=typeof window}function ee(e){return Ct(e)||Mt(e)}function te(e){return(jt=ce(e,Gt))&&an}function re(e,t){return!t&&console.warn(e)}function ne(e,t){return e&&(Gt[e]=t)&&jt&&(jt[e]=t)||Gt}function ie(){return 0}function oe(e,t,r){return(r=e[t])&&Ct(r)?e[t]():q(r)&&e.getAttribute&&e.getAttribute(t)||r}function ae(e,t){(e=e.split(",")).forEach(t)}function se(e,t,r,n){zt.length&&$t(),e.render(t,r,n),zt.length&&$t()}function le(e){var t=parseFloat(e);return(t||0===t)&&(e+"").match(kt).length<2?t:Mt(e)?e.trim():e}function ue(e){return e}function ce(e,t){for(var r in t)e[r]=t[r];return e}function he(e,t){for(var r in t)"__proto__"!==r&&"constructor"!==r&&"prototype"!==r&&(e[r]=Et(t[r])?he(e[r]||(e[r]={}),t[r]):t[r]);return e}function pe(e){var t,r=e.parent||Ve,n=e.keyframes?(t=Rt(e.keyframes),function(e,r){for(var n in r)n in e||"duration"===n&&t||"ease"===n||(e[n]=r[n])}):er;if(_t(e.inherit))for(;r;)n(e,r.vars.defaults),r=r.parent||r._dp;return e}function de(e){return!e||e._ts&&de(e.parent)}function fe(e){return e._repeat?me(e._tTime,e=e.duration()+e._rDelay)*e:0}function me(e,t){return t=Math.floor(e/=t),e&&t===e?t-1:t}function ve(e,t){return(e-t._start)*t._ts+(0<=t._ts?0:t._dirty?t.totalDuration():t._tDur)}function ge(e,t){var r;if((t._time||t._initted&&!t._dur)&&(r=ve(e.rawTime(),t),(!t._dur||Te(0,t.totalDuration(),r)-t._tTime>yt)&&t.render(r,!0)),ir(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=-yt}}function ye(e,t,r,n){return t.parent&&nr(t),t._start=qt((Tt(r)?r:r||e!==Ve?Me(e,r,t):e._time)+t._delay),t._end=qt(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),Ae(t)||(e._recent=t),n||ge(e,t),e}function be(e,t){(Gt.ScrollTrigger||Ht("scrollTrigger",t))&&Gt.ScrollTrigger.create(t,e)}function xe(e,t,r,n){return Dr(e,t),e._initted?!r&&e._pt&&(e._dur&&!1!==e.vars.lazy||!e._dur&&e.vars.lazy)&&Ye!==wr.frame?(zt.push(e),e._lazy=[t,n]):void 0:1}function we(e){return(e=e.parent)&&e._ts&&e._initted&&!e._lock&&(e.rawTime()<0||we(e))}function Ae(e){return"isFromStart"===(e=e.data)||"isStart"===e}function Se(e,t,r,n){var i=e._repeat,o=qt(t)||0;return(t=e._tTime/e._tDur)&&!n&&(e._time*=o/e._dur),e._dur=o,e._tDur=i?i<0?1e10:qt(o*(i+1)+e._rDelay*i):o,0<t&&!n?ar(e,e._tTime=e._tDur*t):e.parent&&or(e),r||ir(e.parent,e),e}function Be(e){return e instanceof Nr?ir(e):Se(e,e._dur)}function Me(e,t,r){var n,i,o,a=e.labels,s=e._recent||sr,l=e.duration()>=gt?s.endTime(!1):e._dur;return Mt(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*(Rt(r)?r[0]:r).totalDuration()),1<n?Me(e,t.substr(0,n-1),r)+i:l+i)):null==t?l:+t}function Ce(e,t,r){var n,i,o=Tt(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=_t(i.vars.inherit)&&i.parent;s.immediateRender=_t(n.immediateRender),e<2?s.runBackwards=1:s.startAt=t[a-1]}return new Xr(t[0],s,t[1+a])}function Te(e,t,r){return r<e?e:t<r?t:r}function Ee(e){if(Ct(e))return e;var t=Et(e)?e:{each:e},r=Tr(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 Mt(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,g,y,b,x=(h||t).length,w=o[x];if(!w){if(!(b="auto"===t.grid?0:(t.grid||[1,gt])[1])){for(g=-gt;g<(g=h[b++].getBoundingClientRect().left)&&b<x;);b--}for(w=o[x]=[],p=a?Math.min(b,x)*l-.5:n%b,d=b===gt?0:a?x*u/b-.5:n/b|0,y=gt,v=g=0;v<x;v++)m=v%b-p,f=d-(v/b|0),w[v]=m=s?Math.abs("y"===s?f:m):At(m*m+f*f),g<m&&(g=m),m<y&&(y=m);"random"===n&&dr(w),w.max=g-y,w.min=y,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=ur(t.amount||t.each)||0,r=r&&x<0?Cr(r):r}return x=(w[e]-w.min)/w.max||0,qt(w.b+(r?r(x):x)*w.v)+w.u}}function _e(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+(Tt(r)?0:ur(r))}}function De(e,t){var r,n,i=Rt(e);return!i&&Et(e)&&(r=i=e.radius||gt,e.values?(e=pr(e.values),(n=!Tt(e[0]))&&(r*=r)):e=_e(e.increment)),lr(t,i?Ct(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=gt,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||Tt(t)?u:u+ur(t)}:_e(e))}function Re(e,t,r,n){return lr(Rt(e)?!t:!0===r?!!(r=0):!n,(function(){return Rt(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 Pe(e,t,r){return lr(r,(function(r){return e[~~t(r)]}))}function Oe(e,t,r,n,i){var o=t-e,a=n-r;return lr(i,(function(t){return r+((t-e)/o*a||0)}))}function Ie(e,t,r){var n,i,o,a=e.labels,s=gt;for(n in a)(i=a[n]-t)<0==!!r&&i&&s>(i=Math.abs(i))&&(o=n,s=i);return o}function Fe(e,t,r){var n=e.vars,i=n[t];i&&(t=n[t+"Params"],n=n.callbackScope||e,r&&zt.length&&$t(),t?i.apply(n,t):i.call(n))}function Le(e){return nr(e),e.scrollTrigger&&e.scrollTrigger.kill(!1),e.progress()<1&&Fe(e,"onInterrupt"),e}function ke(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)*mr+.5|0}function Ue(e,t,r){var n,i,o,a,s="",l=(e+s).match(br),u=t?"hsla(":"rgba(",c=0;if(!l)return e;if(l=l.map((function(e){return(e=gr(e,t,1))&&u+(t?e[0]+","+e[1]+"%,"+e[2]+"%,"+e[3]:e.join(","))+")"})),r&&(o=yr(e),(n=r.c).join(s)!==o.c.join(s)))for(a=(i=e.replace(br,"1").split(It)).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(br)).length-1;c<a;c++)s+=i[c]+l[c];return s+i[a]}function Ge(e,t){for(var r,n=e._first;n;)n instanceof Nr?Ge(n,t):!n.vars.yoyoEase||n._yoyo&&n._repeat||n._yoyo===t||(n.timeline?Ge(n.timeline,t):(r=n._ease,n._ease=n._yEase,n._yEase=r,n._yoyo=t)),n=n._next}function je(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}};ae(e,(function(e){for(var t in Sr[e]=Gt[e]=i,Sr[r=e.toLowerCase()]=n,i)Sr[r+("easeIn"===t?".in":"easeOut"===t?".out":".inOut")]=Sr[e+"."+t]=i[t]}))}function He(e){return function(t){return t<.5?(1-e(1-2*t))/2:.5+e(2*(t-.5))/2}}function Ne(e,t,r){function n(e){return 1===e?1:i*Math.pow(2,-10*e)*Bt((e-o)*a)+1}var i=1<=t?t:1,o=(a=(r||(e?.3:.45))/(t<1?t:1))/bt*(Math.asin(1/i)||0),a=(r="out"===e?n:"in"===e?function(e){return 1-n(1-e)}:He(n),bt/a);return r.config=function(t,r){return Ne(e,t,r)},r}function ze(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)}:He(t);return n.config=function(t){return ze(e,t)},n}var Je,Ve,Ke,Qe,Xe,We,Ye,Ze,qe,$e,et,tt,rt,nt,it,ot,at,st,lt,ut,ct,ht,pt,dt,ft,mt={autoSleep:120,force3D:"auto",nullTargetWarn:1,units:{lineHeight:""}},vt={duration:.5,overwrite:!1,delay:0},gt=1e8,yt=1/gt,bt=2*Math.PI,xt=bt/4,wt=0,At=Math.sqrt,St=Math.cos,Bt=Math.sin,Mt=function(e){return"string"==typeof e},Ct=function(e){return"function"==typeof e},Tt=function(e){return"number"==typeof e},Et=function(e){return"object"==Z(e)},_t=function(e){return!1!==e},Dt="function"==typeof ArrayBuffer&&ArrayBuffer.isView||function(){},Rt=Array.isArray,Pt=/(?:-?\.?\d|\.)+/gi,Ot=/[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g,It=/[-+=.]*\d+[.e-]*\d*[a-z%]*/g,Ft=/[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi,Lt=/[+-]=-?[.\d]+/,kt=/[^,'"\[\]\s]+/gi,Ut=/[\d.+\-=]+(?:e[-+]\d*)*/i,Gt={},jt={},Ht=function(e,t){return console.warn("Invalid property",e,"set to",t,"Missing plugin? gsap.registerPlugin()")},Nt={},zt=[],Jt={},Vt={},Kt={},Qt=30,Xt=[],Wt="",Yt=function(e){var t,r,n=e[0];if(Et(n)||Ct(n)||(e=[e]),!(t=(n._gsap||{}).harness)){for(r=Xt.length;r--&&!Xt[r].targetTest(n););t=Xt[r]}for(r=e.length;r--;)e[r]&&(e[r]._gsap||(e[r]._gsap=new jr(e[r],t)))||e.splice(r,1);return e},Zt=function(e){return e._gsap||Yt(pr(e))[0]._gsap},qt=function(e){return Math.round(1e7*e)/1e7||0},$t=function(){var e,t,r=zt.length,n=zt.slice(0);for(Jt={},e=zt.length=0;e<r;e++)(t=n[e])&&t._lazy&&(t.render(t._lazy[0],t._lazy[1],!0)._lazy=0)},er=function(e,t){for(var r in t)r in e||(e[r]=t[r]);return e},tr=function(e,t){var r,n={};for(r in e)r in t||(n[r]=e[r]);return n},rr=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},nr=function(e,t){!e.parent||t&&!e.parent.autoRemoveChildren||e.parent.remove(e),e._act=0},ir=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},or=function(e){return e._end=qt(e._start+(e._tDur/Math.abs(e._ts||e._rts||yt)||0))},ar=function(e,t){var r=e._dp;return r&&r.smoothChildTiming&&e._ts&&(e._start=qt(r._time-(0<e._ts?t/e._ts:((e._dirty?e.totalDuration():e._tDur)-t)/-e._ts)),or(e),r._dirty||ir(r,e)),e},sr={_start:0,endTime:ie,totalDuration:ie},lr=function(e,t){return e||0===e?t(e):t},ur=function(e,t){return Mt(e)&&(t=Ut.exec(e))?e.substr(t.index+t[0].length):""},cr=[].slice,hr=function(e,t){return e&&Et(e)&&"length"in e&&(!t&&!e.length||e.length-1 in e&&Et(e[0]))&&!e.nodeType&&e!==Ke},pr=function(e,t,r){return!Mt(e)||r||!Qe&&Ar()?Rt(e)?function(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:[];return e.forEach((function(e){return Mt(e)&&!t||hr(e,1)?r.push.apply(r,W(pr(e))):r.push(e)}))||r}(e,r):hr(e)?cr.call(e,0):e?[e]:[]:cr.call((t||Xe).querySelectorAll(e),0)},dr=function(e){return e.sort((function(){return.5-Math.random()}))},fr=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?kt:Pt),a+=e.substr(o,t-o)+Re(i?r:+r[0],i?0:+r[1],+r[2]||1e-5),o=n+1;return a+e.substr(o,e.length-o)},mr=255,vr={aqua:[0,mr,mr],lime:[0,mr,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,mr],navy:[0,0,128],white:[mr,mr,mr],olive:[128,128,0],yellow:[mr,mr,0],orange:[mr,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[mr,0,0],pink:[mr,192,203],cyan:[0,mr,mr],transparent:[mr,mr,mr,0]},gr=function(e,t,r){var n,i,o,a,s,l,u,c=e?Tt(e)?[e>>16,e>>8&mr,e&mr]:0:vr.black;if(!c){if(","===e.substr(-1)&&(e=e.substr(0,e.length-1)),vr[e])c=vr[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&mr,c&mr,parseInt(e.substr(7),16)/255];c=[(e=parseInt(e.substr(1),16))>>16,e>>8&mr,e&mr]}else if("hsl"===e.substr(0,3))if(c=u=e.match(Pt),t){if(~e.indexOf("="))return c=e.match(Ot),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]=ke(a+1/3,n,i),c[1]=ke(a,n,i),c[2]=ke(a-1/3,n,i);else c=e.match(Pt)||vr.transparent;c=c.map(Number)}return t&&!u&&(n=c[0]/mr,i=c[1]/mr,o=c[2]/mr,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},yr=function(e){var t=[],r=[],n=-1;return e.split(br).forEach((function(e){e=e.match(It)||[],t.push.apply(t,W(e)),r.push(n+=e.length+1)})),t.c=r,t},br=function(){var e,t="(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3,4}){1,2}\\b";for(e in vr)t+="|"+e+"\\b";return new RegExp(t+")","gi")}(),xr=/hsl[a]?\(/,wr=(it=Date.now,ot=500,at=33,st=it(),lt=st,ct=ut=1e3/240,pt={time:0,frame:0,tick:function(){Er(!0)},deltaRatio:function(e){return rt/(1e3/(e||60))},wake:function(){We&&(!Qe&&$()&&(Ke=Qe=window,Xe=Ke.document||{},Gt.gsap=an,(Ke.gsapVersions||(Ke.gsapVersions=[])).push(an.version),te(jt||Ke.GreenSockGlobals||!Ke.gsap&&Ke||{}),tt=Ke.requestAnimationFrame),$e&&pt.sleep(),et=tt||function(e){return setTimeout(e,ct-1e3*pt.time+1|0)},qe=1,Er(2))},sleep:function(){(tt?Ke.cancelAnimationFrame:clearTimeout)($e),qe=0,et=ie},lagSmoothing:function(e,t){ot=e||1/yt,at=Math.min(t,ot,0)},fps:function(e){ut=1e3/(e||240),ct=1e3*pt.time+ut},add:function(e){ht.indexOf(e)<0&&ht.push(e),Ar()},remove:function(e,t){~(t=ht.indexOf(e))&&ht.splice(t,1)&&t<=nt&&nt--},_listeners:ht=[]}),Ar=function(){return!qe&&wr.wake()},Sr={},Br=/^[\d.\-M][\d.\-,\s]/,Mr=/["']/g,Cr=function(e){return function(t){return 1-e(1-t)}},Tr=function(e,t){return e&&(Ct(e)?e:Sr[e]||function(e){var t,r,n,i=(e+"").split("("),o=Sr[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(Mr,"").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(le))):Sr._CE&&Br.test(e)?Sr._CE("",e):o}(e))||t};function Er(e){var t,r,n,i=it()-lt,o=!0===e;if(ot<i&&(st+=i-at),(0<(i=(r=(lt+=i)-st)-ct)||o)&&(n=++pt.frame,rt=r-1e3*pt.time,pt.time=r/=1e3,ct+=i+(ut<=i?4:ut-i),t=1),o||($e=et(Er)),t)for(nt=0;nt<ht.length;nt++)ht[nt](r,rt,n,e)}function _r(e){return e<ft?dt*e*e:e<.7272727272727273?dt*Math.pow(e-1.5/2.75,2)+.75:e<.9090909090909092?dt*(e-=2.25/2.75)*e+.9375:dt*Math.pow(e-2.625/2.75,2)+.984375}function Dr(e,t){var r,n,i,o,a,s,l,u,c,h,p,d,f,m=e.vars,v=m.ease,g=m.startAt,y=m.immediateRender,b=m.lazy,x=m.onUpdate,w=m.onUpdateParams,A=m.callbackScope,S=m.runBackwards,B=m.yoyoEase,M=m.keyframes,C=m.autoRevert,T=e._dur,E=e._startAt,_=e._targets,D=e.parent,R=D&&"nested"===D.data?D.parent._targets:_,P="auto"===e._overwrite&&!Je,O=e.timeline;if(e._ease=Tr(v=!O||M&&v?v:"none",vt.ease),e._yEase=B?Cr(Tr(!0===B?v:B,vt.ease)):0,B&&e._yoyo&&!e._repeat&&(B=e._yEase,e._yEase=e._ease,e._ease=B),e._from=!O&&!!m.runBackwards,!O||M&&!m.stagger){if(d=(u=_[0]?Zt(_[0]).harness:0)&&m[u.prop],r=tr(m,Nt),E&&nr(E.render(-1,!0)),g)if(nr(e._startAt=Xr.set(_,er({data:"isStart",overwrite:!1,parent:D,immediateRender:!0,lazy:_t(b),startAt:null,delay:0,onUpdate:x,onUpdateParams:w,callbackScope:A,stagger:0},g))),t<0&&!y&&!C&&e._startAt.render(-1,!0),y){if(0<t&&!C&&(e._startAt=0),T&&t<=0)return void(t&&(e._zTime=t))}else!1===C&&(e._startAt=0);else if(S&&T)if(E)C||(e._startAt=0);else if(i=er({overwrite:!1,data:"isFromStart",lazy:(y=!t&&y)&&_t(b),immediateRender:y,stagger:0,parent:D},r),d&&(i[u.prop]=d),nr(e._startAt=Xr.set(_,i)),t<0&&e._startAt.render(-1,!0),e._zTime=t,y){if(!t)return}else Dr(e._startAt,yt);for(e._pt=0,b=T&&_t(b)||b&&!T,n=0;n<_.length;n++){if(l=(a=_[n])._gsap||Yt(_)[n]._gsap,e._ptLookup[n]=h={},Jt[l.id]&&zt.length&&$t(),p=R===_?n:R.indexOf(a),u&&!1!==(c=new u).init(a,d||r,e,p,R)&&(e._pt=o=new rn(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)Vt[i]&&(c=Vr(i,r,e,p,a,R))?c.priority&&(s=1):h[i]=o=Jr.call(e,a,i,"get",r[i],p,R,0,m.stringFilter);e._op&&e._op[n]&&e.kill(a,e._op[n]),P&&e._pt&&(Gr=e,Ve.killTweensOf(a,h,e.globalTime(t)),f=!e.parent,Gr=0),e._pt&&b&&(Jt[l.id]=1)}s&&tn(e),e._onInit&&e._onInit(e)}e._onUpdate=x,e._initted=(!e._op||e._pt)&&!f,M&&t<=0&&O.render(gt,!0,!0)}function Rr(e,t,r,n,i){return Ct(e)?e.call(t,r,n,i):Mt(e)&&~e.indexOf("random(")?fr(e):e}function Pr(e,t,r){return e.setAttribute(t,r)}function Or(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 Ir(e,t){for(var r=t._pt;r;)r.r(e,r.d),r=r._next}function Fr(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 Lr(e){for(var t,r,n=this._pt;n;)r=n._next,n.p===e&&!n.op||n.op===e?rr(this,n,"_pt"):n.dep||(t=1),n=r;return!t}function kr(e,t,r,n){n.mSet(e,t,n.m.call(n.tween,r,n.mt),n)}function Ur(e,t){return{name:e,rawVars:1,init:function(e,r,n){n._onInit=function(e){var n,i;if(Mt(r)&&(n={},ae(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?on(s,o):s)&&s.modifier&&s.modifier(u[o],l,c[a],o)}}}}ae("Linear,Quad,Cubic,Quart,Quint,Strong",(function(e,t){var r=t<5?t+1:t;je(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}))})),Sr.Linear.easeNone=Sr.none=Sr.Linear.easeIn,je("Elastic",Ne("in"),Ne("out"),Ne()),dt=7.5625,ft=1/2.75,je("Bounce",(function(e){return 1-_r(1-e)}),_r),je("Expo",(function(e){return e?Math.pow(2,10*(e-1)):0})),je("Circ",(function(e){return-(At(1-e*e)-1)})),je("Sine",(function(e){return 1===e?1:1-St(e*xt)})),je("Back",ze("in"),ze("out"),ze()),Sr.SteppedEase=Sr.steps=Gt.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-yt;return function(e){return((n*Te(0,o,e)|0)+i)*r}}},vt.ease=Sr["quad.out"],ae("onComplete,onUpdate,onStart,onRepeat,onReverseComplete,onInterrupt",(function(e){return Wt+=e+","+e+"Params,"}));var Gr,jr=Q((function e(t,r){X(this,e),this.id=wt++,(t._gsap=this).target=t,this.harness=r,this.get=r?r.get:oe,this.set=r?r.getSetter:qr})),Hr=function(){function e(t){X(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,Se(this,+t.duration,1,1),this.data=t.data,qe||wr.wake()}return Q(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,Se(this,this._repeat<0?e:(e-this._repeat*this._rDelay)/(this._repeat+1))):this._tDur}},{key:"totalTime",value:function(e,t){if(Ar(),!arguments.length)return this._tTime;var r=this._dp;if(r&&r.smoothChildTiming&&this._ts){for(ar(this,e),r._dp&&!r.parent&&ge(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)&&ye(this._dp,this,this._start-this._delay)}return(this._tTime!==e||!this._dur&&!t||this._initted&&Math.abs(this._zTime)===yt||!e&&!this._initted&&(this.add||this._ptLookup))&&(this._ts||(this._pTime=e),se(this,e,t)),this}},{key:"time",value:function(e,t){return arguments.length?this.totalTime(Math.min(this.totalDuration(),e+fe(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)+fe(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?me(this._tTime,r)+1:1}},{key:"timeScale",value:function(e){if(!arguments.length)return this._rts===-yt?0:this._rts;if(this._rts===e)return this;for(var t=this.parent&&this._ts?ve(this.parent._time,this):this._tTime,r=(this._rts=+e||0,this._ts=this._ps||e===-yt?0:this._rts,e=this.totalTime(Te(-this._delay,this._tDur,t),!0)).parent;r&&r.parent;)r._dirty=1,r.totalDuration(),r=r.parent;return or(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):(Ar(),this._ts=this._rts,this.totalTime(this.parent&&!this.parent.smoothChildTiming?this.rawTime():this._tTime||this._pTime,1===this.progress()&&Math.abs(this._zTime)!==yt&&(this._tTime-=yt)))),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||ye(t,this,e-this._delay),this):this._start}},{key:"endTime",value:function(e){return this._start+(_t(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?ve(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,Be(this)):-2===this._repeat?1/0:this._repeat}},{key:"repeatDelay",value:function(e){var t;return arguments.length?(t=this._time,this._rDelay=e,Be(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(Me(this,e),_t(t))}},{key:"restart",value:function(e,t){return this.play().totalTime(e?-this._delay:0,_t(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?-yt:0)),this):this._rts<0}},{key:"invalidate",value:function(){return this._initted=this._act=0,this._zTime=-yt,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)-yt))}},{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,Ct(i)&&(i=i(t))&&(i.then||i===t)&&(t.then=e),r(i),t.then=e}var i=Ct(e)?e:ue;t._initted&&1===t.totalProgress()&&0<=t._ts||!t._tTime&&t._ts<0?n():t._prom=n}))}},{key:"kill",value:function(){Le(this)}}]),e}(),Nr=(er(Hr.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:-yt,_prom:0,_ps:!1,_rts:1}),function(){H(t,Hr);var e=z(t);function t(){var r,n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},i=1<arguments.length?arguments[1]:void 0;return X(this,t),(r=e.call(this,n)).labels={},r.smoothChildTiming=!!n.smoothChildTiming,r.autoRemoveChildren=!!n.autoRemoveChildren,r._sort=_t(n.sortChildren),Ve&&ye(n.parent||Ve,J(r),i),n.reversed&&r.reverse(),n.paused&&r.paused(!0),n.scrollTrigger&&be(J(r),n.scrollTrigger),r}return Q(t,[{key:"to",value:function(e,t,r){return Ce(0,arguments,this),this}},{key:"from",value:function(e,t,r){return Ce(1,arguments,this),this}},{key:"fromTo",value:function(e,t,r,n){return Ce(2,arguments,this),this}},{key:"set",value:function(e,t,r){return t.duration=0,t.parent=this,pe(t).repeatDelay||(t.repeat=0),t.immediateRender=!!t.immediateRender,new Xr(e,t,Me(this,r),1),this}},{key:"call",value:function(e,t,r){return ye(this,Xr.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 Xr(e,r,Me(this,i)),this}},{key:"staggerFrom",value:function(e,t,r,n,i,o,a){return r.runBackwards=1,pe(r).immediateRender=_t(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,pe(n).immediateRender=_t(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:qt(e),g=this._zTime<0!=e<0&&(this._initted||!m);if((v=this!==Ve&&f<v&&0<=e?f:v)!==this._tTime||r||g){if(d!==this._time&&m&&(v+=this._time-d,e+=this._time-d),n=v,c=this._start,s=!(u=this._ts),g&&(m||(d=this._zTime),!e&&t||(this._zTime=e)),this._repeat){if(g=this._yoyo,a=m+this._rDelay,this._repeat<-1&&e<0)return this.totalTime(100*a+e,t,r);if(n=qt(v%a),v===f?(o=this._repeat,n=m):((o=~~(v/a))&&o===v/a&&(n=m,o--),m<n&&(n=m)),h=me(this._tTime,a),g&&1&o&&(n=m-n,p=1),o!==(h=!d&&this._tTime&&h!==o?o:h)&&!this._lock){var y=g&&1&h;if(g=y===(g&&1&o),d=(y=o<h?!y:y)?0:m,this._lock=1,this.render(d||(p?0:qt(o*a)),t,!m)._lock=0,this._tTime=v,!t&&this.parent&&Fe(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,g&&(this._lock=2,this.render(d=y?m:-1e-4,!0),this.vars.repeatRefresh&&!p&&this.invalidate()),this._lock=0,!this._ts&&!s)return this;Ge(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,qt(d),qt(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&&(Fe(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=-yt);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?-yt:yt);break}}b=i}if(l&&!t&&(this.pause(),l.render(d<=n?0:-yt)._zTime=d<=n?1:-1,this._ts))return this._start=c,or(this),this.render(e,t,r);this._onUpdate&&!t&&Fe(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)||nr(this,1),t||e<0&&!d||!v&&!d&&f||(Fe(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(Tt(t)||(t=Me(this,t,e)),!(e instanceof Hr)){if(Rt(e))return e.forEach((function(e){return r.add(e,t)})),this;if(Mt(e))return this.addLabel(e,t);if(!Ct(e))return this;e=Xr.delayedCall(0,e)}return this!==e?ye(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]:-gt,i=[],o=this._first;o;)o._start>=n&&(o instanceof Xr?t&&i.push(o):(r&&i.push(o),e&&i.push.apply(i,W(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 Mt(e)?this.removeLabel(e):Ct(e)?this.killTweensOf(e):(rr(this,e),e===this._recent&&(this._recent=this._last),ir(this))}},{key:"totalTime",value:function(e,r){return arguments.length?(this._forcing=1,!this._dp&&this._ts&&(this._start=qt(wr.time-(0<this._ts?e/this._ts:(this.totalDuration()-e)/-this._ts))),j(V(t.prototype),"totalTime",this).call(this,e,r),this._forcing=0,this):this._tTime}},{key:"addLabel",value:function(e,t){return this.labels[e]=Me(this,t),this}},{key:"removeLabel",value:function(e){return delete this.labels[e],this}},{key:"addPause",value:function(e,t,r){return(t=Xr.delayedCall(0,t||ie,r)).data="isPause",this._hasPause=1,ye(this,t,Me(this,e))}},{key:"removePause",value:function(e){var t=this._first;for(e=Me(this,e);t;)t._start===e&&"isPause"===t.data&&nr(t),t=t._next}},{key:"killTweensOf",value:function(e,t,r){for(var n=this.getTweensOf(e,r),i=n.length;i--;)Gr!==n[i]&&n[i].kill(e,t);return this}},{key:"getTweensOf",value:function(e,t){for(var r,n=[],i=pr(e),o=this._first,a=Tt(t);o;)o instanceof Xr?function(e,t){for(var r=t.length,n=0;e.indexOf(t[n])<0&&++n<r;);return n<r}(o._targets,i)&&(a?(!Gr||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,W(r)),o=o._next;return n}},{key:"tweenTo",value:function(e,t){t=t||{};var r,n=this,i=Me(n,e),o=(e=t).startAt,a=e.onStart,s=e.onStartParams,l=(e=e.immediateRender,Xr.to(n,er({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())||yt,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&&Se(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,er({startAt:{time:Me(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 Ie(this,Me(this,e))}},{key:"previousLabel",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this._time;return Ie(this,Me(this,e),1)}},{key:"currentLabel",value:function(e){return arguments.length?this.seek(e,!0):this.previousLabel(this._time+yt)}},{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 ir(this)}},{key:"invalidate",value:function(){var e=this._first;for(this._lock=0;e;)e.invalidate(),e=e._next;return j(V(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={}),ir(this)}},{key:"totalDuration",value:function(e){var t,r,n,i=0,o=this,a=o._last,s=gt;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,ye(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;Se(o,o===Ve&&o._time>i?o._time:i,1,1),o._dirty=0}return o._tDur}}],[{key:"updateRoot",value:function(e){if(Ve._ts&&(se(Ve,ve(e,Ve)),Ye=wr.frame),wr.frame>=Qt){Qt+=mt.autoSleep||120;var t=Ve._first;if((!t||!t._ts)&&mt.autoSleep&&wr._listeners.length<2){for(;t&&!t._ts;)t=t._next;t||wr.sleep()}}}}]),t}()),zr=(er(Nr.prototype,{_lock:0,_hasPause:0,_forcing:0}),function(e,t,r,n,i,o,a){var s,l,u,c,h,p=new rn(this._pt,e,t,0,1,Or,null,i),d=0,f=0;for(p.b=r,p.e=n,r+="",(i=~(n+="").indexOf("random("))&&(n=fr(n)),o&&(o(o=[r,n],e,t),r=o[0],n=o[1]),s=r.match(Ft)||[];c=Ft.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=Ft.lastIndex);return p.c=d<n.length?n.substring(d,n.length):"",p.fp=a,(Lt.test(n)||i)&&(p.e=0),this._pt=p}),Jr=function(e,t,r,n,i,o,a,s,l){var u;if(Ct(n)&&(n=n(i||0,e,o)),i=e[t],o="get"!==r?r:Ct(i)?l?e[t.indexOf("set")||!Ct(e["get"+t.substr(3)])?t:"get"+t.substr(3)](l):e[t]():i,r=Ct(i)?l?Zr:Yr:Wr,Mt(n)&&"="===(n=~n.indexOf("random(")?fr(n):n).charAt(1)&&(!(u=parseFloat(o)+parseFloat(n.substr(2))*("-"===n.charAt(0)?-1:1)+(ur(o)||0))&&0!==u||(n=u)),o!==n)return isNaN(o*n)||""===n?(i||t in e||Ht(t,n),zr.call(this,e,t,o,n,r,s||mt.stringFilter,l)):(u=new rn(this._pt,e,t,+o||0,n-(o||0),"boolean"==typeof i?en:$r,0,r),l&&(u.fp=l),a&&u.modifier(a,this,e),this._pt=u)},Vr=function(e,t,r,n,i,o){var a,s,l,u;if(Vt[e]&&!1!==(a=new Vt[e]).init(i,a.rawVars?t[e]:function(e,t,r,n,i){if(Ct(e)&&(e=Rr(e,i,t,r,n)),!Et(e)||e.style&&e.nodeType||Rt(e)||Dt(e))return Mt(e)?Rr(e,i,t,r,n):e;var o,a={};for(o in e)a[o]=Rr(e[o],i,t,r,n);return a}(t[e],n,i,o,r),r,n,o)&&(r._pt=s=new rn(r._pt,i,e,0,1,a.render,a,0,a.priority),r!==Ze))for(l=r._ptLookup[r._targets.indexOf(i)],u=a._props.length;u--;)l[a._props[u]]=s;return a},Kr=Wt+"repeat,repeatDelay,yoyo,repeatRefresh,yoyoEase",Qr={},Xr=(ae(Kr+",id,stagger,delay,duration,paused,scrollTrigger",(function(e){return Qr[e]=1})),function(){H(t,Hr);var e=z(t);function t(r,n,i,o){X(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:pe(n))).vars).duration,v=o.delay,g=o.immediateRender,y=o.stagger,b=o.overwrite,x=o.keyframes,w=o.defaults,A=o.scrollTrigger,S=o.yoyoEase,B=(o=n.parent||Ve,(Rt(r)||Dt(r)?Tt(r[0]):"length"in n)?[r]:pr(r));if(a._targets=B.length?Yt(B):re("GSAP target "+r+" not found. https://greensock.com",!mt.nullTargetWarn)||[],a._ptLookup=[],a._overwrite=b,x||y||ee(m)||ee(v)){if(n=a.vars,(s=a.timeline=new Nr({data:"nested",defaults:w||{}})).kill(),s.parent=s._dp=J(a),s._start=0,y||ee(m)||ee(v)){if(c=B.length,d=y&&Ee(y),Et(y))for(h in y)~Kr.indexOf(h)&&((f=f||{})[h]=y[h]);for(l=0;l<c;l++)(u=tr(n,Qr)).stagger=0,S&&(u.yoyoEase=S),f&&ce(u,f),p=B[l],u.duration=+Rr(m,J(a),l,p,B),u.delay=(+Rr(v,J(a),l,p,B)||0)-a._delay,!y&&1===c&&u.delay&&(a._delay=v=u.delay,a._start+=v,u.delay=0),s.to(p,u,d?d(l,p,B):0),s._ease=Sr.none;s.duration()?m=v=0:a.timeline=0}else if(x){pe(er(s.vars.defaults,{ease:"none"})),s._ease=Tr(x.ease||n.ease||"none");var M,C,T,E=0;if(Rt(x))x.forEach((function(e){return s.to(B,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(Rt(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=E=0;l<M.length;l++)(T={ease:(C=M[l]).e,duration:(C.t-(l?M[l-1].t:0))/100*m})[h]=C.v,s.to(B,T,E),E+=T.duration;s.duration()<m&&s.to({},{duration:m-s.duration()})}}m||a.duration(m=s.duration())}else a.timeline=0;return!0!==b||Je||(Gr=J(a),Ve.killTweensOf(B),Gr=0),ye(o,J(a),i),n.reversed&&a.reverse(),n.paused&&a.paused(!0),(g||!m&&!x&&a._start===qt(o._time)&&_t(g)&&de(J(a))&&"nested"!==o.data)&&(a._tTime=-yt,a.render(Math.max(0,-v))),A&&be(J(a),A),a}return Q(t,[{key:"render",value:function(e,t,r){var n,i,o=this._time,a=this._tDur,s=this._dur,l=a-yt<e&&0<=e?a:e<yt?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=qt(l%h),l===a?(g=this._repeat,m=s):((g=~~(l/h))&&g===l/h&&(m=s,g--),s<m&&(m=s)),(d=this._yoyo&&1&g)&&(p=this._yEase,m=s-m),y=me(this._tTime,h),m===o&&!r&&this._initted)return this;g!==y&&(f&&this._yEase&&Ge(f,d),!this.vars.repeatRefresh||d||this._lock||(this._lock=r=1,this.render(qt(h*g),!0).invalidate()._lock=0))}if(!this._initted){if(xe(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&&(Fe(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?-yt: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),Fe(this,"onUpdate")),this._repeat&&g!==y&&this.vars.onRepeat&&!t&&this.parent&&Fe(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)||nr(this,1),t||e<0&&!o||!l&&!o||(Fe(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&&we(h)&&(h._initted||!Ae(h))||(h._ts<0||h._dp._ts<0)&&!Ae(h))?0:1,g=h._rDelay,y=0;if(g&&h._repeat&&(c=me(y=Te(0,h._tDur,p),g),h._yoyo&&1&c&&(v=1-v),c!==me(h._tTime,g)&&(m=1-v,h.vars.repeatRefresh&&h._initted&&h.invalidate())),v!==m||f||h._zTime===yt||!p&&h._zTime){if(h._initted||!xe(h,p,f,d)){for(c=h._zTime,h._zTime=p||(d?yt:0),d=d||p&&!c,h.ratio=v,h._from&&(v=1-v),h._time=0,h._tTime=y,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&&Fe(h,"onUpdate"),y&&h._repeat&&!d&&h.parent&&Fe(h,"onRepeat"),(p>=h._tDur||p<0)&&h.ratio===v&&(v&&nr(h,1),d||(Fe(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(),j(V(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?Le(this):this;if(this.timeline)return p=this.timeline.totalDuration(),this.timeline.killTweensOf(e,t,Gr&&!0!==Gr.vars.overwrite)._first||Le(this),this.parent&&p!==this.timeline.totalDuration()&&Se(this,this._dur*this.timeline._tDur/p,0,1),this;var r,n,i,o,a,s,l,u=this._targets,c=e?pr(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),Le(this);for(r=this._op=this._op||[],"all"!==t&&(Mt(t)&&(a={},ae(t,(function(e){return a[e]=1})),t=a),t=function(e,t){var r,n,i,o,a=(e=e[0]?Zt(e[0]).harness:0)&&e.aliases;if(!a)return t;for(n in r=ce({},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)||rr(this,s,"_pt"),delete n[a]),"all"!==i&&(i[a]=1);return this._initted&&!this._pt&&p&&Le(this),this}}],[{key:"to",value:function(e,r){return new t(e,r,arguments[2])}},{key:"from",value:function(e,t){return Ce(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 Ce(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 Ve.killTweensOf(e,t,r)}}]),t}()),Wr=(er(Xr.prototype,{_targets:[],_lazy:0,_startAt:0,_op:0,_onInit:0}),ae("staggerTo,staggerFrom,staggerFromTo",(function(e){Xr[e]=function(){var t=new Nr,r=cr.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}),Yr=function(e,t,r){return e[t](r)},Zr=function(e,t,r,n){return e[t](n.fp,r)},qr=function(e,t){return Ct(e[t])?Yr:q(e[t])&&e.setAttribute?Pr:Wr},$r=function(e,t){return t.set(t.t,t.p,Math.round(1e6*(t.s+t.c*e))/1e6,t)},en=function(e,t){return t.set(t.t,t.p,!!(t.s+t.c*e),t)},tn=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},rn=function(){function e(t,r,n,i,o,a,s,l,u){X(this,e),this.t=r,this.s=i,this.c=o,this.p=n,this.r=a||$r,this.d=s||this,this.set=l||Wr,this.pr=u||0,(this._next=t)&&(t._prev=this)}return Q(e,[{key:"modifier",value:function(e,t,r){this.mSet=this.mSet||this.set,this.set=kr,this.m=e,this.mt=r,this.tween=t}}]),e}(),nn=(ae(Wt+"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 Nt[e]=1})),Gt.TweenMax=Gt.TweenLite=Xr,Gt.TimelineLite=Gt.TimelineMax=Nr,Ve=new Nr({sortChildren:!1,defaults:vt,autoRemoveChildren:!0,id:"root",smoothChildTiming:!0}),mt.stringFilter=function(e){var t=e.join(" ");if(br.lastIndex=0,br.test(t))return t=xr.test(t),e[1]=Ue(e[1],t),e[0]=Ue(e[0],t,yr(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=Ct(e),n=(r=t&&!r&&e.init?function(){this._props=[]}:e,{init:ie,render:Ir,add:Jr,kill:Lr,modifier:Fr,rawVars:0}),i={targetTest:0,get:0,getSetter:qr,aliases:{},register:0};if(Ar(),e!==r){if(Vt[t])return;er(r,er(tr(e,n),i)),ce(r.prototype,ce(n,tr(e,i))),Vt[r.prop=t]=r,e.targetTest&&(Xt.push(r),Nt[t]=1),t=("css"===t?"CSS":t.charAt(0).toUpperCase()+t.substr(1))+"Plugin"}ne(t,r),e.register&&e.register(an,r,rn)}))},timeline:function(e){return new Nr(e)},getTweensOf:function(e,t){return Ve.getTweensOf(e,t)},getProperty:function(e,t,r,n){Mt(e)&&(e=pr(e)[0]);var i=Zt(e||{}).get,o=r?ue:le;return"native"===r&&(r=""),e&&(t?o((Vt[t]&&Vt[t].get||i)(e,t,r,n)):function(t,r,n){return o((Vt[t]&&Vt[t].get||i)(e,t,r,n))})},quickSetter:function(e,t,r){var n,i;if(1<(e=pr(e)).length)return n=e.map((function(e){return an.quickSetter(e,t,r)})),i=n.length,function(e){for(var t=i;t--;)n[t](e)};e=e[0]||{};var o=Vt[t],a=Zt(e),s=a.harness&&(a.harness.aliases||{})[t]||t,l=o?function(t){var n=new o;Ze._pt=0,n.init(e,r?t+r:t,Ze,0,[e]),n.render(1,n),Ze._pt&&Ir(1,Ze)}:a.set(e,s);return o?l:function(t){return l(e,s,r?t+r:t,a,1)}},isTweening:function(e){return 0<Ve.getTweensOf(e,!0).length},defaults:function(e){return e&&e.ease&&(e.ease=Tr(e.ease,vt.ease)),he(vt,e||{})},config:function(e){return he(mt,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&&!Vt[e]&&!Gt[e]&&re(t+" effect requires "+e+" plugin.")})),Kt[t]=function(e,t,n){return r(pr(e),er(t||{},i),n)},e&&(Nr.prototype[t]=function(e,r,n){return this.add(Kt[t](e,Et(r)?r:(n=r)&&{},this),n)})},registerEase:function(e,t){Sr[e]=Tr(t)},parseEase:function(e,t){return arguments.length?Tr(e,t):Sr},getById:function(e){return Ve.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 Nr(r);for(i.smoothChildTiming=_t(r.smoothChildTiming),Ve.remove(i),i._dp=0,i._time=i._tTime=Ve._time,e=Ve._first;e;)t=e._next,!n&&!e._dur&&e instanceof Xr&&e.vars.onComplete===e._targets[0]||ye(i,e,e._start-e._delay),e=t;return ye(Ve,i,0),i},utils:{wrap:function e(t,r,n){var i=r-t;return Rt(t)?Pe(t,e(0,t.length),r):lr(n,(function(e){return(i+(e-t)%i)%i+t}))},wrapYoyo:function e(t,r,n){var i=r-t,o=2*i;return Rt(t)?Pe(t,e(0,t.length-1),r):lr(n,(function(e){return t+(i<(e=(o+(e-t)%o)%o||0)?o-e:e)}))},distribute:Ee,random:Re,snap:De,normalize:function(e,t,r){return Oe(e,t,0,1,r)},getUnit:ur,clamp:function(e,t,r){return lr(r,(function(r){return Te(e,t,r)}))},splitColor:gr,toArray:pr,selector:function(e){return e=pr(e)[0]||re("Invalid scope")||{},function(t){var r=e.current||e.nativeElement||e;return pr(t,r.querySelectorAll?r:r===e?re("Invalid scope")||Xe.createElement("div"):e)}},mapRange:Oe,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||ur(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=Mt(t),p={};if(!0===n&&(i=1)&&(n=null),h)t={p:t},r={p:r};else if(Rt(t)&&!Rt(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=ce(Rt(t)?[]:{},t));if(!l){for(a in r)Jr.call(p,t,a,"get",r[a]);o=function(e){return Ir(e,p),h?t.p:t}}}return lr(n,o)},shuffle:dr},install:te,effects:Kt,ticker:wr,updateRoot:Nr.updateRoot,plugins:Vt,globalTimeline:Ve,core:{PropTween:rn,globals:ne,Tween:Xr,Timeline:Nr,Animation:Hr,getCache:Zt,_removeLinkedListItem:rr,suppressOverwrites:function(e){return Je=e}}}),on=(ae("to,from,fromTo,delayedCall,set,killTweensOf",(function(e){return nn[e]=Xr[e]})),wr.add(Nr.updateRoot),Ze=nn.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}),an=nn.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])}},Ur("roundProps",_e),Ur("modifiers"),Ur("snap",De))||nn,sn=(Xr.version=Nr.version=an.version="3.9.1",We=1,$()&&Ar(),Sr.Power0,Sr.Power1,Sr.Power2,Sr.Power3,Sr.Power4,Sr.Linear,Sr.Quad,Sr.Cubic,Sr.Quart,Sr.Quint,Sr.Strong,Sr.Elastic,Sr.Back,Sr.SteppedEase,Sr.Bounce,Sr.Sine,Sr.Expo,Sr.Circ,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 ln=(e,t,r,n,i)=>{let o=Object.assign({},e),a=new Xr(o,r,t).eventCallback("onUpdate",(e=>n&&n(o))).eventCallback("onComplete",(e=>{i&&i(),Xr.killTweensOf(a)}));return a},un=e=>sn(void 0,void 0,void 0,(function*(){-1!==e.indexOf(",")&&(e=cn(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})),cn=e=>e.substring(e.indexOf(",")+1),hn=e=>URL.createObjectURL(new Blob([e])),pn=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)},dn=e=>sn(void 0,void 0,void 0,(function*(){return(yield s().get(e,{responseType:"blob"})).data})),fn=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})},mn=e=>sn(void 0,void 0,void 0,(function*(){return fn(yield(0,G.toResult)(e,"base64"))})),vn=(e,t)=>new File([e],t),gn=e=>e.substring(e.indexOf(":")+1,e.indexOf(";")),yn=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},bn=e=>(0,U.md5)(e),xn=(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})}}))},wn=e=>new Array(e.files.length).fill(0).map(((t,r)=>e.files.item(r))).filter((e=>null!==e)),An=e=>new Promise((t=>{e.toBlob((e=>{t(e)}))})),Sn=(e,t)=>s().get(e,{responseType:t||"arraybuffer"}).then((e=>e.data)).catch((e=>{console.log(e,"加载出错")})),Bn=(e,t)=>Object.assign(e,t||{}),Mn=(e,t=0)=>{let r=setTimeout((()=>(null!==r&&clearTimeout(r),r=null,e())),t)},Cn=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},Tn=(e,t,r=1,n)=>new Array(t).fill("").map(((t,i)=>e+(i+r)+(n||""))),En=e=>e.toString().replace(/(\[object )([a-zA-Z]+)(])/,"$2"),_n=(e,t)=>((0,c.js)(e,((r,n)=>{let i=t[r];void 0!==i&&("Object"===En(n)&&"Object"===En(i)&&(i=_n(n,i)),e[r]=i)})),e),Dn=(e,t)=>e.find((e=>e===t)),Rn=(e,t,r=!1)=>{let n=e/t;return r&&(n*=100),Number(n.toFixed(2))},Pn=e=>sn(void 0,void 0,void 0,(function*(){if(!e)throw TypeError("该参数为空");var t=yield Qn(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}})),On=e=>{for(var t=new ArrayBuffer(e.length),r=new Uint8Array(t),n=0;n<e.length;++n)r[n]=e[n];return t},In=e=>null==e||(Array.isArray(e)||"string"==typeof e?0===e.length:"number"==typeof e?0===e:"object"==typeof e?0===Object.keys(e).length:void 0);var Fn=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 Ln=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()},kn=e=>Fn(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)}))}))})),Un=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)},Gn=e=>Fn(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=C(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)}))})),jn=(e,t)=>URL.createObjectURL(new Blob([e],t)),Hn=(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)}))},Nn=e=>Fn(void 0,void 0,void 0,(function*(){var{bitmap:t,texture:r}=e;const{ctx:n,canvas:i}=yield xn(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=Vn(o.data[a],o.data[a+1],o.data[a+2]))[0]/100,u=c[1]/100,c=c[2]/100;l=Kn(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 y.Texture(i)})),zn=e=>{for(var t=(e=e.bitmap).width,r=e.height,n=Jn(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)))},Jn=e=>{const t=document.createElement("canvas"),r=t.getContext("2d");return r.drawImage(e,0,0,e.width,e.height),{ctx:r,canvas:t}},Vn=(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]},Kn=(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]},Qn=e=>{const t=new Image;return t.src=e,new Promise((e=>{t.onload=()=>{e(t)}}))};function Xn(e){return(Xn="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 Wn(e,t){return(Wn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Yn(e){return(Yn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Zn=new h.Box3,qn=new h.Vector3,$n=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&&Wn(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=Yn(e);if(r=t?(r=Yn(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Xn(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 h.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 h.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 h.InstancedInterleavedBuffer(t,6,1),this.setAttribute("instanceStart",new h.InterleavedBufferAttribute(e,3,0)),this.setAttribute("instanceEnd",new h.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 h.InstancedInterleavedBuffer(t,6,1),this.setAttribute("instanceColorStart",new h.InterleavedBufferAttribute(e,3,0)),this.setAttribute("instanceColorEnd",new h.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 h.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 h.Box3);var e=this.attributes.instanceStart,t=this.attributes.instanceEnd;void 0!==e&&void 0!==t&&(this.boundingBox.setFromBufferAttribute(e),Zn.setFromBufferAttribute(t),this.boundingBox.union(Zn))}},{key:"computeBoundingSphere",value:function(){null===this.boundingSphere&&(this.boundingSphere=new h.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++)qn.fromBufferAttribute(e,i),n=Math.max(n,r.distanceToSquared(qn)),qn.fromBufferAttribute(t,i),n=Math.max(n,r.distanceToSquared(qn));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}(h.InstancedBufferGeometry);function ei(e){return(ei="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 ti(e,t){return(ti=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ri(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ni(e){return(ni=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}$n.prototype.isLineSegmentsGeometry=!0,h.UniformsLib.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new h.Vector2(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}},h.ShaderLib.line={uniforms:h.UniformsUtils.merge([h.UniformsLib.common,h.UniformsLib.fog,h.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 ii=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&&ti(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=ni(e);if(r=t?(r=ni(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===ei(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return ri(n)}}(n);function n(e){var t;if(this instanceof n)return t=r.call(this,{type:"LineMaterial",uniforms:h.UniformsUtils.clone(h.ShaderLib.line.uniforms),vertexShader:h.ShaderLib.line.vertexShader,fragmentShader:h.ShaderLib.line.fragmentShader,clipping:!0}),Object.defineProperties(ri(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}(h.ShaderMaterial);function oi(e){return(oi="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 ai(e,t){return(ai=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function si(e){return(si=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}ii.prototype.isLineMaterial=!0;var li,ui,ci,hi,pi=new h.Vector3,di=new h.Vector3,fi=new h.Vector4,mi=new h.Vector4,vi=new h.Vector4,gi=new h.Vector3,yi=new h.Matrix4,bi=new h.Line3,xi=new h.Vector3,wi=new h.Box3,Ai=new h.Sphere,Si=new h.Vector4;function Bi(e,t,r){return Si.set(0,0,-t,1).applyMatrix4(e.projectionMatrix),Si.multiplyScalar(1/Si.w),Si.x=hi/r.width,Si.y=hi/r.height,Si.applyMatrix4(e.projectionMatrixInverse),Si.multiplyScalar(1/Si.w),Math.abs(Math.max(Si.x,Si.y))}var Mi=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&&ai(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=si(e);if(r=t?(r=si(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===oi(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 $n,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new ii({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)pi.fromBufferAttribute(t,i),di.fromBufferAttribute(r,i),n[o]=0===o?0:n[o-1],n[o+1]=n[o]+pi.distanceTo(di);var s=new h.InstancedInterleavedBuffer(n,2,1);return e.setAttribute("instanceDistanceStart",new h.InterleavedBufferAttribute(s,1,0)),e.setAttribute("instanceDistanceEnd",new h.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=(li=e.ray,e=this.matrixWorld,this.geometry),a=this.material;if(hi=a.linewidth+i,ui=o.attributes.instanceStart,ci=o.attributes.instanceEnd,null===o.boundingSphere&&o.computeBoundingSphere(),Ai.copy(o.boundingSphere).applyMatrix4(e),i=r?.5*hi:Bi(n,Math.max(n.near,Ai.distanceToPoint(li.origin)),a.resolution),Ai.radius+=i,!1!==li.intersectsSphere(Ai)&&(null===o.boundingBox&&o.computeBoundingBox(),wi.copy(o.boundingBox).applyMatrix4(e),i=r?.5*hi:Bi(n,Math.max(n.near,wi.distanceToPoint(li.origin)),a.resolution),wi.expandByScalar(i),!1!==li.intersectsBox(wi)))if(r)for(var s=t,l=0,u=ui.count;l<u;l++){bi.start.fromBufferAttribute(ui,l),bi.end.fromBufferAttribute(ci,l);var c=new h.Vector3,p=new h.Vector3;li.distanceSqToSegment(bi.start,bi.end,p,c),p.distanceTo(c)<.5*hi&&s.push({point:p,pointOnLine:c,distance:li.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,g=d.matrixWorld,y=(e=d.geometry).attributes.instanceStart,b=e.attributes.instanceEnd,x=-o.near;li.at(1,vi),vi.w=1,vi.applyMatrix4(o.matrixWorldInverse),vi.applyMatrix4(m),vi.multiplyScalar(1/vi.w),vi.x*=v.x/2,vi.y*=v.y/2,vi.z=0,gi.copy(vi),yi.multiplyMatrices(o.matrixWorldInverse,g);for(var w,A,S,B,M=0,C=y.count;M<C;M++)fi.fromBufferAttribute(y,M),mi.fromBufferAttribute(b,M),fi.w=1,mi.w=1,fi.applyMatrix4(yi),mi.applyMatrix4(yi),fi.z>x&&mi.z>x||(fi.z>x?(w=fi.z-mi.z,w=(fi.z-x)/w,fi.lerp(mi,w)):mi.z>x&&(w=mi.z-fi.z,A=(mi.z-x)/w,mi.lerp(fi,A)),fi.applyMatrix4(m),mi.applyMatrix4(m),fi.multiplyScalar(1/fi.w),mi.multiplyScalar(1/mi.w),fi.x*=v.x/2,fi.y*=v.y/2,mi.x*=v.x/2,mi.y*=v.y/2,bi.start.copy(fi),bi.start.z=0,bi.end.copy(mi),bi.end.z=0,A=bi.closestPointToPointParameter(gi,!0),bi.at(A,xi),S=-1<=(S=h.MathUtils.lerp(fi.z,mi.z,A))&&S<=1,B=gi.distanceTo(xi)<.5*hi,S&&B&&(bi.start.fromBufferAttribute(y,M),bi.end.fromBufferAttribute(b,M),bi.start.applyMatrix4(g),bi.end.applyMatrix4(g),S=new h.Vector3,B=new h.Vector3,li.distanceSqToSegment(bi.start,bi.end,B,S),f.push({point:B,pointOnLine:S,distance:li.origin.distanceTo(B),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}(h.Mesh);function Ci(e){return(Ci="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 Ti(){return(Ti="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 Ei(e,t){return(Ei=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)}Mi.prototype.isLineSegments2=!0;var Di=function(){var e=n,t=$n;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&&Ei(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=_i(e);if(r=t?(r=_i(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Ci(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 Ti(_i(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 Ti(_i(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 Ri(e){return(Ri="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Pi(e,t){return(Pi=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Oi(e){return(Oi=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}Di.prototype.isLineGeometry=!0;var Ii=function(){var e=n,t=Mi;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&&Pi(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=Oi(e);if(r=t?(r=Oi(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Ri(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 Di,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new ii({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}();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 Li(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ki(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 Ui(e,t,r){return t&&ki(e.prototype,t),r&&ki(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Gi(){return(Gi="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=Hi(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 ji(e,t){return(ji=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Hi(e){return(Hi=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}Ii.prototype.isLine2=!0;var 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=Hi(e);if(r=t?(r=Hi(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");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 Li(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 Ui(n,[{key:"copy",value:function(e,t){return Gi(Hi(n.prototype),"copy",this).call(this,e,t),this.element=e.element.cloneNode(!0),this}}]),n}(h.Object3D),zi=(Ni.prototype.isCSS2DObject=!0,new h.Vector3),Ji=new h.Matrix4,Vi=new h.Matrix4,Ki=new h.Vector3,Qi=new h.Vector3,Xi=Ui((function e(){var t,r,n,i,o=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},a=(Li(this,e),this),s={objects:new WeakMap},l=void 0!==o.element?o.element:document.createElement("div");function u(e,t){return Ki.setFromMatrixPosition(e.matrixWorld),Qi.setFromMatrixPosition(t.matrixWorld),Ki.distanceToSquared(Qi)}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(),Ji.copy(t.matrixWorldInverse),Vi.multiplyMatrices(t.projectionMatrix,Ji),function e(t,r,o){var c;t.isCSS2DObject&&(zi.setFromMatrixPosition(t.matrixWorld),zi.applyMatrix4(Vi),c=!0===t.visible&&-1<=zi.z&&zi.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(zi.x*n+n)+"px,"+Math.round(-zi.y*i+i)+"px)":c.style.transform="translate(-50%,-50%) translate("+(zi.x*n+n)+"px,"+(-zi.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"}}));function Wi(e){return(Wi="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 Yi(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Zi(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 qi(e,t,r){return t&&Zi(e.prototype,t),r&&Zi(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function $i(){return($i="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=no(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 eo(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&&to(e,t)}function to(e,t){return(to=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ro(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=no(e);if(r=t?(r=no(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Wi(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 no(e){return(no=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var io=new h.Vector3,oo=new h.Quaternion,ao=new h.Vector3,so=function(){eo(t,h.Object3D);var e=ro(t);function t(){var r,n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:document.createElement("div");return Yi(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 qi(t,[{key:"copy",value:function(e,r){return $i(no(t.prototype),"copy",this).call(this,e,r),this.element=e.element.cloneNode(!0),this}}]),t}(),lo=(so.prototype.isCSS3DObject=!0,function(){eo(t,so);var e=ro(t);function t(r){return Yi(this,t),(r=e.call(this,r)).rotation2D=0,r}return qi(t,[{key:"copy",value:function(e,r){return $i(no(t.prototype),"copy",this).call(this,e,r),this.rotation2D=e.rotation2D,this}}]),t}()),uo=(lo.prototype.isCSS3DSprite=!0,new h.Matrix4),co=new h.Matrix4,ho=qi((function e(){var t,r,n,i,o=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},a=(Yi(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 p(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,d=(t.top+t.bottom)/2),t.isOrthographicCamera?"scale("+r+")translate("+c(o)+"px,"+c(d)+"px)"+h(t.matrixWorldInverse):"translateZ("+r+"px)"+h(t.matrixWorldInverse)),d=o+"translate("+n+"px,"+i+"px)";s.camera.style!==d&&(u.style.transform=d,s.camera.style=d),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?(uo.copy(n.matrixWorldInverse),uo.transpose(),0!==t.rotation2D&&uo.multiply(co.makeRotationZ(t.rotation2D)),t.matrixWorld.decompose(io,oo,ao),uo.setPosition(io),uo.scale(ao),uo.elements[3]=0,uo.elements[7]=0,uo.elements[11]=0,uo.elements[15]=1,p(uo)):p(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,d=t.children.length;h<d;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"}}));const po=(e,t)=>(t.updateMatrixWorld(!0),t=new y.Vector3,e.getWorldPosition(t),t),fo={parse(e){var{x:e,y:t,z:r}=e;return void 0===r?new h.Vector2(e,t):new h.Vector3(e,t,r)},toJSON(e){var{x:e,y:t,z:r}=e;return null==r?{x:e,y:t}:{x:e,y:t,z:r}}},mo=(e,t)=>e.distanceTo(t),vo=e=>new so(e),go=e=>new Ni(e),yo=e=>new lo(e),bo=(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)},xo=(e,t,r)=>{"Group"===e.type||"Object3D"===e.type?e.children.forEach((e=>xo(e,t,r))):bo(e,t,r)},wo=e=>(e.mapping=h.EquirectangularReflectionMapping,e),Ao=e=>{let t=e=>"Group"!==e.type&&"Object3D"!==e.type||1!==e.children.length?e:t(e.children[0]);return t(e)},So=(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 h.VideoTexture(r)},Bo=(e,t=!1)=>{let r=new h.CatmullRomCurve3(e),n=new h.BufferGeometry;e=r.getSpacedPoints(100),n.setFromPoints(e),e=new h.LineBasicMaterial({color:26214});let i=new h.Line(n,e);return i.visible=t,{line:i,curve:r}},Mo=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 h.Vector3(o,a,s))),n[i[t]]=e,t++})),r},Co=e=>{var{pointArray:e,material:t,lineWidth:r,colorArray:n}=e;const i=new Di,o=(i.setPositions(e),t||new ii({transparent:!0,side:h.DoubleSide,linewidth:r||5,vertexColors:!0})),a=(i.setColors(n||[1,1,1]),o.resolution.set(window.innerWidth,window.innerHeight),new Ii(i,o));return a.name="gw",a.computeLineDistances(),a},To=e=>3.1415926*e/180,Eo=(e,t="name",r)=>{const n={};return e.traverse((e=>{"id"===t?n[e.userData.id]=e:n[e[t]]=e,null!=r&&r(e)})),n},_o=(e,t,r,n,i,o)=>({cx:e,cy:t,cz:r,tx:n,ty:i,tz:o});var Do={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 Ro=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 Po=function(){function e(t){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");this.manager=void 0!==t?t:Ro,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 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 Io(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 Fo(e,t){return(Fo=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Lo(e){return(Lo=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var ko=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&&Fo(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=Lo(e);if(r=t?(r=Lo(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(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=Do.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=(a=o.options).textureQuality,a=a.reverseTexture,s=i.notCompress;t(i.size&&1!==n?(r=(t=i.size).w,t=t.h,s=s?1:n,createImageBitmap(e,Object.assign(o.options,{imageOrientation:a?"none":"flipY",resizeHeight:t*s,resizeWidth:r*s}))):createImageBitmap(e,Object.assign(o.options,{imageOrientation:a?"none":"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 Io(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)?Io(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],Do.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 Uo(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)||jo(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 Go(e,t){var r,n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=jo(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 jo(e,t){if(e){if("string"==typeof e)return Ho(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)?Ho(e,t):void 0}}function Ho(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 No(e){return(No="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 zo(){return(zo="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=Zo(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 Jo(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Vo(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 Ko(e,t,r){return t&&Vo(e.prototype,t),r&&Vo(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Qo(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&&Xo(e,t)}function Xo(e,t){return(Xo=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Wo(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=Zo(e);if(r=t?(r=Zo(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===No(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return Yo(n)}}function Yo(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Zo(e){return(Zo=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}ko.prototype.isImageBitmapLoader=!0;var qo=function(){Qo(t,h.Loader);var e=Wo(t);function t(r){return Jo(this,t),(r=e.call(this,r)).dracoLoader=null,r.ktx2Loader=null,r.meshoptDecoder=null,r.pluginCallbacks=[],r.register((function(e){return new na(e)})),r.register((function(e){return new ua(e)})),r.register((function(e){return new ca(e)})),r.register((function(e){return new ia(e)})),r.register((function(e){return new oa(e)})),r.register((function(e){return new aa(e)})),r.register((function(e){return new sa(e)})),r.register((function(e){return new la(e)})),r.register((function(e){return new ta(e)})),r.register((function(e){return new ha(e)})),r}return Ko(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:h.LoaderUtils.extractUrlBase(e),s=(this.manager.itemStart(e),new h.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(h.LoaderUtils.decodeText(new Uint8Array(e,0,4))===pa){try{a[ea.KHR_BINARY_GLTF]=new da(e)}catch(e){return void(n&&n(e))}o=a[ea.KHR_BINARY_GLTF].content}else o=h.LoaderUtils.decodeText(new Uint8Array(e));var l=JSON.parse(o);if(console.log(l,"json"),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 Oa(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 c=0;c<this.pluginCallbacks.length;c++){var p=this.pluginCallbacks[c](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 ea.KHR_MATERIALS_UNLIT:a[f]=new ra;break;case ea.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:a[f]=new ga;break;case ea.KHR_DRACO_MESH_COMPRESSION:a[f]=new fa(l,this.dracoLoader);break;case ea.KHR_TEXTURE_TRANSFORM:a[f]=new ma;break;case ea.KHR_MESH_QUANTIZATION:a[f]=new ya;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 $o(){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 ea={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"},ta=function(){function e(t){Jo(this,e),this.parser=t,this.name=ea.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}return Ko(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 h.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 h.DirectionalLight(s)).target.position.set(0,0,-1),i.add(i.target);break;case"point":(i=new h.PointLight(s)).distance=l;break;case"spot":(i=new h.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}(),ra=function(){function e(){Jo(this,e),this.name=ea.KHR_MATERIALS_UNLIT}return Ko(e,[{key:"getMaterialType",value:function(){return h.MeshBasicMaterial}},{key:"extendParams",value:function(e,t,r){var n,i=[];return e.color=new h.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}(),na=function(){function e(t){Jo(this,e),this.parser=t,this.name=ea.KHR_MATERIALS_CLEARCOAT}return Ko(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?h.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 h.Vector2(r,r))),Promise.all(n)}}]),e}(),ia=function(){function e(t){Jo(this,e),this.parser=t,this.name=ea.KHR_MATERIALS_SHEEN}return Ko(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?h.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 h.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}(),oa=function(){function e(t){Jo(this,e),this.parser=t,this.name=ea.KHR_MATERIALS_TRANSMISSION}return Ko(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?h.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}(),aa=function(){function e(t){Jo(this,e),this.parser=t,this.name=ea.KHR_MATERIALS_VOLUME}return Ko(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?h.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 h.Color(n[0],n[1],n[2]),Promise.all(r)}}]),e}(),sa=function(){function e(t){Jo(this,e),this.parser=t,this.name=ea.KHR_MATERIALS_IOR}return Ko(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?h.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}(),la=function(){function e(t){Jo(this,e),this.parser=t,this.name=ea.KHR_MATERIALS_SPECULAR}return Ko(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?h.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 h.Color(i[0],i[1],i[2]),void 0!==e.specularColorTexture&&n.push(r.assignTexture(t,"specularColorMap",e.specularColorTexture).then((function(e){e.encoding=h.sRGBEncoding}))),Promise.all(n)}}]),e}(),ua=function(){function e(t){Jo(this,e),this.parser=t,this.name=ea.KHR_TEXTURE_BASISU}return Ko(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}(),ca=function(){function e(t){Jo(this,e),this.parser=t,this.name=ea.EXT_TEXTURE_WEBP,this.isSupported=null}return Ko(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}(),ha=function(){function e(t){Jo(this,e),this.name=ea.EXT_MESHOPT_COMPRESSION,this.parser=t}return Ko(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}(),pa="glTF",da=Ko((function e(t){Jo(this,e),this.name=ea.KHR_BINARY_GLTF,this.content=null,this.body=null;var r=new DataView(t,0,12);if(this.header={magic:h.LoaderUtils.decodeText(new Uint8Array(t.slice(0,4))),version:r.getUint32(4,!0),length:r.getUint32(8,!0)},this.header.magic!==pa)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=h.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.")})),fa=function(){function e(t,r){if(Jo(this,e),!r)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=ea.KHR_DRACO_MESH_COMPRESSION,this.json=t,this.dracoLoader=r,this.dracoLoader.preload()}return Ko(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=Ca[r]||r.toLowerCase();l[h]=s[r]}for(n in e.attributes){var p,d,f=Ca[n]||n.toLowerCase();void 0!==s[n]&&(p=i.accessors[e.attributes[n]],d=Aa[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}(),ma=function(){function e(){Jo(this,e),this.name=ea.KHR_TEXTURE_TRANSFORM}return Ko(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}(),va=function(){Qo(t,h.MeshStandardMaterial);var e=Wo(t);function t(r){Jo(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 h.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(Yo(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 Ko(t,[{key:"copy",value:function(e){return zo(Zo(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}(),ga=function(){function e(){Jo(this,e),this.name=ea.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 Ko(e,[{key:"getMaterialType",value:function(){return va}},{key:"extendParams",value:function(e,t,r){t=t.extensions[this.name];var n,i=(e.color=new h.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 h.Color(0,0,0),e.glossiness=void 0!==t.glossinessFactor?t.glossinessFactor:1,e.specular=new h.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 va(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=h.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}(),ya=Ko((function e(){Jo(this,e),this.name=ea.KHR_MESH_QUANTIZATION})),ba=function(){Qo(t,h.Interpolant);var e=Wo(t);function t(r,n,i,o){return Jo(this,t),e.call(this,r,n,i,o)}return Ko(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}(),xa=(ba.prototype.beforeStart_=ba.prototype.copySampleValue_,ba.prototype.afterEnd_=ba.prototype.copySampleValue_,ba.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 g=o[h+v+a],y=o[h+v+s]*u,b=o[c+v+a],x=o[c+v]*u;i[v]=f*g+m*y+p*b+d*x}return i},new h.Quaternion),wa=function(){Qo(t,ba);var e=Wo(t);function t(){return Jo(this,t),e.apply(this,arguments)}return Ko(t,[{key:"interpolate_",value:function(e,r,n,i){return e=zo(Zo(t.prototype),"interpolate_",this).call(this,e,r,n,i),xa.fromArray(e).normalize().toArray(e),e}}]),t}(),Aa={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Sa={9728:h.NearestFilter,9729:h.LinearFilter,9984:h.NearestMipmapNearestFilter,9985:h.LinearMipmapNearestFilter,9986:h.NearestMipmapLinearFilter,9987:h.LinearMipmapLinearFilter},Ba={33071:h.ClampToEdgeWrapping,33648:h.MirroredRepeatWrapping,10497:h.RepeatWrapping},Ma={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Ca={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},Ta={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},Ea={CUBICSPLINE:void 0,LINEAR:h.InterpolateLinear,STEP:h.InterpolateDiscrete};function _a(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 Da(e,t){void 0!==t.extras&&("object"===No(t.extras)?Object.assign(e.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function Ra(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 Pa(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 Oa=function(){function e(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};Jo(this,e),this.json=t,this.extensions={},this.plugins={},this.options=r,this.cache=new $o,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 ko(this.options.manager):this.textureLoader=new h.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 h.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}return Ko(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 Ho(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||jo(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:{}};_a(i,o,n),Da(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),Go(t.children.entries()));try{for(a.s();!(i=a.n()).done;){var s=Uo(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[ea.KHR_BINARY_GLTF].body);var n=this.options;return new Promise((function(e,i){r.load(h.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=Ma[n.type],s=Aa[n.componentType],l=s.BYTES_PER_ELEMENT,u=n.byteOffset||0,c=void 0!==n.bufferView?r.bufferViews[n.bufferView].byteStride:void 0,p=!0===n.normalized,d=c&&c!==l*a?(f=Math.floor(u/c),m="InterleavedBuffer:"+n.bufferView+":"+n.componentType+":"+f+":"+n.count,(v=t.cache.get(m))||(i=new s(o,f*c,n.count*c/l),v=new h.InterleavedBuffer(i,c/l),t.cache.add(m,v)),new h.InterleavedBufferAttribute(v,a,u%c/l,p)):(i=null===o?new s(n.count*a):new s(o,u,n.count*a),new h.BufferAttribute(i,a,p));if(void 0!==n.sparse){var f=Aa[n.sparse.indices.componentType],m=n.sparse.indices.byteOffset||0,v=n.sparse.values.byteOffset||0,g=new f(e[1],m,n.sparse.count*Ma.SCALAR),y=new s(e[2],v,n.sparse.count*a);null!==o&&(d=new h.BufferAttribute(d.array.slice(),d.itemSize,d.normalized));for(var b=0,x=g.length;b<x;b++){var w=g[b];if(d.setX(w,y[b*a]),2<=a&&d.setY(w,y[b*a+1]),3<=a&&d.setZ(w,y[b*a+2]),4<=a&&d.setW(w,y[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=Sa[r.magFilter]||h.LinearFilter,t.minFilter=Sa[r.minFilter]||h.LinearMipmapLinearFilter,t.wrapS=Ba[r.wrapS]||h.RepeatWrapping,t.wrapT=Ba[r.wrapT]||h.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,s;!0===t.isImageBitmapLoader?(a=function(e,t){(e=new h.Texture(e)).needsUpdate=!0,r({texture:e,blob:t})},t.load(h.LoaderUtils.resolveURL(e,i.path),a,void 0,n,o)):(s=i.myOptions.loadConfig.reverseTexture,Pn(e).then((function(e){var t=e.ctx,n=e.canvas,i=(e=e.img,new h.Texture(n));s||(t.clearRect(0,0,n.width,n.height),t.translate(0,n.height),t.scale(1,-1),t.drawImage(e,0,0,n.width,n.height)),r(i)})).catch(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=l,r.userData.blob=e),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[ea.KHR_TEXTURE_TRANSFORM]&&(o=void 0!==r.extensions?r.extensions[ea.KHR_TEXTURE_TRANSFORM]:void 0)&&(a=n.associations.get(i),i=n.extensions[ea.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 h.PointsMaterial,h.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 h.LineBasicMaterial,h.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 h.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||{})[ea.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]?(l=i[ea.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS],t=l.getMaterialType(),s.push(l.extendParams(a,o,r))):n[ea.KHR_MATERIALS_UNLIT]?(l=i[ea.KHR_MATERIALS_UNLIT],t=l.getMaterialType(),s.push(l.extendParams(a,o,r))):(n=o.pbrMetallicRoughness||{},a.color=new h.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=h.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!==h.MeshBasicMaterial&&(s.push(r.assignTexture(a,"normalMap",o.normalTexture)),a.normalScale=new h.Vector2(1,1),void 0!==o.normalTexture.scale&&(n=o.normalTexture.scale,a.normalScale.set(n,n))),void 0!==o.occlusionTexture&&t!==h.MeshBasicMaterial&&(s.push(r.assignTexture(a,"aoMap",o.occlusionTexture)),void 0!==o.occlusionTexture.strength&&(a.aoMapIntensity=o.occlusionTexture.strength)),void 0!==o.emissiveFactor&&t!==h.MeshBasicMaterial&&(a.emissive=(new h.Color).fromArray(o.emissiveFactor)),void 0!==o.emissiveTexture&&t!==h.MeshBasicMaterial&&s.push(r.assignTexture(a,"emissiveMap",o.emissiveTexture)),Promise.all(s).then((function(){var n=t===va?i[ea.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(a):new t(a);return o.name&&(n.name=o.name),n.map&&(n.map.encoding=h.sRGBEncoding),n.emissiveMap&&(n.emissiveMap.encoding=h.sRGBEncoding),Da(n,o),r.associations.set(n,{materials:e}),o.extensions&&_a(i,n,o),n}))}},{key:"createUniqueName",value:function(e){for(var t=h.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[ea.KHR_DRACO_MESH_COMPRESSION])?"draco:"+u.bufferView+":"+u.indices+":"+Ra(u.attributes):l.indices+":"+Ra(l.attributes)+":"+l.mode),u=n[l];u?i.push(u.promise):(u=void 0,u=s.extensions&&s.extensions[ea.KHR_DRACO_MESH_COMPRESSION]?function(e){return r[ea.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then((function(r){return Ia(r,e,t)}))}(s):Ia(new h.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 h.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:h.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,c=s.length;u<c;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?h.SkinnedMesh:h.Mesh)(p,m)).isSkinnedMesh||f.geometry.attributes.skinWeight.normalized||f.normalizeSkinWeights(),5===d.mode?f.geometry=Fa(f.geometry,h.TriangleStripDrawMode):6===d.mode&&(f.geometry=Fa(f.geometry,h.TriangleFanDrawMode));else if(1===d.mode)f=new h.LineSegments(p,m);else if(3===d.mode)f=new h.Line(p,m);else if(2===d.mode)f=new h.LineLoop(p,m);else{if(0!==d.mode)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+d.mode);f=new h.Points(p,m)}if(0<Object.keys(f.geometry.morphAttributes).length){A=w=x=b=y=v=void 0;var v=f,g=i;if(v.updateMorphTargets(),void 0!==g.weights)for(var y=0,b=g.weights.length;y<b;y++)v.morphTargetInfluences[y]=g.weights[y];if(g.extras&&Array.isArray(g.extras.targetNames)){var x=g.extras.targetNames;if(v.morphTargetInfluences.length===x.length){v.morphTargetDictionary={};for(var w=0,A=x.length;w<A;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),Da(f,i),d.extensions&&_a(n,f,d),t.assignFinalMaterial(f),l.push(f)}for(var S=0,B=l.length;S<B;S++)t.associations.set(l[S],{meshes:e,primitives:S});if(1===l.length)return l[0];var M=new h.Group;t.associations.set(M,{meshes:e});for(var C=0,T=l.length;C<T;C++)M.add(l[C]);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 h.PerspectiveCamera(h.MathUtils.radToDeg(r.yfov),r.aspectRatio||1,r.znear||1,r.zfar||2e6):"orthographic"===e.type&&(t=new h.OrthographicCamera(-r.xmag,r.xmag,r.ymag,-r.ymag,r.znear,r.zfar)),e.name&&(t.name=this.createUniqueName(e.name)),Da(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],c=t.samplers[u.sampler],p=void 0!==(u=u.target).node?u.node:u.id,d=void 0!==t.parameters?t.parameters[c.input]:c.input,f=void 0!==t.parameters?t.parameters[c.output]:c.output;r.push(this.getDependency("node",p)),n.push(this.getDependency("accessor",d)),i.push(this.getDependency("accessor",f)),o.push(c),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,c=n.length;u<c;u++)!function(e){var t=n[e],r=i[e],u=o[e],c=a[e],p=s[e];if(void 0!==t){t.updateMatrix(),t.matrixAutoUpdate=!0;var d=void 0;switch(Ta[p.path]){case Ta.weights:d=h.NumberKeyframeTrack;break;case Ta.rotation:d=h.QuaternionKeyframeTrack;break;default:d=h.VectorKeyframeTrack}e=t.name||t.uuid;var f=void 0!==c.interpolation?Ea[c.interpolation]:h.InterpolateLinear,m=[],v=(Ta[p.path]===Ta.weights?t.traverse((function(e){e.morphTargetInfluences&&m.push(e.name||e.uuid)})):m.push(e),u.array);if(u.normalized){for(var g=Pa(v.constructor),y=new Float32Array(v.length),b=0,x=v.length;b<x;b++)y[b]=v[b]*g;v=y}for(var w=0,A=m.length;w<A;w++){var S=new d(m[w]+"."+Ta[p.path],r.array,v,f);"CUBICSPLINE"===c.interpolation&&(S.createInterpolant=function(e){return new(this instanceof h.QuaternionKeyframeTrack?wa:ba)(this.times,this.values,this.getValueSize()/3,e)},S.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0),l.push(S)}}}(u);return r=t.name||"animation_"+e,new h.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 h.Bone:1<t.length?new h.Group:1===t.length?t[0]:new h.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),Da(s,o),o.extensions&&_a(n,s,o),void 0!==o.matrix?((r=new h.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 h.Group,o=(i.isLoadScene=!0,e.name&&(i.name=n.createUniqueName(e.name)),Da(i,e),e.extensions&&_a(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 h.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 h.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=Go(n.associations);try{for(i.s();!(t=i.n()).done;){var o=Uo(t.value,2),a=o[0],s=o[1];(a instanceof h.Material||a instanceof h.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 Ia(e,t,r){var n,i=t.attributes,o=[];for(n in i){var a=Ca[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)),Da(e,t);var s=e,l=t,u=r,c=l.attributes,p=new h.Box3;if(void 0!==c.POSITION){var d=(c=u.json.accessors[c.POSITION]).min,f=c.max;if(void 0===d||void 0===f)console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");else{p.set(new h.Vector3(d[0],d[1],d[2]),new h.Vector3(f[0],f[1],f[2])),c.normalized&&(d=Pa(Aa[c.componentType]),p.min.multiplyScalar(d),p.max.multiplyScalar(d));var m=l.targets;if(void 0!==m){for(var v=new h.Vector3,g=new h.Vector3,y=0,b=m.length;y<b;y++){var x,w,A=m[y];void 0!==A.POSITION&&(w=(A=u.json.accessors[A.POSITION]).min,x=A.max,void 0!==w&&void 0!==x?(g.setX(Math.max(Math.abs(w[0]),Math.abs(x[0]))),g.setY(Math.max(Math.abs(w[1]),Math.abs(x[1]))),g.setZ(Math.max(Math.abs(w[2]),Math.abs(x[2]))),A.normalized&&(w=Pa(Aa[A.componentType]),g.multiplyScalar(w)),v.max(g)):console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION."))}p.expandByVector(v)}s.boundingBox=p,f=new h.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 g,y=i[m];a&&(g=void 0!==y.POSITION?o.getDependency("accessor",y.POSITION):n.attributes.position,p.push(g)),s&&(g=void 0!==y.NORMAL?o.getDependency("accessor",y.NORMAL):n.attributes.normal,d.push(g)),l&&(y=void 0!==y.COLOR_0?o.getDependency("accessor",y.COLOR_0):n.attributes.color,f.push(y))}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 Fa(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===h.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}o=a(356);var La=a.n(o),ka=a(298);const Ua=["Group","Box","Circle","Cylinder","Dodecahedron","Icosahedron","Lathe","Octahedron","Plane","Ring","Sphere","Sprite","Tetrahedron","Torus","TorusKnot","Tube","Reflector"];class Ga{static create(){return new h.MeshStandardMaterial}static isDefval(e){for(const t in this.defVal){const r=this.defVal[t],n=e[t];if(r instanceof h.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 x)if(e[t])return!1;return!0}}Ga.defVal={color:new h.Color(16777215),emissive:new h.Color(0),roughness:1,metalness:0,lightMapIntensity:1,aoMapIntensity:1,emissiveIntensity:1,bumpScale:1,normalScale:new h.Vector2(1,1),displacementScale:1,envMapIntensity:1,wireframe:!1,transparent:!1,depthTest:!0,depthWrite:!0,opacity:1};class ja{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.cb.undo.addUndos.cb({undoVal:e,undos:this.undos}),t}removeUndos(e){var t;return this.undos.splice(e),t=this.dataMap.history.splice(e),this.dataMap.index=this.undos.length-1,this.runScene.cb.undo.removeUndos.cb({index:e}),t}undoByIndex(e){e>this.dataMap.index?this.undos.slice(this.dataMap.index+1,e+1).map((e=>{e instanceof Array?e.map((e=>e.redo())):e.redo()})):e<this.dataMap.index&&this.undos.slice(e+1,this.dataMap.index+1).reverse().map((e=>{e instanceof Array?e.map((e=>e.undo())):e.undo()})),this.dataMap.index=e,this.runScene.cb.undo.undoByIndex.cb(e)}addUndo(e){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.cb.undo.reset.cb("")}}function Ha(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=Ha(e[t]),n[t]=r);return n}}const Na=class extends w{constructor(e){super(),this.type="多层级修改",this.target=e.target,this.typeList=e.typeList,this.new=e.newVal,this.cb=e.cb,this.old=(0,c.qR)(e.target,this.typeList)[(0,ka.lastArrayEle)(e.typeList)]}execute(){return this.redo(),this}_execute(e){const t=(0,c.qR)(this.target,this.typeList);t[(0,ka.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 za{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 h.ShaderMaterial({uniforms:Ha(Ja.uniforms),vertexShader:Ja.vertexShader,fragmentShader:Ja.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=>!za.TextureNames.includes(e))).map((e=>{var t=r.uniforms[e];n.uniforms[e].value="roomsXYZPropsW"===e||"positionOffsetRoomsXYZPropsW"===e||"roomColorTint"===e?new h.Vector4(t.x,t.y,t.z,t.w):t})),n.userData.tools=this.tools,n},toNormal:e=>{const t=ms(),r=(t.userData=Object.assign(Object.assign({},t.userData),{normal:{type:this.tools.type,uniforms:{}},textures:this.tools.getTextures(e)}),{}),n=e.uniforms,i=Ja.uniforms;return Object.keys(n).filter((e=>!za.TextureNames.includes(e))).map((e=>{var t,o,a,s,l,u,c=n[e].value,p=i[e].value;c instanceof h.Vector4?(({x:t,y:o,z:a}=c),({x:s,y:l,z:u}=p),t===s&&o===l&&a===u||(r[e]=c)):c!==p&&(r[e]=c)})),t.userData.normal.uniforms=r,t},clone:function(e,t){return e}},this.runScene=e}create(){const e=new h.ShaderMaterial({uniforms:Ha(Ja.uniforms),vertexShader:Ja.vertexShader,fragmentShader:Ja.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())}}za.TextureNames=["sideWallTex","backWallTex","floorTex","ceilingTex"];const Ja={uniforms:{roomIntensity:{value:1},roomColorTint:{value:new h.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 h.Vector4(.35,.65,.1,1)},positionOffsetRoomsXYZPropsW:{value:new h.Vector4(4.7,2,-11,-3)},depthTest:{value:!0},depthWrite:{value:!0}},vertexShader:"\n varying vec2 vUv;\n varying vec3 vPos;\n varying mat4 vModelMatrix;\n \n void main() {\n vUv = uv;\n vPos = position;\n vModelMatrix = modelMatrix;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }\n ",fragmentShader:"\n uniform float roomIntensity;\n uniform vec4 roomColorTint;\n \n uniform sampler2D sideWallTex;\n uniform sampler2D backWallTex;\n uniform sampler2D floorTex;\n uniform sampler2D ceilingTex;\n \n uniform float sideWallTexTiling;\n uniform float backWallTexTiling;\n uniform float floorTexTiling;\n uniform float ceilingTexTiling;\n \n uniform float roomTile;\n uniform vec4 roomsXYZPropsW;\n uniform vec4 positionOffsetRoomsXYZPropsW;\n \n varying vec2 vUv;\n varying vec3 vPos;\n varying mat4 vModelMatrix;\n \n void main() {\n vec4 interpVertexPos = vec4(vPos.xyz, vPos.z);\n // 将相机世界空间坐标转换为对象空间坐标\n vec4 cameraObjectPos = inverse(vModelMatrix) * vec4(cameraPosition, 1.0);\n vec4 transCameraPos = vec4(cameraObjectPos.xyz, cameraObjectPos.z);\n \n vec4 temp1 = (interpVertexPos - positionOffsetRoomsXYZPropsW);\n vec4 temp2 = ((roomsXYZPropsW + vec4(-1E-05, -1E-05, -1E-05, -1E-05)) * roomTile);\n vec4 V2 = transCameraPos - positionOffsetRoomsXYZPropsW;\n vec4 V1 = temp1 - V2;\n vec4 middleman = ((floor(temp2 * temp1) + step(vec4(0, 0, 0, 0), V1)) / temp2 - V2) / V1;\n \n // Side Walls\n vec2 sideWallUv = (middleman.x * V1 + V2).zy * sideWallTexTiling;\n vec4 sideWallColor = texture2D(sideWallTex, sideWallUv);\n \n // Back Wall\n vec2 backWallUv = (middleman.z * V1 + V2).xy * backWallTexTiling;\n vec4 backWallColor = texture2D(backWallTex, backWallUv);\n \n // Floor Ceiling\n vec2 floorUv = ((middleman.y * V1) + V2).xz * floorTexTiling;\n vec2 ceilingUv = ((middleman.y * V1) + V2).xz * ceilingTexTiling;\n vec4 floorColor = texture2D(floorTex, floorUv);\n vec4 ceilingColor = texture2D(ceilingTex, ceilingUv);\n vec4 cfColor = mix(floorColor, ceilingColor, step(0.0, V1.y));\n \n // Mix\n float compareXZ = 0.0;\n float stepXZ = step(middleman.z, middleman.x);\n if(stepXZ <= 0.0)\n compareXZ = middleman.x;\n else\n compareXZ = middleman.z;\n \n vec4 wallColor = vec4(0);\n if(stepXZ <= 0.0)\n wallColor = sideWallColor;\n else\n wallColor = backWallColor;\n \n vec4 finalColor = vec4(0);\n if(middleman.y <= compareXZ)\n finalColor = cfColor;\n else\n finalColor = wallColor;\n \n // Tint Room\n vec4 tintColor = roomColorTint * finalColor * roomIntensity;\n \n gl_FragColor = tintColor;\n }\n "};class Va{constructor(e){this.tools={type:"Fresnel",getTextures(e){const t=[];return e.envMap&&t.push({type:"envMap",texture:e.envMap}),e.displacementMap&&t.push({type:"displacementMap",texture:e.displacementMap}),t},parseData:e=>{const{textures:t,normal:r,material:n}=e,i=vs(n,new Ka(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=>!Va.TextureNames.includes(e))).map((e=>{i[e]=r.uniforms[e]})),i.insertFresnelShader(),i.userData.tools=this.tools,i},toNormal:e=>{const t=vs(e,ms()),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=>!Va.TextureNames.includes(e))).map((t=>{var i=e[t],o=n[t].value;"fresnelBias"===t||"fresnelScale"===t||"fresnelPower"===t||"isSurge"===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 Ka(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())}}Va.TextureNames=["envMap","displacementMap"];class Ka extends h.MeshPhysicalMaterial{constructor(e,t,r){if(e?super(e):(super(),this.emissive=new h.Color(65535),this.envMap=null,this.displacementMap=null,this.metalness=0,this.roughness=0,this.ior=1.5,this.transmission=1,this.opacity=1,this.transparent=!0,this.thickness=0),this.runScene=r,t?(this.fresnelBias=new h.Uniform(t.fresnelBias),this.fresnelScale=new h.Uniform(t.fresnelScale),this.fresnelPower=new h.Uniform(t.fresnelPower)):(this.fresnelBias=new h.Uniform(Qa.uniforms.fresnelBias.value),this.fresnelScale=new h.Uniform(Qa.uniforms.fresnelScale.value),this.fresnelPower=new h.Uniform(Qa.uniforms.fresnelPower.value)),this.clock=new h.Clock,this.isSurge=new h.Uniform(!1),this.deltaTime=new h.Uniform(0),!this.cubeCamera){const e=new h.WebGLCubeRenderTarget(2048);e.texture.mapping=h.CubeRefractionMapping,this.cubeCamera=new h.CubeCamera(.1,1e5,e),this.runScene.assetsEx.scene.add(this.cubeCamera),this.runScene.cb.render.add("Fresnel",(()=>{this.update()}))}}insertFresnelShader(){this.onBeforeCompile=e=>{e.uniforms.isSurge=this.isSurge,e.uniforms.deltaTime=this.deltaTime,e.uniforms.fresnelBias=this.fresnelBias,e.uniforms.fresnelScale=this.fresnelScale,e.uniforms.fresnelPower=this.fresnelPower,e.vertexShader=e.vertexShader.replace(/varying vec3 vWorldPosition;/g,Qa.vertexParas),e.vertexShader=e.vertexShader.replace(/#include <begin_vertex>/g,Qa.vertexShader1),e.vertexShader=e.vertexShader.replace(/vWorldPosition = worldPosition.xyz;/g,Qa.vertexShader2),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.clock&&(this.deltaTime.value+=3*this.clock.getDelta()),this.cubeCamera&&(this.cubeCamera.position.copy(this.runScene.assetsEx.camera.position),this.cubeCamera.update(this.runScene.assetsEx.renderer,this.runScene.assetsEx.scene))}}const Qa={uniforms:{depthTest:new h.Uniform(!0),depthWrite:new h.Uniform(!0),isSurge:new h.Uniform(!1),deltaTime:new h.Uniform(0),fresnelBias:new h.Uniform(0),fresnelScale:new h.Uniform(1),fresnelPower:new h.Uniform(3)},vertexParas:"\n uniform bool isSurge;\n uniform float deltaTime;\n varying vec3 vWorldPosition;\n varying vec3 vWorldNormal;\n ",vertexShader1:"\n vec3 transformed = vec3(position);\n if(isSurge) {\n // 0.15作为系数控制气泡表面波纹的稀疏程度,数值越大越密\n float wobbleValue = 0.15 * transformed.y + deltaTime;\n // 三角函数的系数控制气泡表面波纹的波动幅度,数值越大波幅越大\n vec3 wobblePos = vec3(0.75 * cos(wobbleValue) + 0.25 * sin(wobbleValue));\n transformed += wobblePos;\n }\n ",vertexShader2:"\n 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 "};class Xa{constructor(e){this.tools={type:"Physical",getTextures(e){const t=[];return Xa.TextureNames.forEach((r=>{e[r]&&t.push({type:r,texture:e[r]})})),t},parseData:e=>{const{normal:t,textures:r,material:n}=e,i=vs(n,new h.MeshPhysicalMaterial);return i.name=n.name,r.forEach((e=>{i[e.type]=e.texture})),Object.keys(t.uniforms).filter((e=>!Xa.IgnoredAttributes.includes(e))).map((e=>{var r=t.uniforms[e];i[e]="attenuationColor"===e||"sheenColor"===e||"specularColor"===e?new h.Color(r):"clearcoatNormalScale"===e?new h.Vector2(r.x,r.y):r})),i.userData.tools=this.tools,i},toNormal:e=>{const t=vs(e,ms()),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=new h.MeshPhysicalMaterial;return Object.keys(e).filter((e=>!Xa.TextureNames.includes(e))).filter((e=>!Xa.IgnoredAttributes.includes(e))).filter((e=>void 0===t[e])).map((t=>{const i=e[t],o=n[t];"attenuationColor"===t||"sheenColor"===t||"specularColor"===t?i.getHexString()!==o.getHexString()&&(r[t]=i.getHexString()):"clearcoatNormalScale"===t?i.x===o.x&&i.y===o.y||(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 h.MeshPhysicalMaterial;return t.userData.tools=this.tools,(e=e||this.runScene.modelEx.select)&&(t.name="MeshPhysicalMaterial-"+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())}}function Wa(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ya(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 Za(e,t,r){t&&Ya(e.prototype,t),r&&Ya(e,r),Object.defineProperty(e,"prototype",{writable:!1})}Xa.IgnoredAttributes=["_listeners","version"],Xa.TextureNames=["alphaMap","aoMap","bumpMap","displacementMap","emissiveMap","envMap","lightMap","map","metalnessMap","normalMap","roughnessMap","clearcoatMap","clearcoatNormalMap","clearcoatRoughnessMap","sheenRoughnessMap","sheenColorMap","specularIntensityMap","specularColorMap","thicknessMap","transmissionMap"];var qa=function(){function e(){Wa(this,e),this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}return Za(e,[{key:"setSize",value:function(){}},{key:"render",value:function(){console.error("THREE.Pass: .render() must be implemented in derived pass.")}}]),e}(),$a=new h.OrthographicCamera(-1,1,1,-1,0,1),es=new h.BufferGeometry,ts=(es.setAttribute("position",new h.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3)),es.setAttribute("uv",new h.Float32BufferAttribute([0,2,0,0,2,0],2)),function(){function e(t){Wa(this,e),this._mesh=new h.Mesh(es,t)}return Za(e,[{key:"dispose",value:function(){this._mesh.geometry.dispose()}},{key:"render",value:function(e){e.render(this._mesh,$a)}},{key:"material",get:function(){return this._mesh.material},set:function(e){this._mesh.material=e}}]),e}());function rs(e){return(rs="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 ns(e,t){return(ns=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function is(e){return(is=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var os=function(){var e=n,t=qa;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&&ns(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=is(e);if(r=t?(r=is(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===rs(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 h.ShaderMaterial?(i.uniforms=e.uniforms,i.material=e):e&&(i.uniforms=h.UniformsUtils.clone(e.uniforms),i.material=new h.ShaderMaterial({defines:Object.assign({},e.defines),uniforms:i.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),i.fsQuad=new ts(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}();const as={uniforms:{tDiffuse:new h.Uniform(null),h:new h.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}"},ss={uniforms:{tDiffuse:new h.Uniform(null),v:new h.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 h.Uniform(null),new h.Uniform(null),new h.Uniform(0),new h.Uniform(0),new h.Uniform(0),new h.Uniform(new h.Vector2),new h.Uniform(.1),new h.Uniform(1e3);class ls{constructor(e){this.materials={},this.render=()=>{(0,c.js)(this.materials,((e,t)=>{const{model:r,material:n}=t;n.update(r)}))},this.tools={type:"Reflector",getTextures:e=>ys(e),parseData:e=>{const{textures:t,normal:r,models:n,material:i}=e,o=vs(i,new us(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=>!ls.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=vs(e,ms()),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=cs.uniforms;return Object.keys(n).filter((e=>!ls.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.cb.render.add("Reflector-render",this.render),this.runScene.cb.model.add.add("",(({model:e})=>{var t;e.material&&"Reflector"===(null==(t=null==(t=e.material.userData)?void 0:t.tools)?void 0:t.type)&&(t=e.material,this.materials[t.userData.id]||(this.materials[t.userData.id]={model:e,material:t}))})),this.runScene.cb.model.remove.add("",(({model:e})=>{var t;e.material&&"Reflector"===(null==(t=null==(t=e.material.userData)?void 0:t.tools)?void 0:t.type)&&(t=e.material,delete this.materials[t.userData.id])}))}bindData(e){const t=e.material;var r=(0,l.getId)();t.userData.id=r,this.materials[r]=e}create(e){const t=new us(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={}}}ls.TextureNames=["map","normalMap","roughnessMap","metalnessMap","tDiffuse","tDiffuseBlur"];class us extends h.MeshStandardMaterial{constructor(e,t,r){e?super(e):(super(),this.opacity=cs.uniforms.opacity.value,this.transparent=cs.uniforms.transparent.value,this.roughness=cs.uniforms.roughness.value,this.metalness=cs.uniforms.metalness.value),this.runScene=r,t?(this.resolution=t.resolution,this.blurSize=t.blurSize,this.mirror=new h.Uniform(t.mirror),this.mixBlur=new h.Uniform(t.mixBlur),this.mixStrength=new h.Uniform(t.mixStrength),this.mixContrast=new h.Uniform(t.mixContrast)):(this.resolution=cs.uniforms.resolution.value,this.blurSize=cs.uniforms.blurSize.value,this.mirror=new h.Uniform(cs.uniforms.mirror.value),this.mixBlur=new h.Uniform(cs.uniforms.mixBlur.value),this.mixStrength=new h.Uniform(cs.uniforms.mixStrength.value),this.mixContrast=new h.Uniform(cs.uniforms.mixContrast.value)),this.textureMatrix=new h.Uniform(new h.Matrix4),this.reflectorWorldPosition=new h.Vector3,this.cameraWorldPosition=new h.Vector3,this.rotationMatrix=new h.Matrix4,this.normal=new h.Vector3,this.view=new h.Vector3,this.lookAtPosition=new h.Vector3,this.target=new h.Vector3,this.tempQuaternion=new h.Vector4,this.virtualCamera=new h.PerspectiveCamera,this.reflectorPlane=new h.Plane,this.clipPlane=new h.Vector4,e={minFilter:h.LinearFilter,magFilter:h.LinearFilter,type:h.HalfFloatType,encoding:this.runScene.assetsEx.get().renderer.outputEncoding},this.glRT1=new h.WebGLRenderTarget(this.resolution,this.resolution,e),this.glRT2=new h.WebGLRenderTarget(this.resolution,this.resolution,e),this.tDiffuse=new h.Uniform(this.glRT1.texture),this.tDiffuseBlur=new h.Uniform(this.glRT2.texture),this.hBlurPass=new os(as),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 os(ss),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=cs.vertexParas+""+e.vertexShader,e.vertexShader=e.vertexShader.replace("#include <project_vertex>",cs.vertexShader),e.fragmentShader=cs.fragmentParas+""+e.fragmentShader,e.fragmentShader=e.fragmentShader.replace("#include <emissivemap_fragment>",cs.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 cs={uniforms:{opacity:new h.Uniform(1),transparent:new h.Uniform(!1),roughness:new h.Uniform(1),metalness:new h.Uniform(.6),resolution:new h.Uniform(1024),blurSize:new h.Uniform(1024),mirror:new h.Uniform(0),mixBlur:new h.Uniform(10),mixStrength:new h.Uniform(2),mixContrast:new h.Uniform(1),depthTest:new h.Uniform(!0),depthWrite:new h.Uniform(!0)},vertexParas:"\n uniform mat4 textureMatrix;\n varying vec4 my_vUv;\n ",vertexShader:"\n #include <project_vertex>\n my_vUv = textureMatrix * vec4(position, 1.0);\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n ",fragmentParas:"\n uniform sampler2D tDiffuse;\n uniform sampler2D tDiffuseBlur;\n uniform sampler2D tDepth;\n uniform sampler2D distortionMap;\n uniform float distortion;\n uniform float mirror;\n uniform float mixBlur;\n uniform float mixStrength;\n uniform float mixContrast;\n uniform float minDepthThreshold;\n uniform float maxDepthThreshold;\n uniform float depthScale;\n uniform float depthToBlurRatioBias;\n varying vec4 my_vUv;\n ",fragmentShader:"\n #include <emissivemap_fragment>\n float distortionFactor = 0.0;\n #ifdef USE_DISTORTION\n distortionFactor = texture2D(distortionMap, vUv).r * distortion;\n #endif\n \n vec4 new_vUv = my_vUv;\n new_vUv.x += distortionFactor;\n new_vUv.y += distortionFactor;\n \n vec4 base = texture2DProj(tDiffuse, new_vUv);\n vec4 blur = texture2DProj(tDiffuseBlur, new_vUv);\n \n vec4 merge = base;\n \n #ifdef USE_NORMALMAP\n vec2 normal_uv = vec2(0.0);\n vec4 normalColor = texture2D(normalMap, vUv * normalScale);\n vec3 my_normal = normalize( vec3( normalColor.r * 2.0 - 1.0, normalColor.b, normalColor.g * 2.0 - 1.0 ) );\n vec3 coord = new_vUv.xyz / new_vUv.w;\n normal_uv = coord.xy + coord.z * my_normal.xz * 0.05;\n vec4 base_normal = texture2D(tDiffuse, normal_uv);\n vec4 blur_normal = texture2D(tDiffuseBlur, normal_uv);\n merge = base_normal;\n blur = blur_normal;\n #endif\n \n float blurFactor = 0.0;\n float depthFactor = 0.0001;\n \n #ifdef USE_DEPTH\n vec4 depth = texture2DProj(tDepth, new_vUv);\n depthFactor = smoothstep(minDepthThreshold, maxDepthThreshold, 1.0-(depth.r * depth.a));\n depthFactor *= depthScale;\n depthFactor = max(0.0001, min(1.0, depthFactor));\n #ifdef USE_BLUR\n blur = blur * min(1.0, depthFactor + depthToBlurRatioBias);\n merge = merge * min(1.0, depthFactor + 0.5);\n #else\n merge = merge * depthFactor;\n #endif\n #endif\n \n float reflectorRoughnessFactor = roughness;\n #ifdef USE_ROUGHNESSMAP\n vec4 reflectorTexelRoughness = texture2D( roughnessMap, vUv );\n reflectorRoughnessFactor *= reflectorTexelRoughness.g;\n #endif\n \n #ifdef USE_BLUR\n blurFactor = min(1.0, mixBlur * reflectorRoughnessFactor);\n merge = mix(merge, blur, blurFactor);\n #endif\n \n vec4 newMerge = vec4(0.0, 0.0, 0.0, 1.0);\n newMerge.r = (merge.r - 0.5) * mixContrast + 0.5;\n newMerge.g = (merge.g - 0.5) * mixContrast + 0.5;\n newMerge.b = (merge.b - 0.5) * mixContrast + 0.5;\n \n diffuseColor.rgb = diffuseColor.rgb * ((1.0 - min(1.0, mirror)) + newMerge.rgb * mixStrength);\n "},hs=class extends w{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.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.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)}},ps={depthTest:!0,depthWrite:!0,alphaTest:0,side:0,displacementScale:1,visible:!0,normalScale:{x:1,y:1},aoMapIntensity:1,lightMapIntensity:1,envMapIntensity:1},ds=["color","emissive","roughness","metalness","normalScale","aoMapIntensity","displacementScale","transparent","lightMapIntensity","envMapIntensity","opacity","alphaTest"];class fs{constructor(e){this.defMaterialMap={BaseMaterial:Ga,SpriteMaterial:Rs,FakeInterior:za,Reflector:ls,Fresnel:Va,Physical:Xa},this.defMaterial=ms(),this.addCb=e=>{this.runScene.cb.material.add.cb(e)},this.setParses=[],this.runScene=e,this.runScene.cb.unique.material.add.add("engine-material-add",(e=>{"SpriteMaterial"!==e.type&&this.addCb(e)})),this.defMaterialMap={BaseMaterial:Ga,SpriteMaterial:Rs,FakeInterior:new za(e),Reflector:new ls(e),Fresnel:new Va(e),Physical:new Xa(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 h.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 A(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&&F(e.newVal),new A(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 hs({target:e,runScene:this.runScene,info:"material",newVal:t,oldVal:e.material}).execute(),this.runScene.modelEx.select===e&&this.runScene.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.select=e,this.runScene.cb.setSelectMaterial.cb(e)}getDataByType(e,t){return this.defMaterialMap[e].tools.parseData(t)}dispose(){this.defMaterialMap.Reflector.dispose(),this.runScene.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,c.js)(ps,((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,c.js)(e,((e,r)=>{var n,i,o,a,s;void 0!==ps[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&&Ga.isDefval(e)}}const ms=()=>{const e=new h.MeshStandardMaterial;return e.userData.id=(0,l.getId)(),e},vs=(e,t)=>(ds.map((r=>{const n=e[r];"object"==typeof n&&(t[r]=n.clone()),t[r]=n})),t),gs=e=>{e.dispose();const t=ys(e);0!==t.length&&t.map((e=>{e=e.texture,E(e)}))},ys=e=>{var t=e.userData.textures||xs(e);return delete e.userData.textures,t},bs=e=>{var t;return(null==(t=null==(t=e.userData)?void 0:t.tools)?void 0:t.getTextures(e))||xs(e)},xs=e=>x.map((t=>({type:t,texture:e[t]}))).filter((e=>e.texture)),ws=e=>{const{material:t,type:r,texture:n}=e;"envMap"===r&&F(n),t[r]=n,t.needsUpdate=!0},As=e=>{e.vertexColors=!1,e.needsUpdate=!1},Ss=e=>null==e?void 0:e.isColor;class Bs{constructor(e){this.setSize=(e,t)=>{var{w:r,h:n}=this.getDomSize();this.runScene.setSize(e||r,t||n)},this.runScene=e,this.runScene.cb.resize.add("render-ex-resize",this.setSize)}create(e){let t=new h.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=h.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 Ms=(e,t)=>{t=(t||{}).removeDom,!(e.render=()=>{})!==t&&e.domElement.remove(),e.setAnimationLoop(null),e.dispose(),e.renderLists&&e.renderLists.dispose()};class Cs{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.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.cb.model.add.cb({model:t,parent:r,isClone:i}),this.cb(t,"add"),o.uniqueEx.material.addModel(t,t.material)}}class Ts extends Cs{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}}class Es{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,ka.multiArrToArr)(i(e)))}t.push(new Ts({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 h.Group;return e.children.filter((e=>!this.runScene.helperEx.isHelper(e)&&!this.runScene.lightEx.isLight(e))).map((e=>{const r=e.clone();Vs(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,this.runScene.cb.setScene.cb({scene:e,type:"any",val:null})}setBackground(e,t=!0){k(e)&&(e.userData.isBackgroud=!0);var r=this.get(),n=new hs({target:r,info:"background",newVal:e,oldVal:r.background,runScene:this.runScene,cb:e=>{}}).execute();return t&&this.runScene.undoEx.addUndo(n),this.runScene.cb.setScene.cb({scene:r,type:"background",val:r.background}),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=>{zs(e,{remove:!1}),this.runScene.cb.model.dispose.cb(e)})),Ms(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.cb.reset.cb(this.get())}dispose(){const{renderer:e,controls:t}=this.runScene.assetsEx.get();this.clean(),Ms(e),t.dispose(),this.runScene.bloom.glow.dispose(),h.Cache.clear()}render(){}create(){return new h.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=F(yield this.runScene.textureEx.parse(t))),null!=t&&t.isTexture&&(r=F(this.runScene.textureEx.clone(t))),this.setNormal({model:e,info:"environment",val:r}),this.runScene.cb.setScene.cb({scene:e,type:"environment",val:r}),r}))}setNormal(e,t=!0){var{model:e,info:r,val:n}=e;e=new hs({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 h.Fog(t)}):(this.oldFog=r.fog,this.setNormal({model:r,info:"fog",val:null})),this.runScene.cb.setScene.cb({scene:r,type:"fog",val:r.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(e,t){e=e||Number(prompt("请输入截图的宽"))||1920,t=t||Number(prompt("请输入截图的高"))||1080;var{w:r,h:n}=(this.runScene.helperEx.unfocus(),this.runScene.renderEx.getDomSize());const i=this.runScene.assetsEx.get().renderer.domElement,{renderer:o,scene:a,camera:s}=(i.width=e,i.height=t,this.runScene.renderEx.setSize(e,t),this.runScene.assetsEx.get());return o.render(a,s),e=i.toDataURL("image/png",1),t=(0,G.base64ToFile)(e,"screenShot.png"),i.width=r,i.height=n,this.runScene.renderEx.setSize(),o.render(a,s),t}static toJSON(e){const t=Object.assign({},e.userData.ex);return e.fog&&(t.fog=Ds(e.fog)),Ss(e.background)&&(t.backgroundColor=e.background.getHexString()),t}}const _s=(e,t,r)=>{e.userData[t]=r},Ds=e=>{const{color:t,far:r,near:n}=e;return{color:t.getHexString(),far:r,near:n}};class Rs{static create(){const e=new h.SpriteMaterial;return e.userData.tools=this.tools,e}}Rs.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,t.name=e.name,_s(e,"name",e.name),Qs(t,1===e.layers.mask?0:1)},toNormal:(e,t)=>{const r=Ns("Box");return r.userData.normal={type:"MySpriteMaterial"},r.material=e.material,Rs.modelTools.merge(e,r),r},parseData:(e,t)=>{const r=Ns("Sprite");var n=e.userData.layers;return Qs(r,n),Rs.modelTools.merge(e,r),r.material=e.material,r}},Rs.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=vs(r,Rs.create());var{depthWrite:e,depthTest:i}=r.userData.normal;return void 0!==e&&(n.depthWrite=e),void 0!==i&&(n.depthTest=i),t.map((e=>{var{type:e,texture:t}=e;n[e]=t})),n},toNormal:e=>{const t=vs(e,ms()),r=Object.assign(Object.assign({},t.userData),{normal:{type:Rs.tools.type},textures:Rs.tools.getTextures(e)});return e.depthWrite!==ps.depthWrite&&(r.normal.depthWrite=e.depthWrite),e.depthTest!==ps.depthTest&&(r.normal.depthTest=e.depthTest),t.userData=r,t},clone:function(e,t){return e}};class Ps extends Cs{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 Os=class extends w{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.cb.model.setParent.cb({model:this.target,parent:e})}undo(){this._execute(this.oldParent)}redo(){this._execute(this.newParent)}},Is=class extends w{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.cb.model.setSelect.cb(null),this.runScene.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 Fs{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.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,c.js)(this.map,((e,t)=>{t.material.dispose()})),this.map={}}}var Ls=a(1);class ks 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),Ls.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(Ls.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 Us{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,c.js)(this.map,((e,t)=>{t.texture.dispose()})),this.map={}}}class Gs{constructor(e){this.runScene=e,this.model=new ks(this),this.material=new Fs(this),this.texture=new Us(this)}getId(e){return e.userData.id}dispose(){this.material.dispose(),this.model.dispose(),this.texture.dispose()}}const js=e=>{if(e.userData)return e.userData.id;throw TypeError("该目标不包含userData")};class Hs{constructor(e){this._selectModel=void 0,this.defNodeMap={castShadow:!1,receiveShadow:!1,renderOrder:0,visible:!0},this.add=(()=>{const e=(e,t)=>{t?(this.runScene.uniqueEx.model.add(e,{hasReset:!0}),this.runScene.cb.model.clone.cb(e)):this.runScene.uniqueEx.model.add(e)};return(t,r,n)=>{var{addUndo:i,isClone:o,select:a}=Bn({addUndo:!0,isClone:!1,select:!0},n);if(t instanceof Array)return t.map((e=>this.add(e,r,n)));e(t,o);var s=new Ps({model:t,parent:r||this.runScene.sceneEx.get(),isClone:o,runScene:this.runScene}).execute();!0===i&&this.runScene.undoEx.addUndo(s),a&&this.setSelectByModel(t,{isDomTreeActive:!1,isClone:o})}})(),this.deepIsVisible=e=>"Scene"===e.type||!!e.visible&&!!e.parent&&this.deepIsVisible(e.parent),this.runScene=e,this.clone=(e=>(t,r=!0)=>{if(e.lightEx.isLight(t))return e.lightEx.clone(t);var n,i,o=Ws(t),a=(e=>{const t={};return Eo(e,"id",(e=>{0<e.animations.length&&(t[js(e)]=e.animations)})),t})(t),s=(o=o?function(e){var t=new Map,r=new Map,n=e.clone();return function e(t,r,n){n(t,r);for(var i=0;i<t.children.length;i++)e(t.children[i],r.children[i],n)}(e,n,(function(e,n){t.set(n,e),r.set(e,n)})),n.traverse((function(e){var n,i;e.isSkinnedMesh&&(i=(n=t.get(e)).skeleton.bones,e.skeleton=n.skeleton.clone(),e.bindMatrix.copy(n.bindMatrix),e.skeleton.bones=i.map((function(e){return r.get(e)})),e.bind(e.skeleton,e.bindMatrix))})),n}(t):t.clone(),_s(s=o,"cloneId",(l=t).userData.id),Eo(o,"id"));l=o,null!=(n=null==(i=null==t?void 0:t.material)?void 0:i.userData)&&n.tools&&(n=null==(n=i.userData.tools)?void 0:n.clone(i,l))&&n.uuid!==i.uuid&&(e.materialEx.resetMaterial(l,n,!0),e.materialEx.add(n,t,i));{var l={newModel:o,newModelMap:s,animaMap:a};const{animaMap:e,newModelMap:t}=l;(0,c.js)(e,((e,r)=>{const n=t[e];n&&(n.animations=[...r.map((e=>e.clone()))])}))}return r&&e.uniqueEx.model.add(o,{reset:!0}),o})(e)}get select(){return this._selectModel}set select(e){this.setSelectByModel(e)}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))&&(this.runScene.multipSelector.add([...r,e],!0),!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.cb.model.unFocus.cb(this._selectModel)}e&&(e.isCamera||(this.runScene.helperEx.focus(e),this.runScene.lightEx.setSelect(e)),this.runScene.cb.model.focus.cb({model:e,status:!0,domActive:!t}),this.runScene.materialEx.setSelect(e.material),this.runScene.cb.model.setSelect.cb(e),this._selectModel=e)}}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 Ts({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&&!Vs(e)}create(){return La().model.getModelByType("Box")}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.cb.model.unFocus.cb(e),this.runScene.materialEx.setSelect(null),this.runScene.lightEx.setNull(e)),this._selectModel=void 0,this.runScene.cb.model.setSelect.cb(null),this.runScene.helperEx.unfocus()}cloneV3(e){return e.clone()}setParent(e,t,r=!0){if(t=new Os({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 hs({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 hs({target:e,info:"material",runScene:this.runScene,oldVal:e.material,newVal:t}).execute();this.select===e&&this.runScene.cb.setSelectMaterial.cb(t),e.material.needsUpdate=!0,r&&this.runScene.undoEx.addUndo(n)}addDef(e){this.add(Ns(e))}isModel(e){return!(e.isLight||e.isCamera)}getSphere(){var e=new h.MeshBasicMaterial,t=new h.SphereGeometry(.7,150,150);return new h.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 h.Group,i=[];i.push(new Ps({model:n,runScene:this.runScene,parent:r||this.runScene.assetsEx.get().scene}).execute()),e instanceof Array?i.push(...e.map((e=>new Os({target:e,oldParent:e.parent,newParent:n,runScene:this.runScene}).execute()))):i.push(new Os({target:e,oldParent:e.parent,newParent:n,runScene:this.runScene}).execute()),r&&this.runScene.cb.model.setOpen.cb({isOpen:!0,model:r}),this.runScene.cb.model.setOpen.cb({isOpen:!0,model:n}),this.runScene.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,ka.multiArrToArr)(e.map((e=>(this.runScene.cb.model.unFocus.cb(e),this.cleanGroup(e,!1)))).filter((e=>e)));return this.runScene.undoEx.addUndo(t),t}if(this.runScene.cb.model.unFocus.cb(e),0!==e.children.length){const r=[],n=e.children.map((e=>{if(e.parent.parent)return new Os({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 Ts({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===La().model.deepFindParentByUuid(n,t)&&n.uuid!==e.uuid&&i.push(n):n.uuid!==e.uuid&&i.push(n)}))}));var o=i.map((e=>new hs({target:e,info:"visible",newVal:!1,runScene:this.runScene,oldVal:e.visible}).execute()));this.runScene.undoEx.addUndo(o),La().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 hs({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 Ts({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 h.Vector3;return e.getWorldPosition(t),t}getClickObj(e,t,r=!1){let n=new h.Raycaster,i=new h.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=>La().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 ln(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.cb.model.setLayers.cb({model:e,val:t})}beforeLoad(e){return e instanceof Array?e.map((e=>this.beforeLoad(e))):e}focus(e){const{scene:t,camera:r,renderer:n,controls:i}=this.runScene.assetsEx.get(),o=new h.Vector3,a=new h.Vector3;if("Mesh"===e.type||"Group"===e.type||"Object3D"===e.type){const e=this.runScene.helperEx.boxHelper;if(e.update(),!e||!e.object)return;var s=n.domElement.getBoundingClientRect();let t=s.width/s.height;const i=new h.Vector3;s=e.geometry.attributes.position.array,i.set(Math.abs(s[0]-s[3]),Math.abs(s[1]-s[7]),Math.abs(s[2]-s[14])),a.x=.5*(s[0]+s[3]),a.y=.5*(s[1]+s[7]),a.z=.5*(s[2]+s[14]);let l=new h.Vector3;l.subVectors(r.position,a),l.projectOnPlane(new h.Vector3(0,1,0)),l.normalize(),1<t&&(t=1/t),s=2*Math.tan(.5*r.fov*Math.PI/180),s=i.length()/t/s,o.addVectors(a,l.multiplyScalar(s))}else{t.updateMatrixWorld(!0),s=new h.Vector3,e.getWorldPosition(s),a.set(s.x,s.y,s.z);let n=new h.Vector3;n.subVectors(r.position,a),n.projectOnPlane(new h.Vector3(0,1,0)),n.normalize(),o.addVectors(a,n.multiplyScalar(3))}ln({positionX:r.position.x,positionY:r.position.y,positionZ:r.position.z,targetX:i.target.x,targetY:i.target.y,targetZ:i.target.z},{positionX:o.x,positionY:o.y,positionZ:o.z,targetX:a.x,targetY:a.y,targetZ:a.z},.5,(e=>{r.position.set(e.positionX,e.positionY,e.positionZ),r.lookAt(e.targetX,e.targetY,e.targetZ),i.target.set(e.targetX,e.targetY,e.targetZ),i.update()}))}}const Ns=e=>{if(Ua.includes(e)){const t=La().model.getModelByType(e);return"Sprite"===t.type&&(t.material.userData.tools=Rs.tools),t}throw TypeError("")},zs=(e,t)=>{t=(t||{}).remove;const{geomerty:r,material:n}=e;r&&(null!=r&&r.dispose(),delete e.geometry),n&&(gs(e.material),e.material.dispose(),delete e.material),!1!==t&&e.parent&&e.parent.remove(e)},Js=(e,t)=>{var{material:r,geometry:n}=e;const i=new y.InstancedMesh(n,r,t.length+1);return[e,...t].map(((e,t)=>{i.setMatrixAt(t,e.matrix)})),i},Vs=e=>0!==e.animations.length,Ks=e=>{e&&e.userData&&(e.userData.isHelper=!0)},Qs=(e,t)=>{null!=t&&(0===t?e.layers.set(0):e.layers.enable(1),_s(e,"layers",t))},Xs=e=>{const t=[];e.traverse((e=>{t.push(e)}))},Ws=e=>{let t=!1;return e.traverse((e=>{e.isSkinnedMesh&&(t=!0)})),t};class Ys{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,c.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,c.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,c.js)(r,((r,n)=>{if(r=this.materialIns[r]){const{material:i,models:o}=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,c.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}),ws({material:r,type:e,texture:t})))}))},this.lazyLoad=(()=>{const e=()=>{this.loadConfig.triggerCb&&this.runScene.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}),ws({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,this.loadConfig=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.parser=t}))}processTexture(e){const{textureDef:t,texture:r}=e;var{md5:e,format:n,size:i,uvScript:o}=t;r.userData.md5=e,n&&(r.format=n,r.userData.format=n),o&&(r.userData.uvScript=o),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;As(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 Zs{constructor(e,t){this.runScene=e,this.loadConfig=t}done(e){var t,r,n;e.asset.ex&&(({camera:e,lights:t,options:r,controls:n}=e.asset.ex),this.camera(e),this.controls(n),this.lights(t),this.options(r))}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)}))}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 qs{constructor(e,t){this.runScene=e,this.loadConfig=t}setTextureLoader(e){this.textureLoader=e,this.initTextureLoader(e)}initTextureLoader(e){e instanceof ko&&e.setOptions({reverseTexture:this.loadConfig.reverseTexture,textureQuality:this.runScene.optionsEx.options.texture.quality})}}class $s{constructor(e,t){this.helperModels=[],this.pending=[],this.nodeType={MySpriteMaterial:Rs},this.cloneMap={},this.runScene=e,this.loadConfig=t,this.material=new Ys(e,t),this.scene=new Zs(e,t),this.options=new qs(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,c.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&&(r.animations=al.parse(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.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,c.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=Js(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=F(i))}i&&(t.background=new h.Color("#"+i)),o&&(({color:r,far:e,near:n}=o),i=new h.Fog("#"+r,n,e),t.fog=i,t.fog.open="true",this.runScene.cb.setScene.cb({scene:t,type:"fog",val:i})),this.runScene.cb.setScene.cb({scene:t,type:"any",val:"any"})}removeHelperModel(){this.helperModels.map((e=>{var t;return null==(t=e.parent)?void 0:t.remove(e)}))}}function el(e){return(el="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 tl=function(){var e=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),t=new Uint8Array([32,0,65,253,3,1,2,34,4,106,6,5,11,8,7,20,13,33,12,16,128,9,116,64,19,113,127,15,10,21,22,14,255,66,24,54,136,107,18,23,192,26,114,118,132,17,77,101,130,144,27,87,131,44,45,74,156,154,70,167]);if("object"!==("undefined"==typeof WebAssembly?"undefined":el(WebAssembly)))return{supported:!1};var r,n="B9h9z9tFBBBF8fL9gBB9gLaaaaaFa9gEaaaB9gFaFa9gEaaaFaEMcBFFFGGGEIIILF9wFFFLEFBFKNFaFCx/IFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBF8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBGy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBEn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBIi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBKI9z9iqlBOc+x8ycGBM/qQFTa8jUUUUBCU/EBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAGTkUUUBRNCUoBAG9uC/wgBZHKCUGAKCUG9JyRVAECFJRICBRcGXEXAcAF9PQFAVAFAclAcAVJAF9JyRMGXGXAG9FQBAMCbJHKC9wZRSAKCIrCEJCGrRQANCUGJRfCBRbAIRTEXGXAOATlAQ9PQBCBRISEMATAQJRIGXAS9FQBCBRtCBREEXGXAOAIlCi9PQBCBRISLMANCU/CBJAEJRKGXGXGXGXGXATAECKrJ2BBAtCKZrCEZfIBFGEBMAKhB83EBAKCNJhB83EBSEMAKAI2BIAI2BBHmCKrHYAYCE6HYy86BBAKCFJAICIJAYJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCGJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCEJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCIJAYAmJHY2BBAI2BFHmCKrHPAPCE6HPy86BBAKCLJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCKJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCOJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCNJAYAmJHY2BBAI2BGHmCKrHPAPCE6HPy86BBAKCVJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCcJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCMJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCSJAYAmJHm2BBAI2BEHICKrHYAYCE6HYy86BBAKCQJAmAYJHm2BBAICIrCEZHYAYCE6HYy86BBAKCfJAmAYJHm2BBAICGrCEZHYAYCE6HYy86BBAKCbJAmAYJHK2BBAICEZHIAICE6HIy86BBAKAIJRISGMAKAI2BNAI2BBHmCIrHYAYCb6HYy86BBAKCFJAICNJAYJHY2BBAmCbZHmAmCb6Hmy86BBAKCGJAYAmJHm2BBAI2BFHYCIrHPAPCb6HPy86BBAKCEJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCIJAmAYJHm2BBAI2BGHYCIrHPAPCb6HPy86BBAKCLJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCKJAmAYJHm2BBAI2BEHYCIrHPAPCb6HPy86BBAKCOJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCNJAmAYJHm2BBAI2BIHYCIrHPAPCb6HPy86BBAKCVJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCcJAmAYJHm2BBAI2BLHYCIrHPAPCb6HPy86BBAKCMJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCSJAmAYJHm2BBAI2BKHYCIrHPAPCb6HPy86BBAKCQJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCfJAmAYJHm2BBAI2BOHICIrHYAYCb6HYy86BBAKCbJAmAYJHK2BBAICbZHIAICb6HIy86BBAKAIJRISFMAKAI8pBB83BBAKCNJAICNJ8pBB83BBAICTJRIMAtCGJRtAECTJHEAS9JQBMMGXAIQBCBRISEMGXAM9FQBANAbJ2BBRtCBRKAfREEXAEANCU/CBJAKJ2BBHTCFrCBATCFZl9zAtJHt86BBAEAGJREAKCFJHKAM9HQBMMAfCFJRfAIRTAbCFJHbAG9HQBMMABAcAG9sJANCUGJAMAG9sTkUUUBpANANCUGJAMCaJAG9sJAGTkUUUBpMAMCBAIyAcJRcAIQBMC9+RKSFMCBC99AOAIlAGCAAGCA9Ly6yRKMALCU/EBJ8kUUUUBAKM+OmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUFT+JUUUBpALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM+lLKFaF99GaG99FaG99GXGXAGCI9HQBAF9FQFEXGXGX9DBBB8/9DBBB+/ABCGJHG1BB+yAB1BBHE+yHI+L+TABCFJHL1BBHK+yHO+L+THN9DBBBB9gHVyAN9DBB/+hANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE86BBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG86BBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG86BBABCIJRBAFCaJHFQBSGMMAF9FQBEXGXGX9DBBB8/9DBBB+/ABCIJHG8uFB+yAB8uFBHE+yHI+L+TABCGJHL8uFBHK+yHO+L+THN9DBBBB9gHVyAN9DB/+g6ANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE87FBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG87FBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG87FBABCNJRBAFCaJHFQBMMM/SEIEaE99EaF99GXAF9FQBCBREABRIEXGXGX9D/zI818/AICKJ8uFBHLCEq+y+VHKAI8uFB+y+UHO9DB/+g6+U9DBBB8/9DBBB+/AO9DBBBB9gy+SHN+L9DBBB9P9d9FQBAN+oRVSFMCUUUU94RVMAICIJ8uFBRcAICGJ8uFBRMABALCFJCEZAEqCFWJAV87FBGXGXAKAM+y+UHN9DB/+g6+U9DBBB8/9DBBB+/AN9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRMSFMCUUUU94RMMABALCGJCEZAEqCFWJAM87FBGXGXAKAc+y+UHK9DB/+g6+U9DBBB8/9DBBB+/AK9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRcSFMCUUUU94RcMABALCaJCEZAEqCFWJAc87FBGXGX9DBBU8/AOAO+U+TANAN+U+TAKAK+U+THO9DBBBBAO9DBBBB9gy+R9DB/+g6+U9DBBB8/+SHO+L9DBBB9P9d9FQBAO+oRcSFMCUUUU94RcMABALCEZAEqCFWJAc87FBAICNJRIAECIJREAFCaJHFQBMMM9JBGXAGCGrAF9sHF9FQBEXABAB8oGBHGCNWCN91+yAGCi91CnWCUUU/8EJ+++U84GBABCIJRBAFCaJHFQBMMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEM/lFFFaGXGXAFABqCEZ9FQBABRESFMGXGXAGCT9PQBABRESFMABREEXAEAF8oGBjGBAECIJAFCIJ8oGBjGBAECNJAFCNJ8oGBjGBAECSJAFCSJ8oGBjGBAECTJREAFCTJRFAGC9wJHGCb9LQBMMAGCI9JQBEXAEAF8oGBjGBAFCIJRFAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF2BB86BBAECFJREAFCFJRFAGCaJHGQBMMABMoFFGaGXGXABCEZ9FQBABRESFMAFCgFZC+BwsN9sRIGXGXAGCT9PQBABRESFMABREEXAEAIjGBAECSJAIjGBAECNJAIjGBAECIJAIjGBAECTJREAGC9wJHGCb9LQBMMAGCI9JQBEXAEAIjGBAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF86BBAECFJREAGCaJHGQBMMABMMMFBCUNMIT9kBB";function i(e,t,n,i,o,a){var s=r.exports.sbrk,l=n+3&-4,u=s(l*i),c=s(o.length),h=new Uint8Array(r.exports.memory.buffer);if(0==(h.set(o,c),e=e(u,n,i,c,o.length))&&a&&a(u,l,i),t.set(h.subarray(u,u+n*i)),s(u-s(0)),0!=e)throw new Error("Malformed buffer data: "+e)}WebAssembly.validate(e)&&(n="B9h9z9tFBBBFiI9gBB9gLaaaaaFa9gEaaaB9gFaFaEMcBBFBFFGGGEILF9wFFFLEFBFKNFaFCx/aFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBG8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBIy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBKi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBOn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBNI9z9iqlBVc+N9IcIBTEM9+FLa8jUUUUBCTlRBCBRFEXCBRGCBREEXABCNJAGJAECUaAFAGrCFZHIy86BBAEAIJREAGCFJHGCN9HQBMAFCx+YUUBJAE86BBAFCEWCxkUUBJAB8pEN83EBAFCFJHFCUG9HQBMMk8lLbaE97F9+FaL978jUUUUBCU/KBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAG/8cBBCUoBAG9uC/wgBZHKCUGAKCUG9JyRNAECFJRKCBRVGXEXAVAF9PQFANAFAVlAVANJAF9JyRcGXGXAG9FQBAcCbJHIC9wZHMCE9sRSAMCFWRQAICIrCEJCGrRfCBRbEXAKRTCBRtGXEXGXAOATlAf9PQBCBRKSLMALCU/CBJAtAM9sJRmATAfJRKCBREGXAMCoB9JQBAOAKlC/gB9JQBCBRIEXAmAIJREGXGXGXGXGXATAICKrJ2BBHYCEZfIBFGEBMAECBDtDMIBSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAEAKDBBBDMIBAKCTJRKMGXGXGXGXGXAYCGrCEZfIBFGEBMAECBDtDMITSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAEAKDBBBDMITAKCTJRKMGXGXGXGXGXAYCIrCEZfIBFGEBMAECBDtDMIASEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAEAKDBBBDMIAAKCTJRKMGXGXGXGXGXAYCKrfIBFGEBMAECBDtDMI8wSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCIJAeDeBJAYCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCNJAeDeBJAYCx+YUUBJ2BBJRKSFMAEAKDBBBDMI8wAKCTJRKMAICoBJREAICUFJAM9LQFAERIAOAKlC/fB9LQBMMGXAEAM9PQBAECErRIEXGXAOAKlCi9PQBCBRKSOMAmAEJRYGXGXGXGXGXATAECKrJ2BBAICKZrCEZfIBFGEBMAYCBDtDMIBSEMAYAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAYAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAYAKDBBBDMIBAKCTJRKMAICGJRIAECTJHEAM9JQBMMGXAK9FQBAKRTAtCFJHtCI6QGSFMMCBRKSEMGXAM9FQBALCUGJAbJREALAbJDBGBReCBRYEXAEALCU/CBJAYJHIDBIBHdCFD9tAdCFDbHPD9OD9hD9RHdAIAMJDBIBH8ZCFD9tA8ZAPD9OD9hD9RH8ZDQBTFtGmEYIPLdKeOnHpAIAQJDBIBHyCFD9tAyAPD9OD9hD9RHyAIASJDBIBH8cCFD9tA8cAPD9OD9hD9RH8cDQBTFtGmEYIPLdKeOnH8dDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGEAeD9uHeDyBjGBAEAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJHIAeApA8dDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHeDyBjGBAIAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJHIAeAdA8ZDQNiV8ZcpMyS8cQ8df8eb8fHdAyA8cDQNiV8ZcpMyS8cQ8df8eb8fH8ZDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGED9uHeDyBjGBAIAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJHIAeAdA8ZDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHeDyBjGBAIAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJREAYCTJHYAM9JQBMMAbCIJHbAG9JQBMMABAVAG9sJALCUGJAcAG9s/8cBBALALCUGJAcCaJAG9sJAG/8cBBMAcCBAKyAVJRVAKQBMC9+RKSFMCBC99AOAKlAGCAAGCA9Ly6yRKMALCU/KBJ8kUUUUBAKMNBT+BUUUBM+KmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUF/8MBALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM/dLEK97FaF97GXGXAGCI9HQBAF9FQFCBRGEXABABDBBBHECiD+rFCiD+sFD/6FHIAECND+rFCiD+sFD/6FAID/gFAECTD+rFCiD+sFD/6FHLD/gFD/kFD/lFHKCBDtD+2FHOAICUUUU94DtHND9OD9RD/kFHI9DBB/+hDYAIAID/mFAKAKD/mFALAOALAND9OD9RD/kFHIAID/mFD/kFD/kFD/jFD/nFHLD/mF9DBBX9LDYHOD/kFCgFDtD9OAECUUU94DtD9OD9QAIALD/mFAOD/kFCND+rFCU/+EDtD9OD9QAKALD/mFAOD/kFCTD+rFCUU/8ODtD9OD9QDMBBABCTJRBAGCIJHGAF9JQBSGMMAF9FQBCBRGEXABCTJHVAVDBBBHECBDtHOCUU98D8cFCUU98D8cEHND9OABDBBBHKAEDQILKOSQfbPden8c8d8e8fCggFDtD9OD/6FAKAEDQBFGENVcMTtmYi8ZpyHECTD+sFD/6FHID/gFAECTD+rFCTD+sFD/6FHLD/gFD/kFD/lFHE9DB/+g6DYALAEAOD+2FHOALCUUUU94DtHcD9OD9RD/kFHLALD/mFAEAED/mFAIAOAIAcD9OD9RD/kFHEAED/mFD/kFD/kFD/jFD/nFHID/mF9DBBX9LDYHOD/kFCTD+rFALAID/mFAOD/kFCggEDtD9OD9QHLAEAID/mFAOD/kFCaDbCBDnGCBDnECBDnKCBDnOCBDncCBDnMCBDnfCBDnbD9OHEDQNVi8ZcMpySQ8c8dfb8e8fD9QDMBBABAKAND9OALAEDQBFTtGEmYILPdKOenD9QDMBBABCAJRBAGCIJHGAF9JQBMMM/hEIGaF97FaL978jUUUUBCTlREGXAF9FQBCBRIEXAEABDBBBHLABCTJHKDBBBHODQILKOSQfbPden8c8d8e8fHNCTD+sFHVCID+rFDMIBAB9DBBU8/DY9D/zI818/DYAVCEDtD9QD/6FD/nFHVALAODQBFGENVcMTtmYi8ZpyHLCTD+rFCTD+sFD/6FD/mFHOAOD/mFAVALCTD+sFD/6FD/mFHcAcD/mFAVANCTD+rFCTD+sFD/6FD/mFHNAND/mFD/kFD/kFD/lFCBDtD+4FD/jF9DB/+g6DYHVD/mF9DBBX9LDYHLD/kFCggEDtHMD9OAcAVD/mFALD/kFCTD+rFD9QHcANAVD/mFALD/kFCTD+rFAOAVD/mFALD/kFAMD9OD9QHVDQBFTtGEmYILPdKOenHLD8dBAEDBIBDyB+t+J83EBABCNJALD8dFAEDBIBDyF+t+J83EBAKAcAVDQNVi8ZcMpySQ8c8dfb8e8fHVD8dBAEDBIBDyG+t+J83EBABCiJAVD8dFAEDBIBDyE+t+J83EBABCAJRBAICIJHIAF9JQBMMM9jFF97GXAGCGrAF9sHG9FQBCBRFEXABABDBBBHECND+rFCND+sFD/6FAECiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMBBABCTJRBAFCIJHFAG9JQBMMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEMMMFBCUNMIT9tBB",console.log("Warning: meshopt_decoder is using experimental SIMD support")),e=WebAssembly.instantiate(function(e){for(var r=new Uint8Array(e.length),n=0;n<e.length;++n){var i=e.charCodeAt(n);r[n]=96<i?i-71:64<i?i-65:47<i?i+4:46<i?63:62}var o=0;for(n=0;n<e.length;++n)r[o++]=r[n]<60?t[r[n]]:64*(r[n]-60)+r[++n];return r.buffer.slice(0,o)}(n),{}).then((function(e){(r=e.instance).exports.__wasm_call_ctors()}));var o={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},a={0:"meshopt_decodeVertexBuffer",1:"meshopt_decodeIndexBuffer",2:"meshopt_decodeIndexSequence",ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};return{ready:e,supported:!0,decodeVertexBuffer:function(e,t,n,a,s){i(r.exports.meshopt_decodeVertexBuffer,e,t,n,a,r.exports[o[s]])},decodeIndexBuffer:function(e,t,n,o){i(r.exports.meshopt_decodeIndexBuffer,e,t,n,o)},decodeIndexSequence:function(e,t,n,o){i(r.exports.meshopt_decodeIndexSequence,e,t,n,o)},decodeGltfBuffer:function(e,t,n,s,l,u){i(r.exports[a[l]],e,t,n,s,r.exports[o[u]])}}}();class rl{constructor(e){this.dracoPath="./draco/",this._gltf=new qo,this.runScene=e;const t=new g;t.setDecoderPath(this.runScene.optionsEx.options.decodePath),this._gltf.setMeshoptDecoder(tl),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 Sn(e);return r?this.parse(r,t):Promise.resolve()}))}parse(e,t){const r=Bn({addToScene:!0,cleanJSON:!0,triggerCb:!1,reverseTexture:!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 $s(this.runScene,r),runScene:this.runScene,loadConfig:r})}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){const n=e.helper.done(t),{addToScene:i,cleanJSON:o,triggerCb:a}=r;var s=e.models;this.runScene.cb.load.modelLoaded.cb(s);let l=[];var u=(t.asset.ex||{}).type;return"material"===u?this.parseMaterial(s):("model"===u?l=this.parseModel(s[0]):(l=this.parseScene({model:s[0],json:t,config:r}),this.runScene.optionsEx.sceneOptions.loaded=!0),i&&this.runScene.modelEx.add(l,void 0,{addUndo:!1,select:!1,isClone:"model"===(null==(u=t.asset.ex)?void 0:u.type)}),this.runScene.modelEx.selectNull(),e.helper.mergeClone(),this.runScene.optionsEx.log(t,"detail"),n.then((()=>a&&this.runScene.cb.load.complete.cb("")))),o&&this.disposeJSON(t),l}parseMaterial(e){var t,[e]=e;if(e=this.runScene.sceneEx.cleanUnlessLevel(e).material)return this.runScene.materialEx.add(e),({select:t}=this.runScene.modelEx),t&&this.runScene.materialEx.resetMaterial(t,e),e}parseModel(e){return[e="glb_model"===e.name&&(null==e?void 0:e.children[0])||e]}parseScene(e){var t;const{model:r,json:n,config:i}=e;e=i.triggerCb;var o=r.children.filter((e=>this.runScene.modelEx.isUnless(e)?void 0:e));if(1===o.length){const[e]=o;e.animations=[...e.animations,...n.animations]}return this.runScene.timeLineEx.parseSavedGroupMap((null==(t=n.asset.ex)?void 0:t.timeLine)||{}),e&&this.runScene.cb.load.loaded.cb(""),o}disposeJSON(e){}}class nl{constructor(e){this._objectLoader=new h.ObjectLoader,this.runScene=e,this._parser=new il(e)}load(){}parse(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*(){var t=yield this._objectLoader.parseAsync(JSON.parse(e));return this._parser.afterParse(this.runScene.sceneEx.cleanUnlessLevel(t))}))}}class il{constructor(e){this.runScene=e}parseModel(e){e.material&&this.parseMaterial(e)}parseMaterial(e){var t=e.material;"SpriteMaterial"===t.type&&_s(t,"tools",Rs.tools),this.runScene.uniqueEx.material.add(e.material)}afterParse(e){return e instanceof Array?e.map((e=>{e.traverse((e=>{this.parseModel(e)}))})):e.traverse((e=>{this.parseModel(e)})),e}}class ol{constructor(e){this.imgBitMap=new h.ImageBitmapLoader,this.object=new h.ObjectLoader,this.runScene=e,this.gltf=new rl(e),this.json=new nl(e)}}const al=new class{constructor(){this.load=new h.AnimationLoader}parse(e){return this.load.parse(e)}};class sl extends p{constructor(e){super(e),this.map={},this.clock=new h.Clock,this.tickIndex=void 0,this.playings=new Set,this.updates={},e.cb.model.add.add("anima-parse",(({model:e})=>{this.parses(e)}))}parses(e){e.traverse((e=>this.parse(e)))}findId(e,t){for(const r of e.animations)if(r.name===t)return r.id}parse(e,t){if(0!==e.animations.length||t){const i=e.animations.length?e.animations:al.parse(t),o=new h.AnimationMixer(e);for(const t of i){var r=(0,l.getId)(),n=(t.id=r,o.clipAction(t));const i={finished:()=>{},loop:()=>{}};o.addEventListener("finished",(()=>i.finished())),o.addEventListener("loop",(()=>i.loop())),this.map[r]={mixer:o,action:n,model:e,time:0,runState:"close",clip:t,eventMap:i}}i.map((t=>{e.animations.find((e=>e.uuid===t.uuid))||e.animations.push(t)}))}}play(e,t,r){e=this.findId(e,t);const n=this.map[e];if(n&&!this.playings.has(n)){t=Bn({onLoop:()=>{},onProgress:()=>{},onFinished:()=>{},onClose:()=>{},onPause:()=>{},onResume:()=>{},onBeforeEnd:()=>{},loop:!1,lastFrame:!0,reset:!0},r);const{onProgress:i,onBeforeEnd:o,onLoop:a,onFinished:s,lastFrame:l,loop:u,reset:c}=t,{action:h,clip:p,eventMap:d}=(this.map[e].options=t,n);h.stop(),r=c?0:n.time,h.time=r,this.setPlayState(n,!0),c&&h.reset(),h.play();let f=!(n.runState="play");this.setUpdates(e,(()=>{var e=Rn(h.time,p.duration,!0);99<=e&&!f&&(o(),f=!0),i(e)})),u?(h.loop=y.LoopRepeat,d.loop=a):(l&&(h.clampWhenFinished=!0),h.loop=y.LoopOnce,d.finished=()=>{this.setPlayState(n,!1),i(100),s()})}}pause(e,t){e=this.findId(e,t);const r=this.map[e];r&&this.playings.has(r)&&(this.updateTime(r),this.setPlayState(r,!1),r.options.onPause(),r.runState="pause")}resume(e,t){var r=this.findId(e,t);const n=this.map[r];n&&this.playings.has(n)&&(n.options.onResume(),this.play(e,t,null==(r=this.map[t])?void 0:r.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,c.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.id],0===this.playings.size&&this.closeAnima())}getItem(e,t){return e=this.findId(e,t),this.map[e]}close(e,t,r){e=this.findId(e,t);const n=this.map[e];n&&this.playings.has(n)&&n.options&&((t=Bn({resetAction:!0},r).resetAction)&&n.action.reset(),this.setPlayState(n,!1),this.updateTime(n,0),n.options.onClose(),n.options=null,n.runState="pause")}setUpdates(e,t){this.updates[e]=t}fadeTo(e){var{lastModel:e,lastName:t,nextModel:r,nextName:n,duration:i}=e;e=this.findId(e,t);const o=this.map[e];o&&(t=this.findId(r,n),(e=this.map[t])&&o.action.crossFadeTo(e.action,i,!0))}resetTime(e,t){const r=this.getItem(e,t);r&&(r.action.time=0)}}class ll{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 ho;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 Xi;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)}setRender2(e){e?this.render2=this.initRender2():this.render2&&(this.disposeRender(this.render2),this.render2=null)}setRender3(e){e?this.render3=this.initRender3():this.render3&&(this.disposeRender(this.render3),this.render3=null)}init(e){var t=this.runScene.sceneEx.create(),r=this.runScene.cameraEx.create(),n=this.runScene.renderEx.create(e),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(),console.log(o,a,"render2,render3"),this.setRender2(o),this.setRender3(a),{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 ul={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}"},cl={shaderID:"luminosityHighPass",uniforms:{tDiffuse:{value:null},luminosityThreshold:{value:1},smoothWidth:{value:1},defaultColor:{value:new h.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 hl(e){return(hl="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 pl(e,t){return(pl=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function dl(e){return(dl=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var fl=function(){var e=n,t=qa;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&&pl(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=dl(e);if(r=t?(r=dl(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===hl(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 h.Vector2(e.x,e.y):new h.Vector2(256,256),a.clearColor=new h.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 h.WebGLRenderTarget(s,l),a.renderTargetBright.texture.name="UnrealBloomPass.bright",a.renderTargetBright.texture.generateMipmaps=!1;for(var u=0;u<a.nMips;u++){var c;((c=new h.WebGLRenderTarget(s,l)).texture.name="UnrealBloomPass.h"+u,c.texture.generateMipmaps=!1,a.renderTargetsHorizontal.push(c),c=new h.WebGLRenderTarget(s,l)).texture.name="UnrealBloomPass.v"+u,c.texture.generateMipmaps=!1,a.renderTargetsVertical.push(c),s=Math.round(s/2),l=Math.round(l/2)}i=cl;for(var p=(a.highPassUniforms=h.UniformsUtils.clone(i.uniforms),a.highPassUniforms.luminosityThreshold.value=o,a.highPassUniforms.smoothWidth.value=.01,a.materialHighPassFilter=new h.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 h.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 h.Vector3(1,1,1),new h.Vector3(1,1,1),new h.Vector3(1,1,1),new h.Vector3(1,1,1),new h.Vector3(1,1,1)],a.compositeMaterial.uniforms.bloomTintColors.value=a.bloomTintColors,e=ul,a.copyUniforms=h.UniformsUtils.clone(e.uniforms),a.copyUniforms.opacity.value=1,a.materialCopy=new h.ShaderMaterial({uniforms:a.copyUniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader,blending:h.AdditiveBlending,depthTest:!1,depthWrite:!1,transparent:!0}),a.enabled=!0,a.needsSwap=!1,a._oldClearColor=new h.Color,a.oldClearAlpha=1,a.basic=new h.MeshBasicMaterial,a.fsQuad=new ts(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 h.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 h.ShaderMaterial({defines:{KERNEL_RADIUS:e,SIGMA:e},uniforms:{colorTexture:{value:null},texSize:{value:new h.Vector2(.5,.5)},direction:{value:new h.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 h.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 ml(e){return(ml="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 vl(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function gl(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 yl(e,t,r){t&&gl(e.prototype,t),r&&gl(e,r),Object.defineProperty(e,"prototype",{writable:!1})}function bl(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&&xl(e,t)}function xl(e,t){return(xl=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function wl(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=Al(e);if(r=t?(r=Al(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===ml(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 Al(e){return(Al=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}fl.BlurDirectionX=new h.Vector2(1,0),fl.BlurDirectionY=new h.Vector2(0,1);var Sl=function(){bl(t,qa);var e=wl(t);function t(r,n){var i;return vl(this,t),(i=e.call(this)).scene=r,i.camera=n,i.clear=!0,i.needsSwap=!1,i.inverse=!1,i}return yl(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}(),Bl=function(){bl(t,qa);var e=wl(t);function t(){var r;return vl(this,t),(r=e.call(this)).needsSwap=!1,r}return yl(t,[{key:"render",value:function(e){e.state.buffers.stencil.setLocked(!1),e.state.buffers.stencil.setTest(!1)}}]),t}();function Ml(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 Cl=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 h.Vector2),this._pixelRatio=t.getPixelRatio(),this._width=n.width,this._height=n.height,(r=new h.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===os&&console.error("THREE.EffectComposer relies on ShaderPass"),this.copyPass=new os(ul),this.clock=new h.Clock}return function(e,t,r){t&&Ml(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!==Sl&&(s instanceof Sl?r=!0:s instanceof Bl&&(r=!1)))}this.renderer.setRenderTarget(t)}},{key:"reset",value:function(e){var t;void 0===e&&(t=this.renderer.getSize(new h.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 Tl(e){return(Tl="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 El(e,t){return(El=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _l(e){return(_l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}new h.OrthographicCamera(-1,1,1,-1,0,1),(o=new h.BufferGeometry).setAttribute("position",new h.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3)),o.setAttribute("uv",new h.Float32BufferAttribute([0,2,0,0,2,0],2));var Dl=function(){var e=n,t=qa;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&&El(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=_l(e);if(r=t?(r=_l(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Tl(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 h.Color,e=ul,a.copyUniforms=h.UniformsUtils.clone(e.uniforms),a.copyMaterial=new h.ShaderMaterial({uniforms:a.copyUniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader,transparent:!0,blending:h.AdditiveBlending,depthTest:!1,depthWrite:!1}),a.fsQuad=new ts(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 h.WebGLRenderTarget(r.width,r.height),this.sampleRenderTarget.texture.name="SSAARenderPass.sample");var n=Rl[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}(),Rl=[[[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 Pl(e){return(Pl="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 Ol(){return(Ol="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=Fl(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 Il(e,t){return(Il=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Fl(e){return(Fl=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Ll=function(){var e=n,t=Dl;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&&Il(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=Fl(e);if(r=t?(r=Fl(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Pl(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 Ol(Fl(n.prototype),"render",this).call(this,e,t,r,i),void(this.accumulateIndex=-1);var o=kl[5],a=(void 0===this.sampleRenderTarget&&(this.sampleRenderTarget=new h.WebGLRenderTarget(r.width,r.height,this.params),this.sampleRenderTarget.texture.name="TAARenderPass.sample"),void 0===this.holdRenderTarget&&(this.holdRenderTarget=new h.WebGLRenderTarget(r.width,r.height,this.params),this.holdRenderTarget.texture.name="TAARenderPass.hold"),-1===this.accumulateIndex&&(Ol(Fl(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}(),kl=[[[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 Ul extends qa{constructor(e,t,r){super(),this.baseTextureID=void 0!==t?t:"tDiffuse",this.effectTextureID=void 0!==r?r:"tDiffuse",e instanceof h.ShaderMaterial?(this.uniforms=e.uniforms,this.material=e):e&&(this.uniforms=h.UniformsUtils.clone(e.uniforms),this.material=new h.ShaderMaterial({defines:Object.assign({},e.defines),uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),this.fsQuad=new ts(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 Gl extends qa{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 h.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 jl={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 Hl{constructor(e){this.modelLength=new Set,this.runScene=e,this.init()}init(){const{setLayers:e,add:t,remove:r}=this.runScene.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.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.cb.bloom.glow.setStatus.cb(!1),this.runScene.bloom.glow.bloomParams.isBloom=!1)}}class Nl{constructor(e){this.bloomParams={isBloom:!1,bloomStrength:2,bloomThreshold:0,bloomRadius:0},this.runScene=e,this.info=new Hl(this.runScene),this.BLOOM_SCENE=1,this.bloomParams.isBloom=!1,this.isUpdate=!0,this.sceneFogColor=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)}}),this.runScene.cb.setScene.add("glow",(({type:e,val:t})=>{"fog"===e&&t&&(this.sceneFogColor=new h.Color(0),this.sceneFogColor.copy(t.color)),"background"===e&&(this.sceneBackground&&k(this.sceneBackground)&&this.sceneBackground.dispose(),this.sceneBackground=t,this.bloomRenderPass&&(this.bloomRenderPass.sceneBg=this.sceneBackground))}))}static getInstance(e){return Nl.instance||(Nl.instance=new Nl(e)),Nl.instance}set rendererTone(e){this.renderer&&(this.renderer.toneMapping=e?h.ACESFilmicToneMapping:h.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 h.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.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))}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 h.WebGLRenderTarget(this.rtSize.width,this.rtSize.height),this.effectRT.texture.name="EffectComposer.pass",this.effectRT.texture.type=h.FloatType,this.effectRT.texture.format=h.RGBAFormat,this.effectRT.texture.encoding=h.sRGBEncoding,this.effectRT.texture.minFilter=h.LinearFilter,this.effectRT.texture.magFilter=h.LinearFilter),this.effectRT.depthTexture=new h.DepthTexture(this.rtSize.width,this.rtSize.height),this.effectRT.depthTexture.format=h.DepthFormat,this.effectRT.depthTexture.type=h.UnsignedIntType,this.taaRenderPass?(this.taaRenderPass.scene=this.mainScene,this.taaRenderPass.camera=this.mainCamera):(this.taaRenderPass=new Ll(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 h.WebGLRenderTarget(this.rtSize.width,this.rtSize.height),this.sampleRT.texture.name="TAARenderPass.sample",this.sampleRT.texture.type=h.FloatType,this.sampleRT.texture.format=h.RGBAFormat,this.sampleRT.texture.encoding=h.sRGBEncoding,this.sampleRT.texture.minFilter=h.LinearFilter,this.sampleRT.texture.magFilter=h.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 h.WebGLRenderTarget(this.rtSize.width,this.rtSize.height),this.holdRT.texture.name="TAARenderPass.hold",this.holdRT.texture.type=h.FloatType,this.holdRT.texture.format=h.RGBAFormat,this.holdRT.texture.encoding=h.sRGBEncoding,this.holdRT.texture.minFilter=h.LinearFilter,this.holdRT.texture.magFilter=h.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 Gl(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 fl(new h.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 Ul(jl,"baseTexture","bloomTexture"),this.mixingPass.renderToScreen=!1),this.effectCopy||(this.effectCopy=new os(ul),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 Cl(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.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}}class zl{constructor(){this.cbs=[]}cb(e){return Promise.all(this.cbs.map((t=>{var r;return null==(r=t.fn)?void 0:r.call(t,e)})))}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)}delete(e){e=(this.get(e)||{}).index,this.cbs.splice(e,1)}}class Jl{constructor(){this.resize=new zl,this.setSelectMaterial=new zl,this.setScene=new zl,this.reset=new zl,this.render=new zl,this.baseLog=new zl,this.inited=new zl,this.texture={add:new zl,remove:new zl,setAnima:new zl},this.model={setSelect:new zl,click:new zl,add:new zl,remove:new zl,multipDrop:new zl,focus:new zl,unFocus:new zl,changeName:new zl,setOpen:new zl,setMainStatue:new zl,setVisible:new zl,setParent:new zl,setLayers:new zl,clone:new zl,dispose:new zl},this.material={add:new zl,dispose:new zl,setName:new zl},this.unique={material:{add:new zl}},this.undo={addUndos:new zl,removeUndos:new zl,undoByIndex:new zl,reset:new zl},this.scene={save:new zl,saveNet:new zl},this.timeLine={setProgress:new zl,playGroup:new zl,setGroupMap:new zl,reset:new zl,closeGroup:new zl},this.events={key:{g:new zl},mouse:{move:new zl,down:new zl,up:new zl},pointer:{down:new zl,up:new zl}},this.bloom={glow:{setData:new zl,setStatus:new zl}},this.load={lazyLoadedTexture:new zl,loaded:new zl,modelLoaded:new zl,progress:new zl,getArrayBuffer:new zl,complete:new zl}}}class Vl{constructor(e){this.runScene=e}create(){return new h.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 Kl(e){return(Kl="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 Ql(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&&Xl(e,t)}function Xl(e,t){return(Xl=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Wl(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Yl(e){return(Yl=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Zl={type:"change"},ql={type:"start"},$l={type:"end"},eu=function(){Ql(t,h.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=Yl(e);if(r=t?(r=Yl(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Kl(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return Wl(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 h.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:h.MOUSE.ROTATE,MIDDLE:h.MOUSE.DOLLY,RIGHT:h.MOUSE.PAN},i.touches={ONE:h.TOUCH.ROTATE,TWO:h.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(Zl),p.update(),f=d.NONE},i.update=(o=new h.Vector3,a=(new h.Quaternion).setFromUnitVectors(r.up,new h.Vector3(0,1,0)),s=a.clone().invert(),l=new h.Vector3,u=new h.Quaternion,c=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&&O(2*Math.PI/60/60*p.autoRotateSpeed),p.enableDamping?(v.theta+=g.theta*p.dampingFactor,v.phi+=g.phi*p.dampingFactor):(v.theta+=g.theta,v.phi+=g.phi),p.minAzimuthAngle),r=p.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),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*=y,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?(g.theta*=1-p.dampingFactor,g.phi*=1-p.dampingFactor,b.multiplyScalar(1-p.dampingFactor)):(g.set(0,0,0),b.set(0,0,0)),y=1,!(!(x||l.distanceToSquared(p.object.position)>m||8*(1-u.dot(p.object.quaternion))>m)||(p.dispatchEvent(Zl),l.copy(p.object.position),u.copy(p.object.quaternion),x=!1))}),i.dispose=function(){p.domElement.removeEventListener("contextmenu",ne),p.domElement.removeEventListener("pointerdown",Z),p.domElement.removeEventListener("pointercancel",ee),p.domElement.removeEventListener("wheel",te),p.domElement.removeEventListener("pointermove",q),p.domElement.removeEventListener("pointerup",$),null!==p._domElementKeyEvents&&p._domElementKeyEvents.removeEventListener("keydown",re)};var i,o,a,s,l,u,c,p=Wl(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 h.Spherical,g=new h.Spherical,y=1,b=new h.Vector3,x=!1,w=new h.Vector2,A=new h.Vector2,S=new h.Vector2,B=new h.Vector2,M=new h.Vector2,C=new h.Vector2,T=new h.Vector2,E=new h.Vector2,_=new h.Vector2,D=[],R={};function P(){return Math.pow(.95,p.zoomSpeed)}function O(e){g.theta-=e}function I(e){g.phi-=e}F=new h.Vector3;var F,L,k,U=function(e,t){F.setFromMatrixColumn(t,0),F.multiplyScalar(-e),b.add(F)},G=(L=new h.Vector3,function(e,t){!0===p.screenSpacePanning?L.setFromMatrixColumn(t,1):(L.setFromMatrixColumn(t,0),L.crossVectors(p.object.up,L)),L.multiplyScalar(e),b.add(L)}),j=(k=new h.Vector3,function(e,t){var r,n=p.domElement;p.object.isPerspectiveCamera?(r=p.object.position,k.copy(r).sub(p.target),r=k.length(),r*=Math.tan(p.object.fov/2*Math.PI/180),U(2*e*r/n.clientHeight,p.object.matrix),G(2*t*r/n.clientHeight,p.object.matrix)):p.object.isOrthographicCamera?(U(e*(p.object.right-p.object.left)/p.object.zoom/n.clientWidth,p.object.matrix),G(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 H(e){p.object.isPerspectiveCamera?y/=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 N(e){p.object.isPerspectiveCamera?y*=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 z(e){w.set(e.clientX,e.clientY)}function J(e){B.set(e.clientX,e.clientY)}function V(){var e,t;1===D.length?w.set(D[0].pageX,D[0].pageY):(e=.5*(D[0].pageX+D[1].pageX),t=.5*(D[0].pageY+D[1].pageY),w.set(e,t))}function K(){var e,t;1===D.length?B.set(D[0].pageX,D[0].pageY):(e=.5*(D[0].pageX+D[1].pageX),t=.5*(D[0].pageY+D[1].pageY),B.set(e,t))}function Q(){var e=D[0].pageX-D[1].pageX,t=D[0].pageY-D[1].pageY;e=Math.sqrt(e*e+t*t),T.set(0,e)}function X(e){1==D.length?A.set(e.pageX,e.pageY):(r=ae(e),t=.5*(e.pageX+r.x),e=.5*(e.pageY+r.y),A.set(t,e)),S.subVectors(A,w).multiplyScalar(p.rotateSpeed);var t,r=p.domElement;O(2*Math.PI*S.x/r.clientHeight),I(2*Math.PI*S.y/r.clientHeight),w.copy(A)}function W(e){var t,r;1===D.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)),C.subVectors(M,B).multiplyScalar(p.panSpeed),j(C.x,C.y),B.copy(M)}function Y(e){var t=ae(e),r=e.pageX-t.x;e=e.pageY-t.y,t=Math.sqrt(r*r+e*e),E.set(0,t),_.set(0,Math.pow(E.y/T.y,p.zoomSpeed)),H(_.y),T.copy(E)}function Z(e){if(!1!==p.enabled)if(0===D.length&&(p.domElement.setPointerCapture(e.pointerId),p.domElement.addEventListener("pointermove",q),p.domElement.addEventListener("pointerup",$)),D.push(e),"touch"===e.pointerType){switch(oe(e),D.length){case 1:switch(p.touches.ONE){case h.TOUCH.ROTATE:if(!1===p.enableRotate)return;V(),f=d.TOUCH_ROTATE;break;case h.TOUCH.PAN:if(!1===p.enablePan)return;K(),f=d.TOUCH_PAN;break;default:f=d.NONE}break;case 2:switch(p.touches.TWO){case h.TOUCH.DOLLY_PAN:if(!1===p.enableZoom&&!1===p.enablePan)return;p.enableZoom&&Q(),p.enablePan&&K(),f=d.TOUCH_DOLLY_PAN;break;case h.TOUCH.DOLLY_ROTATE:if(!1===p.enableZoom&&!1===p.enableRotate)return;p.enableZoom&&Q(),p.enableRotate&&V(),f=d.TOUCH_DOLLY_ROTATE;break;default:f=d.NONE}break;default:f=d.NONE}f!==d.NONE&&p.dispatchEvent(ql)}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 h.MOUSE.DOLLY:if(!1===p.enableZoom)return;!function(e){T.set(e.clientX,e.clientY)}(r),f=d.DOLLY;break;case h.MOUSE.ROTATE:if(r.ctrlKey||r.metaKey||r.shiftKey){if(!1===p.enablePan)return;J(r),f=d.PAN}else{if(!1===p.enableRotate)return;z(r),f=d.ROTATE}break;case h.MOUSE.PAN:if(r.ctrlKey||r.metaKey||r.shiftKey){if(!1===p.enableRotate)return;z(r),f=d.ROTATE}else{if(!1===p.enablePan)return;J(r),f=d.PAN}break;default:f=d.NONE}f!==d.NONE&&p.dispatchEvent(ql)}}function q(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;X(t),p.update();break;case d.TOUCH_PAN:if(!1===p.enablePan)return;W(t),p.update();break;case d.TOUCH_DOLLY_PAN:if(!1===p.enableZoom&&!1===p.enablePan)return;!function(e){p.enableZoom&&Y(e),p.enablePan&&W(e)}(t),p.update();break;case d.TOUCH_DOLLY_ROTATE:if(!1===p.enableZoom&&!1===p.enableRotate)return;!function(e){p.enableZoom&&Y(e),p.enableRotate&&X(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){A.set(e.clientX,e.clientY),S.subVectors(A,w).multiplyScalar(p.rotateSpeed),e=p.domElement,O(2*Math.PI*S.x/e.clientHeight),I(2*Math.PI*S.y/e.clientHeight),w.copy(A),p.update()}(r);break;case d.DOLLY:if(!1===p.enableZoom)return;!function(e){E.set(e.clientX,e.clientY),_.subVectors(E,T),0<_.y?H(P()):_.y<0&&N(P()),T.copy(E),p.update()}(r);break;case d.PAN:if(!1===p.enablePan)return;!function(e){M.set(e.clientX,e.clientY),C.subVectors(M,B).multiplyScalar(p.panSpeed),j(C.x,C.y),B.copy(M),p.update()}(r)}}}function $(e){ie(e),0===D.length&&(p.domElement.releasePointerCapture(e.pointerId),p.domElement.removeEventListener("pointermove",q),p.domElement.removeEventListener("pointerup",$)),p.dispatchEvent($l),f=d.NONE}function ee(e){ie(e)}function te(e){!1!==p.enabled&&!1!==p.enableZoom&&f===d.NONE&&(e.preventDefault(),p.dispatchEvent(ql),e.deltaY<0?N(P()):0<e.deltaY&&H(P()),p.update(),p.dispatchEvent($l))}function re(e){if(!1!==p.enabled&&!1!==p.enablePan){var t=!1;switch(e.code){case p.keys.UP:j(0,p.keyPanSpeed),t=!0;break;case p.keys.BOTTOM:j(0,-p.keyPanSpeed),t=!0;break;case p.keys.LEFT:j(p.keyPanSpeed,0),t=!0;break;case p.keys.RIGHT:j(-p.keyPanSpeed,0),t=!0}t&&(e.preventDefault(),p.update())}}function ne(e){!1!==p.enabled&&e.preventDefault()}function ie(e){delete R[e.pointerId];for(var t=0;t<D.length;t++)if(D[t].pointerId==e.pointerId)return void D.splice(t,1)}function oe(e){var t=R[e.pointerId];void 0===t&&(t=new h.Vector2,R[e.pointerId]=t),t.set(e.pageX,e.pageY)}function ae(e){return e=e.pointerId===D[0].pointerId?D[1]:D[0],R[e.pointerId]}return p.domElement.addEventListener("contextmenu",ne),p.domElement.addEventListener("pointerdown",Z),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 tu{create(e,t){return new eu(e,t)}static toJSON(e){return e.target}}class ru{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}}class nu{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.cb.scene.saveNet.cb("")})),d_exporter_Gltf:()=>{this.events.runScene.exporter.gltf.scene()},alt_selectDom:()=>{console.log("多选dom")},r_runScript:()=>{console.log("运行脚本")},d_copyModel:()=>{var e,t=this.events.runScene.modelEx.select;t&&(this.events.runScene.modelEx.selectNull(),(e=this.events.runScene.modelEx.clone(t,!1))&&this.events.runScene.modelEx.add(e,t.parent,{isClone:!0}))},g_createGroup:()=>{console.log("生成组")},meta_showMateriallLibrary:()=>{console.log("弹出材质库窗口")},f_focusModel:()=>{var e=this.events.runScene.modelEx.select;e&&this.events.runScene.modelEx.focus(e)},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,c.js)(this.eventsMap.down,((r,n)=>{n(t,e)})),t){case"s":this.ctrl&&(e.preventDefault(),this.allFn.s_saveScene());break;case"d":this.ctrl&&(e.preventDefault(),this.allFn.d_copyModel());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.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();var r=this.events.runScene.multipSelector.getSelectedList("value");this.events.runScene.sceneEx.remove(this.events.runScene.modelEx.select||r),r&&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,c.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 iu{constructor(e){this.downPosition={x:0,y:0},this.enableUp=!0,this.fnMap={global:{down:{},up:{}},local:{down:{},up:{}}},this.down=e=>{(0,c.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,c.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.cb.events.pointer.down.cb(e)})),window.addEventListener("pointerup",(e=>{this.events.runScene.cb.events.pointer.up.cb(e)}))}getTriggerModels(e){const t=new h.Raycaster,r=new h.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.runScene.cb.model.click.cb(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)}}var ou=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 au{constructor(e){this.materialMap={},this.textureMap={},this.modelType={Sprite:Rs};var{type:e,runScene:t,helper:r}=e;this.type=e,this.helper=r,this.runScene=t}parse(e){return ou(this,void 0,void 0,(function*(){const t=new h.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(k(t.background)||k(t.environment)){t.userData.ex={},this.runScene.bloom.glow.setUpdate(!1);const{background:r,environment:n}=t,i=(this.runScene.bloom.glow.setUpdate(!0),Ns("Box")),o=ms();i.material=o,e.add(i),e=(0,l.getId)(),t.userData.ex.materialId=e,o.userData.id=e,this.materialMap[e]={material:o},k(r)&&(r.userData.notCompress=!0,303===(o.map=r).mapping&&(t.userData.ex.backgroundMapping=303)),k(n)&&(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=e.material,t=t||this.runScene.optionsEx.exporterOptions.notMaterial?this.runScene.materialEx.defMaterial:this.runScene.materialEx.toNromal(e.material),e.material=t,this.materialMap[t.userData.id]={oldMaterial:r,material:t,normalMaterial:t,models:[e]},t)}}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){Vs(e)&&(n=e.animations.map((e=>e.toJSON())),_s(e,"animations",n));const r=this.modelType[e.type];if(!r)return e;var n=e.material;n=this.materialMap[null==(n=null==n?void 0:n.userData)?void 0:n.id].oldMaterial;const i=r.modelTools.toNormal(e,n);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,c.js)(this.materialMap,((e,t)=>ou(this,void 0,void 0,(function*(){var e=t.material,r=ys(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 ou(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=ms();r.material=n,e.add(r);for(const e of b){if(!t.length)return;var i=t.pop();if(!i)return;n[e]=this.textureMap[i].texture}t.length&&this.setMultipMaterial(e,t)}}class su{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))}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.uvScript=t.userData.uvScript,r.md5=t.userData.md5,r.id=t.userData.id,r.format=t.userData.format,L(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 lu(e){return(lu="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 uu(e,t){return(uu=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function cu(e){return(cu=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var hu=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&&uu(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=cu(e);if(r=t?(r=cu(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===lu(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 h.BufferGeometry,o=(i.setAttribute("position",new h.Float32BufferAttribute([1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],3)),i.computeBoundingSphere(),new h.LineBasicMaterial({fog:!1}));return((i=r.call(this,i,o)).light=e,i.color=t,i.type="RectAreaLightHelper",o=new h.BufferGeometry).setAttribute("position",new h.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 h.Mesh(o,new h.MeshBasicMaterial({side:h.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}(h.Line);class pu{constructor(e){this.runScene=e}}class du extends pu{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 y.Color("#"+o),t}}class fu extends pu{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 y.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 mu extends pu{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 y.Color("#"+o),t.groundColor=new y.Color("#"+a),t.position.set(s.x,s.y,s.z),t}}class vu extends pu{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 y.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 gu{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 y.Color("#"+o),t.position.set(a.x,a.y,a.z),t}}class yu{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:g,radius:y}=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:g.x,camera:{near:m},radius:y},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:g,radius:b}=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 y.Color("#"+n),t.position.set(d.x,d.y,d.z),t.shadow.mapSize.x=g,t.shadow.mapSize.y=g,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=b,t.shadow.camera.updateProjectionMatrix(),t}}const bu={DirectionalLight:fu,PointLight:vu,SpotLight:yu,RectAreaLight:gu,HemisphereLight:mu,AmbientLight:du};class xu{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 fu(e),PointLight:new vu(e),SpotLight:new yu(e),RectAreaLight:new gu(e),HemisphereLight:new mu(e),AmbientLight:new du(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}=Bn({isClone:!1,id:(0,l.getId)(),addUndo:!0,addToScene:!0},t);let o=new y[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 Ps(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 Ts({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 Ts({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 hu(t,16773120);break;case"DirectionalLight":if(n=new y.DirectionalLightHelper(t,1,16711680),t.children[0])t.target=t.children[0];else{let e=new y.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 y.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 y.PointLightHelper(t,1,16711935);break;case"SpotLight":n=new y.SpotLightHelper(t);let o=new y.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 y.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 y.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 hs({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,l.getId)()})}static toJSON(e){return e.map((e=>{var t=e.type;return bu[t].toJSON(e)}))}}class wu{constructor(e){this.helperModels=[];var{type:e,runScene:t}=e;this.runScene=t,this.type=e,this.material=new su({runScene:t,helper:this}),this.before=new au({helper:this,type:e,runScene:t})}init(e){return this.before.parse(e)}parseNode(e){const{object:t,nodeDef:r}=e;(0,c.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:xu.toJSON(this.runScene.lightEx.getLightsByScene()),camera:n.toJSON(),sceneEx:Es.toJSON(t),timeLine:this.runScene.timeLineEx.getSavedData(),controls:tu.toJSON(r),options:this.runScene.exporter.gltf.options.getOptions(t)})}}class Au{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 Su(){Su=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 g(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"==Mu(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 y(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function b(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(y,this),this.reset(!0)}function w(e){if(e){var t,i=e[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:A}}function A(){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(g.prototype),a(g.prototype,i,(function(){return this})),e.AsyncIterator=g,e.async=function(t,r,n,i,o){void 0===o&&(o=Promise);var a=new g(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 Bu(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 Mu(e){return(Mu="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 Cu(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Tu(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 Eu(e,t,r){t&&Tu(e.prototype,t),r&&Tu(e,r),Object.defineProperty(e,"prototype",{writable:!1})}var _u=function(){function e(){Cu(this,e),this.pluginCallbacks=[],this.register((function(e){return new Qu(e)})),this.register((function(e){return new Xu(e)})),this.register((function(e){return new Wu(e)})),this.register((function(e){return new Zu(e)})),this.register((function(e){return new qu(e)})),this.register((function(e){return new Yu(e)}))}return Eu(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"===Mu(r)&&(console.warn("THREE.GLTFExporter: parse() expects options as the fourth argument now."),n=r);for(var i=new Ku,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}(),Du=5121,Ru=5123,Pu=(o=9728,9729),Ou=9984,Iu=9985,Fu=9986,Lu=9987,ku=33071,Uu=33648,Gu=10497,ju={},Hu=(ju[h.NearestFilter]=o,ju[h.NearestMipmapNearestFilter]=Ou,ju[h.NearestMipmapLinearFilter]=Fu,ju[h.LinearFilter]=Pu,ju[h.LinearMipmapNearestFilter]=Iu,ju[h.LinearMipmapLinearFilter]=Lu,ju[h.ClampToEdgeWrapping]=ku,ju[h.RepeatWrapping]=Gu,ju[h.MirroredRepeatWrapping]=Uu,{scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"});function Nu(e,t){return e.length===t.length&&e.every((function(e,r){return e===t[r]}))}function zu(e){return 4*Math.ceil(e/4)}function Ju(e,t){var r=1<arguments.length&&void 0!==t?t:0,n=zu(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 Vu=null,Ku=function(){function e(){Cu(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 Eu(e,[{key:"setPlugins",value:function(e){this.plugins=e}},{key:"write",value:(t=Su().mark((function e(t,r,n){var i,o,a,s,l,u,c;return Su().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=Ju(u.result),t=new DataView(new ArrayBuffer(8)),n=(t.setUint32(0,e.byteLength,!0),t.setUint32(4,5130562,!0),Ju(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){Bu(o,n,i,a,s,"next",e)}function s(e){Bu(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 h.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 h.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 c=a.getImageData(0,0,e,i).data,p=1;p<c.length;p+=4)s.data[p]=c[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 h.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===Du?1:t===Ru?2:4,zu(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===Ru?l.setUint16(u,p,!0):t===Du&&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=Ju(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=Ru;else{if(e.array.constructor!==Uint8Array)throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type.");i=Du}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 c={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){c.bufferView=t,e()}))})));else if(s.embedImages){var p=Vu=Vu||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!==h.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){c.bufferView=t,e()}))}),u)}))):c.uri=p.toDataURL(u)}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:ju[e.magFilter],minFilter:ju[e.minFilter],wrapS:ju[e.wrapS],wrapT:ju[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=(Nu((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===h.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,c,p,d={},f={},m=[],v=[],g={uv:"TEXCOORD_0",uv2:"TEXCOORD_1",color:"COLOR_0",skinWeight:"WEIGHTS_0",skinIndex:"JOINTS_0"},y=s.getAttribute("normal"),b=(void 0===y||this.isNormalizedNormalAttribute(y)||(console.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."),s.setAttribute("normal",this.createNormalizedNormalAttribute(y))),null);for(c in s.attributes)"morph"!==c.slice(0,5)&&(u=s.attributes[c],c=g[c]||c.toUpperCase(),/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(c)||(c="_"+c),t.attributes.has(this.getUID(u))?f[c]=t.attributes.get(this.getUID(u)):(b=null,p=u.array,"JOINTS_0"!==c||p instanceof Uint16Array||p instanceof Uint8Array||(console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'),b=new h.BufferAttribute(new Uint16Array(p),u.itemSize,u.normalized)),null!==(p=this.processAccessor(b||u,s))&&(f[c]=p,t.attributes.set(this.getUID(u),p))));if(void 0!==y&&s.setAttribute("normal",y),0===Object.keys(f).length)return null;if(void 0!==e.morphTargetInfluences&&0<e.morphTargetInfluences.length){var x=[],w=[],A={};if(void 0!==e.morphTargetDictionary)for(var S in e.morphTargetDictionary)A[e.morphTargetDictionary[S]]=S;for(var B=0;B<e.morphTargetInfluences.length;++B){var M,C={},T=!1;for(M in s.morphAttributes)if("position"!==M&&"normal"!==M)T||(console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."),T=!0);else{var E=s.morphAttributes[M][B],_=M.toUpperCase(),D=s.attributes[M];if(t.attributes.has(this.getUID(E)))C[_]=t.attributes.get(this.getUID(E));else{var R=E.clone();if(!s.morphTargetsRelative)for(var P=0,O=E.count;P<O;P++)R.setXYZ(P,E.getX(P)-D.getX(P),E.getY(P)-D.getY(P),E.getZ(P)-D.getZ(P));C[_]=this.processAccessor(R,s),t.attributes.set(this.getUID(D),C[_])}}v.push(C),x.push(e.morphTargetInfluences[B]),void 0!==e.morphTargetDictionary&&w.push(A[B])}d.weights=x,0<w.length&&(d.extras={},d.extras.targetNames=w)}if((y=Array.isArray(e.material))&&0===s.groups.length)return null;for(var I=y?e.material:[e.material],F=y?s.groups:[{materialIndex:0,start:void 0,count:void 0}],L=0,k=F.length;L<k;L++){var U={mode:l,attributes:f},G=(this.serializeUserData(s,U),0<v.length&&(U.targets=v),null!==s.index&&(G=this.getUID(s.index),void 0===F[L].start&&void 0===F[L].count||(G+=":"+F[L].start+":"+F[L].count),t.attributes.has(G)?U.indices=t.attributes.get(G):(U.indices=this.processAccessor(s.index,s,F[L].start,F[L].count),t.attributes.set(G,U.indices)),null===U.indices&&delete U.indices),this.processMaterial(I[F[L].materialIndex]));null!==G&&(U.material=G),m.push(U)}return d.primitives=m,r.meshes||(r.meshes=[]),this._invokeAll((function(t){t.writeMesh&&t.writeMesh(e,d)})),y=r.meshes.push(d)-1,t.meshes.set(a,y),y}},{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:h.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=_u.Utils.mergeMorphTargetTracks(e.clone(),t)).tracks),o=[],a=[],s=0;s<i.length;++s){var l=i[s],u=h.PropertyBinding.parseTrackName(l.name),c=h.PropertyBinding.findNode(t,u.nodeName),p=Hu[u.propertyName];if(!(c="bones"===u.objectName?!0===c.isSkinnedMesh?c.skeleton.getBoneByName(u.objectIndex):void 0:c)||!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===Hu.morphTargetInfluences&&(u/=c.morphTargetInfluences.length));!0===l.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline?(d="CUBICSPLINE",u/=3):d=l.getInterpolation()===h.InterpolateDiscrete?"STEP":"LINEAR",a.push({input:this.processAccessor(new h.BufferAttribute(l.times,1)),output:this.processAccessor(new h.BufferAttribute(l.values,u)),interpolation:d}),o.push({sampler:a.length-1,target:{node:n.get(c),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 h.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 h.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(),Nu(r,[0,0,0,1])||(a.rotation=r),Nu(h,[0,0,0])||(a.translation=h),Nu(t,[1,1,1])||(a.scale=t)):(e.matrixAutoUpdate&&e.updateMatrix(),!1===Nu(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 h.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 h.Scene?this.processScene(e[o]):i.push(e[o]);1===i.length?(t=i[0],"model"===n.myOptions.helper.type&&((r=new h.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}(),Qu=function(){function e(t){Cu(this,e),this.writer=t,this.name="KHR_lights_punctual"}return Eu(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}(),Xu=function(){function e(t){Cu(this,e),this.writer=t,this.name="KHR_materials_unlit"}return Eu(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}(),Wu=function(){function e(t){Cu(this,e),this.writer=t,this.name="KHR_materials_pbrSpecularGlossiness"}return Eu(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}(),Yu=function(){function e(t){Cu(this,e),this.writer=t,this.name="KHR_materials_clearcoat"}return Eu(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}(),Zu=function(){function e(t){Cu(this,e),this.writer=t,this.name="KHR_materials_transmission"}return Eu(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}(),qu=function(){function e(t){Cu(this,e),this.writer=t,this.name="KHR_materials_volume"}return Eu(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}();function $u(){$u=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 g(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"==tc(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 y(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function b(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(y,this),this.reset(!0)}function w(e){if(e){var t,i=e[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:A}}function A(){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(g.prototype),a(g.prototype,i,(function(){return this})),e.AsyncIterator=g,e.async=function(t,r,n,i,o){void 0===o&&(o=Promise);var a=new g(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 ec(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 tc(e){return(tc="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 rc(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function nc(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 ic(e,t,r){t&&nc(e.prototype,t),r&&nc(e,r),Object.defineProperty(e,"prototype",{writable:!1})}_u.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=h.PropertyBinding.parseTrackName(a.name),l=h.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(h.InterpolateLinear)}var u=l.morphTargetInfluences.length,c=l.morphTargetDictionary[s.propertyIndex];if(void 0===c)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+c]=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+c]=m.evaluate(p.times[v]);for(var g=0;g<a.times.length;g++){var y=this.insertKeyframe(p,a.times[g]);p.values[y*u+c]=a.values[g]}}}}return e.tracks=r,e}};var oc=function(){function e(){rc(this,e),this.pluginCallbacks=[],this.register((function(e){return new vc(e)})),this.register((function(e){return new gc(e)})),this.register((function(e){return new yc(e)})),this.register((function(e){return new xc(e)})),this.register((function(e){return new wc(e)})),this.register((function(e){return new bc(e)}))}return ic(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"===tc(r)&&(console.warn("THREE.GLTFExporter: parse() expects options as the fourth argument now."),n=r);for(var i=new mc,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}(),ac=5121,sc=5123,lc=(o=9728,Ou=9729,Fu=9984,Pu=9985,Iu=9986,Lu=9987,ku=33071,Gu=33648,Uu=10497,{}),uc=(lc[h.NearestFilter]=o,lc[h.NearestMipmapNearestFilter]=Fu,lc[h.NearestMipmapLinearFilter]=Iu,lc[h.LinearFilter]=Ou,lc[h.LinearMipmapNearestFilter]=Pu,lc[h.LinearMipmapLinearFilter]=Lu,lc[h.ClampToEdgeWrapping]=ku,lc[h.RepeatWrapping]=Uu,lc[h.MirroredRepeatWrapping]=Gu,{scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"});function cc(e,t){return e.length===t.length&&e.every((function(e,r){return e===t[r]}))}function hc(e){return 4*Math.ceil(e/4)}function pc(e,t){var r=1<arguments.length&&void 0!==t?t:0,n=hc(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 dc=null;function fc(){return dc=dc||("undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"))}var mc=function(){function e(){rc(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 ic(e,[{key:"setPlugins",value:function(e){this.plugins=e}},{key:"write",value:(t=$u().mark((function e(t,r,n){var i,o,a,s,l;return $u().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:o=(a=this).buffers,i=a.json,n=a.options,a=a.extensionsUsed,o=new Blob(o,{type:"application/octet-stream"}),0<(a=Object.keys(a)).length&&(i.extensionsUsed=a),i.buffers&&0<i.buffers.length&&(i.buffers[0].byteLength=o.size),!0===n.binary?((s=new FileReader).readAsArrayBuffer(o),s.onloadend=function(){var e=pc(s.result),t=new DataView(new ArrayBuffer(8)),n=(t.setUint32(0,e.byteLength,!0),t.setUint32(4,5130562,!0),pc((n=JSON.stringify(i),(new TextEncoder).encode(n).buffer),32)),o=new DataView(new ArrayBuffer(8)),a=(o.setUint32(0,n.byteLength,!0),o.setUint32(4,1313821514,!0),new ArrayBuffer(12)),l=((u=new DataView(a)).setUint32(0,1179937895,!0),u.setUint32(4,2,!0),12+o.byteLength+n.byteLength+t.byteLength+e.byteLength),u=(u.setUint32(8,l,!0),new Blob([a,o,n,t,e],{type:"application/octet-stream"})),c=new FileReader;c.readAsArrayBuffer(u),c.onloadend=function(){r(c.result)}}):i.buffers&&0<i.buffers.length?((l=new FileReader).readAsDataURL(o),l.onloadend=function(){var e=l.result;i.buffers[0].uri=e,r(i)}):r(i);case 15: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){ec(o,n,i,a,s,"next",e)}function s(e){ec(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 h.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 h.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:"buildMetalRoughTexture",value:function(e,t){if(e===t)return e;console.warn("THREE.GLTFExporter: Merged metalnessMap and roughnessMap textures.");var r=null==e?void 0:e.image,n=null==t?void 0:t.image,i=Math.max((null==r?void 0:r.width)||0,(null==n?void 0:n.width)||0),o=Math.max((null==r?void 0:r.height)||0,(null==n?void 0:n.height)||0),a=fc(),s=(a.width=i,a.height=o,a.getContext("2d")),l=(s.fillStyle="#00ffff",s.fillRect(0,0,i,o),s.getImageData(0,0,i,o));if(r){s.drawImage(r,0,0,i,o);for(var u=s.getImageData(0,0,i,o).data,c=2;c<u.length;c+=4)l.data[c]=u[c]}if(n){s.drawImage(n,0,0,i,o);for(var p=s.getImageData(0,0,i,o).data,d=1;d<p.length;d+=4)l.data[d]=p[d]}return s.putImageData(l,0,0),(r=(e||t).clone()).source=new h.Source(a),r}},{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===ac?1:t===sc?2:4,hc(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===sc?l.setUint16(u,p,!0):t===ac&&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){var i=new FileReader;i.readAsArrayBuffer(e),i.onloadend=function(){var e=pc(i.result),o={buffer:t.processBuffer(e),byteOffset:t.byteOffset,byteLength:e.byteLength};t.byteOffset+=e.byteLength,n(r.bufferViews.push(o)-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=sc;else{if(e.array.constructor!==Uint8Array)throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type.");i=ac}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){var n=3<arguments.length&&void 0!==arguments[3]?arguments[3]:"image/png",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),n+":flipY/"+r.toString());if(void 0!==o[u])return o[u];a.images||(a.images=[]);var c={mimeType:n};if(s.embedImages){var p=fc(),d=(p.width=Math.min(e.width,s.maxTextureSize),p.height=Math.min(e.height,s.maxTextureSize),p.getContext("2d"));if(!0===r&&(d.translate(0,p.height),d.scale(1,-1)),void 0!==e.data){t!==h.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)}else d.drawImage(e,0,0,p.width,p.height);!0===s.binary?(r=void 0!==p.toBlob?new Promise((function(e){return p.toBlob(e,n)})):p.convertToBlob({type:n}),l.push(r.then((function(e){return i.processBufferViewImage(e).then((function(e){c.bufferView=e}))})))):c.uri=p.toDataURL(n)}else c.uri=e.src;return t=a.images.push(c)-1,o[u]=t}},{key:"processSampler",value:function(e){var t=this.json;return t.samplers||(t.samplers=[]),e={magFilter:lc[e.magFilter],minFilter:lc[e.minFilter],wrapS:lc[e.wrapS],wrapT:lc[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=("image/webp"===(i=e.userData.mimeType)&&(i="image/png"),{sampler:this.processSampler(e),source:this.processImage(e.image,e.format,e.flipY,i)}),i=(e.name&&(n.name=e.name),this._invokeAll((function(t){t.writeTexture&&t.writeTexture(e,n)})),r.textures.push(n)-1);return t.textures.set(e,i),i}},{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={pbrMetallicRoughness:{}},i=(!0!==e.isMeshStandardMaterial&&!0!==e.isMeshBasicMaterial&&console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results."),e.color.toArray().concat([e.opacity])),o=(cc(i,[1,1,1,1])||(n.pbrMetallicRoughness.baseColorFactor=i),e.isMeshStandardMaterial?(n.pbrMetallicRoughness.metallicFactor=e.metalness,n.pbrMetallicRoughness.roughnessFactor=e.roughness):(n.pbrMetallicRoughness.metallicFactor=.5,n.pbrMetallicRoughness.roughnessFactor=.5),(e.metalnessMap||e.roughnessMap)&&(i=this.buildMetalRoughTexture(e.metalnessMap,e.roughnessMap),o={index:this.processTexture(i)},this.applyTextureTransform(o,i),n.pbrMetallicRoughness.metallicRoughnessTexture=o),e.map&&(i={index:this.processTexture(e.map)},this.applyTextureTransform(i,e.map),n.pbrMetallicRoughness.baseColorTexture=i),e.emissive&&(o=e.emissive.clone().multiplyScalar(e.emissiveIntensity),1<(i=Math.max(o.r,o.g,o.b))&&(o.multiplyScalar(1/i),console.warn("THREE.GLTFExporter: Some emissive components exceed 1; emissive has been limited")),0<i&&(n.emissiveFactor=o.toArray()),e.emissiveMap&&(i={index:this.processTexture(e.emissiveMap)},this.applyTextureTransform(i,e.emissiveMap),n.emissiveTexture=i)),e.normalMap&&(o={index:this.processTexture(e.normalMap)},e.normalScale&&1!==e.normalScale.x&&(o.scale=e.normalScale.x),this.applyTextureTransform(o,e.normalMap),n.normalTexture=o),e.aoMap&&(i={index:this.processTexture(e.aoMap),texCoord:1},1!==e.aoMapIntensity&&(i.strength=e.aoMapIntensity),this.applyTextureTransform(i,e.aoMap),n.occlusionTexture=i),e.transparent?n.alphaMode="BLEND":0<e.alphaTest&&(n.alphaMode="MASK",n.alphaCutoff=e.alphaTest),e.side===h.DoubleSide&&(n.doubleSided=!0),""!==e.name&&(n.name=e.name),this.serializeUserData(e,n),this._invokeAll((function(t){t.writeMaterial&&t.writeMaterial(e,n)})),r.materials.push(n)-1);return 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,c,p,d={},f={},m=[],v=[],g={uv:"TEXCOORD_0",uv2:"TEXCOORD_1",color:"COLOR_0",skinWeight:"WEIGHTS_0",skinIndex:"JOINTS_0"},y=s.getAttribute("normal"),b=(void 0===y||this.isNormalizedNormalAttribute(y)||(console.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."),s.setAttribute("normal",this.createNormalizedNormalAttribute(y))),null);for(c in s.attributes)"morph"!==c.slice(0,5)&&(u=s.attributes[c],c=g[c]||c.toUpperCase(),/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(c)||(c="_"+c),t.attributes.has(this.getUID(u))?f[c]=t.attributes.get(this.getUID(u)):(b=null,p=u.array,"JOINTS_0"!==c||p instanceof Uint16Array||p instanceof Uint8Array||(console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'),b=new h.BufferAttribute(new Uint16Array(p),u.itemSize,u.normalized)),null!==(p=this.processAccessor(b||u,s))&&(f[c]=p,t.attributes.set(this.getUID(u),p))));if(void 0!==y&&s.setAttribute("normal",y),0===Object.keys(f).length)return null;if(void 0!==e.morphTargetInfluences&&0<e.morphTargetInfluences.length){var x=[],w=[],A={};if(void 0!==e.morphTargetDictionary)for(var S in e.morphTargetDictionary)A[e.morphTargetDictionary[S]]=S;for(var B=0;B<e.morphTargetInfluences.length;++B){var M,C={},T=!1;for(M in s.morphAttributes)if("position"!==M&&"normal"!==M)T||(console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."),T=!0);else{var E=s.morphAttributes[M][B],_=M.toUpperCase(),D=s.attributes[M];if(t.attributes.has(this.getUID(E)))C[_]=t.attributes.get(this.getUID(E));else{var R=E.clone();if(!s.morphTargetsRelative)for(var P=0,O=E.count;P<O;P++)R.setXYZ(P,E.getX(P)-D.getX(P),E.getY(P)-D.getY(P),E.getZ(P)-D.getZ(P));C[_]=this.processAccessor(R,s),t.attributes.set(this.getUID(D),C[_])}}v.push(C),x.push(e.morphTargetInfluences[B]),void 0!==e.morphTargetDictionary&&w.push(A[B])}d.weights=x,0<w.length&&(d.extras={},d.extras.targetNames=w)}if((y=Array.isArray(e.material))&&0===s.groups.length)return null;for(var I=y?e.material:[e.material],F=y?s.groups:[{materialIndex:0,start:void 0,count:void 0}],L=0,k=F.length;L<k;L++){var U={mode:l,attributes:f},G=(this.serializeUserData(s,U),0<v.length&&(U.targets=v),null!==s.index&&(G=this.getUID(s.index),void 0===F[L].start&&void 0===F[L].count||(G+=":"+F[L].start+":"+F[L].count),t.attributes.has(G)?U.indices=t.attributes.get(G):(U.indices=this.processAccessor(s.index,s,F[L].start,F[L].count),t.attributes.set(G,U.indices)),null===U.indices&&delete U.indices),this.processMaterial(I[F[L].materialIndex]));null!==G&&(U.material=G),m.push(U)}return d.primitives=m,r.meshes||(r.meshes=[]),this._invokeAll((function(t){t.writeMesh&&t.writeMesh(e,d)})),y=r.meshes.push(d)-1,t.meshes.set(a,y),y}},{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:h.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=oc.Utils.mergeMorphTargetTracks(e.clone(),t)).tracks),o=[],a=[],s=0;s<i.length;++s){var l=i[s],u=h.PropertyBinding.parseTrackName(l.name),c=h.PropertyBinding.findNode(t,u.nodeName),p=uc[u.propertyName];if(!(c="bones"===u.objectName?!0===c.isSkinnedMesh?c.skeleton.getBoneByName(u.objectIndex):void 0:c)||!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===uc.morphTargetInfluences&&(u/=c.morphTargetInfluences.length));!0===l.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline?(d="CUBICSPLINE",u/=3):d=l.getInterpolation()===h.InterpolateDiscrete?"STEP":"LINEAR",a.push({input:this.processAccessor(new h.BufferAttribute(l.times,1)),output:this.processAccessor(new h.BufferAttribute(l.values,u)),interpolation:d}),o.push({sampler:a.length-1,target:{node:n.get(c),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=t.nodes[r.get(e)],i=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 h.Matrix4,u=0;u<i.bones.length;++u)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 h.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.trs?(r=e.quaternion.toArray(),h=e.position.toArray(),t=e.scale.toArray(),cc(r,[0,0,0,1])||(a.rotation=r),cc(h,[0,0,0])||(a.translation=h),cc(t,[1,1,1])||(a.scale=t)):(e.matrixAutoUpdate&&e.updateMatrix(),!1===cc(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 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){var t=new h.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=this.options,r=(e=e instanceof Array?e:[e],this._invokeAll((function(t){t.beforeParse&&t.beforeParse(e)})),[]),n=0;n<e.length;n++)e[n]instanceof h.Scene?this.processScene(e[n]):r.push(e[n]);0<r.length&&this.processObjects(r);for(var i=0;i<this.skins.length;++i)this.processSkin(this.skins[i]);for(var o=0;o<t.animations.length;++o)this.processAnimation(t.animations[o],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}(),vc=function(){function e(t){rc(this,e),this.writer=t,this.name="KHR_lights_punctual"}return ic(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}(),gc=function(){function e(t){rc(this,e),this.writer=t,this.name="KHR_materials_unlit"}return ic(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}(),yc=function(){function e(t){rc(this,e),this.writer=t,this.name="KHR_materials_pbrSpecularGlossiness"}return ic(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}(),bc=function(){function e(t){rc(this,e),this.writer=t,this.name="KHR_materials_clearcoat"}return ic(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}(),xc=function(){function e(t){rc(this,e),this.writer=t,this.name="KHR_materials_transmission"}return ic(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}(),wc=function(){function e(t){rc(this,e),this.writer=t,this.name="KHR_materials_volume"}return ic(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}(),Ac=(oc.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=h.PropertyBinding.parseTrackName(a.name),l=h.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(h.InterpolateLinear)}var u=l.morphTargetInfluences.length,c=l.morphTargetDictionary[s.propertyIndex];if(void 0===c)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+c]=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+c]=m.evaluate(p.times[v]);for(var g=0;g<a.times.length;g++){var y=this.insertKeyframe(p,a.times[g]);p.values[y*u+c]=a.values[g]}}}}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 Sc extends p{constructor(){super(...arguments),this._gltf=new _u,this._originGltf=new oc,this.options=new Au}getArrayBuffer(e=this.runScene.sceneEx.getClear(),t="scene"){return Ac(this,void 0,void 0,(function*(){const r=new wu({type:t,runScene:this.runScene});return yield r.init(e),new Promise((t=>{this._gltf.parse(e,(e=>{t(e)}),{binary:!0,onlyVisible:!1,includeCustomExtensions:!0,myOptions:{helper:r,optionsEx:this.runScene.optionsEx}})}))}))}getOriginArrayBuffer(e){return Ac(this,void 0,void 0,(function*(){return new Promise((t=>{this._originGltf.parse(e,(e=>{t(e)}),(()=>{}),{binary:!0,onlyVisible:!1,includeCustomExtensions:!0,animations:[...e.animations]})}))}))}export(e){return Ac(this,void 0,void 0,(function*(){var t=yield this.getArrayBuffer(e);(0,G.downloadFile)(new Blob([t]),"scene.glb")}))}model(e){return Ac(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,G.downloadFile)(new Blob([n]),r+".glb"))}))}material(e){var t;return Ac(this,void 0,void 0,(function*(){if(r=e||(null==(t=this.runScene.modelEx.select)?void 0:t.material)){const e=Ns("Box");var r=(e.material=r).name||"material",n=yield this.getArrayBuffer(e,"material");(0,G.downloadFile)(new Blob([n]),r+".glb")}}))}scene(e=!0){return Ac(this,void 0,void 0,(function*(){var t=yield this.getArrayBuffer();return e&&(0,G.downloadFile)(new Blob([t]),"scene.glb"),t}))}originModel(e){return Ac(this,void 0,void 0,(function*(){var t,r;e&&(t=e.name||e.type,r=yield this.getOriginArrayBuffer(e),(0,G.downloadFile)(new Blob([r]),t+".glb"))}))}}class Bc extends p{constructor(e){super(e),this.gltf=new Sc(e)}}var Mc={},Cc=function(e){return URL.createObjectURL(new Blob([e],{type:"text/javascript"}))},Tc=function(e){return new Worker(e)};try{URL.revokeObjectURL(Cc(""))}catch(zl){Cc=function(e){return"data:application/javascript;charset=UTF-8,"+encodeURI(e)},Tc=function(e){return new Worker(e,{type:"module"})}}for(var Ec=Uint8Array,_c=Uint16Array,Dc=Uint32Array,Rc=new Ec([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]),Pc=new Ec([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]),Oc=new Ec([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Ic=(o=function(e,t){for(var r=new _c(31),n=0;n<31;++n)r[n]=t+=1<<e[n-1];var i=new Dc(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]},(Fu=o(Rc,2))[0]),Fc=Fu[1],Lc=(Ic[28]=258,Fc[258]=28,Iu=o(Pc,0))[0],kc=Iu[1],Uc=new _c(32768),Gc=0;Gc<32768;++Gc){var jc=(43690&Gc)>>>1|(21845&Gc)<<1;Uc[Gc]=((65280&(jc=(61680&(jc=(52428&jc)>>>2|(13107&jc)<<2))>>>4|(3855&jc)<<4))>>>8|(255&jc)<<8)>>>1}var Hc=function(e,t,r){for(var n=e.length,i=0,o=new _c(t);i<n;++i)++o[e[i]-1];var a=new _c(t);for(i=0;i<t;++i)a[i]=a[i-1]+o[i-1]<<1;if(r){var s=new _c(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[Uc[h]>>>l]=u}else for(s=new _c(n),i=0;i<n;++i)e[i]&&(s[i]=Uc[a[e[i]-1]++]>>>15-e[i]);return s},Nc=new Ec(288);for(Gc=0;Gc<144;++Gc)Nc[Gc]=8;for(Gc=144;Gc<256;++Gc)Nc[Gc]=9;for(Gc=256;Gc<280;++Gc)Nc[Gc]=7;for(Gc=280;Gc<288;++Gc)Nc[Gc]=8;var zc=new Ec(32);for(Gc=0;Gc<32;++Gc)zc[Gc]=5;function Jc(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 Vc(e,t,r,n,i){var o,a=wh(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 Kc(e,t){return Ph(e,t)+4294967296*Ph(e,t+4)}var Qc=Hc(Nc,9,0),Xc=Hc(Nc,9,1),Wc=Hc(zc,5,0),Yc=Hc(zc,5,1),Zc=function(e){for(var t=e[0],r=1;r<e.length;++r)e[r]>t&&(t=e[r]);return t},qc=function(e,t,r){var n=t/8|0;return(e[n]|e[1+n]<<8)>>(7&t)&r},$c=function(e,t){var r=t/8|0;return(e[r]|e[1+r]<<8|e[2+r]<<16)>>(7&t)},eh=function(e){return(e/8|0)+(7&e&&1)},th=function(e,t,r){(null==r||r>e.length)&&(r=e.length);var n=new(e instanceof _c?_c:e instanceof Dc?Dc:Ec)(r-(t=null==t||t<0?0:t));return n.set(e.subarray(t,r)),n},rh=function(e,t,r){var n=e.length;if(!n||r&&!r.l&&n<5)return t||new Ec(0);function i(e){var r=t.length;r<e&&((r=new Ec(Math.max(2*r,e))).set(t),t=r)}var o=!t||r,a=!r||r.i,s=(r=r||{},t=t||new Ec(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=qc(e,l,1);var m=qc(e,l+1,3);if(l+=3,!m){var v=e[(M=eh(l)+4)-4]|e[M-3]<<8;if(n<(A=M+v)){if(a)throw"unexpected EOF";break}o&&i(u+v),t.set(e.subarray(M,A),u),r.b=u+=v,r.p=l=8*A;continue}if(1==m)c=Xc,h=Yc,p=9,d=5;else{if(2!=m)throw"invalid block type";v=qc(e,l,31)+257;for(var g=qc(e,l+10,15)+4,y=v+qc(e,l+5,31)+1,b=(l+=14,new Ec(y)),x=new Ec(19),w=0;w<g;++w)x[Oc[w]]=qc(e,l+3*w,7);l+=3*g;var A,S=(1<<(A=Zc(x)))-1,B=Hc(x,A,1);for(w=0;w<y;){var M,C=B[qc(e,l,S)];if(l+=15&C,(M=C>>>4)<16)b[w++]=M;else{var T=0,E=0;for(16==M?(E=3+qc(e,l,3),l+=2,T=b[w-1]):17==M?(E=3+qc(e,l,7),l+=3):18==M&&(E=11+qc(e,l,127),l+=7);E--;)b[w++]=T}}m=b.subarray(0,v);var _=b.subarray(v);p=Zc(m),d=Zc(_),c=Hc(m,p,1),h=Hc(_,d,1)}if(f<l){if(a)throw"unexpected EOF";break}}o&&i(u+131072);for(var D=(1<<p)-1,R=(1<<d)-1,P=l;;P=l){var O=(T=c[$c(e,l)&D])>>>4;if(f<(l+=15&T)){if(a)throw"unexpected EOF";break}if(!T)throw"invalid length/literal";if(O<256)t[u++]=O;else{if(256==O){P=l,c=null;break}var I,F=O-254,L=(264<O&&(I=Rc[w=O-257],F=qc(e,l,(1<<I)-1)+Ic[w],l+=I),(O=h[$c(e,l)&R])>>>4);if(!O)throw"invalid distance";if(l+=15&O,_=Lc[L],3<L&&(I=Pc[L],_+=$c(e,l)&(1<<I)-1,l+=I),f<l){if(a)throw"unexpected EOF";break}o&&i(u+131072);for(var k=u+F;u<k;u+=4)t[u]=t[u-_],t[u+1]=t[u+1-_],t[u+2]=t[u+2-_],t[u+3]=t[u+3-_];u=k}}r.l=c,r.p=P,r.b=u,c&&(s=1,r.m=p,r.d=h,r.n=d)}while(!s);return u==t.length?t:th(t,0,u)},nh=function(e,t,r){var n=t/8|0;e[n]|=r<<=7&t,e[1+n]|=r>>>8},ih=function(e,t,r){var n=t/8|0;e[n]|=r<<=7&t,e[1+n]|=r>>>8,e[2+n]|=r>>>16},oh=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[ph,0];if(1==i)return(m=new Ec(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 _c(h+1),d=ah(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 g=o[n].s;if(!(p[g]>t))break;f+=v-(1<<d-p[g]),p[g]=t}for(f>>>=m;0<f;){var y=o[n].s;p[y]<t?f-=1<<t-p[y]++-1:++n}for(;0<=n&&f;--n){var b=o[n].s;p[b]==t&&(--p[b],++f)}d=t}return[new Ec(p),d]},ah=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},sh=function(e){for(var t=e.length;t&&!e[--t];);for(var r=new _c(++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]},lh=function(e,t){for(var r=0,n=0;n<t.length;++n)r+=e[n]*t[n];return r},uh=function(e,t,r){var n=r.length,i=eh(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)},ch=function(e,t,r,n,i,o,a,s,l,u,c){nh(t,c++,r),++i[256];for(var h=(r=oh(i,15))[0],p=(r=r[1],(d=oh(o,15))[0]),d=d[1],f=(m=sh(h))[0],m=m[1],v=(g=sh(p))[0],g=g[1],y=new _c(19),b=0;b<f.length;++b)y[31&f[b]]++;for(b=0;b<v.length;++b)y[31&v[b]]++;for(var x=(w=oh(y,7))[0],w=w[1],A=19;4<A&&!x[Oc[A-1]];--A);var S,B=u+5<<3,M=lh(i,Nc)+lh(o,zc)+a;if(i=lh(i,h)+lh(o,p)+a+14+3*A+lh(y,x)+(2*y[16]+3*y[17]+7*y[18]),B<=M&&B<=i)return uh(t,c,e.subarray(l,l+u));if(nh(t,c,1+(i<M)),c+=2,i<M){var C=Hc(h,r,0),T=h,E=Hc(p,d,0),_=p,D=Hc(x,w,0);for(nh(t,c,m-257),nh(t,c+5,g-1),nh(t,c+10,A-4),c+=14,b=0;b<A;++b)nh(t,c+3*b,x[Oc[b]]);c+=3*A;for(var R=[f,v],P=0;P<2;++P){var O=R[P];for(b=0;b<O.length;++b){var I=31&O[b];nh(t,c,D[I]),c+=x[I],15<I&&(nh(t,c,O[b]>>>5&127),c+=O[b]>>>12)}}}else C=Qc,T=Nc,E=Wc,_=zc;for(b=0;b<s;++b)255<n[b]?(I=n[b]>>>18&31,ih(t,c,C[I+257]),c+=T[I+257],7<I&&(nh(t,c,n[b]>>>23&31),c+=Rc[I]),S=31&n[b],ih(t,c,E[S]),c+=_[S],3<S&&(ih(t,c,n[b]>>>5&8191),c+=Pc[S])):(ih(t,c,C[n[b]]),c+=T[n[b]]);return ih(t,c,C[256]),c+T[256]},hh=new Dc([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),ph=new Ec(0),dh=function(e,t,r,n,i,o){var a=e.length,s=new Ec(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?uh(l,u,e.subarray(c,h)):(l[c]=o,uh(l,u,e.subarray(c,a)))}else{for(var p=(t=hh[t-1])>>>13,d=8191&t,f=(1<<r)-1,m=new _c(32768),v=new _c(1+f),g=Math.ceil(r/3),y=2*g,b=function(t){return(e[t]^e[t+1]<<g^e[t+2]<<y)&f},x=new Dc(25e3),w=new _c(288),A=new _c(32),S=0,B=0,M=(c=0,0),C=0,T=0;c<a;++c){var E=b(c),_=32767&c,D=v[E];if(m[_]=D,v[E]=_,C<=c){var R=a-c;if((7e3<S||24576<M)&&423<R){u=ch(e,l,0,x,w,A,B,M,T,c-T,u),M=S=B=0,T=c;for(var P=0;P<286;++P)w[P]=0;for(P=0;P<30;++P)A[P]=0}var O=2,I=0,F=d,L=_-D&32767;if(2<R&&E==b(c-L))for(var k=Math.min(p,R)-1,U=Math.min(32767,c),G=Math.min(258,R);L<=U&&--F&&_!=D;){if(e[c+O]==e[c+O-L]){for(var j=0;j<G&&e[c+j]==e[c+j-L];++j);if(O<j){if(I=L,k<(O=j))break;var H=Math.min(L,j-2),N=0;for(P=0;P<H;++P){var z=c-L+P+32768&32767,J=z-m[z]+32768&32767;N<J&&(N=J,D=z)}}}L+=(_=D)-(D=m[_])+32768&32767}I?(x[M++]=268435456|Fc[O]<<18|kc[I],E=31&Fc[O],R=31&kc[I],B+=Rc[E]+Pc[R],++w[257+E],++A[R],C=c+O,++S):(x[M++]=e[c],++w[e[c]])}}u=ch(e,l,o,x,w,A,B,M,T,c-T,u),!o&&7&u&&(u=uh(l,u+1,ph))}return th(s,0,n+eh(u)+i)},fh=function(){for(var e=new Dc(256),t=0;t<256;++t){for(var r=t,n=9;--n;)r=(1&r&&3988292384)^r>>>1;e[t]=r}return e}(),mh=function(){var e=-1;return{p:function(t){for(var r=e,n=0;n<t.length;++n)r=fh[255&r^t[n]]^r>>>8;e=r},d:function(){return~e}}},vh=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}}},gh=function(e,t,r,n,i){return dh(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)},yh=function(e,t){var r,n={};for(r in e)n[r]=e[r];for(r in t)n[r]=t[r];return n},bh=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]},xh=[],wh=function(e,t,r,n){var i;if(!xh[r]){for(var o="",a={},s=e.length-1,l=0;l<s;++l)o=(i=bh(e[l],o,a))[0],a=i[1];xh[r]=bh(e[s],o,a)}var u=yh({},xh[r][1]);return function(e,t,r,n,i){return(t=Tc(Mc[t]||(Mc[t]=Cc(e)))).onerror=function(e){return i(e.error,null)},t.onmessage=function(e){return i(null,e.data)},t.postMessage(r,n),t}(xh[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 Ec||e[t]instanceof _c||e[t]instanceof Dc)&&r.push((e[t]=new e[t].constructor(e[t])).buffer);return r}(u),n)},Ah=function(){return[Ec,_c,Dc,Rc,Pc,Oc,Ic,Lc,Xc,Yc,Uc,Hc,Zc,qc,$c,eh,th,rh,Xh,Eh,_h]},Sh=function(){return[Ec,_c,Dc,Rc,Pc,Oc,Fc,kc,Qc,Nc,Wc,zc,Uc,hh,ph,Hc,nh,ih,oh,ah,sh,lh,uh,ch,eh,th,dh,gh,Jh,Eh]},Bh=function(){return[Ih,kh,Oh,mh,fh]},Mh=function(){return[Fh,Lh]},Ch=function(){return[Uh,Oh,vh]},Th=function(){return[Gh]},Eh=function(e){return postMessage(e,[e.buffer])},_h=function(e){return e&&e.size&&new Ec(e.size)},Dh=function(e,t,r,n,i,o){var a=wh(r,n,i,(function(e,t){a.terminate(),o(e,t)}));return a.postMessage([e,t],t.consume?[e.buffer]:[]),function(){a.terminate()}},Rh=function(e,t){return e[t]|e[t+1]<<8},Ph=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},Oh=function(e,t,r){for(;r;++t)e[t]=r,r>>>=8},Ih=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&&Oh(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)}},Fh=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)},Lh=function(e){var t=e.length;return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0},kh=function(e){return 10+(e.filename&&e.filename.length+1||0)},Uh=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)},Gh=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 jh(e,t){return t||"function"!=typeof e||(t=e,e={}),this.ondata=t,e}var Hh=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(gh(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}(),Nh=function(e,t){Vc([Sh,function(){return[Jc,Hh]}],this,jh.call(this,e,t),(function(e){e=new Hh(e.data),onmessage=Jc(e)}),6)};function zh(e,t,r){if(r||(r=t,t={}),"function"!=typeof r)throw"no callback";return Dh(e,t,[Sh],(function(e){return Eh(Jh(e.data[0],e.data[1]))}),0,r)}function Jh(e,t){return gh(e,t||{},0,0)}var Vh=function(){function e(e){this.s={},this.p=new Ec(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 Ec(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=rh(this.p,this.o,this.s);this.ondata(th(t,e,this.s.b),this.d),this.o=th(t,this.s.b-32768),this.s.b=this.o.length,this.p=th(this.p,this.s.p/8|0),this.s.p&=7},e.prototype.push=function(e,t){this.e(e),this.c(t)},e}(),Kh=function(e){this.ondata=e,Vc([Ah,function(){return[Jc,Vh]}],this,0,(function(){var e=new Vh;onmessage=Jc(e)}),7)};function Qh(e,t,r){if(r||(r=t,t={}),"function"!=typeof r)throw"no callback";return Dh(e,t,[Ah],(function(e){return Eh(Xh(e.data[0],_h(e.data[1])))}),1,r)}function Xh(e,t){return rh(e,t)}var Wh=function(){function e(e,t){this.c=mh(),this.l=0,this.v=1,Hh.call(this,e,t)}return e.prototype.push=function(e,t){Hh.prototype.push.call(this,e,t)},e.prototype.p=function(e,t){this.c.p(e),this.l+=e.length,e=gh(e,this.o,this.v&&kh(this.o),t&&8,!t),this.v&&(Ih(e,this.o),this.v=0),t&&(Oh(e,e.length-8,this.c.d()),Oh(e,e.length-4,this.l)),this.ondata(e,t)},e}(),Yh=function(e,t){Vc([Sh,Bh,function(){return[Jc,Hh,Wh]}],this,jh.call(this,e,t),(function(e){e=new Wh(e.data),onmessage=Jc(e)}),8)};function Zh(e,t,r){if(r||(r=t,t={}),"function"!=typeof r)throw"no callback";return Dh(e,t,[Sh,Bh,function(){return[qh]}],(function(e){return Eh(qh(e.data[0],e.data[1]))}),2,r)}function qh(e,t){t=t||{};var r=mh(),n=e.length,i=(r.p(e),e=gh(e,t,kh(t),8)).length;return Ih(e,t),Oh(e,i-8,r.d()),Oh(e,i-4,n),e}var $h=function(){function e(e){this.v=1,Vh.call(this,e)}return e.prototype.push=function(e,t){if(Vh.prototype.e.call(this,e),this.v){if((e=3<this.p.length?Fh(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)}Vh.prototype.c.call(this,t)},e}(),ep=function(e){this.ondata=e,Vc([Ah,Mh,function(){return[Jc,Vh,$h]}],this,0,(function(){var e=new $h;onmessage=Jc(e)}),9)};function tp(e,t,r){if(r||(r=t,t={}),"function"!=typeof r)throw"no callback";return Dh(e,t,[Ah,Mh,function(){return[rp]}],(function(e){return Eh(rp(e.data[0]))}),3,r)}function rp(e,t){return rh(e.subarray(Fh(e),-8),t||new Ec(Lh(e)))}var np=function(){function e(e,t){this.c=vh(),this.v=1,Hh.call(this,e,t)}return e.prototype.push=function(e,t){Hh.prototype.push.call(this,e,t)},e.prototype.p=function(e,t){this.c.p(e),e=gh(e,this.o,this.v&&2,t&&4,!t),this.v&&(Uh(e,this.o),this.v=0),t&&Oh(e,e.length-4,this.c.d()),this.ondata(e,t)},e}(),ip=function(e,t){Vc([Sh,Ch,function(){return[Jc,Hh,np]}],this,jh.call(this,e,t),(function(e){e=new np(e.data),onmessage=Jc(e)}),10)};function op(e,t){t=t||{};var r=vh();return r.p(e),e=gh(e,t,2,4),Uh(e,t),Oh(e,e.length-4,r.d()),e}var ap=function(){function e(e){this.v=1,Vh.call(this,e)}return e.prototype.push=function(e,t){if(Vh.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)}Vh.prototype.c.call(this,t)},e}(),sp=function(e){this.ondata=e,Vc([Ah,Th,function(){return[Jc,Vh,ap]}],this,0,(function(){var e=new ap;onmessage=Jc(e)}),11)};function lp(e,t,r){if(r||(r=t,t={}),"function"!=typeof r)throw"no callback";return Dh(e,t,[Ah,Th,function(){return[up]}],(function(e){return Eh(up(e.data[0],_h(e.data[1])))}),5,r)}function up(e,t){return rh((Gh(e),e.subarray(2,-4)),t)}var cp=function(){function e(e){this.G=$h,this.I=Vh,this.Z=ap,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 Ec(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}(),hp=function(){function e(e){this.G=ep,this.I=Kh,this.Z=sp,this.ondata=e}return e.prototype.push=function(e,t){cp.prototype.push.call(this,e,t)},e}(),pp=function e(t,r,n,i){for(var o in t){var a=t[o];o=r+o,a instanceof Ec?n[o]=[a,i]:Array.isArray(a)?n[o]=[a[0],yh(i,a[1])]:e(a,o+"/",n,i)}},dp="undefined"!=typeof TextEncoder&&new TextEncoder,fp="undefined"!=typeof TextDecoder&&new TextDecoder,mp=0;try{fp.decode(ph,{stream:!0}),mp=1}catch(zl){}var vp=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,th(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)}},gp=function(){function e(e){this.ondata=e,mp?this.t=new TextDecoder:this.p=ph}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 Ec(this.p.length+e.length)).set(this.p),r.set(e,this.p.length),e=vp(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}(),yp=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(bp(e),this.d=t||!1)},e}();function bp(e,t){if(t){for(var r=new Ec(e.length),n=0;n<e.length;++n)r[n]=e.charCodeAt(n);return r}if(dp)return dp.encode(e);var i=e.length,o=new Ec(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 Ec(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 th(o,0,a)}function xp(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(fp)return fp.decode(e);var i=(t=vp(e))[0];if(t[1].length)throw"invalid utf-8 data";return i}function wp(e){return 1==e?3:e<6?2:9==e?1:0}var Ap=function(e,t){return t+30+Rh(e,t+26)+Rh(e,t+28)},Sp=function(e,t,r){var n=Rh(e,t+28),i=xp(e.subarray(t+46,t+46+n),!(2048&Rh(e,t+8))),o=(n=t+46+n,Ph(e,t+20)),a=(o=(r=r&&4294967295==o?Bp(e,n):[o,Ph(e,t+24),Ph(e,t+42)])[0],r[1]);return r=r[2],[Rh(e,t+10),o,a,i,n+Rh(e,t+30)+Rh(e,t+32),r]},Bp=function(e,t){for(;1!=Rh(e,t);t+=4+Rh(e,t+2));return[Kc(e,t+12),Kc(e,t+4),Kc(e,t+20)]},Mp=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},Cp=function(e,t,r,n,i,o,a,s){var l=n.length,u=r.extra,c=s&&s.length,h=Mp(u),p=(Oh(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(Oh(e,t,p<<25|i.getMonth()+1<<21|i.getDate()<<16|i.getHours()<<11|i.getMinutes()<<5|i.getSeconds()>>>1),t+=4,null!=o&&(Oh(e,t,r.crc),Oh(e,t+4,o),Oh(e,t+8,r.size)),Oh(e,t+12,l),Oh(e,t+14,h),t+=16,null!=a&&(Oh(e,t,c),Oh(e,t+6,r.attrs),Oh(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;Oh(e,t,+d),Oh(e,t+2,m),e.set(f,t+4),t+=4+m}return c&&(e.set(s,t),t+=c),t},Tp=function(e,t,r,n,i){Oh(e,t,101010256),Oh(e,t+8,r),Oh(e,t+10,r),Oh(e,t+12,n),Oh(e,t+16,i)},Ep=function(){function e(e){this.filename=e,this.c=mh(),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}(),_p=function(){function e(e,t){var r=this;t=t||{},Ep.call(this,e),this.d=new Hh(t,(function(e,t){r.ondata(null,e,t)})),this.compression=8,this.flag=wp(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){Ep.prototype.push.call(this,e,t)},e}(),Dp=function(){function e(e,t){var r=this;t=t||{},Ep.call(this,e),this.d=new Nh(t,(function(e,t,n){r.ondata(e,t,n)})),this.compression=8,this.flag=wp(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){Ep.prototype.push.call(this,e,t)},e}(),Rp=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=bp(e.filename),n=r.length,i=(o=e.comment)&&bp(o),o=n!=e.filename.length||i&&o.length!=i.length,a=n+Mp(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 Ec(a);var l=(Cp(n,0,e,r,o),[n]),u=this.d,c=(this.d=0,this.u.length),h=yh(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 Ec(16),Oh(r,0,134695760),Oh(r,4,e.crc),Oh(r,8,p),Oh(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+Mp(l.extra)+(l.o?l.o.length:0);for(var o=new Ec(r+22),a=0,s=this.u;a<s.length;a++){var l=s[a];Cp(o,e,l,l.f,l.u,l.c,t,l.o),e+=46+l.f.length+Mp(l.extra)+(l.o?l.o.length:0),t+=l.b}Tp(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}(),Pp=function(){function e(){}return e.prototype.push=function(e,t){this.ondata(null,e,t)},e.compression=0,e}(),Op=function(){function e(){var e=this;this.i=new Vh((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}(),Ip=function(){function e(e,t){var r=this;t<32e4?this.i=new Vh((function(e,t){r.ondata(null,e,t)})):(this.i=new Kh((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=th(e,0)),this.i.push(e,t)},e.compression=8,e}(),Fp=function(){function e(e){this.onfile=e,this.k=[],this.o={0:Pp},this.p=ph}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 Ec(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,g,y,b=Ph(l,a);return 67324752==b?(o=1,s=a,h.d=null,h.c=0,n=Rh(l,a+6),e=Rh(l,a+8),t=2048&n,n&=8,i=Rh(l,a+26),p=Rh(l,a+28),a+30+i+p<u&&(h.k.unshift(d=[]),o=2,f=Ph(l,a+18),m=Ph(l,a+22),v=xp(l.subarray(a+30,a+=30+i),!t),4294967295==f?(i=n?[-2]:Bp(l,a),f=i[0],m=i[1]):n&&(f=-1),a+=p,h.c=f,y={name:v,compression:e,start:function(){if(!y.ondata)throw"no callback";if(f){var t=r.o[e];if(!t)throw"unknown compression type "+e;(g=f<0?new t(v):new t(v,f,m)).ondata=function(e,t,r){y.ondata(e,t,r)};for(var n=0,i=d;n<i.length;n++)g.push(i[n],!1);r.k[0]==d&&r.c?r.d=g:g.push(ph,!0)}else y.ondata(null,ph,!0)},terminate:function(){g&&g.terminate&&g.terminate()}},0<=f&&(y.size=f,y.originalSize=m),h.onfile(y)),"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=ph,c<0&&(n=o?l.subarray(0,s-12-(-2==c&&8)-(134695760==Ph(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 Lp(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 kp(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 Up(e,t,r,n,i){for(var o=i<e?i:e,a=[],s=Lp(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],g=h[d-m],y=(u[d][m]=v+g,u[m][d-1]/u[d][m]);u[m][d]=f+v*y,f=g*y}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,A=1,S=[],B=0;B<=r;++B)S[B]=o.slice(0);for(var M=S[0][0]=1;M<=n;++M){var C=0,T=x-M,E=r-M;M<=x&&(S[A][0]=S[w][0]/u[1+E][T],C=S[A][0]*u[T][E]);for(var _=x-1<=E?M-1:r-x,D=-1<=T?1:-T;D<=_;++D)S[A][D]=(S[w][D]-S[w][D-1])/u[1+E][T+D],C+=S[A][D]*u[T+D][E];x<=E&&(S[A][M]=-S[w][M-1]/u[1+E][x],C+=S[A][M]*u[x][E]),s[M][x]=C;var R=w;w=A,A=R}}for(var P=r,O=1;O<=n;++O){for(var I=0;I<=r;++I)s[O][I]*=P;P*=r-O}return s}(s,n,e,o,t),u=[],c=0;c<r.length;++c){var p=r[c].clone(),d=p.w;p.x*=d,p.y*=d,p.z*=d,u[c]=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 g=o+1;g<=i+1;++g)a[g]=new h.Vector4(0,0,0);return a}function Gp(e){for(var t=e.length,r=[],n=[],i=0;i<t;++i){var o=e[i];r[i]=new h.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 jp(e){return(jp="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 Hp(e,t){return(Hp=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 zp,Jp,Vp,Kp=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&&Hp(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"===jp(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 h.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 h.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=Lp(e,n,t),o=kp(i,n,e,t),a=new h.Vector4(0,0,0,0),s=0;s<=e;++s){var l=r[i-e+s],u=o[s],c=l.w*u;a.x+=l.x*c,a.y+=l.y*c,a.z+=l.z*c,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 h.Vector3,r=(e=this.knots[0]+e*(this.knots[this.knots.length-1]-this.knots[0]),Gp(Up(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}(h.Curve);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 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 Yp(e,t,r){t&&Wp(e.prototype,t),r&&Wp(e,r),Object.defineProperty(e,"prototype",{writable:!1})}function Zp(e,t){return(Zp=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function qp(e){return(qp=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var $p=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&&Zp(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=qp(e);if(r=t?(r=qp(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){return Xp(this,n),r.call(this,e)}return Yp(n,[{key:"load",value:function(e,t,r,n){var i=this,o=""===i.path?h.LoaderUtils.extractUrlBase(e):i.path,a=new h.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===vd(r,0,n.length))zp=(new id).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=vd(e)))throw new Error("THREE.FBXLoader: Unknown format.");if(sd(r)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+sd(r));zp=(new nd).parse(r)}var r,n=new h.TextureLoader(this.manager).setPath(this.resourcePath||t).setCrossOrigin(this.crossOrigin);return new ed(n,this.manager).parse(zp)}}]),n}(h.Loader),ed=function(){function e(t,r){Xp(this,e),this.textureLoader=t,this.manager=r}return Yp(e,[{key:"parse",value:function(){Jp=this.parseConnections();var e=this.parseImages(),t=(e=this.parseTextures(e),e=this.parseMaterials(e),this.parseDeformers()),r=(new td).parse(t);return this.parseScene(t,r,e),Vp}},{key:"parseConnections",value:function(){var e=new Map;return"Connections"in zp&&zp.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 zp.Objects){var n,i=zp.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 zp.Objects){var r,n=zp.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?h.RepeatWrapping:h.ClampToEdgeWrapping,t.wrapT=0===n?h.RepeatWrapping:h.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=Jp.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 h.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 h.Texture):this.textureLoader.load(r),this.textureLoader.setPath(n),i}},{key:"parseMaterials",value:function(e){var t=new Map;if("Material"in zp.Objects){var r,n=zp.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"===Qp(o)&&(o=o.value),!Jp.has(n))return null;switch(e=this.parseParameters(e,t,n),o.toLowerCase()){case"phong":r=new h.MeshPhongMaterial;break;case"lambert":r=new h.MeshLambertMaterial;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',o),r=new h.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 h.Color).fromArray(e.Diffuse.value):!e.DiffuseColor||"Color"!==e.DiffuseColor.type&&"ColorRGB"!==e.DiffuseColor.type||(n.color=(new h.Color).fromArray(e.DiffuseColor.value)),e.DisplacementFactor&&(n.displacementScale=e.DisplacementFactor.value),e.Emissive?n.emissive=(new h.Color).fromArray(e.Emissive.value):!e.EmissiveColor||"Color"!==e.EmissiveColor.type&&"ColorRGB"!==e.EmissiveColor.type||(n.emissive=(new h.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 h.Color).fromArray(e.Specular.value):e.SpecularColor&&"Color"===e.SpecularColor.type&&(n.specular=(new h.Color).fromArray(e.SpecularColor.value)),this);return Jp.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=h.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=h.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=h.EquirectangularReflectionMapping,n.envMap.encoding=h.sRGBEncoding);break;case"SpecularColor":n.specularMap=i.getTexture(t,e.ID),void 0!==n.specularMap&&(n.specularMap.encoding=h.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 zp.Objects&&t in zp.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),t=Jp.get(t).children[0].ID),e.get(t)}},{key:"parseDeformers",value:function(){var e={},t={};if("Deformer"in zp.Objects){var r,n=zp.Objects.Deformer;for(r in n){var i,o=n[r],a=Jp.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 h.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=Jp.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){Vp=new h.Group;var n=this.parseModels(e.skeletons,t,r),i=zp.Objects.Model,o=this;n.forEach((function(e){var t=i[e.ID];o.setLookAtProperties(e,t),Jp.get(e.ID).parents.forEach((function(t){void 0!==(t=n.get(t.ID))&&t.add(e)})),null===e.parent&&Vp.add(e)})),this.bindSkeleton(e.skeletons,t,n),this.createAmbientLight(),Vp.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=dd(e.userData.transformData),e.applyMatrix4(t),e.updateWorldMatrix())})),r=(new rd).parse(),1===Vp.children.length&&Vp.children[0].isGroup&&(Vp.children[0].animations=r,Vp=Vp.children[0]),Vp.animations=r}},{key:"parseModels",value:function(e,t,r){var n,i=new Map,o=zp.Objects.Model;for(n in o){var a=parseInt(n),s=o[n],l=Jp.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 h.Bone;break;default:u=new h.Group}u.name=s.attrName?h.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 h.Bone).matrixWorld.copy(t.transformLink),i.name=n?h.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=zp.Objects.NodeAttribute[e.ID])&&(r=e)})),void 0===r)t=new h.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,c=(void 0!==r.FieldOfView&&(u=r.FieldOfView.value),r.FocalLength?r.FocalLength.value:null);switch(n){case 0:t=new h.PerspectiveCamera(u,l,i,o),null!==c&&t.setFocalLength(c);break;case 1:t=new h.OrthographicCamera(-a/2,a/2,s/2,-s/2,i,o);break;default:console.warn("THREE.FBXLoader: Unknown camera type "+n+"."),t=new h.Object3D}}return t}},{key:"createLight",value:function(e){var t,r;if(e.children.forEach((function(e){void 0!==(e=zp.Objects.NodeAttribute[e.ID])&&(r=e)})),void 0===r)t=new h.Object3D;else{e=void 0===r.LightType?0:r.LightType.value;var n=16777215,i=(void 0!==r.Color&&(n=(new h.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 h.PointLight(n,i,o,1);break;case 1:t=new h.DirectionalLight(n,i);break;case 2:var a=Math.PI/3,s=(void 0!==r.InnerAngle&&(a=h.MathUtils.degToRad(r.InnerAngle.value)),0);void 0!==r.OuterAngle&&(s=h.MathUtils.degToRad(r.OuterAngle.value),s=Math.max(s,1)),t=new h.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 h.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 h.MeshPhongMaterial({color:13421772}),a.push(o)),"color"in i.attributes&&a.forEach((function(e){e.vertexColors=!0})),i.FBX_Deformer?(n=new h.SkinnedMesh(i,o)).normalizeSkinWeights():n=new h.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 h.LineBasicMaterial({color:3342591,linewidth:1});return new h.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?fd(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&&Jp.get(e.ID).children.forEach((function(t){"LookAtProperty"===t.relationship&&"Lcl_Translation"in(t=zp.Objects.Model[t.ID])&&(t=t.Lcl_Translation.value,void 0!==e.target?(e.target.position.fromArray(t),Vp.add(e.target)):e.lookAt((new h.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];Jp.get(parseInt(o.ID)).parents.forEach((function(e){t.has(e.ID)&&(e=e.ID,Jp.get(e).parents.forEach((function(e){r.has(e.ID)&&r.get(e.ID).bind(new h.Skeleton(o.bones),i[e.ID])})))}))}(n)}},{key:"parsePoseNodes",value:function(){var e={};if("Pose"in zp.Objects){var t,r,n=zp.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 h.Matrix4).fromArray(t.Matrix.a)})):e[r.Node]=(new h.Matrix4).fromArray(r.Matrix.a))}return e}},{key:"createAmbientLight",value:function(){var e,t,r;"GlobalSettings"in zp&&"AmbientColor"in zp.GlobalSettings&&(r=(t=zp.GlobalSettings.AmbientColor.value)[0],e=t[1],t=t[2],0===r&&0===e&&0===t||(r=new h.Color(r,e,t),Vp.add(new h.AmbientLight(r,1))))}}]),e}(),td=function(){function e(){Xp(this,e)}return Yp(e,[{key:"parse",value:function(e){var t=new Map;if("Geometry"in zp.Objects){var r,n=zp.Objects.Geometry;for(r in n){var i=Jp.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 zp.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=fd(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=dd(a),this.genGeometry(t,n,o,e)}},{key:"genGeometry",value:function(e,t,r,n){var i,o,a=new h.BufferGeometry,s=(e.attrName&&(a.name=e.attrName),this.parseGeoNode(e,t)),l=this.genBuffers(s),u=new h.Float32BufferAttribute(l.vertex,3);return u.applyMatrix4(n),a.setAttribute("position",u),0<l.colors.length&&a.setAttribute("color",new h.Float32BufferAttribute(l.colors,3)),t&&(a.setAttribute("skinIndex",new h.Uint16BufferAttribute(l.weightsIndices,4)),a.setAttribute("skinWeight",new h.Float32BufferAttribute(l.vertexWeights,4)),a.FBX_Deformer=t),0<l.normal.length&&(u=(new h.Matrix3).getNormalMatrix(n),(t=new h.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 h.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,g,y=!1,b=(p<0&&(p^=-1,y=!0),[]),x=[];if(o.push(3*p,3*p+1,3*p+2),e.color&&(g=cd(d,r,p,e.color),s.push(g[0],g[1],g[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&&(g=cd(d,r,p,e.normal),a.push(g[0],g[1],g[2])),e.material&&"AllSame"!==e.material.mappingType&&(f=cd(d,r,p,e.material)[0]),e.uv&&e.uv.forEach((function(e,t){e=cd(d,r,p,e),void 0===l[t]&&(l[t]=[]),l[t].push(e[0]),l[t].push(e[1])})),n++,y&&(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=zp.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 c=3*a[u];l[c]=o[3*u],l[1+c]=o[3*u+1],l[2+c]=o[3*u+2]}s=this.genBuffers({vertexIndices:t,vertexPositions:l}),(t=new h.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===Kp)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 h.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 h.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 h.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 Kp(r,t,n,s,l).getPoints(12*n.length),(new h.BufferGeometry).setFromPoints(e)}}]),e}(),rd=function(){function e(){Xp(this,e)}return Yp(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!==zp.Objects.AnimationCurve)return e=this.parseAnimationCurveNodes(),this.parseAnimationCurves(e),e=this.parseAnimationLayers(e),this.parseAnimStacks(e)}},{key:"parseAnimationCurveNodes",value:function(){var e,t=zp.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=zp.Objects.AnimationCurve;for(t in r){var n,i={id:r[t].id,times:r[t].KeyTime.a.map(ld),values:r[t].KeyValueFloat.a},o=Jp.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=zp.Objects.AnimationLayer,n=new Map;for(t in r)!function(t){var r=[],i=Jp.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=Jp.get(t.ID).parents.filter((function(e){return void 0!==e.relationship}))[0].ID;if(void 0!==o){var a=zp.Objects.Model[o.toString()];if(void 0===a)return void console.warn("THREE.FBXLoader: Encountered a unused curve.",t);var s={modelName:a.attrName?h.PropertyBinding.sanitizeNodeName(a.attrName):"",ID:a.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1]};Vp.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 h.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=Jp.get(t.ID).parents.filter((function(e){return void 0!==e.relationship}))[0].ID,t=Jp.get(o).parents[0].ID,t=Jp.get(t).parents[0].ID,t=Jp.get(t).parents[0].ID,t={modelName:(t=zp.Objects.Model[t]).attrName?h.PropertyBinding.sanitizeNodeName(t.attrName):"",morphName:zp.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=zp.Objects.AnimationStack,n={};for(t in r){var i=(1<(i=Jp.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 h.AnimationClip(e.name,-1,t)}},{key:"generateTracks",value:function(e){var t=[],r=new h.Vector3,n=new h.Quaternion,i=new h.Vector3;return e.transform&&e.transform.decompose(r,n,i),r=r.toArray(),n=(new h.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 h.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(h.MathUtils.degToRad)),void 0!==t.y&&(this.interpolateRotations(t.y),t.y.values=t.y.values.map(h.MathUtils.degToRad)),void 0!==t.z&&(this.interpolateRotations(t.z),t.z.values=t.z.values.map(h.MathUtils.degToRad));for(var a=this.getTimesForAllAxes(t),s=this.getKeyframeTrackValues(a,t,r),l=(void 0!==n&&((n=n.map(h.MathUtils.degToRad)).push(o),n=(new h.Euler).fromArray(n),n=(new h.Quaternion).setFromEuler(n)),void 0!==i&&((i=i.map(h.MathUtils.degToRad)).push(o),i=(new h.Euler).fromArray(i),i=(new h.Quaternion).setFromEuler(i).invert()),new h.Quaternion),u=new h.Euler,c=[],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(c,p/3*4);return new h.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=Vp.getObjectByName(e.modelName).morphTargetDictionary[e.morphName];return new h.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=gd(e.times,t,u),e.values=gd(e.values,t,c)}}}}]),e}(),nd=function(){function e(){Xp(this,e)}return Yp(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 ad,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=md(t))}}},{key:"parseNodePropertyContinued",value:function(e){var t=this.getCurrentNode();t.a+=e,","!==e.slice(-1)&&(t.a=md(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=md(s)}this.getPrevNode()[n]={type:i,type2:o,flag:a,value:s},this.setCurrentProp(this.getPrevNode(),n)}}]),e}(),id=function(){function e(){Xp(this,e)}return Yp(e,[{key:"parse",value:function(e){var t=new od(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 ad;!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=up(new Uint8Array(e.getArrayBuffer(o)));var a=new od(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}(),od=function(){function e(t,r){Xp(this,e),this.dv=new DataView(t),this.offset=0,this.littleEndian=void 0===r||r}return Yp(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)),h.LoaderUtils.decodeText(new Uint8Array(t))}}]),e}(),ad=function(){function e(){Xp(this,e)}return Yp(e,[{key:"add",value:function(e,t){this[e]=t}}]),e}();function sd(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 ld(e){return e/46186158e3}var ud=[];function cd(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=ud,l=n.buffer,u=a,c=o,h=0;c<u;c++,h++)s[h]=l[c];return s}var hd=new h.Euler,pd=new h.Vector3;function dd(e){var t=new h.Matrix4,r=new h.Matrix4,n=new h.Matrix4,i=new h.Matrix4,o=new h.Matrix4,a=new h.Matrix4,s=new h.Matrix4,l=new h.Matrix4,u=new h.Matrix4,c=new h.Matrix4,p=new h.Matrix4,d=new h.Matrix4,f=e.inheritType||0,m=(e.translation&&t.setPosition(pd.fromArray(e.translation)),e.preRotation&&((m=e.preRotation.map(h.MathUtils.degToRad)).push(e.eulerOrder),r.makeRotationFromEuler(hd.fromArray(m))),e.rotation&&((m=e.rotation.map(h.MathUtils.degToRad)).push(e.eulerOrder),n.makeRotationFromEuler(hd.fromArray(m))),e.postRotation&&((m=e.postRotation.map(h.MathUtils.degToRad)).push(e.eulerOrder),i.makeRotationFromEuler(hd.fromArray(m)),i.invert()),e.scale&&o.scale(pd.fromArray(e.scale)),e.scalingOffset&&s.setPosition(pd.fromArray(e.scalingOffset)),e.scalingPivot&&a.setPosition(pd.fromArray(e.scalingPivot)),e.rotationOffset&&l.setPosition(pd.fromArray(e.rotationOffset)),e.rotationPivot&&u.setPosition(pd.fromArray(e.rotationPivot)),e.parentMatrixWorld&&(p.copy(e.parentMatrix),c.copy(e.parentMatrixWorld)),r.clone().multiply(n).multiply(i)),v=(((e=new h.Matrix4).extractRotation(c),v=new h.Matrix4).copyPosition(c),v.clone().invert().multiply(c)),g=(v=e.clone().invert().multiply(v),o),y=new h.Matrix4;return 0===f?y.copy(e).multiply(m).multiply(v).multiply(g):1===f?y.copy(e).multiply(v).multiply(m).multiply(g):(f=(new h.Matrix4).scale((new h.Vector3).setFromMatrixScale(p)).clone().invert(),p=v.clone().multiply(f),y.copy(e).multiply(m).multiply(p).multiply(g)),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 h.Matrix4).copyPosition(e),p=c.clone().multiply(m),d.copyPosition(p),(e=d.clone().multiply(y)).premultiply(c.invert()),e}function fd(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 md(e){return e.split(",").map((function(e){return parseFloat(e)}))}function vd(e,t,r){return void 0===t&&(t=0),void 0===r&&(r=e.byteLength),h.LoaderUtils.decodeText(new Uint8Array(e,t,r))}function gd(e,t,r){return e.slice(0,t).concat(r).concat(e.slice(t))}function yd(e){return(yd="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 bd(e,t){return(bd=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)}var wd=/^[og]\s*(.+)?/,Ad=/^mtllib /,Sd=/^usemtl /,Bd=/^usemap /,Md=new h.Vector3,Cd=new h.Vector3,Td=new h.Vector3,Ed=new h.Vector3,_d=new h.Vector3,Dd=new h.Color;function Rd(){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;Md.fromArray(n,e),Cd.fromArray(n,t),Td.fromArray(n,r),_d.subVectors(Td,Cd),Ed.subVectors(Md,Cd),_d.cross(Ed),_d.normalize(),i.push(_d.x,_d.y,_d.z),i.push(_d.x,_d.y,_d.z),i.push(_d.x,_d.y,_d.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 Pd=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&&bd(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=xd(e);if(r=t?(r=xd(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===yd(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 h.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 Rd,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,c=o.length;u<c;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?(Dd.setRGB(parseFloat(p[4]),parseFloat(p[5]),parseFloat(p[6])).convertSRGBToLinear(),i.colors.push(Dd.r,Dd.g,Dd.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 g=d[m];0<g.length&&(g=g.split("/"),f.push(g))}for(var y=f[0],b=1,x=f.length-1;b<x;b++){var w=f[b],A=f[b+1];i.addFace(y[0],w[0],A[0],y[1],w[1],A[1],y[2],w[2],A[2])}}else if("l"===t){var S=a.substring(1).trim().split(" "),B=[],M=[];if(-1===a.indexOf("/"))B=S;else for(var C=0,T=S.length;C<T;C++){var E=S[C].split("/");""!==E[0]&&B.push(E[0]),""!==E[1]&&M.push(E[1])}i.addLineGeometry(B,M)}else"p"===t?(r=a.slice(1).trim().split(" "),i.addPointGeometry(r)):null!==(s=wd.exec(a))?(r=(" "+s[0].slice(1).trim()).slice(1),i.startObject(r)):Sd.test(a)?i.object.startMaterial(a.substring(7).trim(),i.materialLibraries):Ad.test(a)?i.materialLibraries.push(a.substring(7).trim()):Bd.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 _,D=new h.Group;if(1==(D.materialLibraries=[].concat(i.materialLibraries),e=!(1===i.objects.length&&0===i.objects[0].geometry.vertices.length)))for(var R=0,P=i.objects.length;R<P;R++){var O=i.objects[R],I=O.geometry,F=O.materials,L="Line"===I.type,k="Points"===I.type,U=!1;if(0!==I.vertices.length){for(var G=new h.BufferGeometry,j=(G.setAttribute("position",new h.Float32BufferAttribute(I.vertices,3)),0<I.normals.length&&G.setAttribute("normal",new h.Float32BufferAttribute(I.normals,3)),0<I.colors.length&&(U=!0,G.setAttribute("color",new h.Float32BufferAttribute(I.colors,3))),!0===I.hasUVIndices&&G.setAttribute("uv",new h.Float32BufferAttribute(I.uvs,2)),[]),H=0,N=F.length;H<N;H++){var z,J=F[H],V=J.name+"_"+J.smooth+"_"+U,K=i.materials[V];null!==this.materials&&(K=this.materials.create(J.name),!L||!K||K instanceof h.LineBasicMaterial?!k||!K||K instanceof h.PointsMaterial||(z=new h.PointsMaterial({size:10,sizeAttenuation:!1}),h.Material.prototype.copy.call(z,K),z.color.copy(K.color),z.map=K.map,K=z):(z=new h.LineBasicMaterial,h.Material.prototype.copy.call(z,K),z.color.copy(K.color),K=z)),void 0===K&&((K=L?new h.LineBasicMaterial:k?new h.PointsMaterial({size:1,sizeAttenuation:!1}):new h.MeshPhongMaterial).name=J.name,K.flatShading=!J.smooth,K.vertexColors=U,i.materials[V]=K),j.push(K)}if(I=void 0,1<j.length){for(var Q=0,X=F.length;Q<X;Q++){var W=F[Q];G.addGroup(W.groupStart,W.groupCount,Q)}I=new(L?h.LineSegments:k?h.Points:h.Mesh)(G,j)}else I=new(L?h.LineSegments:k?h.Points:h.Mesh)(G,j[0]);I.name=O.name,D.add(I)}}else 0<i.vertices.length&&(e=new h.PointsMaterial({size:1,sizeAttenuation:!1}),(_=new h.BufferGeometry).setAttribute("position",new h.Float32BufferAttribute(i.vertices,3)),0<i.colors.length&&void 0!==i.colors[0]&&(_.setAttribute("color",new h.Float32BufferAttribute(i.colors,3)),e.vertexColors=!0),_=new h.Points(_,e),D.add(_));return D}}])&&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}(h.Loader),Od=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 Id{constructor(e){this.parses={fbx:new $p,obj:new Pd,object:new h.ObjectLoader},this.runScene=e}getBack(e){return e.name.substring(e.name.lastIndexOf(".")+1).toLowerCase()}parseFiles(e){return Promise.all(e.map((e=>this.parse(e))))}parse(e){return Od(this,void 0,void 0,(function*(){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 Od(this,void 0,void 0,(function*(){var t=yield(0,G.toResult)(e,"arrayBuffer");return{type:"model",result:yield this.runScene.loaderer.gltf.parse(t,{addToScene:!1})}}))}fbx(e){return Od(this,void 0,void 0,(function*(){var t=e instanceof ArrayBuffer?e:yield(0,G.toResult)(e,"arrayBuffer");const r=this.parses.fbx.parse(t,"");return r.traverse((e=>{e.material&&(e.material=this.runScene.materialEx.create())})),{type:"model",result:this.runScene.sceneEx.cleanUnlessLevel(r)}}))}obj(e){return Od(this,void 0,void 0,(function*(){var t=e instanceof File?yield(0,G.toResult)(e,"text"):e;const r=this.parses.obj.parse(t);return r.traverse((e=>{e.material&&(e.material=this.runScene.materialEx.create())})),{type:"model",result:this.runScene.sceneEx.cleanUnlessLevel(r)}}))}json(e){return Od(this,void 0,void 0,(function*(){var t=e instanceof File?yield(0,G.toResult)(e,"text"):e;return{type:"model",result:this.runScene.loaderer.json.parse(t)}}))}}class Fd extends p{constructor(e){super(e),this._lastRenderMode=null,this.setRenderMode=(()=>{let e=!1;const t=()=>{e||(this.runScene.cb.load.loaded.add("global-config",(()=>{"controlsChange"===this._lastRenderMode&&this.runScene.render()})),this.runScene.cb.load.complete.add("global-config",(()=>{"controlsChange"===this._lastRenderMode&&this.runScene.render()})),e=!0)},r=()=>{const{renderer:e,controls:t}=this.runScene.assetsEx;var r=this.runScene.render;"tick"===this._lastRenderMode?e.setAnimationLoop(null):"controlsChange"===this._lastRenderMode&&t.removeEventListener("change",r)},n=e=>{var t=this.runScene.render;const{renderer:r,controls:n}=this.runScene.assetsEx;"tick"===e?r.setAnimationLoop(t):"controlsChange"===e&&n.addEventListener("change",t)};return e=>{this._lastRenderMode!==e&&(t(),r(),n(e),this._lastRenderMode=e)}})()}setGlow(e){this.runScene.bloom.glow.bloomParams.isBloom=e}setRender2(e){this.runScene.assetsEx.setRender2(e)}setRender3(e){this.runScene.assetsEx.setRender3(e)}}function Ld(e){return(Ld="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){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}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 Gd(e,t,r){t&&Ud(e.prototype,t),r&&Ud(e,r),Object.defineProperty(e,"prototype",{writable:!1})}function jd(){return(jd="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=Vd(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 Hd(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&&Nd(e,t)}function Nd(e,t){return(Nd=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function zd(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=Vd(e);if(r=t?(r=Vd(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Ld(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return Jd(n)}}function Jd(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Vd(e){return(Vd=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Kd=new h.Raycaster,Qd=new h.Vector3,Xd=new h.Vector3,Wd=new h.Quaternion,Yd={X:new h.Vector3(1,0,0),Y:new h.Vector3(0,1,0),Z:new h.Vector3(0,0,1)},Zd={type:"change"},qd={type:"mouseDown"},$d={type:"mouseUp",mode:null},ef={type:"objectChange"};function tf(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}Ou=function(){Hd(t,h.Object3D);var e=zd(t);function t(r,n){kd(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 gf,a=(i._gizmo=o,i.add(o),new yf),s=(i._plane=a,i.add(a),Jd(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(Zd))}}),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 h.Vector3,r=new h.Vector3;var u=new h.Quaternion,c=new h.Quaternion,p=new h.Vector3,d=new h.Quaternion,f=new h.Vector3,m=new h.Vector3,v=new h.Vector3,g=new h.Vector3;return l("worldPosition",n),l("worldPositionStart",r),l("worldQuaternion",u),l("worldQuaternionStart",c),l("cameraPosition",p),l("cameraQuaternion",d),l("pointStart",f),l("pointEnd",m),l("rotationAxis",v),l("rotationAngle",0),l("eye",g),i._offset=new h.Vector3,i._startNorm=new h.Vector3,i._endNorm=new h.Vector3,i._cameraScale=new h.Vector3,i._parentPosition=new h.Vector3,i._parentQuaternion=new h.Quaternion,i._parentQuaternionInv=new h.Quaternion,i._parentScale=new h.Vector3,i._worldScaleStart=new h.Vector3,i._worldQuaternionInv=new h.Quaternion,i._worldScale=new h.Vector3,i._positionStart=new h.Vector3,i._quaternionStart=new h.Quaternion,i._scaleStart=new h.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(Jd(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(Jd(i)),i._onPointerHover=function(e){if(this.enabled)switch(e.pointerType){case"mouse":case"pen":this.pointerHover(this._getPointer(e))}}.bind(Jd(i)),i._onPointerMove=function(e){this.enabled&&this.pointerMove(this._getPointer(e))}.bind(Jd(i)),i._onPointerUp=function(e){this.enabled&&(this.domElement.releasePointerCapture(e.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.pointerUp(this._getPointer(e)))}.bind(Jd(i)),i.domElement.addEventListener("pointerdown",i._onPointerDown),i.domElement.addEventListener("pointermove",i._onPointerHover),i.domElement.addEventListener("pointerup",i._onPointerUp),i}return Gd(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(),jd(Vd(t.prototype),"updateMatrixWorld",this).call(this,this)}},{key:"pointerHover",value:function(e){void 0!==this.object&&!0!==this.dragging&&(Kd.setFromCamera(e,this.camera),e=tf(this._gizmo.picker[this.mode],Kd),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&&(Kd.setFromCamera(e,this.camera),(e=tf(this._plane,Kd,!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,qd.mode=this.mode,this.dispatchEvent(qd))}},{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&&(Kd.setFromCamera(e,this.camera),(e=tf(this._plane,Kd,!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(Wd.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(Qd.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(Qd.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),Xd.set(e,e,e)):(Qd.copy(this.pointStart),Xd.copy(this.pointEnd),Qd.applyQuaternion(this._worldQuaternionInv),Xd.applyQuaternion(this._worldQuaternionInv),Xd.divide(Qd),-1===t.search("X")&&(Xd.x=1),-1===t.search("Y")&&(Xd.y=1),-1===t.search("Z")&&(Xd.z=1)),n.scale.copy(this._scaleStart).multiply(Xd),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(Qd.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(Qd.copy(this.rotationAxis).cross(this.eye))*e):"X"!==t&&"Y"!==t&&"Z"!==t||(this.rotationAxis.copy(Yd[t]),Qd.copy(Yd[t]),"local"===i&&Qd.applyQuaternion(this.worldQuaternion),this.rotationAngle=this._offset.dot(Qd.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(Wd.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this._parentQuaternionInv),n.quaternion.copy(Wd.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),n.quaternion.multiply(this._quaternionStart).normalize())),this.dispatchEvent(Zd),this.dispatchEvent(ef)))}},{key:"pointerUp",value:function(e){0===e.button&&(this.dragging&&null!==this.axis&&($d.mode=this.mode,this.dispatchEvent($d)),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(Zd),this.dispatchEvent(ef),this.pointStart.copy(this.pointEnd))}},{key:"getRaycaster",value:function(){return Kd}},{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}(),Ou.prototype.isTransformControls=!0;var rf=new h.Euler,nf=new h.Vector3(0,1,0),of=new h.Vector3(0,0,0),af=new h.Matrix4,sf=new h.Quaternion,lf=new h.Quaternion,uf=new h.Vector3,cf=new h.Matrix4,hf=new h.Vector3(1,0,0),pf=new h.Vector3(0,1,0),df=new h.Vector3(0,0,1),ff=new h.Vector3,mf=new h.Vector3,vf=new h.Vector3,gf=function(){Hd(t,h.Object3D);var e=zd(t);function t(){kd(this,t),(r=e.call(this)).type="TransformControlsGizmo";var r,n=new h.MeshBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),i=new h.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()),c=(u.color.setHex(255),u.opacity=.5,n.clone());(c.opacity=.25,y=n.clone()).color.setHex(16776960),y.opacity=.25,n.clone().color.setHex(16776960);var p=(((n=n.clone()).color.setHex(7895160),m=new h.CylinderGeometry(0,.04,.1,12)).translate(0,.05,0),new h.BoxGeometry(.08,.08,.08)),d=(p.translate(0,.04,0),new h.BufferGeometry);function f(e,t){return(e=new h.TorusGeometry(e,.0075,3,64,t*Math.PI*2)).rotateY(Math.PI/2),e.rotateX(Math.PI/2),e}(d.setAttribute("position",new h.Float32BufferAttribute([0,0,0,1,0,0],3)),A=new h.CylinderGeometry(.0075,.0075,.5,3)).translate(0,.25,0);var m={X:[[new h.Mesh(m,x),[.5,0,0],[0,0,-Math.PI/2]],[new h.Mesh(m,x),[-.5,0,0],[0,0,Math.PI/2]],[new h.Mesh(A,x),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new h.Mesh(m,w),[0,.5,0]],[new h.Mesh(m,w),[0,-.5,0],[Math.PI,0,0]],[new h.Mesh(A,w)]],Z:[[new h.Mesh(m,a),[0,0,.5],[Math.PI/2,0,0]],[new h.Mesh(m,a),[0,0,-.5],[-Math.PI/2,0,0]],[new h.Mesh(A,a),null,[Math.PI/2,0,0]]],XYZ:[[new h.Mesh(new h.OctahedronGeometry(.1,0),c.clone()),[0,0,0]]],XY:[[new h.Mesh(new h.BoxGeometry(.15,.15,.01),u.clone()),[.15,.15,0]]],YZ:[[new h.Mesh(new h.BoxGeometry(.15,.15,.01),s.clone()),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new h.Mesh(new h.BoxGeometry(.15,.15,.01),l.clone()),[.15,0,.15],[-Math.PI/2,0,0]]]},v={X:[[new h.Mesh(new h.CylinderGeometry(.2,0,.6,4),o),[.3,0,0],[0,0,-Math.PI/2]],[new h.Mesh(new h.CylinderGeometry(.2,0,.6,4),o),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new h.Mesh(new h.CylinderGeometry(.2,0,.6,4),o),[0,.3,0]],[new h.Mesh(new h.CylinderGeometry(.2,0,.6,4),o),[0,-.3,0],[0,0,Math.PI]]],Z:[[new h.Mesh(new h.CylinderGeometry(.2,0,.6,4),o),[0,0,.3],[Math.PI/2,0,0]],[new h.Mesh(new h.CylinderGeometry(.2,0,.6,4),o),[0,0,-.3],[-Math.PI/2,0,0]]],XYZ:[[new h.Mesh(new h.OctahedronGeometry(.2,0),o)]],XY:[[new h.Mesh(new h.BoxGeometry(.2,.2,.01),o),[.15,.15,0]]],YZ:[[new h.Mesh(new h.BoxGeometry(.2,.2,.01),o),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new h.Mesh(new h.BoxGeometry(.2,.2,.01),o),[.15,0,.15],[-Math.PI/2,0,0]]]},g={START:[[new h.Mesh(new h.OctahedronGeometry(.01,2),i),null,null,null,"helper"]],END:[[new h.Mesh(new h.OctahedronGeometry(.01,2),i),null,null,null,"helper"]],DELTA:[[new h.Line(((g=new h.BufferGeometry).setAttribute("position",new h.Float32BufferAttribute([0,0,0,1,1,1],3)),g),i),null,null,null,"helper"]],X:[[new h.Line(d,i.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new h.Line(d,i.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new h.Line(d,i.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},y=(n={XYZE:[[new h.Mesh(f(.5,1),n),null,[0,Math.PI/2,0]]],X:[[new h.Mesh(f(.5,.5),x)]],Y:[[new h.Mesh(f(.5,.5),w),null,[0,0,-Math.PI/2]]],Z:[[new h.Mesh(f(.5,.5),a),null,[0,Math.PI/2,0]]],E:[[new h.Mesh(f(.75,1),y),null,[0,Math.PI/2,0]]]},{AXIS:[[new h.Line(d,i.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]}),b={XYZE:[[new h.Mesh(new h.SphereGeometry(.25,10,8),o)]],X:[[new h.Mesh(new h.TorusGeometry(.5,.1,4,24),o),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new h.Mesh(new h.TorusGeometry(.5,.1,4,24),o),[0,0,0],[Math.PI/2,0,0]]],Z:[[new h.Mesh(new h.TorusGeometry(.5,.1,4,24),o),[0,0,0],[0,0,-Math.PI/2]]],E:[[new h.Mesh(new h.TorusGeometry(.75,.1,2,24),o)]]},x={X:[[new h.Mesh(p,x),[.5,0,0],[0,0,-Math.PI/2]],[new h.Mesh(A,x),[0,0,0],[0,0,-Math.PI/2]],[new h.Mesh(p,x),[-.5,0,0],[0,0,Math.PI/2]]],Y:[[new h.Mesh(p,w),[0,.5,0]],[new h.Mesh(A,w)],[new h.Mesh(p,w),[0,-.5,0],[0,0,Math.PI]]],Z:[[new h.Mesh(p,a),[0,0,.5],[Math.PI/2,0,0]],[new h.Mesh(A,a),[0,0,0],[Math.PI/2,0,0]],[new h.Mesh(p,a),[0,0,-.5],[-Math.PI/2,0,0]]],XY:[[new h.Mesh(new h.BoxGeometry(.15,.15,.01),u),[.15,.15,0]]],YZ:[[new h.Mesh(new h.BoxGeometry(.15,.15,.01),s),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new h.Mesh(new h.BoxGeometry(.15,.15,.01),l),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new h.Mesh(new h.BoxGeometry(.1,.1,.1),c.clone())]]},w={X:[[new h.Mesh(new h.CylinderGeometry(.2,0,.6,4),o),[.3,0,0],[0,0,-Math.PI/2]],[new h.Mesh(new h.CylinderGeometry(.2,0,.6,4),o),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new h.Mesh(new h.CylinderGeometry(.2,0,.6,4),o),[0,.3,0]],[new h.Mesh(new h.CylinderGeometry(.2,0,.6,4),o),[0,-.3,0],[0,0,Math.PI]]],Z:[[new h.Mesh(new h.CylinderGeometry(.2,0,.6,4),o),[0,0,.3],[Math.PI/2,0,0]],[new h.Mesh(new h.CylinderGeometry(.2,0,.6,4),o),[0,0,-.3],[-Math.PI/2,0,0]]],XY:[[new h.Mesh(new h.BoxGeometry(.2,.2,.01),o),[.15,.15,0]]],YZ:[[new h.Mesh(new h.BoxGeometry(.2,.2,.01),o),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new h.Mesh(new h.BoxGeometry(.2,.2,.01),o),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new h.Mesh(new h.BoxGeometry(.2,.2,.2),o),[0,0,0]]]},A={X:[[new h.Line(d,i.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new h.Line(d,i.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new h.Line(d,i.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]};function S(e){var t,r=new h.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=S(m)),r.add(r.gizmo.rotate=S(n)),r.add(r.gizmo.scale=S(x)),r.add(r.picker.translate=S(v)),r.add(r.picker.rotate=S(b)),r.add(r.picker.scale=S(w)),r.add(r.helper.translate=S(g)),r.add(r.helper.rotate=S(y)),r.add(r.helper.scale=S(A)),r.picker.translate.visible=!1,r.picker.rotate.visible=!1,r.picker.scale.visible=!1,r}return Gd(t,[{key:"updateMatrixWorld",value:function(e){var r=this,n="local"===("scale"===this.mode?"local":this.space)?this.worldQuaternion:lf,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&&(Wd.setFromEuler(rf.set(0,0,0)),t.quaternion.copy(n).multiply(Wd),.9<Math.abs(nf.copy(hf).applyQuaternion(n).dot(r.eye))&&(t.visible=!1)),"Y"===r.axis&&(Wd.setFromEuler(rf.set(0,0,Math.PI/2)),t.quaternion.copy(n).multiply(Wd),.9<Math.abs(nf.copy(pf).applyQuaternion(n).dot(r.eye))&&(t.visible=!1)),"Z"===r.axis&&(Wd.setFromEuler(rf.set(0,Math.PI/2,0)),t.quaternion.copy(n).multiply(Wd),.9<Math.abs(nf.copy(df).applyQuaternion(n).dot(r.eye))&&(t.visible=!1)),"XYZE"===r.axis&&(Wd.setFromEuler(rf.set(0,Math.PI/2,0)),nf.copy(r.rotationAxis),t.quaternion.setFromRotationMatrix(af.lookAt(of,nf,pf)),t.quaternion.multiply(Wd),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),Qd.set(1e-10,1e-10,1e-10).add(r.worldPositionStart).sub(r.worldPosition).multiplyScalar(-1),Qd.applyQuaternion(r.worldQuaternionStart.clone().invert()),t.scale.copy(Qd),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(nf.copy(hf).applyQuaternion(n).dot(r.eye))&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"Y"===t.name&&.99<Math.abs(nf.copy(pf).applyQuaternion(n).dot(r.eye))&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"Z"===t.name&&.99<Math.abs(nf.copy(df).applyQuaternion(n).dot(r.eye))&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"XY"===t.name&&Math.abs(nf.copy(df).applyQuaternion(n).dot(r.eye))<.2&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"YZ"===t.name&&Math.abs(nf.copy(hf).applyQuaternion(n).dot(r.eye))<.2&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"XZ"===t.name&&Math.abs(nf.copy(pf).applyQuaternion(n).dot(r.eye))<.2&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1)):"rotate"===r.mode&&(sf.copy(n),nf.copy(r.eye).applyQuaternion(Wd.copy(n).invert()),-1!==t.name.search("E")&&t.quaternion.setFromRotationMatrix(af.lookAt(r.eye,of,pf)),"X"===t.name&&(Wd.setFromAxisAngle(hf,Math.atan2(-nf.y,nf.z)),Wd.multiplyQuaternions(sf,Wd),t.quaternion.copy(Wd)),"Y"===t.name&&(Wd.setFromAxisAngle(pf,Math.atan2(nf.x,nf.z)),Wd.multiplyQuaternions(sf,Wd),t.quaternion.copy(Wd)),"Z"===t.name&&(Wd.setFromAxisAngle(df,Math.atan2(nf.y,nf.x)),Wd.multiplyQuaternions(sf,Wd),t.quaternion.copy(Wd))),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);jd(Vd(t.prototype),"updateMatrixWorld",this).call(this,e)}}]),t}(),yf=(gf.prototype.isTransformControlsGizmo=!0,function(){Hd(t,h.Mesh);var e=zd(t);function t(){var r;return kd(this,t),(r=e.call(this,new h.PlaneGeometry(1e5,1e5,2,2),new h.MeshBasicMaterial({visible:!1,wireframe:!0,side:h.DoubleSide,transparent:!0,opacity:.1,toneMapped:!1}))).type="TransformControlsPlane",r}return Gd(t,[{key:"updateMatrixWorld",value:function(e){var r=this.space;switch(this.position.copy(this.worldPosition),"scale"===this.mode&&(r="local"),ff.copy(hf).applyQuaternion("local"===r?this.worldQuaternion:lf),mf.copy(pf).applyQuaternion("local"===r?this.worldQuaternion:lf),vf.copy(df).applyQuaternion("local"===r?this.worldQuaternion:lf),nf.copy(mf),this.mode){case"translate":case"scale":switch(this.axis){case"X":nf.copy(this.eye).cross(ff),uf.copy(ff).cross(nf);break;case"Y":nf.copy(this.eye).cross(mf),uf.copy(mf).cross(nf);break;case"Z":nf.copy(this.eye).cross(vf),uf.copy(vf).cross(nf);break;case"XY":uf.copy(vf);break;case"YZ":uf.copy(ff);break;case"XZ":nf.copy(vf),uf.copy(mf);break;case"XYZ":case"E":uf.set(0,0,0)}break;default:uf.set(0,0,0)}0===uf.length()?this.quaternion.copy(this.cameraQuaternion):(cf.lookAt(Qd.set(0,0,0),uf,nf),this.quaternion.setFromRotationMatrix(cf)),jd(Vd(t.prototype),"updateMatrixWorld",this).call(this,e)}}]),t}());yf.prototype.isTransformControlsPlane=!0;class bf extends Ou{constructor(e,t){super(e,t),this.transGizmo=this.children[0],this.scaleCoefficient=new h.Vector3,this.beginScale=new h.Vector3,this.posStart=new h.Vector2,this.posEnd=new h.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 xf{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 h.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 y.Vector3,this.transControlsStatusMap={position:"translate",rotation:"rotate",scale:"scale"},this.multipObj=null,this.worldOldVal=new y.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=po(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=po(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=po(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=po(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 bf(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 y.GridHelper(20,10);return e.name="helper",e.position.y=0,e.material.opacity=.75,e.material.transparent=!0,e}dispose(){}reset(){"running"!==this.runScene.optionsEx.options.mode&&this.transContro.reset()}isHelper(e){return"GridHelper"===e.type||"CubeCamera"===e.type||e.isTransformControls||e.userData.isHelper}setHelper(e,t=!1,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)}}var wf=a(185);class Af{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,wf.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.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.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.cb.model.unFocus.cb(e)})),this.setBoxHelperEmpty(),this.selectors={}}createGroup(){this.runScene.helperEx.unfocus(),this.runScene.modelEx.selectNull();var e=new h.Group;const t=new h.Group;this.runScene.modelEx.add(e,void 0,{addUndo:!1}),this.runScene.modelEx.add(t);var r=[...this.getSelectedList("value")],n=(this.runScene.cb.model.multipDrop.cb({models:this.getSelectedList("value"),dropModel:e}),La().group.getCenter(e));t.position.copy(n),this.runScene.cb.model.multipDrop.cb({models:r,dropModel:t}),this.runScene.modelEx.remove(e,!1),this.runScene.modelEx.select=t}getSelectorGroup(){const e=this.getSelectedList("value"),t=new h.Group;return e.forEach((e=>t.add(e.clone()))),this.setEmpty(),t}}function Sf(){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 Sf.Panel("FPS","#0ff","#002")),u=r(new Sf.Panel("MS","#0f0","#020"));return self.performance&&self.performance.memory&&(i=r(new Sf.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}}Sf.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,g){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/g)*f))}}};const Bf=Sf;class Mf{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,renderMode:"tick",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}init(e){this.options=_n(this.options,e||{}),this.options.showFps&&(this.addFps(),this.runScene.cb.render.add("optionx-ex-render",this.render.bind(this)))}addFps(){this.stats=Bf(),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.runScene.cb.baseLog.cb({msg:e,type:r}),console.log(e))}}class Cf extends Map{toJSON(){const e={};return this.forEach(((t,r)=>{e[t]=r})),e}}class Tf extends p{constructor(e){super(e),this.map=new Cf,this.renderName="script-texture-render",this.bindEvent()}parse(e,t){var r=js(t);0===Object.keys(e).length?this.map.has(r)&&this.map.delete(r):this.map.set(r,{texture:t,uvScript:e})}bindEvent(){this.runScene.cb.texture.setAnima.add("script-texture-set-anima",(({uvScript:e,texture:t})=>this.parse(e,t))),this.runScene.cb.texture.add.add("script-texture-add-texture",(e=>{var t=e.userData.uvScript;t&&this.parse(t,e)}))}playAll(){this.runScene.cb.render.add(this.renderName,(()=>{this.map.forEach((e=>{const{texture:t,uvScript:r}=e;var{moveX:e,moveY:n,rotate:i}=r;e&&(t.offset.x+=e),n&&(t.offset.y+=n),i&&(t.rotation+=i)}))}))}closeAll(){this.map.forEach((e=>{const{texture:t,uvScript:r}=e;var{moveX:e,moveY:n,rotate:i}=r;0!==e&&(t.offset.x=0),0!==n&&(t.offset.y=0),0!==i&&(t.rotation=0)})),this.runScene.cb.render.delete(this.renderName)}}class Ef extends p{constructor(e){super(e),this.runAll=!1,this.texture=new Tf(e)}playAll(){this.runAll||(this.runAll=!0,this.texture.playAll())}closeAll(){this.runAll&&(this.runAll=!1,this.texture.closeAll())}}class _f{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=_f.isNotNow(e)?this.getAllData():e,(0,c.js)(n,((r,n)=>{void 0!==e[r]&&("number"===(n=n.type)?(i[r]=t[r],o[r]=e[r]):"color"===n&&(0,c.js)(e[r],((e,n)=>{var a=r+e;i[a]=t[r][e],o[a]=n})))})),!(0,c.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,ka.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 h=r,p=l,d=u,f=o;const t={color(e){const{animaData:t,defType:r}=e,n={};(0,c.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,wf.isTrue)(e)&&(0,wf.isTrue)(i)&&(0,wf.isTrue)(o))return n}};return()=>{let r;return{promise:new Promise((n=>{var i;if(!(i=e(p,h,0,f)))return n(0);var{begin:i,end:o}=i;return r=ln(i,o,d,(e=>{(0,c.js)(f,((r,n)=>{n=n.type;var i,o=e[r];"number"===n?h[r]=o:"color"===n&&(o=t.color({animaData:e,defType:r}))&&(({r:n,g:o,b:i}=o),h[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,c.js)(e,(i=>{n[i]=r?"notNow":_f.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?La().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 _f.getAllDefValByType(this.defOptions,this.target,e)}getData(e){return _f.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){_f.setTargetByBetween(e,t,r,this.defOptions,this.target)}clone(e){var{data:t,type:r}=this;const n=new(0,Rf[r])(e);return n.data=t,n}reset(){(0,c.js)(this.defOptions,((e,t)=>{_f.SetTargetByData({baseType:t.type,data:_f.getValByType(this.beginData,e,this.defOptions),target:this.target,defType:e})}))}remove(){delete this.target.userData.isTimeLineUsed}}_f.setTargetByBetween=(()=>{const e=(e,t,r)=>e!==t?(t-e)*r+e:e;return(t,r,n,i,o)=>{(0,c.js)(i,((i,a)=>{var s,l,u,c,h,p;a=a.type,void 0!==t[i]&&void 0!==r[i]&&_f.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 Df=_f,Rf={model:class extends Df{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}=Df.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,ka.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=ln(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 Df{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}=Df.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=ln(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:ln}};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,ka.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":La().model.v3ToMap(t),scale:e?"notNow":La().model.v3ToMap(r),rotation:e?"notNow":La().model.v3ToMap(n),target:e?"notNow":La().model.v3ToMap(this.controls.target)}}getData(e){var{position:t,scale:r,rotation:n}=this.target;let i;if("position"===e)i=La().model.v3ToMap(t);else if("scale"===e)i=La().model.v3ToMap(r);else if("rotation"===e)i=La().model.v3ToMap(n);else{if("target"!==e)throw TypeError("输入值不存在");i=La().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 Df{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)}}},Pf={RunScene:class{constructor(e){this.cb=new Jl,this.script=new Ef(this),this.uniqueEx=new Gs(this),this.fileEx=new Id(this),this.optionsEx=new Mf(this),this.undoEx=new ja(this),this.textureEx=new B(this),this.controlsEx=new tu,this.assetsEx=new ll(this),this.renderEx=new Bs(this),this.events=new class{constructor(e){this.key=new nu(this),this.mouse=new iu(this),this.drag=new ru(this),this.mouseEventMap={move:{timeLineMove:e=>{}},down:{},up:{timeLineUp:e=>{}}},this.mouseDown=e=>{},this.mouseUp=e=>{this.runScene.cb.events.mouse.up.cb(e),Object.values(this.mouseEventMap.up).map((t=>t(e)))},this.mouseMove=e=>{this.runScene.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.cb.resize.cb(""))),window.addEventListener("mousemove",this.mouseMove),window.addEventListener("mousedown",this.mouseDown),window.addEventListener("mouseup",this.mouseUp)}}(this),this.multipSelector=new Af(this),this.helperEx=null,this.materialEx=new fs(this),this.cameraEx=new Vl(this),this.sceneEx=new Es(this),this.modelEx=new Hs(this),this.loaderer=new ol(this),this.exporter=new Bc(this),this.lightEx=new xu(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.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.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.cb.timeLine.setProgress.cb(0),Object.values(t.data).map((e=>e.reset())))}getSavedData(){return(0,c.js)(this.groupMap,((e,t)=>{t.run=!1})),this.groupMap}parseSavedGroupMap(e){Object.keys(e).map((t=>{const r=e[t],n={};(0,c.js)(r.data,((e,t)=>{var{type:t,data:r}=t;const i=Rf[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.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,ka.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.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 sl(this),this.globalConfig=new Fd(this),this.bloom={glow:new Nl(this)},this.render=()=>{var e;if(null!=(e=this.optionsEx.options)&&e.run){const{render2:e,render3:t,scene:r,camera:n}=this.assetsEx;this.cb.render.cb(""),this.bloom.glow.update(),null!=t&&t.render(r,n),null!=e&&e.render(r,n)}};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,loadConfig:r}=e;this.events.init(t),this.assetsEx.init(t),this.globalConfig.setRenderMode(this.optionsEx.options.renderMode),this.helperEx=new xf(this);const{camera:n,controls:i}=this.assetsEx.get();this.uniqueEx.model.add(n),this.renderEx.setSize(),i.update(),this.bloom.glow.init(this.assetsEx.get()),this.cb.inited.cb(0),this.cameraEx.reset(n),this.loadScene(e,r)}loadScene(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=Object.assign(Object.assign({},t),{triggerCb:!0});if(e instanceof ArrayBuffer)return this.optionsEx.log("正在解析二进制文件","base","info"),this.loaderer.gltf.parse(e,r);this.optionsEx.log("正在拉取场景","base","info");var n=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.cb.load.progress.cb(t)}}).then((e=>e.data)).catch((e=>{this.sceneEx.clean(),this.optionsEx.log("下载场景失败:",e)}));return n?(this.cb.load.getArrayBuffer.cb(n),this.optionsEx.log("拉取场景成功、正在解析","base","success"),this.loaderer.gltf.parse(n,r)):void 0}))}dispose(){this.assetsEx.dispose(),this.sceneEx.clean()}on(e,t){return null!=(e=this.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,!0),this.bloom.glow.setSize(e,t)}},Utils:t,ModelEx:n,MaterialEx:r,TextureEx:e,Bus:class{constructor(){this.list={}}on(e,t){this.list[e]=t}emit(...e){if(void 0===this.list[e[0]])throw Error("请先挂载在使用");return this.list[e[0]](...[...e].filter(((e,t)=>0!==t)))}off(e){this.list[e]&&delete this.list[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}));
|