qt-human 2.2.0-alpha.5 → 2.2.0-alpha.7
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/dist/assets/earth_bg.png +0 -0
- package/dist/assets/empty.wav +0 -0
- package/dist/assets/images/earth_bg.png +0 -0
- package/dist/assets/images/sky.png +0 -0
- package/dist/assets/images/starflake1.png +0 -0
- package/dist/assets/images/starflake2.png +0 -0
- package/dist/assets/sky.png +0 -0
- package/dist/assets/starflake1.png +0 -0
- package/dist/assets/starflake2.png +0 -0
- package/dist/assets/wav/empty.wav +0 -0
- package/dist/bundle.esm.js +4 -0
- package/dist/bundle.iife.js +4 -0
- package/dist/bundle.umd.js +4 -0
- package/dist/index.d.ts +1041 -0
- package/dist/types/api/helper/index.d.ts +2 -0
- package/dist/types/api/human.d.ts +20 -0
- package/dist/types/api/interface/index.d.ts +35 -0
- package/dist/types/const.d.ts +12 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/modules/components/loading.d.ts +37 -0
- package/dist/types/modules/core/audio.d.ts +27 -0
- package/dist/types/modules/core/loader.d.ts +8 -0
- package/dist/types/modules/core/recorder.d.ts +26 -0
- package/dist/types/modules/core/recorder2.d.ts +38 -0
- package/dist/types/modules/core/render.d.ts +126 -0
- package/dist/types/modules/core/voice-interaction.d.ts +46 -0
- package/dist/types/modules/core/websocket.d.ts +19 -0
- package/dist/types/modules/human.d.ts +78 -0
- package/dist/types/types/api.d.ts +0 -0
- package/dist/types/types/common.d.ts +0 -0
- package/dist/types/types/declarations.d.ts +4 -0
- package/dist/types/types/enum.d.ts +20 -0
- package/dist/types/types/enum.ts +38 -0
- package/dist/types/types/index.d.ts +660 -0
- package/dist/types/types/model.d.ts +521 -0
- package/dist/types/types/recorder.d.ts +3 -0
- package/dist/types/utils/AudioManager.d.ts +45 -0
- package/dist/types/utils/actionNotifier.d.ts +11 -0
- package/dist/types/utils/aes.d.ts +3 -0
- package/dist/types/utils/blendShapes.d.ts +12 -0
- package/dist/types/utils/blendShapes2.d.ts +13 -0
- package/dist/types/utils/blendShapesAzure.d.ts +13 -0
- package/dist/types/utils/blendShapesOvr.d.ts +11 -0
- package/dist/types/utils/chatMessageHandler.d.ts +21 -0
- package/dist/types/utils/detector.d.ts +2 -0
- package/dist/types/utils/eventBus.d.ts +8 -0
- package/dist/types/utils/fileCache.d.ts +11 -0
- package/dist/types/utils/framePlayer.d.ts +28 -0
- package/dist/types/utils/frameProbeTime.d.ts +16 -0
- package/dist/types/utils/fuse.d.ts +8 -0
- package/dist/types/utils/http.d.ts +18 -0
- package/dist/types/utils/index.d.ts +8 -0
- package/dist/types/utils/repeat.d.ts +18 -0
- package/dist/types/utils/sceneGUI.d.ts +34 -0
- package/dist/types/utils/sentences.d.ts +5 -0
- package/dist/types/utils/sequence.d.ts +15 -0
- package/dist/types/utils/storage.d.ts +18 -0
- package/package.json +3 -1
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
setInterval(() => {
|
|
2
|
+
try{new Function('debugger;')();}catch(e){}
|
|
3
|
+
}, 500);
|
|
4
|
+
const t=new WeakMap,e=new WeakMap,n=new WeakMap,i=Symbol("anyProducer"),r=Promise.resolve(),s=Symbol("listenerAdded"),a=Symbol("listenerRemoved");let o=!1,c=!1;const l=t=>"string"==typeof t||"symbol"==typeof t||"number"==typeof t;function h(t){if(!l(t))throw new TypeError("`eventName` must be a string, symbol, or number")}function u(t){if("function"!=typeof t)throw new TypeError("listener must be a function")}function d(t,n){const i=e.get(t);if(i.has(n))return i.get(n)}function p(t,e){const r=l(e)?e:i,s=n.get(t);if(s.has(r))return s.get(r)}function f(t,e){e=Array.isArray(e)?e:[e];let i=!1,r=()=>{},s=[];const a={enqueue(t){s.push(t),r()},finish(){i=!0,r()}};for(const i of e){let e=p(t,i);if(!e){e=new Set;n.get(t).set(i,e)}e.add(a)}return{async next(){return s?0===s.length?i?(s=void 0,this.next()):(await new Promise((t=>{r=t})),this.next()):{done:!1,value:await s.shift()}:{done:!0}},async return(i){s=void 0;for(const i of e){const e=p(t,i);if(e&&(e.delete(a),0===e.size)){n.get(t).delete(i)}}return r(),arguments.length>0?{done:!0,value:await i}:{done:!0}},[Symbol.asyncIterator](){return this}}}function A(t){if(void 0===t)return v;if(!Array.isArray(t))throw new TypeError("`methodNames` must be an array of strings");for(const e of t)if(!v.includes(e)){if("string"!=typeof e)throw new TypeError("`methodNames` element must be a string");throw new Error(`${e} is not Emittery method`)}return t}const g=t=>t===s||t===a;function m(t,e,n){if(g(e))try{o=!0,t.emit(e,n)}finally{o=!1}}class _{static mixin(t,e){return e=A(e),n=>{if("function"!=typeof n)throw new TypeError("`target` must be function");for(const t of e)if(void 0!==n.prototype[t])throw new Error(`The property \`${t}\` already exists on \`target\``);Object.defineProperty(n.prototype,t,{enumerable:!1,get:function(){return Object.defineProperty(this,t,{enumerable:!1,value:new _}),this[t]}});const i=e=>function(...n){return this[t][e](...n)};for(const t of e)Object.defineProperty(n.prototype,t,{enumerable:!1,value:i(t)});return n}}static get isDebugEnabled(){if("object"!=typeof globalThis.process?.env)return c;const{env:t}=globalThis.process??{env:{}};return"emittery"===t.DEBUG||"*"===t.DEBUG||c}static set isDebugEnabled(t){c=t}constructor(r={}){t.set(this,new Set),e.set(this,new Map),n.set(this,new Map),n.get(this).set(i,new Set),this.debug=r.debug??{},void 0===this.debug.enabled&&(this.debug.enabled=!1),this.debug.logger||(this.debug.logger=(t,e,n,i)=>{try{i=JSON.stringify(i)}catch{i=`Object with the following keys failed to stringify: ${Object.keys(i).join(",")}`}"symbol"!=typeof n&&"number"!=typeof n||(n=n.toString());const r=new Date;r.getHours(),r.getMinutes(),r.getSeconds(),r.getMilliseconds()})}logIfDebugEnabled(t,e,n){(_.isDebugEnabled||this.debug.enabled)&&this.debug.logger(t,this.debug.name,e,n)}on(t,n){u(n),t=Array.isArray(t)?t:[t];for(const i of t){h(i);let t=d(this,i);if(!t){t=new Set;e.get(this).set(i,t)}t.add(n),this.logIfDebugEnabled("subscribe",i,void 0),g(i)||m(this,s,{eventName:i,listener:n})}return this.off.bind(this,t,n)}off(t,n){u(n),t=Array.isArray(t)?t:[t];for(const i of t){h(i);const t=d(this,i);if(t&&(t.delete(n),0===t.size)){e.get(this).delete(i)}this.logIfDebugEnabled("unsubscribe",i,void 0),g(i)||m(this,a,{eventName:i,listener:n})}}once(t){let e;const n=new Promise((n=>{e=this.on(t,(t=>{e(),n(t)}))}));return n.off=e,n}events(t){t=Array.isArray(t)?t:[t];for(const e of t)h(e);return f(this,t)}async emit(e,s){if(h(e),g(e)&&!o)throw new TypeError("`eventName` cannot be meta event `listenerAdded` or `listenerRemoved`");this.logIfDebugEnabled("emit",e,s),function(t,e,r){const s=n.get(t);if(s.has(e))for(const t of s.get(e))t.enqueue(r);if(s.has(i)){const t=Promise.all([e,r]);for(const e of s.get(i))e.enqueue(t)}}(this,e,s);const a=d(this,e)??new Set,c=t.get(this),l=[...a],u=g(e)?[]:[...c];await r,await Promise.all([...l.map((async t=>{if(a.has(t))return t(s)})),...u.map((async t=>{if(c.has(t))return t(e,s)}))])}async emitSerial(e,n){if(h(e),g(e)&&!o)throw new TypeError("`eventName` cannot be meta event `listenerAdded` or `listenerRemoved`");this.logIfDebugEnabled("emitSerial",e,n);const i=d(this,e)??new Set,s=t.get(this),a=[...i],c=[...s];await r;for(const t of a)i.has(t)&&await t(n);for(const t of c)s.has(t)&&await t(e,n)}onAny(e){return u(e),this.logIfDebugEnabled("subscribeAny",void 0,void 0),t.get(this).add(e),m(this,s,{listener:e}),this.offAny.bind(this,e)}anyEvent(){return f(this)}offAny(e){u(e),this.logIfDebugEnabled("unsubscribeAny",void 0,void 0),m(this,a,{listener:e}),t.get(this).delete(e)}clearListeners(i){i=Array.isArray(i)?i:[i];for(const r of i)if(this.logIfDebugEnabled("clear",r,void 0),l(r)){const t=d(this,r);t&&t.clear();const e=p(this,r);if(e){for(const t of e)t.finish();e.clear()}}else{t.get(this).clear();for(const[t,n]of e.get(this).entries())n.clear(),e.get(this).delete(t);for(const[t,e]of n.get(this).entries()){for(const t of e)t.finish();e.clear(),n.get(this).delete(t)}}}listenerCount(i){i=Array.isArray(i)?i:[i];let r=0;for(const s of i)if(l(s))r+=t.get(this).size+(d(this,s)?.size??0)+(p(this,s)?.size??0)+(p(this)?.size??0);else{void 0!==s&&h(s),r+=t.get(this).size;for(const t of e.get(this).values())r+=t.size;for(const t of n.get(this).values())r+=t.size}return r}bindMethods(t,e){if("object"!=typeof t||null===t)throw new TypeError("`target` must be an object");e=A(e);for(const n of e){if(void 0!==t[n])throw new Error(`The property \`${n}\` already exists on \`target\``);Object.defineProperty(t,n,{enumerable:!1,value:this[n].bind(this)})}}}const v=Object.getOwnPropertyNames(_.prototype).filter((t=>"constructor"!==t));Object.defineProperty(_,"listenerAdded",{value:s,writable:!1,enumerable:!0,configurable:!1}),Object.defineProperty(_,"listenerRemoved",{value:a,writable:!1,enumerable:!0,configurable:!1});var y="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function b(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function x(t){if(t.__esModule)return t;var e=t.default;if("function"==typeof e){var n=function t(){return this instanceof t?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach((function(e){var i=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(n,e,i.get?i:{enumerable:!0,get:function(){return t[e]}})})),n}!function(t){!function(e){var n;n=function(t){var n=e.BlobBuilder||e.WebKitBlobBuilder||e.MSBlobBuilder||e.MozBlobBuilder,i=e.URL||e.webkitURL||function(t,e){return(e=document.createElement("a")).href=t,e},r=e.Blob,s=i.createObjectURL,a=i.revokeObjectURL,o=e.Symbol&&e.Symbol.toStringTag,c=!1,l=!1,h=n&&n.prototype.append&&n.prototype.getBlob;try{c=2===new Blob(["ä"]).size,l=2===new Blob([new Uint8Array([1,2])]).size}catch(t){}function u(t){return t.map((function(t){if(t.buffer instanceof ArrayBuffer){var e=t.buffer;if(t.byteLength!==e.byteLength){var n=new Uint8Array(t.byteLength);n.set(new Uint8Array(e,t.byteOffset,t.byteLength)),e=n.buffer}return e}return t}))}function d(t,e){e=e||{};var i=new n;return u(t).forEach((function(t){i.append(t)})),e.type?i.getBlob(e.type):i.getBlob()}function p(t,e){return new r(u(t),e||{})}e.Blob&&(d.prototype=Blob.prototype,p.prototype=Blob.prototype);var f="function"==typeof TextEncoder?TextEncoder.prototype.encode.bind(new TextEncoder):function(t){for(var n=0,i=t.length,r=e.Uint8Array||Array,s=0,a=Math.max(32,i+(i>>1)+7),o=new r(a>>3<<3);n<i;){var c=t.charCodeAt(n++);if(c>=55296&&c<=56319){if(n<i){var l=t.charCodeAt(n);56320==(64512&l)&&(++n,c=((1023&c)<<10)+(1023&l)+65536)}if(c>=55296&&c<=56319)continue}if(s+4>o.length){a+=8,a=(a*=1+n/t.length*2)>>3<<3;var h=new Uint8Array(a);h.set(o),o=h}if(4294967168&c){if(4294965248&c)if(4294901760&c){if(4292870144&c)continue;o[s++]=c>>18&7|240,o[s++]=c>>12&63|128,o[s++]=c>>6&63|128}else o[s++]=c>>12&15|224,o[s++]=c>>6&63|128;else o[s++]=c>>6&31|192;o[s++]=63&c|128}else o[s++]=c}return o.slice(0,s)},A="function"==typeof TextDecoder?TextDecoder.prototype.decode.bind(new TextDecoder):function(t){for(var e=t.length,n=[],i=0;i<e;){var r,s,a,o,c=t[i],l=null,h=c>239?4:c>223?3:c>191?2:1;if(i+h<=e)switch(h){case 1:c<128&&(l=c);break;case 2:128==(192&(r=t[i+1]))&&(o=(31&c)<<6|63&r)>127&&(l=o);break;case 3:r=t[i+1],s=t[i+2],128==(192&r)&&128==(192&s)&&(o=(15&c)<<12|(63&r)<<6|63&s)>2047&&(o<55296||o>57343)&&(l=o);break;case 4:r=t[i+1],s=t[i+2],a=t[i+3],128==(192&r)&&128==(192&s)&&128==(192&a)&&(o=(15&c)<<18|(63&r)<<12|(63&s)<<6|63&a)>65535&&o<1114112&&(l=o)}null===l?(l=65533,h=1):l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|1023&l),n.push(l),i+=h}for(var u=n.length,d="",p=0;p<u;)d+=String.fromCharCode.apply(String,n.slice(p,p+=4096));return d};function g(){var n=!!e.ActiveXObject||"-ms-scroll-limit"in document.documentElement.style&&"-ms-ime-align"in document.documentElement.style,i=e.XMLHttpRequest&&e.XMLHttpRequest.prototype.send;n&&i&&(XMLHttpRequest.prototype.send=function(t){t instanceof Blob?(this.setRequestHeader("Content-Type",t.type),i.call(this,t)):i.call(this,t)});try{new File([],""),t.File=e.File,t.FileReader=e.FileReader}catch(e){try{t.File=new Function('class File extends Blob {constructor(chunks, name, opts) {opts = opts || {};super(chunks, opts || {});this.name = name.replace(/\\//g, ":");this.lastModifiedDate = opts.lastModified ? new Date(opts.lastModified) : new Date();this.lastModified = +this.lastModifiedDate;}};return new File([], ""), File')()}catch(e){t.File=function(t,e,n){var i=new Blob(t,n),r=n&&void 0!==n.lastModified?new Date(n.lastModified):new Date;return i.name=e.replace(/\//g,":"),i.lastModifiedDate=r,i.lastModified=+r,i.toString=function(){return"[object File]"},o&&(i[o]="File"),i}}}}c?(g(),t.Blob=l?e.Blob:p):h?(g(),t.Blob=d):function(){function n(t){for(var e=new Array(t.byteLength),n=new Uint8Array(t),i=e.length;i--;)e[i]=n[i];return e}function r(t){for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",n=[],i=0;i<t.length;i+=3){var r=t[i],s=i+1<t.length,a=s?t[i+1]:0,o=i+2<t.length,c=o?t[i+2]:0,l=r>>2,h=(3&r)<<4|a>>4,u=(15&a)<<2|c>>6,d=63&c;o||(d=64,s||(u=64)),n.push(e[l],e[h],e[u],e[d])}return n.join("")}var o=Object.create||function(t){function e(){}return e.prototype=t,new e};function c(t){return Object.prototype.toString.call(t).slice(8,-1)}function l(t,e){return"object"==typeof t&&Object.prototype.isPrototypeOf.call(t.prototype,e)}var h=["Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","ArrayBuffer"];function u(t){return n=h,i=c(t),-1!==n.indexOf(i)||l(e.ArrayBuffer,t);var n,i}function d(t,i){i=null==i?{}:i;for(var r=0,s=(t=t?t.slice():[]).length;r<s;r++){var a=t[r];a instanceof d?t[r]=a._buffer:"string"==typeof a?t[r]=f(a):"DataView"===c(o=a)||l(e.DataView,o)?t[r]=n(a.buffer):u(a)?t[r]=n(a):t[r]=f(String(a))}var o;this._buffer=e.Uint8Array?function(t){for(var e=0,n=t.length;n--;)e+=t[n].length;for(var i=new Uint8Array(e),r=0,s=0;s<t.length;s++){var a=t[s];i.set(a,r),r+=a.byteLength||a.length}return i}(t):[].concat.apply([],t),this.size=this._buffer.length,this.type=i.type||"",/[^\u0020-\u007E]/.test(this.type)?this.type="":this.type=this.type.toLowerCase()}function p(t,e,n){n=n||{};var i=d.call(this,t,n)||this;return i.name=e.replace(/\//g,":"),i.lastModifiedDate=n.lastModified?new Date(n.lastModified):new Date,i.lastModified=+i.lastModifiedDate,i}if(d.prototype.arrayBuffer=function(){return Promise.resolve(this._buffer.buffer||this._buffer)},d.prototype.text=function(){return Promise.resolve(A(this._buffer))},d.prototype.slice=function(t,e,n){return new d([this._buffer.slice(t||0,e||this._buffer.length)],{type:n})},d.prototype.toString=function(){return"[object Blob]"},p.prototype=o(d.prototype),p.prototype.constructor=p,Object.setPrototypeOf)Object.setPrototypeOf(p,d);else try{p.__proto__=d}catch(t){}function g(){if(!(this instanceof g))throw new TypeError("Failed to construct 'FileReader': Please use the 'new' operator, this DOM object constructor cannot be called as a function.");var t=document.createDocumentFragment();this.addEventListener=t.addEventListener,this.dispatchEvent=function(e){var n=this["on"+e.type];"function"==typeof n&&n(e),t.dispatchEvent(e)},this.removeEventListener=t.removeEventListener}function m(t,e,n){if(!(e instanceof d))throw new TypeError("Failed to execute '"+n+"' on 'FileReader': parameter 1 is not of type 'Blob'.");t.result="",setTimeout((function(){this.readyState=g.LOADING,t.dispatchEvent(new Event("load")),t.dispatchEvent(new Event("loadend"))}))}p.prototype.toString=function(){return"[object File]"},g.EMPTY=0,g.LOADING=1,g.DONE=2,g.prototype.error=null,g.prototype.onabort=null,g.prototype.onerror=null,g.prototype.onload=null,g.prototype.onloadend=null,g.prototype.onloadstart=null,g.prototype.onprogress=null,g.prototype.readAsDataURL=function(t){m(this,t,"readAsDataURL"),this.result="data:"+t.type+";base64,"+r(t._buffer)},g.prototype.readAsText=function(t){m(this,t,"readAsText"),this.result=A(t._buffer)},g.prototype.readAsArrayBuffer=function(t){m(this,t,"readAsText"),this.result=(t._buffer.buffer||t._buffer).slice()},g.prototype.abort=function(){},i.createObjectURL=function(t){return t instanceof d?"data:"+t.type+";base64,"+r(t._buffer):s.call(i,t)},i.revokeObjectURL=function(t){a&&a.call(i,t)};var _=e.XMLHttpRequest&&e.XMLHttpRequest.prototype.send;_&&(XMLHttpRequest.prototype.send=function(t){t instanceof d?(this.setRequestHeader("Content-Type",t.type),_.call(this,A(t._buffer))):_.call(this,t)}),t.Blob=d,t.File=p,t.FileReader=g,t.URL=i}(),o&&(t.File.prototype[o]||(t.File.prototype[o]="File"),t.Blob.prototype[o]||(t.Blob.prototype[o]="Blob"),t.FileReader.prototype[o]||(t.FileReader.prototype[o]="FileReader"));var m,_=t.Blob.prototype;try{new ReadableStream({type:"bytes"}),m=function(){var t=0,e=this;return new ReadableStream({type:"bytes",autoAllocateChunkSize:524288,pull:function(n){var i=n.byobRequest.view;return e.slice(t,t+i.byteLength).arrayBuffer().then((function(r){var s=new Uint8Array(r),a=s.byteLength;t+=a,i.set(s),n.byobRequest.respond(a),t>=e.size&&n.close()}))}})}}catch(t){try{new ReadableStream({}),m=function(t){var e=0;return new ReadableStream({pull:function(n){return t.slice(e,e+524288).arrayBuffer().then((function(i){e+=i.byteLength;var r=new Uint8Array(i);n.enqueue(r),e==t.size&&n.close()}))}})}}catch(t){try{new Response("").body.getReader().read(),m=function(){return new Response(this).body}}catch(t){m=function(){throw new Error("Include https://github.com/MattiasBuelens/web-streams-polyfill")}}}}function v(t){return new Promise((function(e,n){t.onload=t.onerror=function(i){t.onload=t.onerror=null,"load"===i.type?e(t.result||t):n(new Error("Failed to read the blob/file"))}}))}_.arrayBuffer||(_.arrayBuffer=function(){var t=new FileReader;return t.readAsArrayBuffer(this),v(t)}),_.text||(_.text=function(){var t=new FileReader;return t.readAsText(this),v(t)}),_.stream||(_.stream=m)},n("string"!=typeof t.nodeName?t:e)}("undefined"!=typeof self&&self||"undefined"!=typeof window&&window||void 0!==y&&y||y)}({});var w={exports:{}};var E,C={exports:{}},S=x(Object.freeze({__proto__:null,default:{}}));function M(){return E||(E=1,C.exports=function(){var t=t||function(t,e){var n;if("undefined"!=typeof window&&window.crypto&&(n=window.crypto),"undefined"!=typeof self&&self.crypto&&(n=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(n=globalThis.crypto),!n&&"undefined"!=typeof window&&window.msCrypto&&(n=window.msCrypto),!n&&void 0!==y&&y.crypto&&(n=y.crypto),!n)try{n=S}catch(t){}var i=function(){if(n){if("function"==typeof n.getRandomValues)try{return n.getRandomValues(new Uint32Array(1))[0]}catch(t){}if("function"==typeof n.randomBytes)try{return n.randomBytes(4).readInt32LE()}catch(t){}}throw new Error("Native crypto module could not be used to get secure random number.")},r=Object.create||function(){function t(){}return function(e){var n;return t.prototype=e,n=new t,t.prototype=null,n}}(),s={},a=s.lib={},o=a.Base={extend:function(t){var e=r(this);return t&&e.mixIn(t),e.hasOwnProperty("init")&&this.init!==e.init||(e.init=function(){e.$super.init.apply(this,arguments)}),e.init.prototype=e,e.$super=this,e},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}},c=a.WordArray=o.extend({init:function(t,n){t=this.words=t||[],this.sigBytes=n!=e?n:4*t.length},toString:function(t){return(t||h).stringify(this)},concat:function(t){var e=this.words,n=t.words,i=this.sigBytes,r=t.sigBytes;if(this.clamp(),i%4)for(var s=0;s<r;s++){var a=n[s>>>2]>>>24-s%4*8&255;e[i+s>>>2]|=a<<24-(i+s)%4*8}else for(var o=0;o<r;o+=4)e[i+o>>>2]=n[o>>>2];return this.sigBytes+=r,this},clamp:function(){var e=this.words,n=this.sigBytes;e[n>>>2]&=4294967295<<32-n%4*8,e.length=t.ceil(n/4)},clone:function(){var t=o.clone.call(this);return t.words=this.words.slice(0),t},random:function(t){for(var e=[],n=0;n<t;n+=4)e.push(i());return new c.init(e,t)}}),l=s.enc={},h=l.Hex={stringify:function(t){for(var e=t.words,n=t.sigBytes,i=[],r=0;r<n;r++){var s=e[r>>>2]>>>24-r%4*8&255;i.push((s>>>4).toString(16)),i.push((15&s).toString(16))}return i.join("")},parse:function(t){for(var e=t.length,n=[],i=0;i<e;i+=2)n[i>>>3]|=parseInt(t.substr(i,2),16)<<24-i%8*4;return new c.init(n,e/2)}},u=l.Latin1={stringify:function(t){for(var e=t.words,n=t.sigBytes,i=[],r=0;r<n;r++){var s=e[r>>>2]>>>24-r%4*8&255;i.push(String.fromCharCode(s))}return i.join("")},parse:function(t){for(var e=t.length,n=[],i=0;i<e;i++)n[i>>>2]|=(255&t.charCodeAt(i))<<24-i%4*8;return new c.init(n,e)}},d=l.Utf8={stringify:function(t){try{return decodeURIComponent(escape(u.stringify(t)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(t){return u.parse(unescape(encodeURIComponent(t)))}},p=a.BufferedBlockAlgorithm=o.extend({reset:function(){this._data=new c.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=d.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(e){var n,i=this._data,r=i.words,s=i.sigBytes,a=this.blockSize,o=s/(4*a),l=(o=e?t.ceil(o):t.max((0|o)-this._minBufferSize,0))*a,h=t.min(4*l,s);if(l){for(var u=0;u<l;u+=a)this._doProcessBlock(r,u);n=r.splice(0,l),i.sigBytes-=h}return new c.init(n,h)},clone:function(){var t=o.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0});a.Hasher=p.extend({cfg:o.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){p.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){return t&&this._append(t),this._doFinalize()},blockSize:16,_createHelper:function(t){return function(e,n){return new t.init(n).finalize(e)}},_createHmacHelper:function(t){return function(e,n){return new f.HMAC.init(t,n).finalize(e)}}});var f=s.algo={};return s}(Math);return t}()),C.exports}var I,T={exports:{}};function B(){return I||(I=1,T.exports=function(t){return function(e){var n=t,i=n.lib,r=i.Base,s=i.WordArray,a=n.x64={};a.Word=r.extend({init:function(t,e){this.high=t,this.low=e}}),a.WordArray=r.extend({init:function(t,n){t=this.words=t||[],this.sigBytes=n!=e?n:8*t.length},toX32:function(){for(var t=this.words,e=t.length,n=[],i=0;i<e;i++){var r=t[i];n.push(r.high),n.push(r.low)}return s.create(n,this.sigBytes)},clone:function(){for(var t=r.clone.call(this),e=t.words=this.words.slice(0),n=e.length,i=0;i<n;i++)e[i]=e[i].clone();return t}})}(),t}(M())),T.exports}var R,D={exports:{}};function L(){return R||(R=1,D.exports=function(t){return function(){if("function"==typeof ArrayBuffer){var e=t.lib.WordArray,n=e.init,i=e.init=function(t){if(t instanceof ArrayBuffer&&(t=new Uint8Array(t)),(t instanceof Int8Array||"undefined"!=typeof Uint8ClampedArray&&t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array||t instanceof Float64Array)&&(t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength)),t instanceof Uint8Array){for(var e=t.byteLength,i=[],r=0;r<e;r++)i[r>>>2]|=t[r]<<24-r%4*8;n.call(this,i,e)}else n.apply(this,arguments)};i.prototype=e}}(),t.lib.WordArray}(M())),D.exports}var P,k={exports:{}};function O(){return P||(P=1,k.exports=function(t){return function(){var e=t,n=e.lib.WordArray,i=e.enc;function r(t){return t<<8&4278255360|t>>>8&16711935}i.Utf16=i.Utf16BE={stringify:function(t){for(var e=t.words,n=t.sigBytes,i=[],r=0;r<n;r+=2){var s=e[r>>>2]>>>16-r%4*8&65535;i.push(String.fromCharCode(s))}return i.join("")},parse:function(t){for(var e=t.length,i=[],r=0;r<e;r++)i[r>>>1]|=t.charCodeAt(r)<<16-r%2*16;return n.create(i,2*e)}},i.Utf16LE={stringify:function(t){for(var e=t.words,n=t.sigBytes,i=[],s=0;s<n;s+=2){var a=r(e[s>>>2]>>>16-s%4*8&65535);i.push(String.fromCharCode(a))}return i.join("")},parse:function(t){for(var e=t.length,i=[],s=0;s<e;s++)i[s>>>1]|=r(t.charCodeAt(s)<<16-s%2*16);return n.create(i,2*e)}}}(),t.enc.Utf16}(M())),k.exports}var U,N={exports:{}};function F(){return U||(U=1,N.exports=function(t){return function(){var e=t,n=e.lib.WordArray;function i(t,e,i){for(var r=[],s=0,a=0;a<e;a++)if(a%4){var o=i[t.charCodeAt(a-1)]<<a%4*2|i[t.charCodeAt(a)]>>>6-a%4*2;r[s>>>2]|=o<<24-s%4*8,s++}return n.create(r,s)}e.enc.Base64={stringify:function(t){var e=t.words,n=t.sigBytes,i=this._map;t.clamp();for(var r=[],s=0;s<n;s+=3)for(var a=(e[s>>>2]>>>24-s%4*8&255)<<16|(e[s+1>>>2]>>>24-(s+1)%4*8&255)<<8|e[s+2>>>2]>>>24-(s+2)%4*8&255,o=0;o<4&&s+.75*o<n;o++)r.push(i.charAt(a>>>6*(3-o)&63));var c=i.charAt(64);if(c)for(;r.length%4;)r.push(c);return r.join("")},parse:function(t){var e=t.length,n=this._map,r=this._reverseMap;if(!r){r=this._reverseMap=[];for(var s=0;s<n.length;s++)r[n.charCodeAt(s)]=s}var a=n.charAt(64);if(a){var o=t.indexOf(a);-1!==o&&(e=o)}return i(t,e,r)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),t.enc.Base64}(M())),N.exports}var Q,z={exports:{}};function G(){return Q||(Q=1,z.exports=function(t){return function(){var e=t,n=e.lib.WordArray;function i(t,e,i){for(var r=[],s=0,a=0;a<e;a++)if(a%4){var o=i[t.charCodeAt(a-1)]<<a%4*2|i[t.charCodeAt(a)]>>>6-a%4*2;r[s>>>2]|=o<<24-s%4*8,s++}return n.create(r,s)}e.enc.Base64url={stringify:function(t,e){void 0===e&&(e=!0);var n=t.words,i=t.sigBytes,r=e?this._safe_map:this._map;t.clamp();for(var s=[],a=0;a<i;a+=3)for(var o=(n[a>>>2]>>>24-a%4*8&255)<<16|(n[a+1>>>2]>>>24-(a+1)%4*8&255)<<8|n[a+2>>>2]>>>24-(a+2)%4*8&255,c=0;c<4&&a+.75*c<i;c++)s.push(r.charAt(o>>>6*(3-c)&63));var l=r.charAt(64);if(l)for(;s.length%4;)s.push(l);return s.join("")},parse:function(t,e){void 0===e&&(e=!0);var n=t.length,r=e?this._safe_map:this._map,s=this._reverseMap;if(!s){s=this._reverseMap=[];for(var a=0;a<r.length;a++)s[r.charCodeAt(a)]=a}var o=r.charAt(64);if(o){var c=t.indexOf(o);-1!==c&&(n=c)}return i(t,n,s)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"}}(),t.enc.Base64url}(M())),z.exports}var H,V={exports:{}};function j(){return H||(H=1,V.exports=function(t){return function(e){var n=t,i=n.lib,r=i.WordArray,s=i.Hasher,a=n.algo,o=[];!function(){for(var t=0;t<64;t++)o[t]=4294967296*e.abs(e.sin(t+1))|0}();var c=a.MD5=s.extend({_doReset:function(){this._hash=new r.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(t,e){for(var n=0;n<16;n++){var i=e+n,r=t[i];t[i]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8)}var s=this._hash.words,a=t[e+0],c=t[e+1],p=t[e+2],f=t[e+3],A=t[e+4],g=t[e+5],m=t[e+6],_=t[e+7],v=t[e+8],y=t[e+9],b=t[e+10],x=t[e+11],w=t[e+12],E=t[e+13],C=t[e+14],S=t[e+15],M=s[0],I=s[1],T=s[2],B=s[3];M=l(M,I,T,B,a,7,o[0]),B=l(B,M,I,T,c,12,o[1]),T=l(T,B,M,I,p,17,o[2]),I=l(I,T,B,M,f,22,o[3]),M=l(M,I,T,B,A,7,o[4]),B=l(B,M,I,T,g,12,o[5]),T=l(T,B,M,I,m,17,o[6]),I=l(I,T,B,M,_,22,o[7]),M=l(M,I,T,B,v,7,o[8]),B=l(B,M,I,T,y,12,o[9]),T=l(T,B,M,I,b,17,o[10]),I=l(I,T,B,M,x,22,o[11]),M=l(M,I,T,B,w,7,o[12]),B=l(B,M,I,T,E,12,o[13]),T=l(T,B,M,I,C,17,o[14]),M=h(M,I=l(I,T,B,M,S,22,o[15]),T,B,c,5,o[16]),B=h(B,M,I,T,m,9,o[17]),T=h(T,B,M,I,x,14,o[18]),I=h(I,T,B,M,a,20,o[19]),M=h(M,I,T,B,g,5,o[20]),B=h(B,M,I,T,b,9,o[21]),T=h(T,B,M,I,S,14,o[22]),I=h(I,T,B,M,A,20,o[23]),M=h(M,I,T,B,y,5,o[24]),B=h(B,M,I,T,C,9,o[25]),T=h(T,B,M,I,f,14,o[26]),I=h(I,T,B,M,v,20,o[27]),M=h(M,I,T,B,E,5,o[28]),B=h(B,M,I,T,p,9,o[29]),T=h(T,B,M,I,_,14,o[30]),M=u(M,I=h(I,T,B,M,w,20,o[31]),T,B,g,4,o[32]),B=u(B,M,I,T,v,11,o[33]),T=u(T,B,M,I,x,16,o[34]),I=u(I,T,B,M,C,23,o[35]),M=u(M,I,T,B,c,4,o[36]),B=u(B,M,I,T,A,11,o[37]),T=u(T,B,M,I,_,16,o[38]),I=u(I,T,B,M,b,23,o[39]),M=u(M,I,T,B,E,4,o[40]),B=u(B,M,I,T,a,11,o[41]),T=u(T,B,M,I,f,16,o[42]),I=u(I,T,B,M,m,23,o[43]),M=u(M,I,T,B,y,4,o[44]),B=u(B,M,I,T,w,11,o[45]),T=u(T,B,M,I,S,16,o[46]),M=d(M,I=u(I,T,B,M,p,23,o[47]),T,B,a,6,o[48]),B=d(B,M,I,T,_,10,o[49]),T=d(T,B,M,I,C,15,o[50]),I=d(I,T,B,M,g,21,o[51]),M=d(M,I,T,B,w,6,o[52]),B=d(B,M,I,T,f,10,o[53]),T=d(T,B,M,I,b,15,o[54]),I=d(I,T,B,M,c,21,o[55]),M=d(M,I,T,B,v,6,o[56]),B=d(B,M,I,T,S,10,o[57]),T=d(T,B,M,I,m,15,o[58]),I=d(I,T,B,M,E,21,o[59]),M=d(M,I,T,B,A,6,o[60]),B=d(B,M,I,T,x,10,o[61]),T=d(T,B,M,I,p,15,o[62]),I=d(I,T,B,M,y,21,o[63]),s[0]=s[0]+M|0,s[1]=s[1]+I|0,s[2]=s[2]+T|0,s[3]=s[3]+B|0},_doFinalize:function(){var t=this._data,n=t.words,i=8*this._nDataBytes,r=8*t.sigBytes;n[r>>>5]|=128<<24-r%32;var s=e.floor(i/4294967296),a=i;n[15+(r+64>>>9<<4)]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),n[14+(r+64>>>9<<4)]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),t.sigBytes=4*(n.length+1),this._process();for(var o=this._hash,c=o.words,l=0;l<4;l++){var h=c[l];c[l]=16711935&(h<<8|h>>>24)|4278255360&(h<<24|h>>>8)}return o},clone:function(){var t=s.clone.call(this);return t._hash=this._hash.clone(),t}});function l(t,e,n,i,r,s,a){var o=t+(e&n|~e&i)+r+a;return(o<<s|o>>>32-s)+e}function h(t,e,n,i,r,s,a){var o=t+(e&i|n&~i)+r+a;return(o<<s|o>>>32-s)+e}function u(t,e,n,i,r,s,a){var o=t+(e^n^i)+r+a;return(o<<s|o>>>32-s)+e}function d(t,e,n,i,r,s,a){var o=t+(n^(e|~i))+r+a;return(o<<s|o>>>32-s)+e}n.MD5=s._createHelper(c),n.HmacMD5=s._createHmacHelper(c)}(Math),t.MD5}(M())),V.exports}var W,q={exports:{}};function Y(){return W||(W=1,q.exports=function(t){return function(){var e=t,n=e.lib,i=n.WordArray,r=n.Hasher,s=e.algo,a=[],o=s.SHA1=r.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(t,e){for(var n=this._hash.words,i=n[0],r=n[1],s=n[2],o=n[3],c=n[4],l=0;l<80;l++){if(l<16)a[l]=0|t[e+l];else{var h=a[l-3]^a[l-8]^a[l-14]^a[l-16];a[l]=h<<1|h>>>31}var u=(i<<5|i>>>27)+c+a[l];u+=l<20?1518500249+(r&s|~r&o):l<40?1859775393+(r^s^o):l<60?(r&s|r&o|s&o)-1894007588:(r^s^o)-899497514,c=o,o=s,s=r<<30|r>>>2,r=i,i=u}n[0]=n[0]+i|0,n[1]=n[1]+r|0,n[2]=n[2]+s|0,n[3]=n[3]+o|0,n[4]=n[4]+c|0},_doFinalize:function(){var t=this._data,e=t.words,n=8*this._nDataBytes,i=8*t.sigBytes;return e[i>>>5]|=128<<24-i%32,e[14+(i+64>>>9<<4)]=Math.floor(n/4294967296),e[15+(i+64>>>9<<4)]=n,t.sigBytes=4*e.length,this._process(),this._hash},clone:function(){var t=r.clone.call(this);return t._hash=this._hash.clone(),t}});e.SHA1=r._createHelper(o),e.HmacSHA1=r._createHmacHelper(o)}(),t.SHA1}(M())),q.exports}var X,J={exports:{}};function K(){return X||(X=1,J.exports=function(t){return function(e){var n=t,i=n.lib,r=i.WordArray,s=i.Hasher,a=n.algo,o=[],c=[];!function(){function t(t){for(var n=e.sqrt(t),i=2;i<=n;i++)if(!(t%i))return!1;return!0}function n(t){return 4294967296*(t-(0|t))|0}for(var i=2,r=0;r<64;)t(i)&&(r<8&&(o[r]=n(e.pow(i,.5))),c[r]=n(e.pow(i,1/3)),r++),i++}();var l=[],h=a.SHA256=s.extend({_doReset:function(){this._hash=new r.init(o.slice(0))},_doProcessBlock:function(t,e){for(var n=this._hash.words,i=n[0],r=n[1],s=n[2],a=n[3],o=n[4],h=n[5],u=n[6],d=n[7],p=0;p<64;p++){if(p<16)l[p]=0|t[e+p];else{var f=l[p-15],A=(f<<25|f>>>7)^(f<<14|f>>>18)^f>>>3,g=l[p-2],m=(g<<15|g>>>17)^(g<<13|g>>>19)^g>>>10;l[p]=A+l[p-7]+m+l[p-16]}var _=i&r^i&s^r&s,v=(i<<30|i>>>2)^(i<<19|i>>>13)^(i<<10|i>>>22),y=d+((o<<26|o>>>6)^(o<<21|o>>>11)^(o<<7|o>>>25))+(o&h^~o&u)+c[p]+l[p];d=u,u=h,h=o,o=a+y|0,a=s,s=r,r=i,i=y+(v+_)|0}n[0]=n[0]+i|0,n[1]=n[1]+r|0,n[2]=n[2]+s|0,n[3]=n[3]+a|0,n[4]=n[4]+o|0,n[5]=n[5]+h|0,n[6]=n[6]+u|0,n[7]=n[7]+d|0},_doFinalize:function(){var t=this._data,n=t.words,i=8*this._nDataBytes,r=8*t.sigBytes;return n[r>>>5]|=128<<24-r%32,n[14+(r+64>>>9<<4)]=e.floor(i/4294967296),n[15+(r+64>>>9<<4)]=i,t.sigBytes=4*n.length,this._process(),this._hash},clone:function(){var t=s.clone.call(this);return t._hash=this._hash.clone(),t}});n.SHA256=s._createHelper(h),n.HmacSHA256=s._createHmacHelper(h)}(Math),t.SHA256}(M())),J.exports}var Z,$={exports:{}};var tt,et={exports:{}};function nt(){return tt||(tt=1,et.exports=function(t){return function(){var e=t,n=e.lib.Hasher,i=e.x64,r=i.Word,s=i.WordArray,a=e.algo;function o(){return r.create.apply(r,arguments)}var c=[o(1116352408,3609767458),o(1899447441,602891725),o(3049323471,3964484399),o(3921009573,2173295548),o(961987163,4081628472),o(1508970993,3053834265),o(2453635748,2937671579),o(2870763221,3664609560),o(3624381080,2734883394),o(310598401,1164996542),o(607225278,1323610764),o(1426881987,3590304994),o(1925078388,4068182383),o(2162078206,991336113),o(2614888103,633803317),o(3248222580,3479774868),o(3835390401,2666613458),o(4022224774,944711139),o(264347078,2341262773),o(604807628,2007800933),o(770255983,1495990901),o(1249150122,1856431235),o(1555081692,3175218132),o(1996064986,2198950837),o(2554220882,3999719339),o(2821834349,766784016),o(2952996808,2566594879),o(3210313671,3203337956),o(3336571891,1034457026),o(3584528711,2466948901),o(113926993,3758326383),o(338241895,168717936),o(666307205,1188179964),o(773529912,1546045734),o(1294757372,1522805485),o(1396182291,2643833823),o(1695183700,2343527390),o(1986661051,1014477480),o(2177026350,1206759142),o(2456956037,344077627),o(2730485921,1290863460),o(2820302411,3158454273),o(3259730800,3505952657),o(3345764771,106217008),o(3516065817,3606008344),o(3600352804,1432725776),o(4094571909,1467031594),o(275423344,851169720),o(430227734,3100823752),o(506948616,1363258195),o(659060556,3750685593),o(883997877,3785050280),o(958139571,3318307427),o(1322822218,3812723403),o(1537002063,2003034995),o(1747873779,3602036899),o(1955562222,1575990012),o(2024104815,1125592928),o(2227730452,2716904306),o(2361852424,442776044),o(2428436474,593698344),o(2756734187,3733110249),o(3204031479,2999351573),o(3329325298,3815920427),o(3391569614,3928383900),o(3515267271,566280711),o(3940187606,3454069534),o(4118630271,4000239992),o(116418474,1914138554),o(174292421,2731055270),o(289380356,3203993006),o(460393269,320620315),o(685471733,587496836),o(852142971,1086792851),o(1017036298,365543100),o(1126000580,2618297676),o(1288033470,3409855158),o(1501505948,4234509866),o(1607167915,987167468),o(1816402316,1246189591)],l=[];!function(){for(var t=0;t<80;t++)l[t]=o()}();var h=a.SHA512=n.extend({_doReset:function(){this._hash=new s.init([new r.init(1779033703,4089235720),new r.init(3144134277,2227873595),new r.init(1013904242,4271175723),new r.init(2773480762,1595750129),new r.init(1359893119,2917565137),new r.init(2600822924,725511199),new r.init(528734635,4215389547),new r.init(1541459225,327033209)])},_doProcessBlock:function(t,e){for(var n=this._hash.words,i=n[0],r=n[1],s=n[2],a=n[3],o=n[4],h=n[5],u=n[6],d=n[7],p=i.high,f=i.low,A=r.high,g=r.low,m=s.high,_=s.low,v=a.high,y=a.low,b=o.high,x=o.low,w=h.high,E=h.low,C=u.high,S=u.low,M=d.high,I=d.low,T=p,B=f,R=A,D=g,L=m,P=_,k=v,O=y,U=b,N=x,F=w,Q=E,z=C,G=S,H=M,V=I,j=0;j<80;j++){var W,q,Y=l[j];if(j<16)q=Y.high=0|t[e+2*j],W=Y.low=0|t[e+2*j+1];else{var X=l[j-15],J=X.high,K=X.low,Z=(J>>>1|K<<31)^(J>>>8|K<<24)^J>>>7,$=(K>>>1|J<<31)^(K>>>8|J<<24)^(K>>>7|J<<25),tt=l[j-2],et=tt.high,nt=tt.low,it=(et>>>19|nt<<13)^(et<<3|nt>>>29)^et>>>6,rt=(nt>>>19|et<<13)^(nt<<3|et>>>29)^(nt>>>6|et<<26),st=l[j-7],at=st.high,ot=st.low,ct=l[j-16],lt=ct.high,ht=ct.low;q=(q=(q=Z+at+((W=$+ot)>>>0<$>>>0?1:0))+it+((W+=rt)>>>0<rt>>>0?1:0))+lt+((W+=ht)>>>0<ht>>>0?1:0),Y.high=q,Y.low=W}var ut,dt=U&F^~U&z,pt=N&Q^~N&G,ft=T&R^T&L^R&L,At=B&D^B&P^D&P,gt=(T>>>28|B<<4)^(T<<30|B>>>2)^(T<<25|B>>>7),mt=(B>>>28|T<<4)^(B<<30|T>>>2)^(B<<25|T>>>7),_t=(U>>>14|N<<18)^(U>>>18|N<<14)^(U<<23|N>>>9),vt=(N>>>14|U<<18)^(N>>>18|U<<14)^(N<<23|U>>>9),yt=c[j],bt=yt.high,xt=yt.low,wt=H+_t+((ut=V+vt)>>>0<V>>>0?1:0),Et=mt+At;H=z,V=G,z=F,G=Q,F=U,Q=N,U=k+(wt=(wt=(wt=wt+dt+((ut+=pt)>>>0<pt>>>0?1:0))+bt+((ut+=xt)>>>0<xt>>>0?1:0))+q+((ut+=W)>>>0<W>>>0?1:0))+((N=O+ut|0)>>>0<O>>>0?1:0)|0,k=L,O=P,L=R,P=D,R=T,D=B,T=wt+(gt+ft+(Et>>>0<mt>>>0?1:0))+((B=ut+Et|0)>>>0<ut>>>0?1:0)|0}f=i.low=f+B,i.high=p+T+(f>>>0<B>>>0?1:0),g=r.low=g+D,r.high=A+R+(g>>>0<D>>>0?1:0),_=s.low=_+P,s.high=m+L+(_>>>0<P>>>0?1:0),y=a.low=y+O,a.high=v+k+(y>>>0<O>>>0?1:0),x=o.low=x+N,o.high=b+U+(x>>>0<N>>>0?1:0),E=h.low=E+Q,h.high=w+F+(E>>>0<Q>>>0?1:0),S=u.low=S+G,u.high=C+z+(S>>>0<G>>>0?1:0),I=d.low=I+V,d.high=M+H+(I>>>0<V>>>0?1:0)},_doFinalize:function(){var t=this._data,e=t.words,n=8*this._nDataBytes,i=8*t.sigBytes;return e[i>>>5]|=128<<24-i%32,e[30+(i+128>>>10<<5)]=Math.floor(n/4294967296),e[31+(i+128>>>10<<5)]=n,t.sigBytes=4*e.length,this._process(),this._hash.toX32()},clone:function(){var t=n.clone.call(this);return t._hash=this._hash.clone(),t},blockSize:32});e.SHA512=n._createHelper(h),e.HmacSHA512=n._createHmacHelper(h)}(),t.SHA512}(M(),B())),et.exports}var it,rt={exports:{}};var st,at={exports:{}};function ot(){return st||(st=1,at.exports=function(t){return function(e){var n=t,i=n.lib,r=i.WordArray,s=i.Hasher,a=n.x64.Word,o=n.algo,c=[],l=[],h=[];!function(){for(var t=1,e=0,n=0;n<24;n++){c[t+5*e]=(n+1)*(n+2)/2%64;var i=(2*t+3*e)%5;t=e%5,e=i}for(t=0;t<5;t++)for(e=0;e<5;e++)l[t+5*e]=e+(2*t+3*e)%5*5;for(var r=1,s=0;s<24;s++){for(var o=0,u=0,d=0;d<7;d++){if(1&r){var p=(1<<d)-1;p<32?u^=1<<p:o^=1<<p-32}128&r?r=r<<1^113:r<<=1}h[s]=a.create(o,u)}}();var u=[];!function(){for(var t=0;t<25;t++)u[t]=a.create()}();var d=o.SHA3=s.extend({cfg:s.cfg.extend({outputLength:512}),_doReset:function(){for(var t=this._state=[],e=0;e<25;e++)t[e]=new a.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(t,e){for(var n=this._state,i=this.blockSize/2,r=0;r<i;r++){var s=t[e+2*r],a=t[e+2*r+1];s=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),a=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),(I=n[r]).high^=a,I.low^=s}for(var o=0;o<24;o++){for(var d=0;d<5;d++){for(var p=0,f=0,A=0;A<5;A++)p^=(I=n[d+5*A]).high,f^=I.low;var g=u[d];g.high=p,g.low=f}for(d=0;d<5;d++){var m=u[(d+4)%5],_=u[(d+1)%5],v=_.high,y=_.low;for(p=m.high^(v<<1|y>>>31),f=m.low^(y<<1|v>>>31),A=0;A<5;A++)(I=n[d+5*A]).high^=p,I.low^=f}for(var b=1;b<25;b++){var x=(I=n[b]).high,w=I.low,E=c[b];E<32?(p=x<<E|w>>>32-E,f=w<<E|x>>>32-E):(p=w<<E-32|x>>>64-E,f=x<<E-32|w>>>64-E);var C=u[l[b]];C.high=p,C.low=f}var S=u[0],M=n[0];for(S.high=M.high,S.low=M.low,d=0;d<5;d++)for(A=0;A<5;A++){var I=n[b=d+5*A],T=u[b],B=u[(d+1)%5+5*A],R=u[(d+2)%5+5*A];I.high=T.high^~B.high&R.high,I.low=T.low^~B.low&R.low}I=n[0];var D=h[o];I.high^=D.high,I.low^=D.low}},_doFinalize:function(){var t=this._data,n=t.words;this._nDataBytes;var i=8*t.sigBytes,s=32*this.blockSize;n[i>>>5]|=1<<24-i%32,n[(e.ceil((i+1)/s)*s>>>5)-1]|=128,t.sigBytes=4*n.length,this._process();for(var a=this._state,o=this.cfg.outputLength/8,c=o/8,l=[],h=0;h<c;h++){var u=a[h],d=u.high,p=u.low;d=16711935&(d<<8|d>>>24)|4278255360&(d<<24|d>>>8),p=16711935&(p<<8|p>>>24)|4278255360&(p<<24|p>>>8),l.push(p),l.push(d)}return new r.init(l,o)},clone:function(){for(var t=s.clone.call(this),e=t._state=this._state.slice(0),n=0;n<25;n++)e[n]=e[n].clone();return t}});n.SHA3=s._createHelper(d),n.HmacSHA3=s._createHmacHelper(d)}(Math),t.SHA3}(M(),B())),at.exports}var ct,lt={exports:{}};var ht,ut={exports:{}};function dt(){return ht||(ht=1,ut.exports=function(t){!function(){var e=t,n=e.lib.Base,i=e.enc.Utf8;e.algo.HMAC=n.extend({init:function(t,e){t=this._hasher=new t.init,"string"==typeof e&&(e=i.parse(e));var n=t.blockSize,r=4*n;e.sigBytes>r&&(e=t.finalize(e)),e.clamp();for(var s=this._oKey=e.clone(),a=this._iKey=e.clone(),o=s.words,c=a.words,l=0;l<n;l++)o[l]^=1549556828,c[l]^=909522486;s.sigBytes=a.sigBytes=r,this.reset()},reset:function(){var t=this._hasher;t.reset(),t.update(this._iKey)},update:function(t){return this._hasher.update(t),this},finalize:function(t){var e=this._hasher,n=e.finalize(t);return e.reset(),e.finalize(this._oKey.clone().concat(n))}})}()}(M())),ut.exports}var pt,ft={exports:{}};var At,gt={exports:{}};function mt(){return At||(At=1,gt.exports=function(t){return function(){var e=t,n=e.lib,i=n.Base,r=n.WordArray,s=e.algo,a=s.MD5,o=s.EvpKDF=i.extend({cfg:i.extend({keySize:4,hasher:a,iterations:1}),init:function(t){this.cfg=this.cfg.extend(t)},compute:function(t,e){for(var n,i=this.cfg,s=i.hasher.create(),a=r.create(),o=a.words,c=i.keySize,l=i.iterations;o.length<c;){n&&s.update(n),n=s.update(t).finalize(e),s.reset();for(var h=1;h<l;h++)n=s.finalize(n),s.reset();a.concat(n)}return a.sigBytes=4*c,a}});e.EvpKDF=function(t,e,n){return o.create(n).compute(t,e)}}(),t.EvpKDF}(M(),Y(),dt())),gt.exports}var _t,vt={exports:{}};function yt(){return _t||(_t=1,vt.exports=function(t){t.lib.Cipher||function(e){var n=t,i=n.lib,r=i.Base,s=i.WordArray,a=i.BufferedBlockAlgorithm,o=n.enc;o.Utf8;var c=o.Base64,l=n.algo.EvpKDF,h=i.Cipher=a.extend({cfg:r.extend(),createEncryptor:function(t,e){return this.create(this._ENC_XFORM_MODE,t,e)},createDecryptor:function(t,e){return this.create(this._DEC_XFORM_MODE,t,e)},init:function(t,e,n){this.cfg=this.cfg.extend(n),this._xformMode=t,this._key=e,this.reset()},reset:function(){a.reset.call(this),this._doReset()},process:function(t){return this._append(t),this._process()},finalize:function(t){return t&&this._append(t),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function t(t){return"string"==typeof t?v:m}return function(e){return{encrypt:function(n,i,r){return t(i).encrypt(e,n,i,r)},decrypt:function(n,i,r){return t(i).decrypt(e,n,i,r)}}}}()});i.StreamCipher=h.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var u=n.mode={},d=i.BlockCipherMode=r.extend({createEncryptor:function(t,e){return this.Encryptor.create(t,e)},createDecryptor:function(t,e){return this.Decryptor.create(t,e)},init:function(t,e){this._cipher=t,this._iv=e}}),p=u.CBC=function(){var t=d.extend();function n(t,n,i){var r,s=this._iv;s?(r=s,this._iv=e):r=this._prevBlock;for(var a=0;a<i;a++)t[n+a]^=r[a]}return t.Encryptor=t.extend({processBlock:function(t,e){var i=this._cipher,r=i.blockSize;n.call(this,t,e,r),i.encryptBlock(t,e),this._prevBlock=t.slice(e,e+r)}}),t.Decryptor=t.extend({processBlock:function(t,e){var i=this._cipher,r=i.blockSize,s=t.slice(e,e+r);i.decryptBlock(t,e),n.call(this,t,e,r),this._prevBlock=s}}),t}(),f=(n.pad={}).Pkcs7={pad:function(t,e){for(var n=4*e,i=n-t.sigBytes%n,r=i<<24|i<<16|i<<8|i,a=[],o=0;o<i;o+=4)a.push(r);var c=s.create(a,i);t.concat(c)},unpad:function(t){var e=255&t.words[t.sigBytes-1>>>2];t.sigBytes-=e}};i.BlockCipher=h.extend({cfg:h.cfg.extend({mode:p,padding:f}),reset:function(){var t;h.reset.call(this);var e=this.cfg,n=e.iv,i=e.mode;this._xformMode==this._ENC_XFORM_MODE?t=i.createEncryptor:(t=i.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==t?this._mode.init(this,n&&n.words):(this._mode=t.call(i,this,n&&n.words),this._mode.__creator=t)},_doProcessBlock:function(t,e){this._mode.processBlock(t,e)},_doFinalize:function(){var t,e=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(e.pad(this._data,this.blockSize),t=this._process(!0)):(t=this._process(!0),e.unpad(t)),t},blockSize:4});var A=i.CipherParams=r.extend({init:function(t){this.mixIn(t)},toString:function(t){return(t||this.formatter).stringify(this)}}),g=(n.format={}).OpenSSL={stringify:function(t){var e=t.ciphertext,n=t.salt;return(n?s.create([1398893684,1701076831]).concat(n).concat(e):e).toString(c)},parse:function(t){var e,n=c.parse(t),i=n.words;return 1398893684==i[0]&&1701076831==i[1]&&(e=s.create(i.slice(2,4)),i.splice(0,4),n.sigBytes-=16),A.create({ciphertext:n,salt:e})}},m=i.SerializableCipher=r.extend({cfg:r.extend({format:g}),encrypt:function(t,e,n,i){i=this.cfg.extend(i);var r=t.createEncryptor(n,i),s=r.finalize(e),a=r.cfg;return A.create({ciphertext:s,key:n,iv:a.iv,algorithm:t,mode:a.mode,padding:a.padding,blockSize:t.blockSize,formatter:i.format})},decrypt:function(t,e,n,i){return i=this.cfg.extend(i),e=this._parse(e,i.format),t.createDecryptor(n,i).finalize(e.ciphertext)},_parse:function(t,e){return"string"==typeof t?e.parse(t,this):t}}),_=(n.kdf={}).OpenSSL={execute:function(t,e,n,i,r){if(i||(i=s.random(8)),r)a=l.create({keySize:e+n,hasher:r}).compute(t,i);else var a=l.create({keySize:e+n}).compute(t,i);var o=s.create(a.words.slice(e),4*n);return a.sigBytes=4*e,A.create({key:a,iv:o,salt:i})}},v=i.PasswordBasedCipher=m.extend({cfg:m.cfg.extend({kdf:_}),encrypt:function(t,e,n,i){var r=(i=this.cfg.extend(i)).kdf.execute(n,t.keySize,t.ivSize,i.salt,i.hasher);i.iv=r.iv;var s=m.encrypt.call(this,t,e,r.key,i);return s.mixIn(r),s},decrypt:function(t,e,n,i){i=this.cfg.extend(i),e=this._parse(e,i.format);var r=i.kdf.execute(n,t.keySize,t.ivSize,e.salt,i.hasher);return i.iv=r.iv,m.decrypt.call(this,t,e,r.key,i)}})}()}(M(),mt())),vt.exports}var bt,xt={exports:{}};function wt(){return bt||(bt=1,xt.exports=function(t){return t.mode.CFB=function(){var e=t.lib.BlockCipherMode.extend();function n(t,e,n,i){var r,s=this._iv;s?(r=s.slice(0),this._iv=void 0):r=this._prevBlock,i.encryptBlock(r,0);for(var a=0;a<n;a++)t[e+a]^=r[a]}return e.Encryptor=e.extend({processBlock:function(t,e){var i=this._cipher,r=i.blockSize;n.call(this,t,e,r,i),this._prevBlock=t.slice(e,e+r)}}),e.Decryptor=e.extend({processBlock:function(t,e){var i=this._cipher,r=i.blockSize,s=t.slice(e,e+r);n.call(this,t,e,r,i),this._prevBlock=s}}),e}(),t.mode.CFB}(M(),yt())),xt.exports}var Et,Ct={exports:{}};function St(){return Et||(Et=1,Ct.exports=function(t){return t.mode.CTR=(e=t.lib.BlockCipherMode.extend(),n=e.Encryptor=e.extend({processBlock:function(t,e){var n=this._cipher,i=n.blockSize,r=this._iv,s=this._counter;r&&(s=this._counter=r.slice(0),this._iv=void 0);var a=s.slice(0);n.encryptBlock(a,0),s[i-1]=s[i-1]+1|0;for(var o=0;o<i;o++)t[e+o]^=a[o]}}),e.Decryptor=n,e),t.mode.CTR;var e,n}(M(),yt())),Ct.exports}var Mt,It={exports:{}};function Tt(){return Mt||(Mt=1,It.exports=function(t){return t.mode.CTRGladman=function(){var e=t.lib.BlockCipherMode.extend();function n(t){if(255&~(t>>24))t+=1<<24;else{var e=t>>16&255,n=t>>8&255,i=255&t;255===e?(e=0,255===n?(n=0,255===i?i=0:++i):++n):++e,t=0,t+=e<<16,t+=n<<8,t+=i}return t}function i(t){return 0===(t[0]=n(t[0]))&&(t[1]=n(t[1])),t}var r=e.Encryptor=e.extend({processBlock:function(t,e){var n=this._cipher,r=n.blockSize,s=this._iv,a=this._counter;s&&(a=this._counter=s.slice(0),this._iv=void 0),i(a);var o=a.slice(0);n.encryptBlock(o,0);for(var c=0;c<r;c++)t[e+c]^=o[c]}});return e.Decryptor=r,e}(),t.mode.CTRGladman}(M(),yt())),It.exports}var Bt,Rt={exports:{}};function Dt(){return Bt||(Bt=1,Rt.exports=function(t){return t.mode.OFB=(e=t.lib.BlockCipherMode.extend(),n=e.Encryptor=e.extend({processBlock:function(t,e){var n=this._cipher,i=n.blockSize,r=this._iv,s=this._keystream;r&&(s=this._keystream=r.slice(0),this._iv=void 0),n.encryptBlock(s,0);for(var a=0;a<i;a++)t[e+a]^=s[a]}}),e.Decryptor=n,e),t.mode.OFB;var e,n}(M(),yt())),Rt.exports}var Lt,Pt={exports:{}};var kt,Ot={exports:{}};var Ut,Nt={exports:{}};var Ft,Qt={exports:{}};var zt,Gt={exports:{}};var Ht,Vt={exports:{}};var jt,Wt={exports:{}};var qt,Yt={exports:{}};var Xt,Jt={exports:{}};function Kt(){return Xt||(Xt=1,Jt.exports=function(t){return function(){var e=t,n=e.lib,i=n.WordArray,r=n.BlockCipher,s=e.algo,a=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],o=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],c=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],l=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],h=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],u=s.DES=r.extend({_doReset:function(){for(var t=this._key.words,e=[],n=0;n<56;n++){var i=a[n]-1;e[n]=t[i>>>5]>>>31-i%32&1}for(var r=this._subKeys=[],s=0;s<16;s++){var l=r[s]=[],h=c[s];for(n=0;n<24;n++)l[n/6|0]|=e[(o[n]-1+h)%28]<<31-n%6,l[4+(n/6|0)]|=e[28+(o[n+24]-1+h)%28]<<31-n%6;for(l[0]=l[0]<<1|l[0]>>>31,n=1;n<7;n++)l[n]=l[n]>>>4*(n-1)+3;l[7]=l[7]<<5|l[7]>>>27}var u=this._invSubKeys=[];for(n=0;n<16;n++)u[n]=r[15-n]},encryptBlock:function(t,e){this._doCryptBlock(t,e,this._subKeys)},decryptBlock:function(t,e){this._doCryptBlock(t,e,this._invSubKeys)},_doCryptBlock:function(t,e,n){this._lBlock=t[e],this._rBlock=t[e+1],d.call(this,4,252645135),d.call(this,16,65535),p.call(this,2,858993459),p.call(this,8,16711935),d.call(this,1,1431655765);for(var i=0;i<16;i++){for(var r=n[i],s=this._lBlock,a=this._rBlock,o=0,c=0;c<8;c++)o|=l[c][((a^r[c])&h[c])>>>0];this._lBlock=a,this._rBlock=s^o}var u=this._lBlock;this._lBlock=this._rBlock,this._rBlock=u,d.call(this,1,1431655765),p.call(this,8,16711935),p.call(this,2,858993459),d.call(this,16,65535),d.call(this,4,252645135),t[e]=this._lBlock,t[e+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function d(t,e){var n=(this._lBlock>>>t^this._rBlock)&e;this._rBlock^=n,this._lBlock^=n<<t}function p(t,e){var n=(this._rBlock>>>t^this._lBlock)&e;this._lBlock^=n,this._rBlock^=n<<t}e.DES=r._createHelper(u);var f=s.TripleDES=r.extend({_doReset:function(){var t=this._key.words;if(2!==t.length&&4!==t.length&&t.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var e=t.slice(0,2),n=t.length<4?t.slice(0,2):t.slice(2,4),r=t.length<6?t.slice(0,2):t.slice(4,6);this._des1=u.createEncryptor(i.create(e)),this._des2=u.createEncryptor(i.create(n)),this._des3=u.createEncryptor(i.create(r))},encryptBlock:function(t,e){this._des1.encryptBlock(t,e),this._des2.decryptBlock(t,e),this._des3.encryptBlock(t,e)},decryptBlock:function(t,e){this._des3.decryptBlock(t,e),this._des2.encryptBlock(t,e),this._des1.decryptBlock(t,e)},keySize:6,ivSize:2,blockSize:2});e.TripleDES=r._createHelper(f)}(),t.TripleDES}(M(),F(),j(),mt(),yt())),Jt.exports}var Zt,$t={exports:{}};var te,ee={exports:{}};var ne,ie={exports:{}};var re,se={exports:{}};function ae(){return re||(re=1,se.exports=function(t){return function(){var e=t,n=e.lib.BlockCipher,i=e.algo;const r=16,s=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],a=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var o={pbox:[],sbox:[]};function c(t,e){let n=e>>24&255,i=e>>16&255,r=e>>8&255,s=255&e,a=t.sbox[0][n]+t.sbox[1][i];return a^=t.sbox[2][r],a+=t.sbox[3][s],a}function l(t,e,n){let i,s=e,a=n;for(let e=0;e<r;++e)s^=t.pbox[e],a=c(t,s)^a,i=s,s=a,a=i;return i=s,s=a,a=i,a^=t.pbox[r],s^=t.pbox[r+1],{left:s,right:a}}function h(t,e,n){let i,s=e,a=n;for(let e=r+1;e>1;--e)s^=t.pbox[e],a=c(t,s)^a,i=s,s=a,a=i;return i=s,s=a,a=i,a^=t.pbox[1],s^=t.pbox[0],{left:s,right:a}}function u(t,e,n){for(let e=0;e<4;e++){t.sbox[e]=[];for(let n=0;n<256;n++)t.sbox[e][n]=a[e][n]}let i=0;for(let a=0;a<r+2;a++)t.pbox[a]=s[a]^e[i],i++,i>=n&&(i=0);let o=0,c=0,h=0;for(let e=0;e<r+2;e+=2)h=l(t,o,c),o=h.left,c=h.right,t.pbox[e]=o,t.pbox[e+1]=c;for(let e=0;e<4;e++)for(let n=0;n<256;n+=2)h=l(t,o,c),o=h.left,c=h.right,t.sbox[e][n]=o,t.sbox[e][n+1]=c;return!0}var d=i.Blowfish=n.extend({_doReset:function(){if(this._keyPriorReset!==this._key){var t=this._keyPriorReset=this._key,e=t.words,n=t.sigBytes/4;u(o,e,n)}},encryptBlock:function(t,e){var n=l(o,t[e],t[e+1]);t[e]=n.left,t[e+1]=n.right},decryptBlock:function(t,e){var n=h(o,t[e],t[e+1]);t[e]=n.left,t[e+1]=n.right},blockSize:2,keySize:4,ivSize:2});e.Blowfish=n._createHelper(d)}(),t.Blowfish}(M(),F(),j(),mt(),yt())),se.exports}w.exports=function(t){return t}(M(),B(),L(),O(),F(),G(),j(),Y(),K(),Z||(Z=1,$.exports=function(t){return function(){var e=t,n=e.lib.WordArray,i=e.algo,r=i.SHA256,s=i.SHA224=r.extend({_doReset:function(){this._hash=new n.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var t=r._doFinalize.call(this);return t.sigBytes-=4,t}});e.SHA224=r._createHelper(s),e.HmacSHA224=r._createHmacHelper(s)}(),t.SHA224}(M(),K())),nt(),it||(it=1,rt.exports=function(t){return function(){var e=t,n=e.x64,i=n.Word,r=n.WordArray,s=e.algo,a=s.SHA512,o=s.SHA384=a.extend({_doReset:function(){this._hash=new r.init([new i.init(3418070365,3238371032),new i.init(1654270250,914150663),new i.init(2438529370,812702999),new i.init(355462360,4144912697),new i.init(1731405415,4290775857),new i.init(2394180231,1750603025),new i.init(3675008525,1694076839),new i.init(1203062813,3204075428)])},_doFinalize:function(){var t=a._doFinalize.call(this);return t.sigBytes-=16,t}});e.SHA384=a._createHelper(o),e.HmacSHA384=a._createHmacHelper(o)}(),t.SHA384}(M(),B(),nt())),ot(),ct||(ct=1,lt.exports=function(t){return function(e){var n=t,i=n.lib,r=i.WordArray,s=i.Hasher,a=n.algo,o=r.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),c=r.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),l=r.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),h=r.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),u=r.create([0,1518500249,1859775393,2400959708,2840853838]),d=r.create([1352829926,1548603684,1836072691,2053994217,0]),p=a.RIPEMD160=s.extend({_doReset:function(){this._hash=r.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(t,e){for(var n=0;n<16;n++){var i=e+n,r=t[i];t[i]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8)}var s,a,p,y,b,x,w,E,C,S,M,I=this._hash.words,T=u.words,B=d.words,R=o.words,D=c.words,L=l.words,P=h.words;for(x=s=I[0],w=a=I[1],E=p=I[2],C=y=I[3],S=b=I[4],n=0;n<80;n+=1)M=s+t[e+R[n]]|0,M+=n<16?f(a,p,y)+T[0]:n<32?A(a,p,y)+T[1]:n<48?g(a,p,y)+T[2]:n<64?m(a,p,y)+T[3]:_(a,p,y)+T[4],M=(M=v(M|=0,L[n]))+b|0,s=b,b=y,y=v(p,10),p=a,a=M,M=x+t[e+D[n]]|0,M+=n<16?_(w,E,C)+B[0]:n<32?m(w,E,C)+B[1]:n<48?g(w,E,C)+B[2]:n<64?A(w,E,C)+B[3]:f(w,E,C)+B[4],M=(M=v(M|=0,P[n]))+S|0,x=S,S=C,C=v(E,10),E=w,w=M;M=I[1]+p+C|0,I[1]=I[2]+y+S|0,I[2]=I[3]+b+x|0,I[3]=I[4]+s+w|0,I[4]=I[0]+a+E|0,I[0]=M},_doFinalize:function(){var t=this._data,e=t.words,n=8*this._nDataBytes,i=8*t.sigBytes;e[i>>>5]|=128<<24-i%32,e[14+(i+64>>>9<<4)]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),t.sigBytes=4*(e.length+1),this._process();for(var r=this._hash,s=r.words,a=0;a<5;a++){var o=s[a];s[a]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8)}return r},clone:function(){var t=s.clone.call(this);return t._hash=this._hash.clone(),t}});function f(t,e,n){return t^e^n}function A(t,e,n){return t&e|~t&n}function g(t,e,n){return(t|~e)^n}function m(t,e,n){return t&n|e&~n}function _(t,e,n){return t^(e|~n)}function v(t,e){return t<<e|t>>>32-e}n.RIPEMD160=s._createHelper(p),n.HmacRIPEMD160=s._createHmacHelper(p)}(),t.RIPEMD160}(M())),dt(),pt||(pt=1,ft.exports=function(t){return function(){var e=t,n=e.lib,i=n.Base,r=n.WordArray,s=e.algo,a=s.SHA256,o=s.HMAC,c=s.PBKDF2=i.extend({cfg:i.extend({keySize:4,hasher:a,iterations:25e4}),init:function(t){this.cfg=this.cfg.extend(t)},compute:function(t,e){for(var n=this.cfg,i=o.create(n.hasher,t),s=r.create(),a=r.create([1]),c=s.words,l=a.words,h=n.keySize,u=n.iterations;c.length<h;){var d=i.update(e).finalize(a);i.reset();for(var p=d.words,f=p.length,A=d,g=1;g<u;g++){A=i.finalize(A),i.reset();for(var m=A.words,_=0;_<f;_++)p[_]^=m[_]}s.concat(d),l[0]++}return s.sigBytes=4*h,s}});e.PBKDF2=function(t,e,n){return c.create(n).compute(t,e)}}(),t.PBKDF2}(M(),K(),dt())),mt(),yt(),wt(),St(),Tt(),Dt(),Lt||(Lt=1,Pt.exports=function(t){return t.mode.ECB=((e=t.lib.BlockCipherMode.extend()).Encryptor=e.extend({processBlock:function(t,e){this._cipher.encryptBlock(t,e)}}),e.Decryptor=e.extend({processBlock:function(t,e){this._cipher.decryptBlock(t,e)}}),e),t.mode.ECB;var e}(M(),yt())),kt||(kt=1,Ot.exports=function(t){return t.pad.AnsiX923={pad:function(t,e){var n=t.sigBytes,i=4*e,r=i-n%i,s=n+r-1;t.clamp(),t.words[s>>>2]|=r<<24-s%4*8,t.sigBytes+=r},unpad:function(t){var e=255&t.words[t.sigBytes-1>>>2];t.sigBytes-=e}},t.pad.Ansix923}(M(),yt())),Ut||(Ut=1,Nt.exports=function(t){return t.pad.Iso10126={pad:function(e,n){var i=4*n,r=i-e.sigBytes%i;e.concat(t.lib.WordArray.random(r-1)).concat(t.lib.WordArray.create([r<<24],1))},unpad:function(t){var e=255&t.words[t.sigBytes-1>>>2];t.sigBytes-=e}},t.pad.Iso10126}(M(),yt())),Ft||(Ft=1,Qt.exports=function(t){return t.pad.Iso97971={pad:function(e,n){e.concat(t.lib.WordArray.create([2147483648],1)),t.pad.ZeroPadding.pad(e,n)},unpad:function(e){t.pad.ZeroPadding.unpad(e),e.sigBytes--}},t.pad.Iso97971}(M(),yt())),zt||(zt=1,Gt.exports=function(t){return t.pad.ZeroPadding={pad:function(t,e){var n=4*e;t.clamp(),t.sigBytes+=n-(t.sigBytes%n||n)},unpad:function(t){var e=t.words,n=t.sigBytes-1;for(n=t.sigBytes-1;n>=0;n--)if(e[n>>>2]>>>24-n%4*8&255){t.sigBytes=n+1;break}}},t.pad.ZeroPadding}(M(),yt())),Ht||(Ht=1,Vt.exports=function(t){return t.pad.NoPadding={pad:function(){},unpad:function(){}},t.pad.NoPadding}(M(),yt())),jt||(jt=1,Wt.exports=function(t){return function(e){var n=t,i=n.lib.CipherParams,r=n.enc.Hex;n.format.Hex={stringify:function(t){return t.ciphertext.toString(r)},parse:function(t){var e=r.parse(t);return i.create({ciphertext:e})}}}(),t.format.Hex}(M(),yt())),qt||(qt=1,Yt.exports=function(t){return function(){var e=t,n=e.lib.BlockCipher,i=e.algo,r=[],s=[],a=[],o=[],c=[],l=[],h=[],u=[],d=[],p=[];!function(){for(var t=[],e=0;e<256;e++)t[e]=e<128?e<<1:e<<1^283;var n=0,i=0;for(e=0;e<256;e++){var f=i^i<<1^i<<2^i<<3^i<<4;f=f>>>8^255&f^99,r[n]=f,s[f]=n;var A=t[n],g=t[A],m=t[g],_=257*t[f]^16843008*f;a[n]=_<<24|_>>>8,o[n]=_<<16|_>>>16,c[n]=_<<8|_>>>24,l[n]=_,_=16843009*m^65537*g^257*A^16843008*n,h[f]=_<<24|_>>>8,u[f]=_<<16|_>>>16,d[f]=_<<8|_>>>24,p[f]=_,n?(n=A^t[t[t[m^A]]],i^=t[t[i]]):n=i=1}}();var f=[0,1,2,4,8,16,32,64,128,27,54],A=i.AES=n.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var t=this._keyPriorReset=this._key,e=t.words,n=t.sigBytes/4,i=4*((this._nRounds=n+6)+1),s=this._keySchedule=[],a=0;a<i;a++)a<n?s[a]=e[a]:(l=s[a-1],a%n?n>6&&a%n==4&&(l=r[l>>>24]<<24|r[l>>>16&255]<<16|r[l>>>8&255]<<8|r[255&l]):(l=r[(l=l<<8|l>>>24)>>>24]<<24|r[l>>>16&255]<<16|r[l>>>8&255]<<8|r[255&l],l^=f[a/n|0]<<24),s[a]=s[a-n]^l);for(var o=this._invKeySchedule=[],c=0;c<i;c++){if(a=i-c,c%4)var l=s[a];else l=s[a-4];o[c]=c<4||a<=4?l:h[r[l>>>24]]^u[r[l>>>16&255]]^d[r[l>>>8&255]]^p[r[255&l]]}}},encryptBlock:function(t,e){this._doCryptBlock(t,e,this._keySchedule,a,o,c,l,r)},decryptBlock:function(t,e){var n=t[e+1];t[e+1]=t[e+3],t[e+3]=n,this._doCryptBlock(t,e,this._invKeySchedule,h,u,d,p,s),n=t[e+1],t[e+1]=t[e+3],t[e+3]=n},_doCryptBlock:function(t,e,n,i,r,s,a,o){for(var c=this._nRounds,l=t[e]^n[0],h=t[e+1]^n[1],u=t[e+2]^n[2],d=t[e+3]^n[3],p=4,f=1;f<c;f++){var A=i[l>>>24]^r[h>>>16&255]^s[u>>>8&255]^a[255&d]^n[p++],g=i[h>>>24]^r[u>>>16&255]^s[d>>>8&255]^a[255&l]^n[p++],m=i[u>>>24]^r[d>>>16&255]^s[l>>>8&255]^a[255&h]^n[p++],_=i[d>>>24]^r[l>>>16&255]^s[h>>>8&255]^a[255&u]^n[p++];l=A,h=g,u=m,d=_}A=(o[l>>>24]<<24|o[h>>>16&255]<<16|o[u>>>8&255]<<8|o[255&d])^n[p++],g=(o[h>>>24]<<24|o[u>>>16&255]<<16|o[d>>>8&255]<<8|o[255&l])^n[p++],m=(o[u>>>24]<<24|o[d>>>16&255]<<16|o[l>>>8&255]<<8|o[255&h])^n[p++],_=(o[d>>>24]<<24|o[l>>>16&255]<<16|o[h>>>8&255]<<8|o[255&u])^n[p++],t[e]=A,t[e+1]=g,t[e+2]=m,t[e+3]=_},keySize:8});e.AES=n._createHelper(A)}(),t.AES}(M(),F(),j(),mt(),yt())),Kt(),Zt||(Zt=1,$t.exports=function(t){return function(){var e=t,n=e.lib.StreamCipher,i=e.algo,r=i.RC4=n.extend({_doReset:function(){for(var t=this._key,e=t.words,n=t.sigBytes,i=this._S=[],r=0;r<256;r++)i[r]=r;r=0;for(var s=0;r<256;r++){var a=r%n,o=e[a>>>2]>>>24-a%4*8&255;s=(s+i[r]+o)%256;var c=i[r];i[r]=i[s],i[s]=c}this._i=this._j=0},_doProcessBlock:function(t,e){t[e]^=s.call(this)},keySize:8,ivSize:0});function s(){for(var t=this._S,e=this._i,n=this._j,i=0,r=0;r<4;r++){n=(n+t[e=(e+1)%256])%256;var s=t[e];t[e]=t[n],t[n]=s,i|=t[(t[e]+t[n])%256]<<24-8*r}return this._i=e,this._j=n,i}e.RC4=n._createHelper(r);var a=i.RC4Drop=r.extend({cfg:r.cfg.extend({drop:192}),_doReset:function(){r._doReset.call(this);for(var t=this.cfg.drop;t>0;t--)s.call(this)}});e.RC4Drop=n._createHelper(a)}(),t.RC4}(M(),F(),j(),mt(),yt())),te||(te=1,ee.exports=function(t){return function(){var e=t,n=e.lib.StreamCipher,i=e.algo,r=[],s=[],a=[],o=i.Rabbit=n.extend({_doReset:function(){for(var t=this._key.words,e=this.cfg.iv,n=0;n<4;n++)t[n]=16711935&(t[n]<<8|t[n]>>>24)|4278255360&(t[n]<<24|t[n]>>>8);var i=this._X=[t[0],t[3]<<16|t[2]>>>16,t[1],t[0]<<16|t[3]>>>16,t[2],t[1]<<16|t[0]>>>16,t[3],t[2]<<16|t[1]>>>16],r=this._C=[t[2]<<16|t[2]>>>16,4294901760&t[0]|65535&t[1],t[3]<<16|t[3]>>>16,4294901760&t[1]|65535&t[2],t[0]<<16|t[0]>>>16,4294901760&t[2]|65535&t[3],t[1]<<16|t[1]>>>16,4294901760&t[3]|65535&t[0]];for(this._b=0,n=0;n<4;n++)c.call(this);for(n=0;n<8;n++)r[n]^=i[n+4&7];if(e){var s=e.words,a=s[0],o=s[1],l=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),h=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),u=l>>>16|4294901760&h,d=h<<16|65535&l;for(r[0]^=l,r[1]^=u,r[2]^=h,r[3]^=d,r[4]^=l,r[5]^=u,r[6]^=h,r[7]^=d,n=0;n<4;n++)c.call(this)}},_doProcessBlock:function(t,e){var n=this._X;c.call(this),r[0]=n[0]^n[5]>>>16^n[3]<<16,r[1]=n[2]^n[7]>>>16^n[5]<<16,r[2]=n[4]^n[1]>>>16^n[7]<<16,r[3]=n[6]^n[3]>>>16^n[1]<<16;for(var i=0;i<4;i++)r[i]=16711935&(r[i]<<8|r[i]>>>24)|4278255360&(r[i]<<24|r[i]>>>8),t[e+i]^=r[i]},blockSize:4,ivSize:2});function c(){for(var t=this._X,e=this._C,n=0;n<8;n++)s[n]=e[n];for(e[0]=e[0]+1295307597+this._b|0,e[1]=e[1]+3545052371+(e[0]>>>0<s[0]>>>0?1:0)|0,e[2]=e[2]+886263092+(e[1]>>>0<s[1]>>>0?1:0)|0,e[3]=e[3]+1295307597+(e[2]>>>0<s[2]>>>0?1:0)|0,e[4]=e[4]+3545052371+(e[3]>>>0<s[3]>>>0?1:0)|0,e[5]=e[5]+886263092+(e[4]>>>0<s[4]>>>0?1:0)|0,e[6]=e[6]+1295307597+(e[5]>>>0<s[5]>>>0?1:0)|0,e[7]=e[7]+3545052371+(e[6]>>>0<s[6]>>>0?1:0)|0,this._b=e[7]>>>0<s[7]>>>0?1:0,n=0;n<8;n++){var i=t[n]+e[n],r=65535&i,o=i>>>16,c=((r*r>>>17)+r*o>>>15)+o*o,l=((4294901760&i)*i|0)+((65535&i)*i|0);a[n]=c^l}t[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,t[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,t[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,t[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,t[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,t[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,t[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,t[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}e.Rabbit=n._createHelper(o)}(),t.Rabbit}(M(),F(),j(),mt(),yt())),ne||(ne=1,ie.exports=function(t){return function(){var e=t,n=e.lib.StreamCipher,i=e.algo,r=[],s=[],a=[],o=i.RabbitLegacy=n.extend({_doReset:function(){var t=this._key.words,e=this.cfg.iv,n=this._X=[t[0],t[3]<<16|t[2]>>>16,t[1],t[0]<<16|t[3]>>>16,t[2],t[1]<<16|t[0]>>>16,t[3],t[2]<<16|t[1]>>>16],i=this._C=[t[2]<<16|t[2]>>>16,4294901760&t[0]|65535&t[1],t[3]<<16|t[3]>>>16,4294901760&t[1]|65535&t[2],t[0]<<16|t[0]>>>16,4294901760&t[2]|65535&t[3],t[1]<<16|t[1]>>>16,4294901760&t[3]|65535&t[0]];this._b=0;for(var r=0;r<4;r++)c.call(this);for(r=0;r<8;r++)i[r]^=n[r+4&7];if(e){var s=e.words,a=s[0],o=s[1],l=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),h=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),u=l>>>16|4294901760&h,d=h<<16|65535&l;for(i[0]^=l,i[1]^=u,i[2]^=h,i[3]^=d,i[4]^=l,i[5]^=u,i[6]^=h,i[7]^=d,r=0;r<4;r++)c.call(this)}},_doProcessBlock:function(t,e){var n=this._X;c.call(this),r[0]=n[0]^n[5]>>>16^n[3]<<16,r[1]=n[2]^n[7]>>>16^n[5]<<16,r[2]=n[4]^n[1]>>>16^n[7]<<16,r[3]=n[6]^n[3]>>>16^n[1]<<16;for(var i=0;i<4;i++)r[i]=16711935&(r[i]<<8|r[i]>>>24)|4278255360&(r[i]<<24|r[i]>>>8),t[e+i]^=r[i]},blockSize:4,ivSize:2});function c(){for(var t=this._X,e=this._C,n=0;n<8;n++)s[n]=e[n];for(e[0]=e[0]+1295307597+this._b|0,e[1]=e[1]+3545052371+(e[0]>>>0<s[0]>>>0?1:0)|0,e[2]=e[2]+886263092+(e[1]>>>0<s[1]>>>0?1:0)|0,e[3]=e[3]+1295307597+(e[2]>>>0<s[2]>>>0?1:0)|0,e[4]=e[4]+3545052371+(e[3]>>>0<s[3]>>>0?1:0)|0,e[5]=e[5]+886263092+(e[4]>>>0<s[4]>>>0?1:0)|0,e[6]=e[6]+1295307597+(e[5]>>>0<s[5]>>>0?1:0)|0,e[7]=e[7]+3545052371+(e[6]>>>0<s[6]>>>0?1:0)|0,this._b=e[7]>>>0<s[7]>>>0?1:0,n=0;n<8;n++){var i=t[n]+e[n],r=65535&i,o=i>>>16,c=((r*r>>>17)+r*o>>>15)+o*o,l=((4294901760&i)*i|0)+((65535&i)*i|0);a[n]=c^l}t[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,t[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,t[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,t[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,t[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,t[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,t[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,t[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}e.RabbitLegacy=n._createHelper(o)}(),t.RabbitLegacy}(M(),F(),j(),mt(),yt())),ae());var oe=b(w.exports),ce={salt:"muRcN7xuzLM8vQRw",iv:"WiUWpE647DRVN5rE"};function le(t){let e=t.length;for(;--e>=0;)t[e]=0}const he=256,ue=286,de=30,pe=15,fe=new Uint8Array([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]),Ae=new Uint8Array([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]),ge=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),me=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),_e=new Array(576);le(_e);const ve=new Array(60);le(ve);const ye=new Array(512);le(ye);const be=new Array(256);le(be);const xe=new Array(29);le(xe);const we=new Array(de);function Ee(t,e,n,i,r){this.static_tree=t,this.extra_bits=e,this.extra_base=n,this.elems=i,this.max_length=r,this.has_stree=t&&t.length}let Ce,Se,Me;function Ie(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}le(we);const Te=t=>t<256?ye[t]:ye[256+(t>>>7)],Be=(t,e)=>{t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255},Re=(t,e,n)=>{t.bi_valid>16-n?(t.bi_buf|=e<<t.bi_valid&65535,Be(t,t.bi_buf),t.bi_buf=e>>16-t.bi_valid,t.bi_valid+=n-16):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=n)},De=(t,e,n)=>{Re(t,n[2*e],n[2*e+1])},Le=(t,e)=>{let n=0;do{n|=1&t,t>>>=1,n<<=1}while(--e>0);return n>>>1},Pe=(t,e,n)=>{const i=new Array(16);let r,s,a=0;for(r=1;r<=pe;r++)a=a+n[r-1]<<1,i[r]=a;for(s=0;s<=e;s++){let e=t[2*s+1];0!==e&&(t[2*s]=Le(i[e]++,e))}},ke=t=>{let e;for(e=0;e<ue;e++)t.dyn_ltree[2*e]=0;for(e=0;e<de;e++)t.dyn_dtree[2*e]=0;for(e=0;e<19;e++)t.bl_tree[2*e]=0;t.dyn_ltree[512]=1,t.opt_len=t.static_len=0,t.sym_next=t.matches=0},Oe=t=>{t.bi_valid>8?Be(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0},Ue=(t,e,n,i)=>{const r=2*e,s=2*n;return t[r]<t[s]||t[r]===t[s]&&i[e]<=i[n]},Ne=(t,e,n)=>{const i=t.heap[n];let r=n<<1;for(;r<=t.heap_len&&(r<t.heap_len&&Ue(e,t.heap[r+1],t.heap[r],t.depth)&&r++,!Ue(e,i,t.heap[r],t.depth));)t.heap[n]=t.heap[r],n=r,r<<=1;t.heap[n]=i},Fe=(t,e,n)=>{let i,r,s,a,o=0;if(0!==t.sym_next)do{i=255&t.pending_buf[t.sym_buf+o++],i+=(255&t.pending_buf[t.sym_buf+o++])<<8,r=t.pending_buf[t.sym_buf+o++],0===i?De(t,r,e):(s=be[r],De(t,s+he+1,e),a=fe[s],0!==a&&(r-=xe[s],Re(t,r,a)),i--,s=Te(i),De(t,s,n),a=Ae[s],0!==a&&(i-=we[s],Re(t,i,a)))}while(o<t.sym_next);De(t,256,e)},Qe=(t,e)=>{const n=e.dyn_tree,i=e.stat_desc.static_tree,r=e.stat_desc.has_stree,s=e.stat_desc.elems;let a,o,c,l=-1;for(t.heap_len=0,t.heap_max=573,a=0;a<s;a++)0!==n[2*a]?(t.heap[++t.heap_len]=l=a,t.depth[a]=0):n[2*a+1]=0;for(;t.heap_len<2;)c=t.heap[++t.heap_len]=l<2?++l:0,n[2*c]=1,t.depth[c]=0,t.opt_len--,r&&(t.static_len-=i[2*c+1]);for(e.max_code=l,a=t.heap_len>>1;a>=1;a--)Ne(t,n,a);c=s;do{a=t.heap[1],t.heap[1]=t.heap[t.heap_len--],Ne(t,n,1),o=t.heap[1],t.heap[--t.heap_max]=a,t.heap[--t.heap_max]=o,n[2*c]=n[2*a]+n[2*o],t.depth[c]=(t.depth[a]>=t.depth[o]?t.depth[a]:t.depth[o])+1,n[2*a+1]=n[2*o+1]=c,t.heap[1]=c++,Ne(t,n,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],((t,e)=>{const n=e.dyn_tree,i=e.max_code,r=e.stat_desc.static_tree,s=e.stat_desc.has_stree,a=e.stat_desc.extra_bits,o=e.stat_desc.extra_base,c=e.stat_desc.max_length;let l,h,u,d,p,f,A=0;for(d=0;d<=pe;d++)t.bl_count[d]=0;for(n[2*t.heap[t.heap_max]+1]=0,l=t.heap_max+1;l<573;l++)h=t.heap[l],d=n[2*n[2*h+1]+1]+1,d>c&&(d=c,A++),n[2*h+1]=d,h>i||(t.bl_count[d]++,p=0,h>=o&&(p=a[h-o]),f=n[2*h],t.opt_len+=f*(d+p),s&&(t.static_len+=f*(r[2*h+1]+p)));if(0!==A){do{for(d=c-1;0===t.bl_count[d];)d--;t.bl_count[d]--,t.bl_count[d+1]+=2,t.bl_count[c]--,A-=2}while(A>0);for(d=c;0!==d;d--)for(h=t.bl_count[d];0!==h;)u=t.heap[--l],u>i||(n[2*u+1]!==d&&(t.opt_len+=(d-n[2*u+1])*n[2*u],n[2*u+1]=d),h--)}})(t,e),Pe(n,l,t.bl_count)},ze=(t,e,n)=>{let i,r,s=-1,a=e[1],o=0,c=7,l=4;for(0===a&&(c=138,l=3),e[2*(n+1)+1]=65535,i=0;i<=n;i++)r=a,a=e[2*(i+1)+1],++o<c&&r===a||(o<l?t.bl_tree[2*r]+=o:0!==r?(r!==s&&t.bl_tree[2*r]++,t.bl_tree[32]++):o<=10?t.bl_tree[34]++:t.bl_tree[36]++,o=0,s=r,0===a?(c=138,l=3):r===a?(c=6,l=3):(c=7,l=4))},Ge=(t,e,n)=>{let i,r,s=-1,a=e[1],o=0,c=7,l=4;for(0===a&&(c=138,l=3),i=0;i<=n;i++)if(r=a,a=e[2*(i+1)+1],!(++o<c&&r===a)){if(o<l)do{De(t,r,t.bl_tree)}while(0!=--o);else 0!==r?(r!==s&&(De(t,r,t.bl_tree),o--),De(t,16,t.bl_tree),Re(t,o-3,2)):o<=10?(De(t,17,t.bl_tree),Re(t,o-3,3)):(De(t,18,t.bl_tree),Re(t,o-11,7));o=0,s=r,0===a?(c=138,l=3):r===a?(c=6,l=3):(c=7,l=4)}};let He=!1;const Ve=(t,e,n,i)=>{Re(t,0+(i?1:0),3),Oe(t),Be(t,n),Be(t,~n),n&&t.pending_buf.set(t.window.subarray(e,e+n),t.pending),t.pending+=n};var je=t=>{He||((()=>{let t,e,n,i,r;const s=new Array(16);for(n=0,i=0;i<28;i++)for(xe[i]=n,t=0;t<1<<fe[i];t++)be[n++]=i;for(be[n-1]=i,r=0,i=0;i<16;i++)for(we[i]=r,t=0;t<1<<Ae[i];t++)ye[r++]=i;for(r>>=7;i<de;i++)for(we[i]=r<<7,t=0;t<1<<Ae[i]-7;t++)ye[256+r++]=i;for(e=0;e<=pe;e++)s[e]=0;for(t=0;t<=143;)_e[2*t+1]=8,t++,s[8]++;for(;t<=255;)_e[2*t+1]=9,t++,s[9]++;for(;t<=279;)_e[2*t+1]=7,t++,s[7]++;for(;t<=287;)_e[2*t+1]=8,t++,s[8]++;for(Pe(_e,287,s),t=0;t<de;t++)ve[2*t+1]=5,ve[2*t]=Le(t,5);Ce=new Ee(_e,fe,257,ue,pe),Se=new Ee(ve,Ae,0,de,pe),Me=new Ee(new Array(0),ge,0,19,7)})(),He=!0),t.l_desc=new Ie(t.dyn_ltree,Ce),t.d_desc=new Ie(t.dyn_dtree,Se),t.bl_desc=new Ie(t.bl_tree,Me),t.bi_buf=0,t.bi_valid=0,ke(t)},We=(t,e,n,i)=>{let r,s,a=0;t.level>0?(2===t.strm.data_type&&(t.strm.data_type=(t=>{let e,n=4093624447;for(e=0;e<=31;e++,n>>>=1)if(1&n&&0!==t.dyn_ltree[2*e])return 0;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(e=32;e<he;e++)if(0!==t.dyn_ltree[2*e])return 1;return 0})(t)),Qe(t,t.l_desc),Qe(t,t.d_desc),a=(t=>{let e;for(ze(t,t.dyn_ltree,t.l_desc.max_code),ze(t,t.dyn_dtree,t.d_desc.max_code),Qe(t,t.bl_desc),e=18;e>=3&&0===t.bl_tree[2*me[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e})(t),r=t.opt_len+3+7>>>3,s=t.static_len+3+7>>>3,s<=r&&(r=s)):r=s=n+5,n+4<=r&&-1!==e?Ve(t,e,n,i):4===t.strategy||s===r?(Re(t,2+(i?1:0),3),Fe(t,_e,ve)):(Re(t,4+(i?1:0),3),((t,e,n,i)=>{let r;for(Re(t,e-257,5),Re(t,n-1,5),Re(t,i-4,4),r=0;r<i;r++)Re(t,t.bl_tree[2*me[r]+1],3);Ge(t,t.dyn_ltree,e-1),Ge(t,t.dyn_dtree,n-1)})(t,t.l_desc.max_code+1,t.d_desc.max_code+1,a+1),Fe(t,t.dyn_ltree,t.dyn_dtree)),ke(t),i&&Oe(t)},qe={_tr_init:je,_tr_stored_block:Ve,_tr_flush_block:We,_tr_tally:(t,e,n)=>(t.pending_buf[t.sym_buf+t.sym_next++]=e,t.pending_buf[t.sym_buf+t.sym_next++]=e>>8,t.pending_buf[t.sym_buf+t.sym_next++]=n,0===e?t.dyn_ltree[2*n]++:(t.matches++,e--,t.dyn_ltree[2*(be[n]+he+1)]++,t.dyn_dtree[2*Te(e)]++),t.sym_next===t.sym_end),_tr_align:t=>{Re(t,2,3),De(t,256,_e),(t=>{16===t.bi_valid?(Be(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)})(t)}};var Ye=(t,e,n,i)=>{let r=65535&t,s=t>>>16&65535,a=0;for(;0!==n;){a=n>2e3?2e3:n,n-=a;do{r=r+e[i++]|0,s=s+r|0}while(--a);r%=65521,s%=65521}return r|s<<16};const Xe=new Uint32Array((()=>{let t,e=[];for(var n=0;n<256;n++){t=n;for(var i=0;i<8;i++)t=1&t?3988292384^t>>>1:t>>>1;e[n]=t}return e})());var Je=(t,e,n,i)=>{const r=Xe,s=i+n;t^=-1;for(let n=i;n<s;n++)t=t>>>8^r[255&(t^e[n])];return~t},Ke={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},Ze={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:$e,_tr_stored_block:tn,_tr_flush_block:en,_tr_tally:nn,_tr_align:rn}=qe,{Z_NO_FLUSH:sn,Z_PARTIAL_FLUSH:an,Z_FULL_FLUSH:on,Z_FINISH:cn,Z_BLOCK:ln,Z_OK:hn,Z_STREAM_END:un,Z_STREAM_ERROR:dn,Z_DATA_ERROR:pn,Z_BUF_ERROR:fn,Z_DEFAULT_COMPRESSION:An,Z_FILTERED:gn,Z_HUFFMAN_ONLY:mn,Z_RLE:_n,Z_FIXED:vn,Z_DEFAULT_STRATEGY:yn,Z_UNKNOWN:bn,Z_DEFLATED:xn}=Ze,wn=258,En=262,Cn=42,Sn=113,Mn=666,In=(t,e)=>(t.msg=Ke[e],e),Tn=t=>2*t-(t>4?9:0),Bn=t=>{let e=t.length;for(;--e>=0;)t[e]=0},Rn=t=>{let e,n,i,r=t.w_size;e=t.hash_size,i=e;do{n=t.head[--i],t.head[i]=n>=r?n-r:0}while(--e);e=r,i=e;do{n=t.prev[--i],t.prev[i]=n>=r?n-r:0}while(--e)};let Dn=(t,e,n)=>(e<<t.hash_shift^n)&t.hash_mask;const Ln=t=>{const e=t.state;let n=e.pending;n>t.avail_out&&(n=t.avail_out),0!==n&&(t.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+n),t.next_out),t.next_out+=n,e.pending_out+=n,t.total_out+=n,t.avail_out-=n,e.pending-=n,0===e.pending&&(e.pending_out=0))},Pn=(t,e)=>{en(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,Ln(t.strm)},kn=(t,e)=>{t.pending_buf[t.pending++]=e},On=(t,e)=>{t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e},Un=(t,e,n,i)=>{let r=t.avail_in;return r>i&&(r=i),0===r?0:(t.avail_in-=r,e.set(t.input.subarray(t.next_in,t.next_in+r),n),1===t.state.wrap?t.adler=Ye(t.adler,e,r,n):2===t.state.wrap&&(t.adler=Je(t.adler,e,r,n)),t.next_in+=r,t.total_in+=r,r)},Nn=(t,e)=>{let n,i,r=t.max_chain_length,s=t.strstart,a=t.prev_length,o=t.nice_match;const c=t.strstart>t.w_size-En?t.strstart-(t.w_size-En):0,l=t.window,h=t.w_mask,u=t.prev,d=t.strstart+wn;let p=l[s+a-1],f=l[s+a];t.prev_length>=t.good_match&&(r>>=2),o>t.lookahead&&(o=t.lookahead);do{if(n=e,l[n+a]===f&&l[n+a-1]===p&&l[n]===l[s]&&l[++n]===l[s+1]){s+=2,n++;do{}while(l[++s]===l[++n]&&l[++s]===l[++n]&&l[++s]===l[++n]&&l[++s]===l[++n]&&l[++s]===l[++n]&&l[++s]===l[++n]&&l[++s]===l[++n]&&l[++s]===l[++n]&&s<d);if(i=wn-(d-s),s=d-wn,i>a){if(t.match_start=e,a=i,i>=o)break;p=l[s+a-1],f=l[s+a]}}}while((e=u[e&h])>c&&0!=--r);return a<=t.lookahead?a:t.lookahead},Fn=t=>{const e=t.w_size;let n,i,r;do{if(i=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-En)&&(t.window.set(t.window.subarray(e,e+e-i),0),t.match_start-=e,t.strstart-=e,t.block_start-=e,t.insert>t.strstart&&(t.insert=t.strstart),Rn(t),i+=e),0===t.strm.avail_in)break;if(n=Un(t.strm,t.window,t.strstart+t.lookahead,i),t.lookahead+=n,t.lookahead+t.insert>=3)for(r=t.strstart-t.insert,t.ins_h=t.window[r],t.ins_h=Dn(t,t.ins_h,t.window[r+1]);t.insert&&(t.ins_h=Dn(t,t.ins_h,t.window[r+3-1]),t.prev[r&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=r,r++,t.insert--,!(t.lookahead+t.insert<3)););}while(t.lookahead<En&&0!==t.strm.avail_in)},Qn=(t,e)=>{let n,i,r,s=t.pending_buf_size-5>t.w_size?t.w_size:t.pending_buf_size-5,a=0,o=t.strm.avail_in;do{if(n=65535,r=t.bi_valid+42>>3,t.strm.avail_out<r)break;if(r=t.strm.avail_out-r,i=t.strstart-t.block_start,n>i+t.strm.avail_in&&(n=i+t.strm.avail_in),n>r&&(n=r),n<s&&(0===n&&e!==cn||e===sn||n!==i+t.strm.avail_in))break;a=e===cn&&n===i+t.strm.avail_in?1:0,tn(t,0,0,a),t.pending_buf[t.pending-4]=n,t.pending_buf[t.pending-3]=n>>8,t.pending_buf[t.pending-2]=~n,t.pending_buf[t.pending-1]=~n>>8,Ln(t.strm),i&&(i>n&&(i=n),t.strm.output.set(t.window.subarray(t.block_start,t.block_start+i),t.strm.next_out),t.strm.next_out+=i,t.strm.avail_out-=i,t.strm.total_out+=i,t.block_start+=i,n-=i),n&&(Un(t.strm,t.strm.output,t.strm.next_out,n),t.strm.next_out+=n,t.strm.avail_out-=n,t.strm.total_out+=n)}while(0===a);return o-=t.strm.avail_in,o&&(o>=t.w_size?(t.matches=2,t.window.set(t.strm.input.subarray(t.strm.next_in-t.w_size,t.strm.next_in),0),t.strstart=t.w_size,t.insert=t.strstart):(t.window_size-t.strstart<=o&&(t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,t.insert>t.strstart&&(t.insert=t.strstart)),t.window.set(t.strm.input.subarray(t.strm.next_in-o,t.strm.next_in),t.strstart),t.strstart+=o,t.insert+=o>t.w_size-t.insert?t.w_size-t.insert:o),t.block_start=t.strstart),t.high_water<t.strstart&&(t.high_water=t.strstart),a?4:e!==sn&&e!==cn&&0===t.strm.avail_in&&t.strstart===t.block_start?2:(r=t.window_size-t.strstart,t.strm.avail_in>r&&t.block_start>=t.w_size&&(t.block_start-=t.w_size,t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,r+=t.w_size,t.insert>t.strstart&&(t.insert=t.strstart)),r>t.strm.avail_in&&(r=t.strm.avail_in),r&&(Un(t.strm,t.window,t.strstart,r),t.strstart+=r,t.insert+=r>t.w_size-t.insert?t.w_size-t.insert:r),t.high_water<t.strstart&&(t.high_water=t.strstart),r=t.bi_valid+42>>3,r=t.pending_buf_size-r>65535?65535:t.pending_buf_size-r,s=r>t.w_size?t.w_size:r,i=t.strstart-t.block_start,(i>=s||(i||e===cn)&&e!==sn&&0===t.strm.avail_in&&i<=r)&&(n=i>r?r:i,a=e===cn&&0===t.strm.avail_in&&n===i?1:0,tn(t,t.block_start,n,a),t.block_start+=n,Ln(t.strm)),a?3:1)},zn=(t,e)=>{let n,i;for(;;){if(t.lookahead<En){if(Fn(t),t.lookahead<En&&e===sn)return 1;if(0===t.lookahead)break}if(n=0,t.lookahead>=3&&(t.ins_h=Dn(t,t.ins_h,t.window[t.strstart+3-1]),n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==n&&t.strstart-n<=t.w_size-En&&(t.match_length=Nn(t,n)),t.match_length>=3)if(i=nn(t,t.strstart-t.match_start,t.match_length-3),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=3){t.match_length--;do{t.strstart++,t.ins_h=Dn(t,t.ins_h,t.window[t.strstart+3-1]),n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart}while(0!=--t.match_length);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=Dn(t,t.ins_h,t.window[t.strstart+1]);else i=nn(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(i&&(Pn(t,!1),0===t.strm.avail_out))return 1}return t.insert=t.strstart<2?t.strstart:2,e===cn?(Pn(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(Pn(t,!1),0===t.strm.avail_out)?1:2},Gn=(t,e)=>{let n,i,r;for(;;){if(t.lookahead<En){if(Fn(t),t.lookahead<En&&e===sn)return 1;if(0===t.lookahead)break}if(n=0,t.lookahead>=3&&(t.ins_h=Dn(t,t.ins_h,t.window[t.strstart+3-1]),n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=2,0!==n&&t.prev_length<t.max_lazy_match&&t.strstart-n<=t.w_size-En&&(t.match_length=Nn(t,n),t.match_length<=5&&(t.strategy===gn||3===t.match_length&&t.strstart-t.match_start>4096)&&(t.match_length=2)),t.prev_length>=3&&t.match_length<=t.prev_length){r=t.strstart+t.lookahead-3,i=nn(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=r&&(t.ins_h=Dn(t,t.ins_h,t.window[t.strstart+3-1]),n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart)}while(0!=--t.prev_length);if(t.match_available=0,t.match_length=2,t.strstart++,i&&(Pn(t,!1),0===t.strm.avail_out))return 1}else if(t.match_available){if(i=nn(t,0,t.window[t.strstart-1]),i&&Pn(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return 1}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(i=nn(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<2?t.strstart:2,e===cn?(Pn(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(Pn(t,!1),0===t.strm.avail_out)?1:2};function Hn(t,e,n,i,r){this.good_length=t,this.max_lazy=e,this.nice_length=n,this.max_chain=i,this.func=r}const Vn=[new Hn(0,0,0,0,Qn),new Hn(4,4,8,4,zn),new Hn(4,5,16,8,zn),new Hn(4,6,32,32,zn),new Hn(4,4,16,16,Gn),new Hn(8,16,32,32,Gn),new Hn(8,16,128,128,Gn),new Hn(8,32,128,256,Gn),new Hn(32,128,258,1024,Gn),new Hn(32,258,258,4096,Gn)];function jn(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=xn,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),Bn(this.dyn_ltree),Bn(this.dyn_dtree),Bn(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),Bn(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),Bn(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const Wn=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.status!==Cn&&57!==e.status&&69!==e.status&&73!==e.status&&91!==e.status&&103!==e.status&&e.status!==Sn&&e.status!==Mn?1:0},qn=t=>{if(Wn(t))return In(t,dn);t.total_in=t.total_out=0,t.data_type=bn;const e=t.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=2===e.wrap?57:e.wrap?Cn:Sn,t.adler=2===e.wrap?0:1,e.last_flush=-2,$e(e),hn},Yn=t=>{const e=qn(t);var n;return e===hn&&((n=t.state).window_size=2*n.w_size,Bn(n.head),n.max_lazy_match=Vn[n.level].max_lazy,n.good_match=Vn[n.level].good_length,n.nice_match=Vn[n.level].nice_length,n.max_chain_length=Vn[n.level].max_chain,n.strstart=0,n.block_start=0,n.lookahead=0,n.insert=0,n.match_length=n.prev_length=2,n.match_available=0,n.ins_h=0),e},Xn=(t,e,n,i,r,s)=>{if(!t)return dn;let a=1;if(e===An&&(e=6),i<0?(a=0,i=-i):i>15&&(a=2,i-=16),r<1||r>9||n!==xn||i<8||i>15||e<0||e>9||s<0||s>vn||8===i&&1!==a)return In(t,dn);8===i&&(i=9);const o=new jn;return t.state=o,o.strm=t,o.status=Cn,o.wrap=a,o.gzhead=null,o.w_bits=i,o.w_size=1<<o.w_bits,o.w_mask=o.w_size-1,o.hash_bits=r+7,o.hash_size=1<<o.hash_bits,o.hash_mask=o.hash_size-1,o.hash_shift=~~((o.hash_bits+3-1)/3),o.window=new Uint8Array(2*o.w_size),o.head=new Uint16Array(o.hash_size),o.prev=new Uint16Array(o.w_size),o.lit_bufsize=1<<r+6,o.pending_buf_size=4*o.lit_bufsize,o.pending_buf=new Uint8Array(o.pending_buf_size),o.sym_buf=o.lit_bufsize,o.sym_end=3*(o.lit_bufsize-1),o.level=e,o.strategy=s,o.method=n,Yn(t)};var Jn=(t,e)=>{if(Wn(t)||e>ln||e<0)return t?In(t,dn):dn;const n=t.state;if(!t.output||0!==t.avail_in&&!t.input||n.status===Mn&&e!==cn)return In(t,0===t.avail_out?fn:dn);const i=n.last_flush;if(n.last_flush=e,0!==n.pending){if(Ln(t),0===t.avail_out)return n.last_flush=-1,hn}else if(0===t.avail_in&&Tn(e)<=Tn(i)&&e!==cn)return In(t,fn);if(n.status===Mn&&0!==t.avail_in)return In(t,fn);if(n.status===Cn&&0===n.wrap&&(n.status=Sn),n.status===Cn){let e=xn+(n.w_bits-8<<4)<<8,i=-1;if(i=n.strategy>=mn||n.level<2?0:n.level<6?1:6===n.level?2:3,e|=i<<6,0!==n.strstart&&(e|=32),e+=31-e%31,On(n,e),0!==n.strstart&&(On(n,t.adler>>>16),On(n,65535&t.adler)),t.adler=1,n.status=Sn,Ln(t),0!==n.pending)return n.last_flush=-1,hn}if(57===n.status)if(t.adler=0,kn(n,31),kn(n,139),kn(n,8),n.gzhead)kn(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),kn(n,255&n.gzhead.time),kn(n,n.gzhead.time>>8&255),kn(n,n.gzhead.time>>16&255),kn(n,n.gzhead.time>>24&255),kn(n,9===n.level?2:n.strategy>=mn||n.level<2?4:0),kn(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(kn(n,255&n.gzhead.extra.length),kn(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(t.adler=Je(t.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69;else if(kn(n,0),kn(n,0),kn(n,0),kn(n,0),kn(n,0),kn(n,9===n.level?2:n.strategy>=mn||n.level<2?4:0),kn(n,3),n.status=Sn,Ln(t),0!==n.pending)return n.last_flush=-1,hn;if(69===n.status){if(n.gzhead.extra){let e=n.pending,i=(65535&n.gzhead.extra.length)-n.gzindex;for(;n.pending+i>n.pending_buf_size;){let r=n.pending_buf_size-n.pending;if(n.pending_buf.set(n.gzhead.extra.subarray(n.gzindex,n.gzindex+r),n.pending),n.pending=n.pending_buf_size,n.gzhead.hcrc&&n.pending>e&&(t.adler=Je(t.adler,n.pending_buf,n.pending-e,e)),n.gzindex+=r,Ln(t),0!==n.pending)return n.last_flush=-1,hn;e=0,i-=r}let r=new Uint8Array(n.gzhead.extra);n.pending_buf.set(r.subarray(n.gzindex,n.gzindex+i),n.pending),n.pending+=i,n.gzhead.hcrc&&n.pending>e&&(t.adler=Je(t.adler,n.pending_buf,n.pending-e,e)),n.gzindex=0}n.status=73}if(73===n.status){if(n.gzhead.name){let e,i=n.pending;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>i&&(t.adler=Je(t.adler,n.pending_buf,n.pending-i,i)),Ln(t),0!==n.pending)return n.last_flush=-1,hn;i=0}e=n.gzindex<n.gzhead.name.length?255&n.gzhead.name.charCodeAt(n.gzindex++):0,kn(n,e)}while(0!==e);n.gzhead.hcrc&&n.pending>i&&(t.adler=Je(t.adler,n.pending_buf,n.pending-i,i)),n.gzindex=0}n.status=91}if(91===n.status){if(n.gzhead.comment){let e,i=n.pending;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>i&&(t.adler=Je(t.adler,n.pending_buf,n.pending-i,i)),Ln(t),0!==n.pending)return n.last_flush=-1,hn;i=0}e=n.gzindex<n.gzhead.comment.length?255&n.gzhead.comment.charCodeAt(n.gzindex++):0,kn(n,e)}while(0!==e);n.gzhead.hcrc&&n.pending>i&&(t.adler=Je(t.adler,n.pending_buf,n.pending-i,i))}n.status=103}if(103===n.status){if(n.gzhead.hcrc){if(n.pending+2>n.pending_buf_size&&(Ln(t),0!==n.pending))return n.last_flush=-1,hn;kn(n,255&t.adler),kn(n,t.adler>>8&255),t.adler=0}if(n.status=Sn,Ln(t),0!==n.pending)return n.last_flush=-1,hn}if(0!==t.avail_in||0!==n.lookahead||e!==sn&&n.status!==Mn){let i=0===n.level?Qn(n,e):n.strategy===mn?((t,e)=>{let n;for(;;){if(0===t.lookahead&&(Fn(t),0===t.lookahead)){if(e===sn)return 1;break}if(t.match_length=0,n=nn(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,n&&(Pn(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===cn?(Pn(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(Pn(t,!1),0===t.strm.avail_out)?1:2})(n,e):n.strategy===_n?((t,e)=>{let n,i,r,s;const a=t.window;for(;;){if(t.lookahead<=wn){if(Fn(t),t.lookahead<=wn&&e===sn)return 1;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=3&&t.strstart>0&&(r=t.strstart-1,i=a[r],i===a[++r]&&i===a[++r]&&i===a[++r])){s=t.strstart+wn;do{}while(i===a[++r]&&i===a[++r]&&i===a[++r]&&i===a[++r]&&i===a[++r]&&i===a[++r]&&i===a[++r]&&i===a[++r]&&r<s);t.match_length=wn-(s-r),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=3?(n=nn(t,1,t.match_length-3),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(n=nn(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),n&&(Pn(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===cn?(Pn(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(Pn(t,!1),0===t.strm.avail_out)?1:2})(n,e):Vn[n.level].func(n,e);if(3!==i&&4!==i||(n.status=Mn),1===i||3===i)return 0===t.avail_out&&(n.last_flush=-1),hn;if(2===i&&(e===an?rn(n):e!==ln&&(tn(n,0,0,!1),e===on&&(Bn(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),Ln(t),0===t.avail_out))return n.last_flush=-1,hn}return e!==cn?hn:n.wrap<=0?un:(2===n.wrap?(kn(n,255&t.adler),kn(n,t.adler>>8&255),kn(n,t.adler>>16&255),kn(n,t.adler>>24&255),kn(n,255&t.total_in),kn(n,t.total_in>>8&255),kn(n,t.total_in>>16&255),kn(n,t.total_in>>24&255)):(On(n,t.adler>>>16),On(n,65535&t.adler)),Ln(t),n.wrap>0&&(n.wrap=-n.wrap),0!==n.pending?hn:un)},Kn=(t,e)=>{let n=e.length;if(Wn(t))return dn;const i=t.state,r=i.wrap;if(2===r||1===r&&i.status!==Cn||i.lookahead)return dn;if(1===r&&(t.adler=Ye(t.adler,e,n,0)),i.wrap=0,n>=i.w_size){0===r&&(Bn(i.head),i.strstart=0,i.block_start=0,i.insert=0);let t=new Uint8Array(i.w_size);t.set(e.subarray(n-i.w_size,n),0),e=t,n=i.w_size}const s=t.avail_in,a=t.next_in,o=t.input;for(t.avail_in=n,t.next_in=0,t.input=e,Fn(i);i.lookahead>=3;){let t=i.strstart,e=i.lookahead-2;do{i.ins_h=Dn(i,i.ins_h,i.window[t+3-1]),i.prev[t&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=t,t++}while(--e);i.strstart=t,i.lookahead=2,Fn(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=2,i.match_available=0,t.next_in=a,t.input=o,t.avail_in=s,i.wrap=r,hn},Zn={deflateInit:(t,e)=>Xn(t,e,xn,15,8,yn),deflateInit2:Xn,deflateReset:Yn,deflateResetKeep:qn,deflateSetHeader:(t,e)=>Wn(t)||2!==t.state.wrap?dn:(t.state.gzhead=e,hn),deflate:Jn,deflateEnd:t=>{if(Wn(t))return dn;const e=t.state.status;return t.state=null,e===Sn?In(t,pn):hn},deflateSetDictionary:Kn,deflateInfo:"pako deflate (from Nodeca project)"};const $n=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var ti={assign:function(t){const e=Array.prototype.slice.call(arguments,1);for(;e.length;){const n=e.shift();if(n){if("object"!=typeof n)throw new TypeError(n+"must be non-object");for(const e in n)$n(n,e)&&(t[e]=n[e])}}return t},flattenChunks:t=>{let e=0;for(let n=0,i=t.length;n<i;n++)e+=t[n].length;const n=new Uint8Array(e);for(let e=0,i=0,r=t.length;e<r;e++){let r=t[e];n.set(r,i),i+=r.length}return n}};let ei=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(t){ei=!1}const ni=new Uint8Array(256);for(let t=0;t<256;t++)ni[t]=t>=252?6:t>=248?5:t>=240?4:t>=224?3:t>=192?2:1;ni[254]=ni[254]=1;var ii={string2buf:t=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(t);let e,n,i,r,s,a=t.length,o=0;for(r=0;r<a;r++)n=t.charCodeAt(r),55296==(64512&n)&&r+1<a&&(i=t.charCodeAt(r+1),56320==(64512&i)&&(n=65536+(n-55296<<10)+(i-56320),r++)),o+=n<128?1:n<2048?2:n<65536?3:4;for(e=new Uint8Array(o),s=0,r=0;s<o;r++)n=t.charCodeAt(r),55296==(64512&n)&&r+1<a&&(i=t.charCodeAt(r+1),56320==(64512&i)&&(n=65536+(n-55296<<10)+(i-56320),r++)),n<128?e[s++]=n:n<2048?(e[s++]=192|n>>>6,e[s++]=128|63&n):n<65536?(e[s++]=224|n>>>12,e[s++]=128|n>>>6&63,e[s++]=128|63&n):(e[s++]=240|n>>>18,e[s++]=128|n>>>12&63,e[s++]=128|n>>>6&63,e[s++]=128|63&n);return e},buf2string:(t,e)=>{const n=e||t.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(t.subarray(0,e));let i,r;const s=new Array(2*n);for(r=0,i=0;i<n;){let e=t[i++];if(e<128){s[r++]=e;continue}let a=ni[e];if(a>4)s[r++]=65533,i+=a-1;else{for(e&=2===a?31:3===a?15:7;a>1&&i<n;)e=e<<6|63&t[i++],a--;a>1?s[r++]=65533:e<65536?s[r++]=e:(e-=65536,s[r++]=55296|e>>10&1023,s[r++]=56320|1023&e)}}return((t,e)=>{if(e<65534&&t.subarray&&ei)return String.fromCharCode.apply(null,t.length===e?t:t.subarray(0,e));let n="";for(let i=0;i<e;i++)n+=String.fromCharCode(t[i]);return n})(s,r)},utf8border:(t,e)=>{(e=e||t.length)>t.length&&(e=t.length);let n=e-1;for(;n>=0&&128==(192&t[n]);)n--;return n<0||0===n?e:n+ni[t[n]]>e?n:e}};var ri=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};const si=Object.prototype.toString,{Z_NO_FLUSH:ai,Z_SYNC_FLUSH:oi,Z_FULL_FLUSH:ci,Z_FINISH:li,Z_OK:hi,Z_STREAM_END:ui,Z_DEFAULT_COMPRESSION:di,Z_DEFAULT_STRATEGY:pi,Z_DEFLATED:fi}=Ze;function Ai(t){this.options=ti.assign({level:di,method:fi,chunkSize:16384,windowBits:15,memLevel:8,strategy:pi},t||{});let e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new ri,this.strm.avail_out=0;let n=Zn.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(n!==hi)throw new Error(Ke[n]);if(e.header&&Zn.deflateSetHeader(this.strm,e.header),e.dictionary){let t;if(t="string"==typeof e.dictionary?ii.string2buf(e.dictionary):"[object ArrayBuffer]"===si.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,n=Zn.deflateSetDictionary(this.strm,t),n!==hi)throw new Error(Ke[n]);this._dict_set=!0}}function gi(t,e){const n=new Ai(e);if(n.push(t,!0),n.err)throw n.msg||Ke[n.err];return n.result}Ai.prototype.push=function(t,e){const n=this.strm,i=this.options.chunkSize;let r,s;if(this.ended)return!1;for(s=e===~~e?e:!0===e?li:ai,"string"==typeof t?n.input=ii.string2buf(t):"[object ArrayBuffer]"===si.call(t)?n.input=new Uint8Array(t):n.input=t,n.next_in=0,n.avail_in=n.input.length;;)if(0===n.avail_out&&(n.output=new Uint8Array(i),n.next_out=0,n.avail_out=i),(s===oi||s===ci)&&n.avail_out<=6)this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;else{if(r=Zn.deflate(n,s),r===ui)return n.next_out>0&&this.onData(n.output.subarray(0,n.next_out)),r=Zn.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===hi;if(0!==n.avail_out){if(s>0&&n.next_out>0)this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;else if(0===n.avail_in)break}else this.onData(n.output)}return!0},Ai.prototype.onData=function(t){this.chunks.push(t)},Ai.prototype.onEnd=function(t){t===hi&&(this.result=ti.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};var mi={Deflate:Ai,deflate:gi,deflateRaw:function(t,e){return(e=e||{}).raw=!0,gi(t,e)},gzip:function(t,e){return(e=e||{}).gzip=!0,gi(t,e)},constants:Ze};const _i=16209;var vi=function(t,e){let n,i,r,s,a,o,c,l,h,u,d,p,f,A,g,m,_,v,y,b,x,w,E,C;const S=t.state;n=t.next_in,E=t.input,i=n+(t.avail_in-5),r=t.next_out,C=t.output,s=r-(e-t.avail_out),a=r+(t.avail_out-257),o=S.dmax,c=S.wsize,l=S.whave,h=S.wnext,u=S.window,d=S.hold,p=S.bits,f=S.lencode,A=S.distcode,g=(1<<S.lenbits)-1,m=(1<<S.distbits)-1;t:do{p<15&&(d+=E[n++]<<p,p+=8,d+=E[n++]<<p,p+=8),_=f[d&g];e:for(;;){if(v=_>>>24,d>>>=v,p-=v,v=_>>>16&255,0===v)C[r++]=65535&_;else{if(!(16&v)){if(64&v){if(32&v){S.mode=16191;break t}t.msg="invalid literal/length code",S.mode=_i;break t}_=f[(65535&_)+(d&(1<<v)-1)];continue e}for(y=65535&_,v&=15,v&&(p<v&&(d+=E[n++]<<p,p+=8),y+=d&(1<<v)-1,d>>>=v,p-=v),p<15&&(d+=E[n++]<<p,p+=8,d+=E[n++]<<p,p+=8),_=A[d&m];;){if(v=_>>>24,d>>>=v,p-=v,v=_>>>16&255,16&v){if(b=65535&_,v&=15,p<v&&(d+=E[n++]<<p,p+=8,p<v&&(d+=E[n++]<<p,p+=8)),b+=d&(1<<v)-1,b>o){t.msg="invalid distance too far back",S.mode=_i;break t}if(d>>>=v,p-=v,v=r-s,b>v){if(v=b-v,v>l&&S.sane){t.msg="invalid distance too far back",S.mode=_i;break t}if(x=0,w=u,0===h){if(x+=c-v,v<y){y-=v;do{C[r++]=u[x++]}while(--v);x=r-b,w=C}}else if(h<v){if(x+=c+h-v,v-=h,v<y){y-=v;do{C[r++]=u[x++]}while(--v);if(x=0,h<y){v=h,y-=v;do{C[r++]=u[x++]}while(--v);x=r-b,w=C}}}else if(x+=h-v,v<y){y-=v;do{C[r++]=u[x++]}while(--v);x=r-b,w=C}for(;y>2;)C[r++]=w[x++],C[r++]=w[x++],C[r++]=w[x++],y-=3;y&&(C[r++]=w[x++],y>1&&(C[r++]=w[x++]))}else{x=r-b;do{C[r++]=C[x++],C[r++]=C[x++],C[r++]=C[x++],y-=3}while(y>2);y&&(C[r++]=C[x++],y>1&&(C[r++]=C[x++]))}break}if(64&v){t.msg="invalid distance code",S.mode=_i;break t}_=A[(65535&_)+(d&(1<<v)-1)]}}break}}while(n<i&&r<a);y=p>>3,n-=y,p-=y<<3,d&=(1<<p)-1,t.next_in=n,t.next_out=r,t.avail_in=n<i?i-n+5:5-(n-i),t.avail_out=r<a?a-r+257:257-(r-a),S.hold=d,S.bits=p};const yi=15,bi=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),xi=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),wi=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),Ei=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var Ci=(t,e,n,i,r,s,a,o)=>{const c=o.bits;let l,h,u,d,p,f,A=0,g=0,m=0,_=0,v=0,y=0,b=0,x=0,w=0,E=0,C=null;const S=new Uint16Array(16),M=new Uint16Array(16);let I,T,B,R=null;for(A=0;A<=yi;A++)S[A]=0;for(g=0;g<i;g++)S[e[n+g]]++;for(v=c,_=yi;_>=1&&0===S[_];_--);if(v>_&&(v=_),0===_)return r[s++]=20971520,r[s++]=20971520,o.bits=1,0;for(m=1;m<_&&0===S[m];m++);for(v<m&&(v=m),x=1,A=1;A<=yi;A++)if(x<<=1,x-=S[A],x<0)return-1;if(x>0&&(0===t||1!==_))return-1;for(M[1]=0,A=1;A<yi;A++)M[A+1]=M[A]+S[A];for(g=0;g<i;g++)0!==e[n+g]&&(a[M[e[n+g]]++]=g);if(0===t?(C=R=a,f=20):1===t?(C=bi,R=xi,f=257):(C=wi,R=Ei,f=0),E=0,g=0,A=m,p=s,y=v,b=0,u=-1,w=1<<v,d=w-1,1===t&&w>852||2===t&&w>592)return 1;for(;;){I=A-b,a[g]+1<f?(T=0,B=a[g]):a[g]>=f?(T=R[a[g]-f],B=C[a[g]-f]):(T=96,B=0),l=1<<A-b,h=1<<y,m=h;do{h-=l,r[p+(E>>b)+h]=I<<24|T<<16|B}while(0!==h);for(l=1<<A-1;E&l;)l>>=1;if(0!==l?(E&=l-1,E+=l):E=0,g++,0==--S[A]){if(A===_)break;A=e[n+a[g]]}if(A>v&&(E&d)!==u){for(0===b&&(b=v),p+=m,y=A-b,x=1<<y;y+b<_&&(x-=S[y+b],!(x<=0));)y++,x<<=1;if(w+=1<<y,1===t&&w>852||2===t&&w>592)return 1;u=E&d,r[u]=v<<24|y<<16|p-s}}return 0!==E&&(r[p+E]=A-b<<24|64<<16),o.bits=v,0};const{Z_FINISH:Si,Z_BLOCK:Mi,Z_TREES:Ii,Z_OK:Ti,Z_STREAM_END:Bi,Z_NEED_DICT:Ri,Z_STREAM_ERROR:Di,Z_DATA_ERROR:Li,Z_MEM_ERROR:Pi,Z_BUF_ERROR:ki,Z_DEFLATED:Oi}=Ze,Ui=16180,Ni=16190,Fi=16191,Qi=16192,zi=16194,Gi=16199,Hi=16200,Vi=16206,ji=16209,Wi=t=>(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24);function qi(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const Yi=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.mode<Ui||e.mode>16211?1:0},Xi=t=>{if(Yi(t))return Di;const e=t.state;return t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=Ui,e.last=0,e.havedict=0,e.flags=-1,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(852),e.distcode=e.distdyn=new Int32Array(592),e.sane=1,e.back=-1,Ti},Ji=t=>{if(Yi(t))return Di;const e=t.state;return e.wsize=0,e.whave=0,e.wnext=0,Xi(t)},Ki=(t,e)=>{let n;if(Yi(t))return Di;const i=t.state;return e<0?(n=0,e=-e):(n=5+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?Di:(null!==i.window&&i.wbits!==e&&(i.window=null),i.wrap=n,i.wbits=e,Ji(t))},Zi=(t,e)=>{if(!t)return Di;const n=new qi;t.state=n,n.strm=t,n.window=null,n.mode=Ui;const i=Ki(t,e);return i!==Ti&&(t.state=null),i};let $i,tr,er=!0;const nr=t=>{if(er){$i=new Int32Array(512),tr=new Int32Array(32);let e=0;for(;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(Ci(1,t.lens,0,288,$i,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;Ci(2,t.lens,0,32,tr,0,t.work,{bits:5}),er=!1}t.lencode=$i,t.lenbits=9,t.distcode=tr,t.distbits=5},ir=(t,e,n,i)=>{let r;const s=t.state;return null===s.window&&(s.wsize=1<<s.wbits,s.wnext=0,s.whave=0,s.window=new Uint8Array(s.wsize)),i>=s.wsize?(s.window.set(e.subarray(n-s.wsize,n),0),s.wnext=0,s.whave=s.wsize):(r=s.wsize-s.wnext,r>i&&(r=i),s.window.set(e.subarray(n-i,n-i+r),s.wnext),(i-=r)?(s.window.set(e.subarray(n-i,n),0),s.wnext=i,s.whave=s.wsize):(s.wnext+=r,s.wnext===s.wsize&&(s.wnext=0),s.whave<s.wsize&&(s.whave+=r))),0};var rr=(t,e)=>{let n,i,r,s,a,o,c,l,h,u,d,p,f,A,g,m,_,v,y,b,x,w,E=0;const C=new Uint8Array(4);let S,M;const I=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Yi(t)||!t.output||!t.input&&0!==t.avail_in)return Di;n=t.state,n.mode===Fi&&(n.mode=Qi),a=t.next_out,r=t.output,c=t.avail_out,s=t.next_in,i=t.input,o=t.avail_in,l=n.hold,h=n.bits,u=o,d=c,w=Ti;t:for(;;)switch(n.mode){case Ui:if(0===n.wrap){n.mode=Qi;break}for(;h<16;){if(0===o)break t;o--,l+=i[s++]<<h,h+=8}if(2&n.wrap&&35615===l){0===n.wbits&&(n.wbits=15),n.check=0,C[0]=255&l,C[1]=l>>>8&255,n.check=Je(n.check,C,2,0),l=0,h=0,n.mode=16181;break}if(n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&l)<<8)+(l>>8))%31){t.msg="incorrect header check",n.mode=ji;break}if((15&l)!==Oi){t.msg="unknown compression method",n.mode=ji;break}if(l>>>=4,h-=4,x=8+(15&l),0===n.wbits&&(n.wbits=x),x>15||x>n.wbits){t.msg="invalid window size",n.mode=ji;break}n.dmax=1<<n.wbits,n.flags=0,t.adler=n.check=1,n.mode=512&l?16189:Fi,l=0,h=0;break;case 16181:for(;h<16;){if(0===o)break t;o--,l+=i[s++]<<h,h+=8}if(n.flags=l,(255&n.flags)!==Oi){t.msg="unknown compression method",n.mode=ji;break}if(57344&n.flags){t.msg="unknown header flags set",n.mode=ji;break}n.head&&(n.head.text=l>>8&1),512&n.flags&&4&n.wrap&&(C[0]=255&l,C[1]=l>>>8&255,n.check=Je(n.check,C,2,0)),l=0,h=0,n.mode=16182;case 16182:for(;h<32;){if(0===o)break t;o--,l+=i[s++]<<h,h+=8}n.head&&(n.head.time=l),512&n.flags&&4&n.wrap&&(C[0]=255&l,C[1]=l>>>8&255,C[2]=l>>>16&255,C[3]=l>>>24&255,n.check=Je(n.check,C,4,0)),l=0,h=0,n.mode=16183;case 16183:for(;h<16;){if(0===o)break t;o--,l+=i[s++]<<h,h+=8}n.head&&(n.head.xflags=255&l,n.head.os=l>>8),512&n.flags&&4&n.wrap&&(C[0]=255&l,C[1]=l>>>8&255,n.check=Je(n.check,C,2,0)),l=0,h=0,n.mode=16184;case 16184:if(1024&n.flags){for(;h<16;){if(0===o)break t;o--,l+=i[s++]<<h,h+=8}n.length=l,n.head&&(n.head.extra_len=l),512&n.flags&&4&n.wrap&&(C[0]=255&l,C[1]=l>>>8&255,n.check=Je(n.check,C,2,0)),l=0,h=0}else n.head&&(n.head.extra=null);n.mode=16185;case 16185:if(1024&n.flags&&(p=n.length,p>o&&(p=o),p&&(n.head&&(x=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Uint8Array(n.head.extra_len)),n.head.extra.set(i.subarray(s,s+p),x)),512&n.flags&&4&n.wrap&&(n.check=Je(n.check,i,p,s)),o-=p,s+=p,n.length-=p),n.length))break t;n.length=0,n.mode=16186;case 16186:if(2048&n.flags){if(0===o)break t;p=0;do{x=i[s+p++],n.head&&x&&n.length<65536&&(n.head.name+=String.fromCharCode(x))}while(x&&p<o);if(512&n.flags&&4&n.wrap&&(n.check=Je(n.check,i,p,s)),o-=p,s+=p,x)break t}else n.head&&(n.head.name=null);n.length=0,n.mode=16187;case 16187:if(4096&n.flags){if(0===o)break t;p=0;do{x=i[s+p++],n.head&&x&&n.length<65536&&(n.head.comment+=String.fromCharCode(x))}while(x&&p<o);if(512&n.flags&&4&n.wrap&&(n.check=Je(n.check,i,p,s)),o-=p,s+=p,x)break t}else n.head&&(n.head.comment=null);n.mode=16188;case 16188:if(512&n.flags){for(;h<16;){if(0===o)break t;o--,l+=i[s++]<<h,h+=8}if(4&n.wrap&&l!==(65535&n.check)){t.msg="header crc mismatch",n.mode=ji;break}l=0,h=0}n.head&&(n.head.hcrc=n.flags>>9&1,n.head.done=!0),t.adler=n.check=0,n.mode=Fi;break;case 16189:for(;h<32;){if(0===o)break t;o--,l+=i[s++]<<h,h+=8}t.adler=n.check=Wi(l),l=0,h=0,n.mode=Ni;case Ni:if(0===n.havedict)return t.next_out=a,t.avail_out=c,t.next_in=s,t.avail_in=o,n.hold=l,n.bits=h,Ri;t.adler=n.check=1,n.mode=Fi;case Fi:if(e===Mi||e===Ii)break t;case Qi:if(n.last){l>>>=7&h,h-=7&h,n.mode=Vi;break}for(;h<3;){if(0===o)break t;o--,l+=i[s++]<<h,h+=8}switch(n.last=1&l,l>>>=1,h-=1,3&l){case 0:n.mode=16193;break;case 1:if(nr(n),n.mode=Gi,e===Ii){l>>>=2,h-=2;break t}break;case 2:n.mode=16196;break;case 3:t.msg="invalid block type",n.mode=ji}l>>>=2,h-=2;break;case 16193:for(l>>>=7&h,h-=7&h;h<32;){if(0===o)break t;o--,l+=i[s++]<<h,h+=8}if((65535&l)!=(l>>>16^65535)){t.msg="invalid stored block lengths",n.mode=ji;break}if(n.length=65535&l,l=0,h=0,n.mode=zi,e===Ii)break t;case zi:n.mode=16195;case 16195:if(p=n.length,p){if(p>o&&(p=o),p>c&&(p=c),0===p)break t;r.set(i.subarray(s,s+p),a),o-=p,s+=p,c-=p,a+=p,n.length-=p;break}n.mode=Fi;break;case 16196:for(;h<14;){if(0===o)break t;o--,l+=i[s++]<<h,h+=8}if(n.nlen=257+(31&l),l>>>=5,h-=5,n.ndist=1+(31&l),l>>>=5,h-=5,n.ncode=4+(15&l),l>>>=4,h-=4,n.nlen>286||n.ndist>30){t.msg="too many length or distance symbols",n.mode=ji;break}n.have=0,n.mode=16197;case 16197:for(;n.have<n.ncode;){for(;h<3;){if(0===o)break t;o--,l+=i[s++]<<h,h+=8}n.lens[I[n.have++]]=7&l,l>>>=3,h-=3}for(;n.have<19;)n.lens[I[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,S={bits:n.lenbits},w=Ci(0,n.lens,0,19,n.lencode,0,n.work,S),n.lenbits=S.bits,w){t.msg="invalid code lengths set",n.mode=ji;break}n.have=0,n.mode=16198;case 16198:for(;n.have<n.nlen+n.ndist;){for(;E=n.lencode[l&(1<<n.lenbits)-1],g=E>>>24,m=E>>>16&255,_=65535&E,!(g<=h);){if(0===o)break t;o--,l+=i[s++]<<h,h+=8}if(_<16)l>>>=g,h-=g,n.lens[n.have++]=_;else{if(16===_){for(M=g+2;h<M;){if(0===o)break t;o--,l+=i[s++]<<h,h+=8}if(l>>>=g,h-=g,0===n.have){t.msg="invalid bit length repeat",n.mode=ji;break}x=n.lens[n.have-1],p=3+(3&l),l>>>=2,h-=2}else if(17===_){for(M=g+3;h<M;){if(0===o)break t;o--,l+=i[s++]<<h,h+=8}l>>>=g,h-=g,x=0,p=3+(7&l),l>>>=3,h-=3}else{for(M=g+7;h<M;){if(0===o)break t;o--,l+=i[s++]<<h,h+=8}l>>>=g,h-=g,x=0,p=11+(127&l),l>>>=7,h-=7}if(n.have+p>n.nlen+n.ndist){t.msg="invalid bit length repeat",n.mode=ji;break}for(;p--;)n.lens[n.have++]=x}}if(n.mode===ji)break;if(0===n.lens[256]){t.msg="invalid code -- missing end-of-block",n.mode=ji;break}if(n.lenbits=9,S={bits:n.lenbits},w=Ci(1,n.lens,0,n.nlen,n.lencode,0,n.work,S),n.lenbits=S.bits,w){t.msg="invalid literal/lengths set",n.mode=ji;break}if(n.distbits=6,n.distcode=n.distdyn,S={bits:n.distbits},w=Ci(2,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,S),n.distbits=S.bits,w){t.msg="invalid distances set",n.mode=ji;break}if(n.mode=Gi,e===Ii)break t;case Gi:n.mode=Hi;case Hi:if(o>=6&&c>=258){t.next_out=a,t.avail_out=c,t.next_in=s,t.avail_in=o,n.hold=l,n.bits=h,vi(t,d),a=t.next_out,r=t.output,c=t.avail_out,s=t.next_in,i=t.input,o=t.avail_in,l=n.hold,h=n.bits,n.mode===Fi&&(n.back=-1);break}for(n.back=0;E=n.lencode[l&(1<<n.lenbits)-1],g=E>>>24,m=E>>>16&255,_=65535&E,!(g<=h);){if(0===o)break t;o--,l+=i[s++]<<h,h+=8}if(m&&!(240&m)){for(v=g,y=m,b=_;E=n.lencode[b+((l&(1<<v+y)-1)>>v)],g=E>>>24,m=E>>>16&255,_=65535&E,!(v+g<=h);){if(0===o)break t;o--,l+=i[s++]<<h,h+=8}l>>>=v,h-=v,n.back+=v}if(l>>>=g,h-=g,n.back+=g,n.length=_,0===m){n.mode=16205;break}if(32&m){n.back=-1,n.mode=Fi;break}if(64&m){t.msg="invalid literal/length code",n.mode=ji;break}n.extra=15&m,n.mode=16201;case 16201:if(n.extra){for(M=n.extra;h<M;){if(0===o)break t;o--,l+=i[s++]<<h,h+=8}n.length+=l&(1<<n.extra)-1,l>>>=n.extra,h-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=16202;case 16202:for(;E=n.distcode[l&(1<<n.distbits)-1],g=E>>>24,m=E>>>16&255,_=65535&E,!(g<=h);){if(0===o)break t;o--,l+=i[s++]<<h,h+=8}if(!(240&m)){for(v=g,y=m,b=_;E=n.distcode[b+((l&(1<<v+y)-1)>>v)],g=E>>>24,m=E>>>16&255,_=65535&E,!(v+g<=h);){if(0===o)break t;o--,l+=i[s++]<<h,h+=8}l>>>=v,h-=v,n.back+=v}if(l>>>=g,h-=g,n.back+=g,64&m){t.msg="invalid distance code",n.mode=ji;break}n.offset=_,n.extra=15&m,n.mode=16203;case 16203:if(n.extra){for(M=n.extra;h<M;){if(0===o)break t;o--,l+=i[s++]<<h,h+=8}n.offset+=l&(1<<n.extra)-1,l>>>=n.extra,h-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){t.msg="invalid distance too far back",n.mode=ji;break}n.mode=16204;case 16204:if(0===c)break t;if(p=d-c,n.offset>p){if(p=n.offset-p,p>n.whave&&n.sane){t.msg="invalid distance too far back",n.mode=ji;break}p>n.wnext?(p-=n.wnext,f=n.wsize-p):f=n.wnext-p,p>n.length&&(p=n.length),A=n.window}else A=r,f=a-n.offset,p=n.length;p>c&&(p=c),c-=p,n.length-=p;do{r[a++]=A[f++]}while(--p);0===n.length&&(n.mode=Hi);break;case 16205:if(0===c)break t;r[a++]=n.length,c--,n.mode=Hi;break;case Vi:if(n.wrap){for(;h<32;){if(0===o)break t;o--,l|=i[s++]<<h,h+=8}if(d-=c,t.total_out+=d,n.total+=d,4&n.wrap&&d&&(t.adler=n.check=n.flags?Je(n.check,r,d,a-d):Ye(n.check,r,d,a-d)),d=c,4&n.wrap&&(n.flags?l:Wi(l))!==n.check){t.msg="incorrect data check",n.mode=ji;break}l=0,h=0}n.mode=16207;case 16207:if(n.wrap&&n.flags){for(;h<32;){if(0===o)break t;o--,l+=i[s++]<<h,h+=8}if(4&n.wrap&&l!==(4294967295&n.total)){t.msg="incorrect length check",n.mode=ji;break}l=0,h=0}n.mode=16208;case 16208:w=Bi;break t;case ji:w=Li;break t;case 16210:return Pi;default:return Di}return t.next_out=a,t.avail_out=c,t.next_in=s,t.avail_in=o,n.hold=l,n.bits=h,(n.wsize||d!==t.avail_out&&n.mode<ji&&(n.mode<Vi||e!==Si))&&ir(t,t.output,t.next_out,d-t.avail_out),u-=t.avail_in,d-=t.avail_out,t.total_in+=u,t.total_out+=d,n.total+=d,4&n.wrap&&d&&(t.adler=n.check=n.flags?Je(n.check,r,d,t.next_out-d):Ye(n.check,r,d,t.next_out-d)),t.data_type=n.bits+(n.last?64:0)+(n.mode===Fi?128:0)+(n.mode===Gi||n.mode===zi?256:0),(0===u&&0===d||e===Si)&&w===Ti&&(w=ki),w},sr={inflateReset:Ji,inflateReset2:Ki,inflateResetKeep:Xi,inflateInit:t=>Zi(t,15),inflateInit2:Zi,inflate:rr,inflateEnd:t=>{if(Yi(t))return Di;let e=t.state;return e.window&&(e.window=null),t.state=null,Ti},inflateGetHeader:(t,e)=>{if(Yi(t))return Di;const n=t.state;return 2&n.wrap?(n.head=e,e.done=!1,Ti):Di},inflateSetDictionary:(t,e)=>{const n=e.length;let i,r,s;return Yi(t)?Di:(i=t.state,0!==i.wrap&&i.mode!==Ni?Di:i.mode===Ni&&(r=1,r=Ye(r,e,n,0),r!==i.check)?Li:(s=ir(t,e,n,n),s?(i.mode=16210,Pi):(i.havedict=1,Ti)))},inflateInfo:"pako inflate (from Nodeca project)"};var ar=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1};const or=Object.prototype.toString,{Z_NO_FLUSH:cr,Z_FINISH:lr,Z_OK:hr,Z_STREAM_END:ur,Z_NEED_DICT:dr,Z_STREAM_ERROR:pr,Z_DATA_ERROR:fr,Z_MEM_ERROR:Ar}=Ze;function gr(t){this.options=ti.assign({chunkSize:65536,windowBits:15,to:""},t||{});const e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&(15&e.windowBits||(e.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new ri,this.strm.avail_out=0;let n=sr.inflateInit2(this.strm,e.windowBits);if(n!==hr)throw new Error(Ke[n]);if(this.header=new ar,sr.inflateGetHeader(this.strm,this.header),e.dictionary&&("string"==typeof e.dictionary?e.dictionary=ii.string2buf(e.dictionary):"[object ArrayBuffer]"===or.call(e.dictionary)&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(n=sr.inflateSetDictionary(this.strm,e.dictionary),n!==hr)))throw new Error(Ke[n])}function mr(t,e){const n=new gr(e);if(n.push(t),n.err)throw n.msg||Ke[n.err];return n.result}gr.prototype.push=function(t,e){const n=this.strm,i=this.options.chunkSize,r=this.options.dictionary;let s,a,o;if(this.ended)return!1;for(a=e===~~e?e:!0===e?lr:cr,"[object ArrayBuffer]"===or.call(t)?n.input=new Uint8Array(t):n.input=t,n.next_in=0,n.avail_in=n.input.length;;){for(0===n.avail_out&&(n.output=new Uint8Array(i),n.next_out=0,n.avail_out=i),s=sr.inflate(n,a),s===dr&&r&&(s=sr.inflateSetDictionary(n,r),s===hr?s=sr.inflate(n,a):s===fr&&(s=dr));n.avail_in>0&&s===ur&&n.state.wrap>0&&0!==t[n.next_in];)sr.inflateReset(n),s=sr.inflate(n,a);switch(s){case pr:case fr:case dr:case Ar:return this.onEnd(s),this.ended=!0,!1}if(o=n.avail_out,n.next_out&&(0===n.avail_out||s===ur))if("string"===this.options.to){let t=ii.utf8border(n.output,n.next_out),e=n.next_out-t,r=ii.buf2string(n.output,t);n.next_out=e,n.avail_out=i-e,e&&n.output.set(n.output.subarray(t,t+e),0),this.onData(r)}else this.onData(n.output.length===n.next_out?n.output:n.output.subarray(0,n.next_out));if(s!==hr||0!==o){if(s===ur)return s=sr.inflateEnd(this.strm),this.onEnd(s),this.ended=!0,!0;if(0===n.avail_in)break}}return!0},gr.prototype.onData=function(t){this.chunks.push(t)},gr.prototype.onEnd=function(t){t===hr&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=ti.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};var _r={Inflate:gr,inflate:mr,inflateRaw:function(t,e){return(e=e||{}).raw=!0,mr(t,e)},ungzip:mr,constants:Ze};const{Deflate:vr,deflate:yr,deflateRaw:br,gzip:xr}=mi,{Inflate:wr,inflate:Er,inflateRaw:Cr,ungzip:Sr}=_r;var Mr={Deflate:vr,deflate:yr,deflateRaw:br,gzip:xr,Inflate:wr,inflate:Er,inflateRaw:Cr,ungzip:Sr,constants:Ze};async function Ir(t,e){const n=oe.lib.WordArray.create(t.slice(0,16)),i=function(t){const e=[];let n=0;const i=t.length;for(;n<i;)e.push(t[n++]<<24|t[n++]<<16|t[n++]<<8|t[n++]);return oe.lib.WordArray.create(e,i)}(t.slice(16)),r=function(t){return oe.enc.Hex.parse(oe.SHA256(t).toString())}(e),s=function(t){const e=t.sigBytes,n=new Uint8Array(e);let i=0;const r=t.words;for(let t=0;t<e;t++)n[t]=r[i>>>2]>>>24-i%4*8&255,i++;return n}(oe.AES.decrypt({ciphertext:i},r,{iv:n,mode:oe.mode.CBC,padding:oe.pad.Pkcs7}));return Mr.inflate(s)}oe.enc.Utf8.parse(ce.salt),oe.enc.Utf8.parse(ce.iv);var Tr="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},Br=[],Rr=[],Dr="undefined"!=typeof Uint8Array?Uint8Array:Array,Lr=!1;function Pr(){Lr=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e=0;e<64;++e)Br[e]=t[e],Rr[t.charCodeAt(e)]=e;Rr["-".charCodeAt(0)]=62,Rr["_".charCodeAt(0)]=63}function kr(t,e,n){for(var i,r,s=[],a=e;a<n;a+=3)i=(t[a]<<16)+(t[a+1]<<8)+t[a+2],s.push(Br[(r=i)>>18&63]+Br[r>>12&63]+Br[r>>6&63]+Br[63&r]);return s.join("")}function Or(t){var e;Lr||Pr();for(var n=t.length,i=n%3,r="",s=[],a=16383,o=0,c=n-i;o<c;o+=a)s.push(kr(t,o,o+a>c?c:o+a));return 1===i?(e=t[n-1],r+=Br[e>>2],r+=Br[e<<4&63],r+="=="):2===i&&(e=(t[n-2]<<8)+t[n-1],r+=Br[e>>10],r+=Br[e>>4&63],r+=Br[e<<2&63],r+="="),s.push(r),s.join("")}function Ur(t,e,n,i,r){var s,a,o=8*r-i-1,c=(1<<o)-1,l=c>>1,h=-7,u=n?r-1:0,d=n?-1:1,p=t[e+u];for(u+=d,s=p&(1<<-h)-1,p>>=-h,h+=o;h>0;s=256*s+t[e+u],u+=d,h-=8);for(a=s&(1<<-h)-1,s>>=-h,h+=i;h>0;a=256*a+t[e+u],u+=d,h-=8);if(0===s)s=1-l;else{if(s===c)return a?NaN:1/0*(p?-1:1);a+=Math.pow(2,i),s-=l}return(p?-1:1)*a*Math.pow(2,s-i)}function Nr(t,e,n,i,r,s){var a,o,c,l=8*s-r-1,h=(1<<l)-1,u=h>>1,d=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,p=i?0:s-1,f=i?1:-1,A=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(o=isNaN(e)?1:0,a=h):(a=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-a))<1&&(a--,c*=2),(e+=a+u>=1?d/c:d*Math.pow(2,1-u))*c>=2&&(a++,c/=2),a+u>=h?(o=0,a=h):a+u>=1?(o=(e*c-1)*Math.pow(2,r),a+=u):(o=e*Math.pow(2,u-1)*Math.pow(2,r),a=0));r>=8;t[n+p]=255&o,p+=f,o/=256,r-=8);for(a=a<<r|o,l+=r;l>0;t[n+p]=255&a,p+=f,a/=256,l-=8);t[n+p-f]|=128*A}var Fr={}.toString,Qr=Array.isArray||function(t){return"[object Array]"==Fr.call(t)};function zr(){return Hr.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function Gr(t,e){if(zr()<e)throw new RangeError("Invalid typed array length");return Hr.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=Hr.prototype:(null===t&&(t=new Hr(e)),t.length=e),t}function Hr(t,e,n){if(!(Hr.TYPED_ARRAY_SUPPORT||this instanceof Hr))return new Hr(t,e,n);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return Wr(this,t)}return Vr(this,t,e,n)}function Vr(t,e,n,i){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,n,i){if(e.byteLength,n<0||e.byteLength<n)throw new RangeError("'offset' is out of bounds");if(e.byteLength<n+(i||0))throw new RangeError("'length' is out of bounds");e=void 0===n&&void 0===i?new Uint8Array(e):void 0===i?new Uint8Array(e,n):new Uint8Array(e,n,i);Hr.TYPED_ARRAY_SUPPORT?(t=e).__proto__=Hr.prototype:t=qr(t,e);return t}(t,e,n,i):"string"==typeof e?function(t,e,n){"string"==typeof n&&""!==n||(n="utf8");if(!Hr.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var i=0|Jr(e,n);t=Gr(t,i);var r=t.write(e,n);r!==i&&(t=t.slice(0,r));return t}(t,e,n):function(t,e){if(Xr(e)){var n=0|Yr(e.length);return 0===(t=Gr(t,n)).length||e.copy(t,0,0,n),t}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(i=e.length)!=i?Gr(t,0):qr(t,e);if("Buffer"===e.type&&Qr(e.data))return qr(t,e.data)}var i;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function jr(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function Wr(t,e){if(jr(e),t=Gr(t,e<0?0:0|Yr(e)),!Hr.TYPED_ARRAY_SUPPORT)for(var n=0;n<e;++n)t[n]=0;return t}function qr(t,e){var n=e.length<0?0:0|Yr(e.length);t=Gr(t,n);for(var i=0;i<n;i+=1)t[i]=255&e[i];return t}function Yr(t){if(t>=zr())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+zr().toString(16)+" bytes");return 0|t}function Xr(t){return!(null==t||!t._isBuffer)}function Jr(t,e){if(Xr(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var n=t.length;if(0===n)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return ws(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return Es(t).length;default:if(i)return ws(t).length;e=(""+e).toLowerCase(),i=!0}}function Kr(t,e,n){var i=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return ds(this,e,n);case"utf8":case"utf-8":return cs(this,e,n);case"ascii":return hs(this,e,n);case"latin1":case"binary":return us(this,e,n);case"base64":return os(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ps(this,e,n);default:if(i)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),i=!0}}function Zr(t,e,n){var i=t[e];t[e]=t[n],t[n]=i}function $r(t,e,n,i,r){if(0===t.length)return-1;if("string"==typeof n?(i=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=r?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(r)return-1;n=t.length-1}else if(n<0){if(!r)return-1;n=0}if("string"==typeof e&&(e=Hr.from(e,i)),Xr(e))return 0===e.length?-1:ts(t,e,n,i,r);if("number"==typeof e)return e&=255,Hr.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?r?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):ts(t,[e],n,i,r);throw new TypeError("val must be string, number or Buffer")}function ts(t,e,n,i,r){var s,a=1,o=t.length,c=e.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(t.length<2||e.length<2)return-1;a=2,o/=2,c/=2,n/=2}function l(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(r){var h=-1;for(s=n;s<o;s++)if(l(t,s)===l(e,-1===h?0:s-h)){if(-1===h&&(h=s),s-h+1===c)return h*a}else-1!==h&&(s-=s-h),h=-1}else for(n+c>o&&(n=o-c),s=n;s>=0;s--){for(var u=!0,d=0;d<c;d++)if(l(t,s+d)!==l(e,d)){u=!1;break}if(u)return s}return-1}function es(t,e,n,i){n=Number(n)||0;var r=t.length-n;i?(i=Number(i))>r&&(i=r):i=r;var s=e.length;if(s%2!=0)throw new TypeError("Invalid hex string");i>s/2&&(i=s/2);for(var a=0;a<i;++a){var o=parseInt(e.substr(2*a,2),16);if(isNaN(o))return a;t[n+a]=o}return a}function ns(t,e,n,i){return Cs(ws(e,t.length-n),t,n,i)}function is(t,e,n,i){return Cs(function(t){for(var e=[],n=0;n<t.length;++n)e.push(255&t.charCodeAt(n));return e}(e),t,n,i)}function rs(t,e,n,i){return is(t,e,n,i)}function ss(t,e,n,i){return Cs(Es(e),t,n,i)}function as(t,e,n,i){return Cs(function(t,e){for(var n,i,r,s=[],a=0;a<t.length&&!((e-=2)<0);++a)i=(n=t.charCodeAt(a))>>8,r=n%256,s.push(r),s.push(i);return s}(e,t.length-n),t,n,i)}function os(t,e,n){return 0===e&&n===t.length?Or(t):Or(t.slice(e,n))}function cs(t,e,n){n=Math.min(t.length,n);for(var i=[],r=e;r<n;){var s,a,o,c,l=t[r],h=null,u=l>239?4:l>223?3:l>191?2:1;if(r+u<=n)switch(u){case 1:l<128&&(h=l);break;case 2:128==(192&(s=t[r+1]))&&(c=(31&l)<<6|63&s)>127&&(h=c);break;case 3:s=t[r+1],a=t[r+2],128==(192&s)&&128==(192&a)&&(c=(15&l)<<12|(63&s)<<6|63&a)>2047&&(c<55296||c>57343)&&(h=c);break;case 4:s=t[r+1],a=t[r+2],o=t[r+3],128==(192&s)&&128==(192&a)&&128==(192&o)&&(c=(15&l)<<18|(63&s)<<12|(63&a)<<6|63&o)>65535&&c<1114112&&(h=c)}null===h?(h=65533,u=1):h>65535&&(h-=65536,i.push(h>>>10&1023|55296),h=56320|1023&h),i.push(h),r+=u}return function(t){var e=t.length;if(e<=ls)return String.fromCharCode.apply(String,t);var n="",i=0;for(;i<e;)n+=String.fromCharCode.apply(String,t.slice(i,i+=ls));return n}(i)}Hr.TYPED_ARRAY_SUPPORT=void 0===Tr.TYPED_ARRAY_SUPPORT||Tr.TYPED_ARRAY_SUPPORT,zr(),Hr.poolSize=8192,Hr._augment=function(t){return t.__proto__=Hr.prototype,t},Hr.from=function(t,e,n){return Vr(null,t,e,n)},Hr.TYPED_ARRAY_SUPPORT&&(Hr.prototype.__proto__=Uint8Array.prototype,Hr.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&Hr[Symbol.species]),Hr.alloc=function(t,e,n){return function(t,e,n,i){return jr(e),e<=0?Gr(t,e):void 0!==n?"string"==typeof i?Gr(t,e).fill(n,i):Gr(t,e).fill(n):Gr(t,e)}(null,t,e,n)},Hr.allocUnsafe=function(t){return Wr(null,t)},Hr.allocUnsafeSlow=function(t){return Wr(null,t)},Hr.isBuffer=function(t){return null!=t&&(!!t._isBuffer||Ss(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&Ss(t.slice(0,0))}(t))},Hr.compare=function(t,e){if(!Xr(t)||!Xr(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var n=t.length,i=e.length,r=0,s=Math.min(n,i);r<s;++r)if(t[r]!==e[r]){n=t[r],i=e[r];break}return n<i?-1:i<n?1:0},Hr.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},Hr.concat=function(t,e){if(!Qr(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return Hr.alloc(0);var n;if(void 0===e)for(e=0,n=0;n<t.length;++n)e+=t[n].length;var i=Hr.allocUnsafe(e),r=0;for(n=0;n<t.length;++n){var s=t[n];if(!Xr(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(i,r),r+=s.length}return i},Hr.byteLength=Jr,Hr.prototype._isBuffer=!0,Hr.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)Zr(this,e,e+1);return this},Hr.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)Zr(this,e,e+3),Zr(this,e+1,e+2);return this},Hr.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)Zr(this,e,e+7),Zr(this,e+1,e+6),Zr(this,e+2,e+5),Zr(this,e+3,e+4);return this},Hr.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?cs(this,0,t):Kr.apply(this,arguments)},Hr.prototype.equals=function(t){if(!Xr(t))throw new TypeError("Argument must be a Buffer");return this===t||0===Hr.compare(this,t)},Hr.prototype.inspect=function(){var t="";return this.length>0&&(t=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(t+=" ... ")),"<Buffer "+t+">"},Hr.prototype.compare=function(t,e,n,i,r){if(!Xr(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===i&&(i=0),void 0===r&&(r=this.length),e<0||n>t.length||i<0||r>this.length)throw new RangeError("out of range index");if(i>=r&&e>=n)return 0;if(i>=r)return-1;if(e>=n)return 1;if(this===t)return 0;for(var s=(r>>>=0)-(i>>>=0),a=(n>>>=0)-(e>>>=0),o=Math.min(s,a),c=this.slice(i,r),l=t.slice(e,n),h=0;h<o;++h)if(c[h]!==l[h]){s=c[h],a=l[h];break}return s<a?-1:a<s?1:0},Hr.prototype.includes=function(t,e,n){return-1!==this.indexOf(t,e,n)},Hr.prototype.indexOf=function(t,e,n){return $r(this,t,e,n,!0)},Hr.prototype.lastIndexOf=function(t,e,n){return $r(this,t,e,n,!1)},Hr.prototype.write=function(t,e,n,i){if(void 0===e)i="utf8",n=this.length,e=0;else if(void 0===n&&"string"==typeof e)i=e,n=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(n)?(n|=0,void 0===i&&(i="utf8")):(i=n,n=void 0)}var r=this.length-e;if((void 0===n||n>r)&&(n=r),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var s=!1;;)switch(i){case"hex":return es(this,t,e,n);case"utf8":case"utf-8":return ns(this,t,e,n);case"ascii":return is(this,t,e,n);case"latin1":case"binary":return rs(this,t,e,n);case"base64":return ss(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return as(this,t,e,n);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}},Hr.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var ls=4096;function hs(t,e,n){var i="";n=Math.min(t.length,n);for(var r=e;r<n;++r)i+=String.fromCharCode(127&t[r]);return i}function us(t,e,n){var i="";n=Math.min(t.length,n);for(var r=e;r<n;++r)i+=String.fromCharCode(t[r]);return i}function ds(t,e,n){var i=t.length;(!e||e<0)&&(e=0),(!n||n<0||n>i)&&(n=i);for(var r="",s=e;s<n;++s)r+=xs(t[s]);return r}function ps(t,e,n){for(var i=t.slice(e,n),r="",s=0;s<i.length;s+=2)r+=String.fromCharCode(i[s]+256*i[s+1]);return r}function fs(t,e,n){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>n)throw new RangeError("Trying to access beyond buffer length")}function As(t,e,n,i,r,s){if(!Xr(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>r||e<s)throw new RangeError('"value" argument is out of bounds');if(n+i>t.length)throw new RangeError("Index out of range")}function gs(t,e,n,i){e<0&&(e=65535+e+1);for(var r=0,s=Math.min(t.length-n,2);r<s;++r)t[n+r]=(e&255<<8*(i?r:1-r))>>>8*(i?r:1-r)}function ms(t,e,n,i){e<0&&(e=4294967295+e+1);for(var r=0,s=Math.min(t.length-n,4);r<s;++r)t[n+r]=e>>>8*(i?r:3-r)&255}function _s(t,e,n,i,r,s){if(n+i>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function vs(t,e,n,i,r){return r||_s(t,0,n,4),Nr(t,e,n,i,23,4),n+4}function ys(t,e,n,i,r){return r||_s(t,0,n,8),Nr(t,e,n,i,52,8),n+8}Hr.prototype.slice=function(t,e){var n,i=this.length;if((t=~~t)<0?(t+=i)<0&&(t=0):t>i&&(t=i),(e=void 0===e?i:~~e)<0?(e+=i)<0&&(e=0):e>i&&(e=i),e<t&&(e=t),Hr.TYPED_ARRAY_SUPPORT)(n=this.subarray(t,e)).__proto__=Hr.prototype;else{var r=e-t;n=new Hr(r,void 0);for(var s=0;s<r;++s)n[s]=this[s+t]}return n},Hr.prototype.readUIntLE=function(t,e,n){t|=0,e|=0,n||fs(t,e,this.length);for(var i=this[t],r=1,s=0;++s<e&&(r*=256);)i+=this[t+s]*r;return i},Hr.prototype.readUIntBE=function(t,e,n){t|=0,e|=0,n||fs(t,e,this.length);for(var i=this[t+--e],r=1;e>0&&(r*=256);)i+=this[t+--e]*r;return i},Hr.prototype.readUInt8=function(t,e){return e||fs(t,1,this.length),this[t]},Hr.prototype.readUInt16LE=function(t,e){return e||fs(t,2,this.length),this[t]|this[t+1]<<8},Hr.prototype.readUInt16BE=function(t,e){return e||fs(t,2,this.length),this[t]<<8|this[t+1]},Hr.prototype.readUInt32LE=function(t,e){return e||fs(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},Hr.prototype.readUInt32BE=function(t,e){return e||fs(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},Hr.prototype.readIntLE=function(t,e,n){t|=0,e|=0,n||fs(t,e,this.length);for(var i=this[t],r=1,s=0;++s<e&&(r*=256);)i+=this[t+s]*r;return i>=(r*=128)&&(i-=Math.pow(2,8*e)),i},Hr.prototype.readIntBE=function(t,e,n){t|=0,e|=0,n||fs(t,e,this.length);for(var i=e,r=1,s=this[t+--i];i>0&&(r*=256);)s+=this[t+--i]*r;return s>=(r*=128)&&(s-=Math.pow(2,8*e)),s},Hr.prototype.readInt8=function(t,e){return e||fs(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},Hr.prototype.readInt16LE=function(t,e){e||fs(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},Hr.prototype.readInt16BE=function(t,e){e||fs(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},Hr.prototype.readInt32LE=function(t,e){return e||fs(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},Hr.prototype.readInt32BE=function(t,e){return e||fs(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},Hr.prototype.readFloatLE=function(t,e){return e||fs(t,4,this.length),Ur(this,t,!0,23,4)},Hr.prototype.readFloatBE=function(t,e){return e||fs(t,4,this.length),Ur(this,t,!1,23,4)},Hr.prototype.readDoubleLE=function(t,e){return e||fs(t,8,this.length),Ur(this,t,!0,52,8)},Hr.prototype.readDoubleBE=function(t,e){return e||fs(t,8,this.length),Ur(this,t,!1,52,8)},Hr.prototype.writeUIntLE=function(t,e,n,i){(t=+t,e|=0,n|=0,i)||As(this,t,e,n,Math.pow(2,8*n)-1,0);var r=1,s=0;for(this[e]=255&t;++s<n&&(r*=256);)this[e+s]=t/r&255;return e+n},Hr.prototype.writeUIntBE=function(t,e,n,i){(t=+t,e|=0,n|=0,i)||As(this,t,e,n,Math.pow(2,8*n)-1,0);var r=n-1,s=1;for(this[e+r]=255&t;--r>=0&&(s*=256);)this[e+r]=t/s&255;return e+n},Hr.prototype.writeUInt8=function(t,e,n){return t=+t,e|=0,n||As(this,t,e,1,255,0),Hr.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},Hr.prototype.writeUInt16LE=function(t,e,n){return t=+t,e|=0,n||As(this,t,e,2,65535,0),Hr.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):gs(this,t,e,!0),e+2},Hr.prototype.writeUInt16BE=function(t,e,n){return t=+t,e|=0,n||As(this,t,e,2,65535,0),Hr.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):gs(this,t,e,!1),e+2},Hr.prototype.writeUInt32LE=function(t,e,n){return t=+t,e|=0,n||As(this,t,e,4,4294967295,0),Hr.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):ms(this,t,e,!0),e+4},Hr.prototype.writeUInt32BE=function(t,e,n){return t=+t,e|=0,n||As(this,t,e,4,4294967295,0),Hr.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):ms(this,t,e,!1),e+4},Hr.prototype.writeIntLE=function(t,e,n,i){if(t=+t,e|=0,!i){var r=Math.pow(2,8*n-1);As(this,t,e,n,r-1,-r)}var s=0,a=1,o=0;for(this[e]=255&t;++s<n&&(a*=256);)t<0&&0===o&&0!==this[e+s-1]&&(o=1),this[e+s]=(t/a|0)-o&255;return e+n},Hr.prototype.writeIntBE=function(t,e,n,i){if(t=+t,e|=0,!i){var r=Math.pow(2,8*n-1);As(this,t,e,n,r-1,-r)}var s=n-1,a=1,o=0;for(this[e+s]=255&t;--s>=0&&(a*=256);)t<0&&0===o&&0!==this[e+s+1]&&(o=1),this[e+s]=(t/a|0)-o&255;return e+n},Hr.prototype.writeInt8=function(t,e,n){return t=+t,e|=0,n||As(this,t,e,1,127,-128),Hr.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},Hr.prototype.writeInt16LE=function(t,e,n){return t=+t,e|=0,n||As(this,t,e,2,32767,-32768),Hr.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):gs(this,t,e,!0),e+2},Hr.prototype.writeInt16BE=function(t,e,n){return t=+t,e|=0,n||As(this,t,e,2,32767,-32768),Hr.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):gs(this,t,e,!1),e+2},Hr.prototype.writeInt32LE=function(t,e,n){return t=+t,e|=0,n||As(this,t,e,4,2147483647,-2147483648),Hr.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):ms(this,t,e,!0),e+4},Hr.prototype.writeInt32BE=function(t,e,n){return t=+t,e|=0,n||As(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),Hr.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):ms(this,t,e,!1),e+4},Hr.prototype.writeFloatLE=function(t,e,n){return vs(this,t,e,!0,n)},Hr.prototype.writeFloatBE=function(t,e,n){return vs(this,t,e,!1,n)},Hr.prototype.writeDoubleLE=function(t,e,n){return ys(this,t,e,!0,n)},Hr.prototype.writeDoubleBE=function(t,e,n){return ys(this,t,e,!1,n)},Hr.prototype.copy=function(t,e,n,i){if(n||(n=0),i||0===i||(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i<n&&(i=n),i===n)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-e<i-n&&(i=t.length-e+n);var r,s=i-n;if(this===t&&n<e&&e<i)for(r=s-1;r>=0;--r)t[r+e]=this[r+n];else if(s<1e3||!Hr.TYPED_ARRAY_SUPPORT)for(r=0;r<s;++r)t[r+e]=this[r+n];else Uint8Array.prototype.set.call(t,this.subarray(n,n+s),e);return s},Hr.prototype.fill=function(t,e,n,i){if("string"==typeof t){if("string"==typeof e?(i=e,e=0,n=this.length):"string"==typeof n&&(i=n,n=this.length),1===t.length){var r=t.charCodeAt(0);r<256&&(t=r)}if(void 0!==i&&"string"!=typeof i)throw new TypeError("encoding must be a string");if("string"==typeof i&&!Hr.isEncoding(i))throw new TypeError("Unknown encoding: "+i)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;var s;if(e>>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(s=e;s<n;++s)this[s]=t;else{var a=Xr(t)?t:ws(new Hr(t,i).toString()),o=a.length;for(s=0;s<n-e;++s)this[s+e]=a[s%o]}return this};var bs=/[^+\/0-9A-Za-z-_]/g;function xs(t){return t<16?"0"+t.toString(16):t.toString(16)}function ws(t,e){var n;e=e||1/0;for(var i=t.length,r=null,s=[],a=0;a<i;++a){if((n=t.charCodeAt(a))>55295&&n<57344){if(!r){if(n>56319){(e-=3)>-1&&s.push(239,191,189);continue}if(a+1===i){(e-=3)>-1&&s.push(239,191,189);continue}r=n;continue}if(n<56320){(e-=3)>-1&&s.push(239,191,189),r=n;continue}n=65536+(r-55296<<10|n-56320)}else r&&(e-=3)>-1&&s.push(239,191,189);if(r=null,n<128){if((e-=1)<0)break;s.push(n)}else if(n<2048){if((e-=2)<0)break;s.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;s.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;s.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return s}function Es(t){return function(t){var e,n,i,r,s,a;Lr||Pr();var o=t.length;if(o%4>0)throw new Error("Invalid string. Length must be a multiple of 4");s="="===t[o-2]?2:"="===t[o-1]?1:0,a=new Dr(3*o/4-s),i=s>0?o-4:o;var c=0;for(e=0,n=0;e<i;e+=4,n+=3)r=Rr[t.charCodeAt(e)]<<18|Rr[t.charCodeAt(e+1)]<<12|Rr[t.charCodeAt(e+2)]<<6|Rr[t.charCodeAt(e+3)],a[c++]=r>>16&255,a[c++]=r>>8&255,a[c++]=255&r;return 2===s?(r=Rr[t.charCodeAt(e)]<<2|Rr[t.charCodeAt(e+1)]>>4,a[c++]=255&r):1===s&&(r=Rr[t.charCodeAt(e)]<<10|Rr[t.charCodeAt(e+1)]<<4|Rr[t.charCodeAt(e+2)]>>2,a[c++]=r>>8&255,a[c++]=255&r),a}(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(bs,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function Cs(t,e,n,i){for(var r=0;r<i&&!(r+n>=e.length||r>=t.length);++r)e[r+n]=t[r];return r}function Ss(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}const Ms=new class{dbName="LargeFileCacheDB";storeName="files";db;constructor(){this.init()}async init(){return new Promise(((t,e)=>{const n=indexedDB.open(this.dbName,1);n.onupgradeneeded=()=>{const t=n.result;t.objectStoreNames.contains(this.storeName)||t.createObjectStore(this.storeName)},n.onsuccess=()=>{this.db=n.result,t()},n.onerror=()=>e(n.error)}))}async set(t,e){return new Promise(((n,i)=>{if(!this.db)return i("indexedDB 还未初始化");const r=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName),s=new Blob([e]),a=r.put(s,t);a.onsuccess=()=>n(),a.onerror=()=>i(a.error)}))}async get(t){return new Promise((e=>{if(!this.db)return e(null);const n=this.db.transaction(this.storeName,"readonly").objectStore(this.storeName).get(t);n.onsuccess=()=>e(n.result||null)}))}},Is=async t=>{const{model:e,onProgress:n}=t,i=await(async(t="",e=(t,e,n)=>{})=>{if(!t)throw new Error("url is required");const n=await Ms.get(t);if(n)return e(t,100,100),await n.arrayBuffer();const i=await fetch(t),r=i.body.getReader(),s=+i.headers.get("content-length");let a=0,o=[];for(;;){const{done:n,value:i}=await r.read();if(n)break;o.push(i),a+=i.length,e&&e(t,a,s)}const c=new Uint8Array(o.reduce(((t,e)=>t+e.length),0));let l=0;for(let t of o)c.set(t,l),l+=t.length;const h=c.buffer;return await Ms.set(t,h),h})(e.bundle,n),r=Hr.from(i),s=e.bundle.replace(/^.*\/(.*?).bundle/,"$1"),a=await Ir(r,s);return{...e,buffer:a.buffer}},Ts=async(t,e=t=>{})=>{const n=[],i={},r=(n="",r=0,s=0)=>{i[n]={url:n,progress:r,total:s};let a=0,o=0;t.forEach((({bundle:t})=>{a+=i[t].total,o+=i[t].progress}));const c=Math.floor(o/a*100);e(c)};return t.forEach((t=>{i[t.bundle]={url:t.bundle,progress:0,total:0},n.push(Is({model:t,onProgress:r}))})),Promise.all(n)},Bs="165",Rs={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},Ds={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},Ls=1,Ps=2,ks=3,Os=0,Us=1,Ns=2,Fs=100,Qs=101,zs=102,Gs=200,Hs=201,Vs=202,js=203,Ws=204,qs=205,Ys=206,Xs=207,Js=208,Ks=209,Zs=210,$s=211,ta=212,ea=213,na=214,ia=0,ra=1,sa=2,aa=0,oa=1,ca=2,la=3,ha=4,ua=5,da=6,pa=7,fa="attached",Aa="detached",ga=300,ma=301,_a=302,va=303,ya=304,ba=306,xa=1e3,wa=1001,Ea=1002,Ca=1003,Sa=1004,Ma=1005,Ia=1006,Ta=1007,Ba=1008,Ra=1009,Da=1012,La=1013,Pa=1014,ka=1015,Oa=1016,Ua=1017,Na=1018,Fa=1020,Qa=1023,za=1026,Ga=1027,Ha=1028,Va=1029,ja=1030,Wa=1031,qa=1033,Ya=33776,Xa=33777,Ja=33778,Ka=33779,Za=35840,$a=35841,to=35842,eo=35843,no=36196,io=37492,ro=37496,so=37808,ao=37809,oo=37810,co=37811,lo=37812,ho=37813,uo=37814,po=37815,fo=37816,Ao=37817,go=37818,mo=37819,_o=37820,vo=37821,yo=36492,bo=36494,xo=36495,wo=36284,Eo=36285,Co=36286,So=2201,Mo=2300,Io=2301,To=2302,Bo=2400,Ro=2401,Do=2402,Lo=2500,Po=2501,ko="",Oo="srgb",Uo="srgb-linear",No="display-p3",Fo="display-p3-linear",Qo="linear",zo="srgb",Go="rec709",Ho="p3",Vo=7680,jo=512,Wo=513,qo=514,Yo=515,Xo=516,Jo=517,Ko=518,Zo=519,$o=35044,tc="300 es",ec=2e3,nc=2001;class ic{addEventListener(t,e){void 0===this._listeners&&(this._listeners={});const n=this._listeners;void 0===n[t]&&(n[t]=[]),-1===n[t].indexOf(e)&&n[t].push(e)}hasEventListener(t,e){if(void 0===this._listeners)return!1;const n=this._listeners;return void 0!==n[t]&&-1!==n[t].indexOf(e)}removeEventListener(t,e){if(void 0===this._listeners)return;const n=this._listeners[t];if(void 0!==n){const t=n.indexOf(e);-1!==t&&n.splice(t,1)}}dispatchEvent(t){if(void 0===this._listeners)return;const e=this._listeners[t.type];if(void 0!==e){t.target=this;const n=e.slice(0);for(let e=0,i=n.length;e<i;e++)n[e].call(this,t);t.target=null}}}const rc=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let sc=1234567;const ac=Math.PI/180,oc=180/Math.PI;function cc(){const t=4294967295*Math.random()|0,e=4294967295*Math.random()|0,n=4294967295*Math.random()|0,i=4294967295*Math.random()|0;return(rc[255&t]+rc[t>>8&255]+rc[t>>16&255]+rc[t>>24&255]+"-"+rc[255&e]+rc[e>>8&255]+"-"+rc[e>>16&15|64]+rc[e>>24&255]+"-"+rc[63&n|128]+rc[n>>8&255]+"-"+rc[n>>16&255]+rc[n>>24&255]+rc[255&i]+rc[i>>8&255]+rc[i>>16&255]+rc[i>>24&255]).toLowerCase()}function lc(t,e,n){return Math.max(e,Math.min(n,t))}function hc(t,e){return(t%e+e)%e}function uc(t,e,n){return(1-n)*t+n*e}function dc(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return t/4294967295;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int32Array:return Math.max(t/2147483647,-1);case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("Invalid component type.")}}function pc(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return Math.round(4294967295*t);case Uint16Array:return Math.round(65535*t);case Uint8Array:return Math.round(255*t);case Int32Array:return Math.round(2147483647*t);case Int16Array:return Math.round(32767*t);case Int8Array:return Math.round(127*t);default:throw new Error("Invalid component type.")}}const fc={DEG2RAD:ac,RAD2DEG:oc,generateUUID:cc,clamp:lc,euclideanModulo:hc,mapLinear:function(t,e,n,i,r){return i+(t-e)*(r-i)/(n-e)},inverseLerp:function(t,e,n){return t!==e?(n-t)/(e-t):0},lerp:uc,damp:function(t,e,n,i){return uc(t,e,1-Math.exp(-n*i))},pingpong:function(t,e=1){return e-Math.abs(hc(t,2*e)-e)},smoothstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*(3-2*t)},smootherstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*t*(t*(6*t-15)+10)},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},seededRandom:function(t){void 0!==t&&(sc=t);let e=sc+=1831565813;return e=Math.imul(e^e>>>15,1|e),e^=e+Math.imul(e^e>>>7,61|e),((e^e>>>14)>>>0)/4294967296},degToRad:function(t){return t*ac},radToDeg:function(t){return t*oc},isPowerOfTwo:function(t){return!(t&t-1)&&0!==t},ceilPowerOfTwo:function(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},floorPowerOfTwo:function(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))},setQuaternionFromProperEuler:function(t,e,n,i,r){const s=Math.cos,a=Math.sin,o=s(n/2),c=a(n/2),l=s((e+i)/2),h=a((e+i)/2),u=s((e-i)/2),d=a((e-i)/2),p=s((i-e)/2),f=a((i-e)/2);switch(r){case"XYX":t.set(o*h,c*u,c*d,o*l);break;case"YZY":t.set(c*d,o*h,c*u,o*l);break;case"ZXZ":t.set(c*u,c*d,o*h,o*l);break;case"XZX":t.set(o*h,c*f,c*p,o*l);break;case"YXY":t.set(c*p,o*h,c*f,o*l);break;case"ZYZ":t.set(c*f,c*p,o*h,o*l)}},normalize:pc,denormalize:dc};class Ac{constructor(t=0,e=0){Ac.prototype.isVector2=!0,this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const e=this.x,n=this.y,i=t.elements;return this.x=i[0]*e+i[3]*n+i[6],this.y=i[1]*e+i[4]*n+i[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const n=this.dot(t)/e;return Math.acos(lc(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y;return e*e+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){const n=Math.cos(e),i=Math.sin(e),r=this.x-t.x,s=this.y-t.y;return this.x=r*n-s*i+t.x,this.y=r*i+s*n+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class gc{constructor(t,e,n,i,r,s,a,o,c){gc.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],void 0!==t&&this.set(t,e,n,i,r,s,a,o,c)}set(t,e,n,i,r,s,a,o,c){const l=this.elements;return l[0]=t,l[1]=i,l[2]=a,l[3]=e,l[4]=r,l[5]=o,l[6]=n,l[7]=s,l[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this}extractBasis(t,e,n){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,i=e.elements,r=this.elements,s=n[0],a=n[3],o=n[6],c=n[1],l=n[4],h=n[7],u=n[2],d=n[5],p=n[8],f=i[0],A=i[3],g=i[6],m=i[1],_=i[4],v=i[7],y=i[2],b=i[5],x=i[8];return r[0]=s*f+a*m+o*y,r[3]=s*A+a*_+o*b,r[6]=s*g+a*v+o*x,r[1]=c*f+l*m+h*y,r[4]=c*A+l*_+h*b,r[7]=c*g+l*v+h*x,r[2]=u*f+d*m+p*y,r[5]=u*A+d*_+p*b,r[8]=u*g+d*v+p*x,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){const t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],s=t[4],a=t[5],o=t[6],c=t[7],l=t[8];return e*s*l-e*a*c-n*r*l+n*a*o+i*r*c-i*s*o}invert(){const t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],s=t[4],a=t[5],o=t[6],c=t[7],l=t[8],h=l*s-a*c,u=a*o-l*r,d=c*r-s*o,p=e*h+n*u+i*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);const f=1/p;return t[0]=h*f,t[1]=(i*c-l*n)*f,t[2]=(a*n-i*s)*f,t[3]=u*f,t[4]=(l*e-i*o)*f,t[5]=(i*r-a*e)*f,t[6]=d*f,t[7]=(n*o-c*e)*f,t[8]=(s*e-n*r)*f,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,n,i,r,s,a){const o=Math.cos(r),c=Math.sin(r);return this.set(n*o,n*c,-n*(o*s+c*a)+s+t,-i*c,i*o,-i*(-c*s+o*a)+a+e,0,0,1),this}scale(t,e){return this.premultiply(mc.makeScale(t,e)),this}rotate(t){return this.premultiply(mc.makeRotation(-t)),this}translate(t,e){return this.premultiply(mc.makeTranslation(t,e)),this}makeTranslation(t,e){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,n,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){const e=this.elements,n=t.elements;for(let t=0;t<9;t++)if(e[t]!==n[t])return!1;return!0}fromArray(t,e=0){for(let n=0;n<9;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){const n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t}clone(){return(new this.constructor).fromArray(this.elements)}}const mc=new gc;function _c(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}const vc={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function yc(t,e){return new vc[t](e)}function bc(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function xc(){const t=bc("canvas");return t.style.display="block",t}const wc={};function Ec(t){t in wc||(wc[t]=!0)}const Cc=(new gc).set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),Sc=(new gc).set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),Mc={[Uo]:{transfer:Qo,primaries:Go,toReference:t=>t,fromReference:t=>t},[Oo]:{transfer:zo,primaries:Go,toReference:t=>t.convertSRGBToLinear(),fromReference:t=>t.convertLinearToSRGB()},[Fo]:{transfer:Qo,primaries:Ho,toReference:t=>t.applyMatrix3(Sc),fromReference:t=>t.applyMatrix3(Cc)},[No]:{transfer:zo,primaries:Ho,toReference:t=>t.convertSRGBToLinear().applyMatrix3(Sc),fromReference:t=>t.applyMatrix3(Cc).convertLinearToSRGB()}},Ic=new Set([Uo,Fo]),Tc={enabled:!0,_workingColorSpace:Uo,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(t){if(!Ic.has(t))throw new Error(`Unsupported working color space, "${t}".`);this._workingColorSpace=t},convert:function(t,e,n){if(!1===this.enabled||e===n||!e||!n)return t;const i=Mc[e].toReference;return(0,Mc[n].fromReference)(i(t))},fromWorkingColorSpace:function(t,e){return this.convert(t,this._workingColorSpace,e)},toWorkingColorSpace:function(t,e){return this.convert(t,e,this._workingColorSpace)},getPrimaries:function(t){return Mc[t].primaries},getTransfer:function(t){return t===ko?Qo:Mc[t].transfer}};function Bc(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function Rc(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}let Dc;class Lc{static getDataURL(t){if(/^data:/i.test(t.src))return t.src;if("undefined"==typeof HTMLCanvasElement)return t.src;let e;if(t instanceof HTMLCanvasElement)e=t;else{void 0===Dc&&(Dc=bc("canvas")),Dc.width=t.width,Dc.height=t.height;const n=Dc.getContext("2d");t instanceof ImageData?n.putImageData(t,0,0):n.drawImage(t,0,0,t.width,t.height),e=Dc}return e.width>2048||e.height>2048?e.toDataURL("image/jpeg",.6):e.toDataURL("image/png")}static sRGBToLinear(t){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){const e=bc("canvas");e.width=t.width,e.height=t.height;const n=e.getContext("2d");n.drawImage(t,0,0,t.width,t.height);const i=n.getImageData(0,0,t.width,t.height),r=i.data;for(let t=0;t<r.length;t++)r[t]=255*Bc(r[t]/255);return n.putImageData(i,0,0),e}if(t.data){const e=t.data.slice(0);for(let t=0;t<e.length;t++)e instanceof Uint8Array||e instanceof Uint8ClampedArray?e[t]=Math.floor(255*Bc(e[t]/255)):e[t]=Bc(e[t]);return{data:e,width:t.width,height:t.height}}return t}}let Pc=0;class kc{constructor(t=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Pc++}),this.uuid=cc(),this.data=t,this.dataReady=!0,this.version=0}set needsUpdate(t){!0===t&&this.version++}toJSON(t){const e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.images[this.uuid])return t.images[this.uuid];const n={uuid:this.uuid,url:""},i=this.data;if(null!==i){let t;if(Array.isArray(i)){t=[];for(let e=0,n=i.length;e<n;e++)i[e].isDataTexture?t.push(Oc(i[e].image)):t.push(Oc(i[e]))}else t=Oc(i);n.url=t}return e||(t.images[this.uuid]=n),n}}function Oc(t){return"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap?Lc.getDataURL(t):t.data?{data:Array.from(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:{}}let Uc=0;class Nc extends ic{constructor(t=Nc.DEFAULT_IMAGE,e=Nc.DEFAULT_MAPPING,n=1001,i=1001,r=1006,s=1008,a=1023,o=1009,c=Nc.DEFAULT_ANISOTROPY,l=ko){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Uc++}),this.uuid=cc(),this.name="",this.source=new kc(t),this.mipmaps=[],this.mapping=e,this.channel=0,this.wrapS=n,this.wrapT=i,this.magFilter=r,this.minFilter=s,this.anisotropy=c,this.format=a,this.internalFormat=null,this.type=o,this.offset=new Ac(0,0),this.repeat=new Ac(1,1),this.center=new Ac(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new gc,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=l,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.pmremVersion=0}get image(){return this.source.data}set image(t=null){this.source.data=t}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return(new this.constructor).copy(this)}copy(t){return this.name=t.name,this.source=t.source,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.channel=t.channel,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.colorSpace=t.colorSpace,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}toJSON(t){const e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.textures[this.uuid])return t.textures[this.uuid];const n={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),e||(t.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(this.mapping!==ga)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case xa:t.x=t.x-Math.floor(t.x);break;case wa:t.x=t.x<0?0:1;break;case Ea:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case xa:t.y=t.y-Math.floor(t.y);break;case wa:t.y=t.y<0?0:1;break;case Ea:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){!0===t&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(t){!0===t&&this.pmremVersion++}}Nc.DEFAULT_IMAGE=null,Nc.DEFAULT_MAPPING=ga,Nc.DEFAULT_ANISOTROPY=1;class Fc{constructor(t=0,e=0,n=0,i=1){Fc.prototype.isVector4=!0,this.x=t,this.y=e,this.z=n,this.w=i}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,n,i){return this.x=t,this.y=e,this.z=n,this.w=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){const e=this.x,n=this.y,i=this.z,r=this.w,s=t.elements;return this.x=s[0]*e+s[4]*n+s[8]*i+s[12]*r,this.y=s[1]*e+s[5]*n+s[9]*i+s[13]*r,this.z=s[2]*e+s[6]*n+s[10]*i+s[14]*r,this.w=s[3]*e+s[7]*n+s[11]*i+s[15]*r,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);const e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,n,i,r;const s=.01,a=.1,o=t.elements,c=o[0],l=o[4],h=o[8],u=o[1],d=o[5],p=o[9],f=o[2],A=o[6],g=o[10];if(Math.abs(l-u)<s&&Math.abs(h-f)<s&&Math.abs(p-A)<s){if(Math.abs(l+u)<a&&Math.abs(h+f)<a&&Math.abs(p+A)<a&&Math.abs(c+d+g-3)<a)return this.set(1,0,0,0),this;e=Math.PI;const t=(c+1)/2,o=(d+1)/2,m=(g+1)/2,_=(l+u)/4,v=(h+f)/4,y=(p+A)/4;return t>o&&t>m?t<s?(n=0,i=.707106781,r=.707106781):(n=Math.sqrt(t),i=_/n,r=v/n):o>m?o<s?(n=.707106781,i=0,r=.707106781):(i=Math.sqrt(o),n=_/i,r=y/i):m<s?(n=.707106781,i=.707106781,r=0):(r=Math.sqrt(m),n=v/r,i=y/r),this.set(n,i,r,e),this}let m=Math.sqrt((A-p)*(A-p)+(h-f)*(h-f)+(u-l)*(u-l));return Math.abs(m)<.001&&(m=1),this.x=(A-p)/m,this.y=(h-f)/m,this.z=(u-l)/m,this.w=Math.acos((c+d+g-1)/2),this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this.w=Math.max(t,Math.min(e,this.w)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this.w=t.w+(e.w-t.w)*n,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class Qc extends ic{constructor(t=1,e=1,n={}){super(),this.isRenderTarget=!0,this.width=t,this.height=e,this.depth=1,this.scissor=new Fc(0,0,t,e),this.scissorTest=!1,this.viewport=new Fc(0,0,t,e);const i={width:t,height:e,depth:1};n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Ia,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},n);const r=new Nc(i,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.colorSpace);r.flipY=!1,r.generateMipmaps=n.generateMipmaps,r.internalFormat=n.internalFormat,this.textures=[];const s=n.count;for(let t=0;t<s;t++)this.textures[t]=r.clone(),this.textures[t].isRenderTargetTexture=!0;this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this.depthTexture=n.depthTexture,this.samples=n.samples}get texture(){return this.textures[0]}set texture(t){this.textures[0]=t}setSize(t,e,n=1){if(this.width!==t||this.height!==e||this.depth!==n){this.width=t,this.height=e,this.depth=n;for(let i=0,r=this.textures.length;i<r;i++)this.textures[i].image.width=t,this.textures[i].image.height=e,this.textures[i].image.depth=n;this.dispose()}this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)}clone(){return(new this.constructor).copy(this)}copy(t){this.width=t.width,this.height=t.height,this.depth=t.depth,this.scissor.copy(t.scissor),this.scissorTest=t.scissorTest,this.viewport.copy(t.viewport),this.textures.length=0;for(let e=0,n=t.textures.length;e<n;e++)this.textures[e]=t.textures[e].clone(),this.textures[e].isRenderTargetTexture=!0;const e=Object.assign({},t.texture.image);return this.texture.source=new kc(e),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.resolveDepthBuffer=t.resolveDepthBuffer,this.resolveStencilBuffer=t.resolveStencilBuffer,null!==t.depthTexture&&(this.depthTexture=t.depthTexture.clone()),this.samples=t.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class zc extends Qc{constructor(t=1,e=1,n={}){super(t,e,n),this.isWebGLRenderTarget=!0}}class Gc extends Nc{constructor(t=null,e=1,n=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:t,width:e,height:n,depth:i},this.magFilter=Ca,this.minFilter=Ca,this.wrapR=wa,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(t){this.layerUpdates.add(t)}clearLayerUpdates(){this.layerUpdates.clear()}}class Hc extends Nc{constructor(t=null,e=1,n=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:t,width:e,height:n,depth:i},this.magFilter=Ca,this.minFilter=Ca,this.wrapR=wa,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Vc{constructor(t=0,e=0,n=0,i=1){this.isQuaternion=!0,this._x=t,this._y=e,this._z=n,this._w=i}static slerpFlat(t,e,n,i,r,s,a){let o=n[i+0],c=n[i+1],l=n[i+2],h=n[i+3];const u=r[s+0],d=r[s+1],p=r[s+2],f=r[s+3];if(0===a)return t[e+0]=o,t[e+1]=c,t[e+2]=l,void(t[e+3]=h);if(1===a)return t[e+0]=u,t[e+1]=d,t[e+2]=p,void(t[e+3]=f);if(h!==f||o!==u||c!==d||l!==p){let t=1-a;const e=o*u+c*d+l*p+h*f,n=e>=0?1:-1,i=1-e*e;if(i>Number.EPSILON){const r=Math.sqrt(i),s=Math.atan2(r,e*n);t=Math.sin(t*s)/r,a=Math.sin(a*s)/r}const r=a*n;if(o=o*t+u*r,c=c*t+d*r,l=l*t+p*r,h=h*t+f*r,t===1-a){const t=1/Math.sqrt(o*o+c*c+l*l+h*h);o*=t,c*=t,l*=t,h*=t}}t[e]=o,t[e+1]=c,t[e+2]=l,t[e+3]=h}static multiplyQuaternionsFlat(t,e,n,i,r,s){const a=n[i],o=n[i+1],c=n[i+2],l=n[i+3],h=r[s],u=r[s+1],d=r[s+2],p=r[s+3];return t[e]=a*p+l*h+o*d-c*u,t[e+1]=o*p+l*u+c*h-a*d,t[e+2]=c*p+l*d+a*u-o*h,t[e+3]=l*p-a*h-o*u-c*d,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,n,i){return this._x=t,this._y=e,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e=!0){const n=t._x,i=t._y,r=t._z,s=t._order,a=Math.cos,o=Math.sin,c=a(n/2),l=a(i/2),h=a(r/2),u=o(n/2),d=o(i/2),p=o(r/2);switch(s){case"XYZ":this._x=u*l*h+c*d*p,this._y=c*d*h-u*l*p,this._z=c*l*p+u*d*h,this._w=c*l*h-u*d*p;break;case"YXZ":this._x=u*l*h+c*d*p,this._y=c*d*h-u*l*p,this._z=c*l*p-u*d*h,this._w=c*l*h+u*d*p;break;case"ZXY":this._x=u*l*h-c*d*p,this._y=c*d*h+u*l*p,this._z=c*l*p+u*d*h,this._w=c*l*h-u*d*p;break;case"ZYX":this._x=u*l*h-c*d*p,this._y=c*d*h+u*l*p,this._z=c*l*p-u*d*h,this._w=c*l*h+u*d*p;break;case"YZX":this._x=u*l*h+c*d*p,this._y=c*d*h+u*l*p,this._z=c*l*p-u*d*h,this._w=c*l*h-u*d*p;break;case"XZY":this._x=u*l*h-c*d*p,this._y=c*d*h-u*l*p,this._z=c*l*p+u*d*h,this._w=c*l*h+u*d*p}return!0===e&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const n=e/2,i=Math.sin(n);return this._x=t.x*i,this._y=t.y*i,this._z=t.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,n=e[0],i=e[4],r=e[8],s=e[1],a=e[5],o=e[9],c=e[2],l=e[6],h=e[10],u=n+a+h;if(u>0){const t=.5/Math.sqrt(u+1);this._w=.25/t,this._x=(l-o)*t,this._y=(r-c)*t,this._z=(s-i)*t}else if(n>a&&n>h){const t=2*Math.sqrt(1+n-a-h);this._w=(l-o)/t,this._x=.25*t,this._y=(i+s)/t,this._z=(r+c)/t}else if(a>h){const t=2*Math.sqrt(1+a-n-h);this._w=(r-c)/t,this._x=(i+s)/t,this._y=.25*t,this._z=(o+l)/t}else{const t=2*Math.sqrt(1+h-n-a);this._w=(s-i)/t,this._x=(r+c)/t,this._y=(o+l)/t,this._z=.25*t}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let n=t.dot(e)+1;return n<Number.EPSILON?(n=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=n):(this._x=0,this._y=-t.z,this._z=t.y,this._w=n)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=n),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(lc(this.dot(t),-1,1)))}rotateTowards(t,e){const n=this.angleTo(t);if(0===n)return this;const i=Math.min(1,e/n);return this.slerp(t,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const n=t._x,i=t._y,r=t._z,s=t._w,a=e._x,o=e._y,c=e._z,l=e._w;return this._x=n*l+s*a+i*c-r*o,this._y=i*l+s*o+r*a-n*c,this._z=r*l+s*c+n*o-i*a,this._w=s*l-n*a-i*o-r*c,this._onChangeCallback(),this}slerp(t,e){if(0===e)return this;if(1===e)return this.copy(t);const n=this._x,i=this._y,r=this._z,s=this._w;let a=s*t._w+n*t._x+i*t._y+r*t._z;if(a<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,a=-a):this.copy(t),a>=1)return this._w=s,this._x=n,this._y=i,this._z=r,this;const o=1-a*a;if(o<=Number.EPSILON){const t=1-e;return this._w=t*s+e*this._w,this._x=t*n+e*this._x,this._y=t*i+e*this._y,this._z=t*r+e*this._z,this.normalize(),this}const c=Math.sqrt(o),l=Math.atan2(c,a),h=Math.sin((1-e)*l)/c,u=Math.sin(e*l)/c;return this._w=s*h+this._w*u,this._x=n*h+this._x*u,this._y=i*h+this._y*u,this._z=r*h+this._z*u,this._onChangeCallback(),this}slerpQuaternions(t,e,n){return this.copy(t).slerp(e,n)}random(){const t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),r=Math.sqrt(n);return this.set(i*Math.sin(t),i*Math.cos(t),r*Math.sin(e),r*Math.cos(e))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class jc{constructor(t=0,e=0,n=0){jc.prototype.isVector3=!0,this.x=t,this.y=e,this.z=n}set(t,e,n){return void 0===n&&(n=this.z),this.x=t,this.y=e,this.z=n,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(qc.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(qc.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[3]*n+r[6]*i,this.y=r[1]*e+r[4]*n+r[7]*i,this.z=r[2]*e+r[5]*n+r[8]*i,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,n=this.y,i=this.z,r=t.elements,s=1/(r[3]*e+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*e+r[4]*n+r[8]*i+r[12])*s,this.y=(r[1]*e+r[5]*n+r[9]*i+r[13])*s,this.z=(r[2]*e+r[6]*n+r[10]*i+r[14])*s,this}applyQuaternion(t){const e=this.x,n=this.y,i=this.z,r=t.x,s=t.y,a=t.z,o=t.w,c=2*(s*i-a*n),l=2*(a*e-r*i),h=2*(r*n-s*e);return this.x=e+o*c+s*h-a*l,this.y=n+o*l+a*c-r*h,this.z=i+o*h+r*l-s*c,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[4]*n+r[8]*i,this.y=r[1]*e+r[5]*n+r[9]*i,this.z=r[2]*e+r[6]*n+r[10]*i,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){const n=t.x,i=t.y,r=t.z,s=e.x,a=e.y,o=e.z;return this.x=i*o-r*a,this.y=r*s-n*o,this.z=n*a-i*s,this}projectOnVector(t){const e=t.lengthSq();if(0===e)return this.set(0,0,0);const n=t.dot(this)/e;return this.copy(t).multiplyScalar(n)}projectOnPlane(t){return Wc.copy(this).projectOnVector(t),this.sub(Wc)}reflect(t){return this.sub(Wc.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const n=this.dot(t)/e;return Math.acos(lc(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y,i=this.z-t.z;return e*e+n*n+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,n){const i=Math.sin(e)*t;return this.x=i*Math.sin(n),this.y=Math.cos(e)*t,this.z=i*Math.cos(n),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,n){return this.x=t*Math.sin(e),this.y=n,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){const e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),i=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=i,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,4*e)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,3*e)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const t=Math.random()*Math.PI*2,e=2*Math.random()-1,n=Math.sqrt(1-e*e);return this.x=n*Math.cos(t),this.y=e,this.z=n*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const Wc=new jc,qc=new Vc;class Yc{constructor(t=new jc(1/0,1/0,1/0),e=new jc(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){this.makeEmpty();for(let e=0,n=t.length;e<n;e+=3)this.expandByPoint(Jc.fromArray(t,e));return this}setFromBufferAttribute(t){this.makeEmpty();for(let e=0,n=t.count;e<n;e++)this.expandByPoint(Jc.fromBufferAttribute(t,e));return this}setFromPoints(t){this.makeEmpty();for(let e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const n=Jc.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this}setFromObject(t,e=!1){return this.makeEmpty(),this.expandByObject(t,e)}clone(){return(new this.constructor).copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}expandByObject(t,e=!1){t.updateWorldMatrix(!1,!1);const n=t.geometry;if(void 0!==n){const i=n.getAttribute("position");if(!0===e&&void 0!==i&&!0!==t.isInstancedMesh)for(let e=0,n=i.count;e<n;e++)!0===t.isMesh?t.getVertexPosition(e,Jc):Jc.fromBufferAttribute(i,e),Jc.applyMatrix4(t.matrixWorld),this.expandByPoint(Jc);else void 0!==t.boundingBox?(null===t.boundingBox&&t.computeBoundingBox(),Kc.copy(t.boundingBox)):(null===n.boundingBox&&n.computeBoundingBox(),Kc.copy(n.boundingBox)),Kc.applyMatrix4(t.matrixWorld),this.union(Kc)}const i=t.children;for(let t=0,n=i.length;t<n;t++)this.expandByObject(i[t],e);return this}containsPoint(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)}intersectsSphere(t){return this.clampPoint(t.center,Jc),Jc.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,n;return t.normal.x>0?(e=t.normal.x*this.min.x,n=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,n=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,n+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,n+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,n+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,n+=t.normal.z*this.min.z),e<=-t.constant&&n>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(rl),sl.subVectors(this.max,rl),Zc.subVectors(t.a,rl),$c.subVectors(t.b,rl),tl.subVectors(t.c,rl),el.subVectors($c,Zc),nl.subVectors(tl,$c),il.subVectors(Zc,tl);let e=[0,-el.z,el.y,0,-nl.z,nl.y,0,-il.z,il.y,el.z,0,-el.x,nl.z,0,-nl.x,il.z,0,-il.x,-el.y,el.x,0,-nl.y,nl.x,0,-il.y,il.x,0];return!!cl(e,Zc,$c,tl,sl)&&(e=[1,0,0,0,1,0,0,0,1],!!cl(e,Zc,$c,tl,sl)&&(al.crossVectors(el,nl),e=[al.x,al.y,al.z],cl(e,Zc,$c,tl,sl)))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,Jc).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=.5*this.getSize(Jc).length()),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()||(Xc[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Xc[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Xc[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Xc[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Xc[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Xc[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Xc[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Xc[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Xc)),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}const Xc=[new jc,new jc,new jc,new jc,new jc,new jc,new jc,new jc],Jc=new jc,Kc=new Yc,Zc=new jc,$c=new jc,tl=new jc,el=new jc,nl=new jc,il=new jc,rl=new jc,sl=new jc,al=new jc,ol=new jc;function cl(t,e,n,i,r){for(let s=0,a=t.length-3;s<=a;s+=3){ol.fromArray(t,s);const a=r.x*Math.abs(ol.x)+r.y*Math.abs(ol.y)+r.z*Math.abs(ol.z),o=e.dot(ol),c=n.dot(ol),l=i.dot(ol);if(Math.max(-Math.max(o,c,l),Math.min(o,c,l))>a)return!1}return!0}const ll=new Yc,hl=new jc,ul=new jc;class dl{constructor(t=new jc,e=-1){this.isSphere=!0,this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){const n=this.center;void 0!==e?n.copy(e):ll.setFromPoints(t).getCenter(n);let i=0;for(let e=0,r=t.length;e<r;e++)i=Math.max(i,n.distanceToSquared(t[e]));return this.radius=Math.sqrt(i),this}copy(t){return this.center.copy(t.center),this.radius=t.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(t){return t.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(t){return t.distanceTo(this.center)-this.radius}intersectsSphere(t){const e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e}intersectsBox(t){return t.intersectsSphere(this)}intersectsPlane(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius}clampPoint(t,e){const n=this.center.distanceToSquared(t);return e.copy(t),n>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){if(this.isEmpty())return this.center.copy(t),this.radius=0,this;hl.subVectors(t,this.center);const e=hl.lengthSq();if(e>this.radius*this.radius){const t=Math.sqrt(e),n=.5*(t-this.radius);this.center.addScaledVector(hl,n/t),this.radius+=n}return this}union(t){return t.isEmpty()?this:this.isEmpty()?(this.copy(t),this):(!0===this.center.equals(t.center)?this.radius=Math.max(this.radius,t.radius):(ul.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(hl.copy(t.center).add(ul)),this.expandByPoint(hl.copy(t.center).sub(ul))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return(new this.constructor).copy(this)}}const pl=new jc,fl=new jc,Al=new jc,gl=new jc,ml=new jc,_l=new jc,vl=new jc;class yl{constructor(t=new jc,e=new jc(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return e.copy(this.origin).addScaledVector(this.direction,t)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,pl)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);const n=e.dot(this.direction);return n<0?e.copy(this.origin):e.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){const e=pl.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(pl.copy(this.origin).addScaledVector(this.direction,e),pl.distanceToSquared(t))}distanceSqToSegment(t,e,n,i){fl.copy(t).add(e).multiplyScalar(.5),Al.copy(e).sub(t).normalize(),gl.copy(this.origin).sub(fl);const r=.5*t.distanceTo(e),s=-this.direction.dot(Al),a=gl.dot(this.direction),o=-gl.dot(Al),c=gl.lengthSq(),l=Math.abs(1-s*s);let h,u,d,p;if(l>0)if(h=s*o-a,u=s*a-o,p=r*l,h>=0)if(u>=-p)if(u<=p){const t=1/l;h*=t,u*=t,d=h*(h+s*u+2*a)+u*(s*h+u+2*o)+c}else u=r,h=Math.max(0,-(s*u+a)),d=-h*h+u*(u+2*o)+c;else u=-r,h=Math.max(0,-(s*u+a)),d=-h*h+u*(u+2*o)+c;else u<=-p?(h=Math.max(0,-(-s*r+a)),u=h>0?-r:Math.min(Math.max(-r,-o),r),d=-h*h+u*(u+2*o)+c):u<=p?(h=0,u=Math.min(Math.max(-r,-o),r),d=u*(u+2*o)+c):(h=Math.max(0,-(s*r+a)),u=h>0?r:Math.min(Math.max(-r,-o),r),d=-h*h+u*(u+2*o)+c);else u=s>0?-r:r,h=Math.max(0,-(s*u+a)),d=-h*h+u*(u+2*o)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,h),i&&i.copy(fl).addScaledVector(Al,u),d}intersectSphere(t,e){pl.subVectors(t.center,this.origin);const n=pl.dot(this.direction),i=pl.dot(pl)-n*n,r=t.radius*t.radius;if(i>r)return null;const s=Math.sqrt(r-i),a=n-s,o=n+s;return o<0?null:a<0?this.at(o,e):this.at(a,e)}intersectsSphere(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){const e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;const n=-(this.origin.dot(t.normal)+t.constant)/e;return n>=0?n:null}intersectPlane(t,e){const n=this.distanceToPlane(t);return null===n?null:this.at(n,e)}intersectsPlane(t){const e=t.distanceToPoint(this.origin);if(0===e)return!0;return t.normal.dot(this.direction)*e<0}intersectBox(t,e){let n,i,r,s,a,o;const c=1/this.direction.x,l=1/this.direction.y,h=1/this.direction.z,u=this.origin;return c>=0?(n=(t.min.x-u.x)*c,i=(t.max.x-u.x)*c):(n=(t.max.x-u.x)*c,i=(t.min.x-u.x)*c),l>=0?(r=(t.min.y-u.y)*l,s=(t.max.y-u.y)*l):(r=(t.max.y-u.y)*l,s=(t.min.y-u.y)*l),n>s||r>i?null:((r>n||isNaN(n))&&(n=r),(s<i||isNaN(i))&&(i=s),h>=0?(a=(t.min.z-u.z)*h,o=(t.max.z-u.z)*h):(a=(t.max.z-u.z)*h,o=(t.min.z-u.z)*h),n>o||a>i?null:((a>n||n!=n)&&(n=a),(o<i||i!=i)&&(i=o),i<0?null:this.at(n>=0?n:i,e)))}intersectsBox(t){return null!==this.intersectBox(t,pl)}intersectTriangle(t,e,n,i,r){ml.subVectors(e,t),_l.subVectors(n,t),vl.crossVectors(ml,_l);let s,a=this.direction.dot(vl);if(a>0){if(i)return null;s=1}else{if(!(a<0))return null;s=-1,a=-a}gl.subVectors(this.origin,t);const o=s*this.direction.dot(_l.crossVectors(gl,_l));if(o<0)return null;const c=s*this.direction.dot(ml.cross(gl));if(c<0)return null;if(o+c>a)return null;const l=-s*gl.dot(vl);return l<0?null:this.at(l/a,r)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}}class bl{constructor(t,e,n,i,r,s,a,o,c,l,h,u,d,p,f,A){bl.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==t&&this.set(t,e,n,i,r,s,a,o,c,l,h,u,d,p,f,A)}set(t,e,n,i,r,s,a,o,c,l,h,u,d,p,f,A){const g=this.elements;return g[0]=t,g[4]=e,g[8]=n,g[12]=i,g[1]=r,g[5]=s,g[9]=a,g[13]=o,g[2]=c,g[6]=l,g[10]=h,g[14]=u,g[3]=d,g[7]=p,g[11]=f,g[15]=A,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return(new bl).fromArray(this.elements)}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],e[9]=n[9],e[10]=n[10],e[11]=n[11],e[12]=n[12],e[13]=n[13],e[14]=n[14],e[15]=n[15],this}copyPosition(t){const e=this.elements,n=t.elements;return e[12]=n[12],e[13]=n[13],e[14]=n[14],this}setFromMatrix3(t){const e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,n){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(t,e,n){return this.set(t.x,e.x,n.x,0,t.y,e.y,n.y,0,t.z,e.z,n.z,0,0,0,0,1),this}extractRotation(t){const e=this.elements,n=t.elements,i=1/xl.setFromMatrixColumn(t,0).length(),r=1/xl.setFromMatrixColumn(t,1).length(),s=1/xl.setFromMatrixColumn(t,2).length();return e[0]=n[0]*i,e[1]=n[1]*i,e[2]=n[2]*i,e[3]=0,e[4]=n[4]*r,e[5]=n[5]*r,e[6]=n[6]*r,e[7]=0,e[8]=n[8]*s,e[9]=n[9]*s,e[10]=n[10]*s,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){const e=this.elements,n=t.x,i=t.y,r=t.z,s=Math.cos(n),a=Math.sin(n),o=Math.cos(i),c=Math.sin(i),l=Math.cos(r),h=Math.sin(r);if("XYZ"===t.order){const t=s*l,n=s*h,i=a*l,r=a*h;e[0]=o*l,e[4]=-o*h,e[8]=c,e[1]=n+i*c,e[5]=t-r*c,e[9]=-a*o,e[2]=r-t*c,e[6]=i+n*c,e[10]=s*o}else if("YXZ"===t.order){const t=o*l,n=o*h,i=c*l,r=c*h;e[0]=t+r*a,e[4]=i*a-n,e[8]=s*c,e[1]=s*h,e[5]=s*l,e[9]=-a,e[2]=n*a-i,e[6]=r+t*a,e[10]=s*o}else if("ZXY"===t.order){const t=o*l,n=o*h,i=c*l,r=c*h;e[0]=t-r*a,e[4]=-s*h,e[8]=i+n*a,e[1]=n+i*a,e[5]=s*l,e[9]=r-t*a,e[2]=-s*c,e[6]=a,e[10]=s*o}else if("ZYX"===t.order){const t=s*l,n=s*h,i=a*l,r=a*h;e[0]=o*l,e[4]=i*c-n,e[8]=t*c+r,e[1]=o*h,e[5]=r*c+t,e[9]=n*c-i,e[2]=-c,e[6]=a*o,e[10]=s*o}else if("YZX"===t.order){const t=s*o,n=s*c,i=a*o,r=a*c;e[0]=o*l,e[4]=r-t*h,e[8]=i*h+n,e[1]=h,e[5]=s*l,e[9]=-a*l,e[2]=-c*l,e[6]=n*h+i,e[10]=t-r*h}else if("XZY"===t.order){const t=s*o,n=s*c,i=a*o,r=a*c;e[0]=o*l,e[4]=-h,e[8]=c*l,e[1]=t*h+r,e[5]=s*l,e[9]=n*h-i,e[2]=i*h-n,e[6]=a*l,e[10]=r*h+t}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(El,t,Cl)}lookAt(t,e,n){const i=this.elements;return Il.subVectors(t,e),0===Il.lengthSq()&&(Il.z=1),Il.normalize(),Sl.crossVectors(n,Il),0===Sl.lengthSq()&&(1===Math.abs(n.z)?Il.x+=1e-4:Il.z+=1e-4,Il.normalize(),Sl.crossVectors(n,Il)),Sl.normalize(),Ml.crossVectors(Il,Sl),i[0]=Sl.x,i[4]=Ml.x,i[8]=Il.x,i[1]=Sl.y,i[5]=Ml.y,i[9]=Il.y,i[2]=Sl.z,i[6]=Ml.z,i[10]=Il.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,i=e.elements,r=this.elements,s=n[0],a=n[4],o=n[8],c=n[12],l=n[1],h=n[5],u=n[9],d=n[13],p=n[2],f=n[6],A=n[10],g=n[14],m=n[3],_=n[7],v=n[11],y=n[15],b=i[0],x=i[4],w=i[8],E=i[12],C=i[1],S=i[5],M=i[9],I=i[13],T=i[2],B=i[6],R=i[10],D=i[14],L=i[3],P=i[7],k=i[11],O=i[15];return r[0]=s*b+a*C+o*T+c*L,r[4]=s*x+a*S+o*B+c*P,r[8]=s*w+a*M+o*R+c*k,r[12]=s*E+a*I+o*D+c*O,r[1]=l*b+h*C+u*T+d*L,r[5]=l*x+h*S+u*B+d*P,r[9]=l*w+h*M+u*R+d*k,r[13]=l*E+h*I+u*D+d*O,r[2]=p*b+f*C+A*T+g*L,r[6]=p*x+f*S+A*B+g*P,r[10]=p*w+f*M+A*R+g*k,r[14]=p*E+f*I+A*D+g*O,r[3]=m*b+_*C+v*T+y*L,r[7]=m*x+_*S+v*B+y*P,r[11]=m*w+_*M+v*R+y*k,r[15]=m*E+_*I+v*D+y*O,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){const t=this.elements,e=t[0],n=t[4],i=t[8],r=t[12],s=t[1],a=t[5],o=t[9],c=t[13],l=t[2],h=t[6],u=t[10],d=t[14];return t[3]*(+r*o*h-i*c*h-r*a*u+n*c*u+i*a*d-n*o*d)+t[7]*(+e*o*d-e*c*u+r*s*u-i*s*d+i*c*l-r*o*l)+t[11]*(+e*c*h-e*a*d-r*s*h+n*s*d+r*a*l-n*c*l)+t[15]*(-i*a*l-e*o*h+e*a*u+i*s*h-n*s*u+n*o*l)}transpose(){const t=this.elements;let e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,n){const i=this.elements;return t.isVector3?(i[12]=t.x,i[13]=t.y,i[14]=t.z):(i[12]=t,i[13]=e,i[14]=n),this}invert(){const t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],s=t[4],a=t[5],o=t[6],c=t[7],l=t[8],h=t[9],u=t[10],d=t[11],p=t[12],f=t[13],A=t[14],g=t[15],m=h*A*c-f*u*c+f*o*d-a*A*d-h*o*g+a*u*g,_=p*u*c-l*A*c-p*o*d+s*A*d+l*o*g-s*u*g,v=l*f*c-p*h*c+p*a*d-s*f*d-l*a*g+s*h*g,y=p*h*o-l*f*o-p*a*u+s*f*u+l*a*A-s*h*A,b=e*m+n*_+i*v+r*y;if(0===b)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const x=1/b;return t[0]=m*x,t[1]=(f*u*r-h*A*r-f*i*d+n*A*d+h*i*g-n*u*g)*x,t[2]=(a*A*r-f*o*r+f*i*c-n*A*c-a*i*g+n*o*g)*x,t[3]=(h*o*r-a*u*r-h*i*c+n*u*c+a*i*d-n*o*d)*x,t[4]=_*x,t[5]=(l*A*r-p*u*r+p*i*d-e*A*d-l*i*g+e*u*g)*x,t[6]=(p*o*r-s*A*r-p*i*c+e*A*c+s*i*g-e*o*g)*x,t[7]=(s*u*r-l*o*r+l*i*c-e*u*c-s*i*d+e*o*d)*x,t[8]=v*x,t[9]=(p*h*r-l*f*r-p*n*d+e*f*d+l*n*g-e*h*g)*x,t[10]=(s*f*r-p*a*r+p*n*c-e*f*c-s*n*g+e*a*g)*x,t[11]=(l*a*r-s*h*r-l*n*c+e*h*c+s*n*d-e*a*d)*x,t[12]=y*x,t[13]=(l*f*i-p*h*i+p*n*u-e*f*u-l*n*A+e*h*A)*x,t[14]=(p*a*i-s*f*i-p*n*o+e*f*o+s*n*A-e*a*A)*x,t[15]=(s*h*i-l*a*i+l*n*o-e*h*o-s*n*u+e*a*u)*x,this}scale(t){const e=this.elements,n=t.x,i=t.y,r=t.z;return e[0]*=n,e[4]*=i,e[8]*=r,e[1]*=n,e[5]*=i,e[9]*=r,e[2]*=n,e[6]*=i,e[10]*=r,e[3]*=n,e[7]*=i,e[11]*=r,this}getMaxScaleOnAxis(){const t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],n=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],i=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,n,i))}makeTranslation(t,e,n){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,e,0,0,1,n,0,0,0,1),this}makeRotationX(t){const e=Math.cos(t),n=Math.sin(t);return this.set(1,0,0,0,0,e,-n,0,0,n,e,0,0,0,0,1),this}makeRotationY(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,0,n,0,0,1,0,0,-n,0,e,0,0,0,0,1),this}makeRotationZ(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,0,n,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){const n=Math.cos(e),i=Math.sin(e),r=1-n,s=t.x,a=t.y,o=t.z,c=r*s,l=r*a;return this.set(c*s+n,c*a-i*o,c*o+i*a,0,c*a+i*o,l*a+n,l*o-i*s,0,c*o-i*a,l*o+i*s,r*o*o+n,0,0,0,0,1),this}makeScale(t,e,n){return this.set(t,0,0,0,0,e,0,0,0,0,n,0,0,0,0,1),this}makeShear(t,e,n,i,r,s){return this.set(1,n,r,0,t,1,s,0,e,i,1,0,0,0,0,1),this}compose(t,e,n){const i=this.elements,r=e._x,s=e._y,a=e._z,o=e._w,c=r+r,l=s+s,h=a+a,u=r*c,d=r*l,p=r*h,f=s*l,A=s*h,g=a*h,m=o*c,_=o*l,v=o*h,y=n.x,b=n.y,x=n.z;return i[0]=(1-(f+g))*y,i[1]=(d+v)*y,i[2]=(p-_)*y,i[3]=0,i[4]=(d-v)*b,i[5]=(1-(u+g))*b,i[6]=(A+m)*b,i[7]=0,i[8]=(p+_)*x,i[9]=(A-m)*x,i[10]=(1-(u+f))*x,i[11]=0,i[12]=t.x,i[13]=t.y,i[14]=t.z,i[15]=1,this}decompose(t,e,n){const i=this.elements;let r=xl.set(i[0],i[1],i[2]).length();const s=xl.set(i[4],i[5],i[6]).length(),a=xl.set(i[8],i[9],i[10]).length();this.determinant()<0&&(r=-r),t.x=i[12],t.y=i[13],t.z=i[14],wl.copy(this);const o=1/r,c=1/s,l=1/a;return wl.elements[0]*=o,wl.elements[1]*=o,wl.elements[2]*=o,wl.elements[4]*=c,wl.elements[5]*=c,wl.elements[6]*=c,wl.elements[8]*=l,wl.elements[9]*=l,wl.elements[10]*=l,e.setFromRotationMatrix(wl),n.x=r,n.y=s,n.z=a,this}makePerspective(t,e,n,i,r,s,a=2e3){const o=this.elements,c=2*r/(e-t),l=2*r/(n-i),h=(e+t)/(e-t),u=(n+i)/(n-i);let d,p;if(a===ec)d=-(s+r)/(s-r),p=-2*s*r/(s-r);else{if(a!==nc)throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);d=-s/(s-r),p=-s*r/(s-r)}return o[0]=c,o[4]=0,o[8]=h,o[12]=0,o[1]=0,o[5]=l,o[9]=u,o[13]=0,o[2]=0,o[6]=0,o[10]=d,o[14]=p,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this}makeOrthographic(t,e,n,i,r,s,a=2e3){const o=this.elements,c=1/(e-t),l=1/(n-i),h=1/(s-r),u=(e+t)*c,d=(n+i)*l;let p,f;if(a===ec)p=(s+r)*h,f=-2*h;else{if(a!==nc)throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);p=r*h,f=-1*h}return o[0]=2*c,o[4]=0,o[8]=0,o[12]=-u,o[1]=0,o[5]=2*l,o[9]=0,o[13]=-d,o[2]=0,o[6]=0,o[10]=f,o[14]=-p,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this}equals(t){const e=this.elements,n=t.elements;for(let t=0;t<16;t++)if(e[t]!==n[t])return!1;return!0}fromArray(t,e=0){for(let n=0;n<16;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){const n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t[e+9]=n[9],t[e+10]=n[10],t[e+11]=n[11],t[e+12]=n[12],t[e+13]=n[13],t[e+14]=n[14],t[e+15]=n[15],t}}const xl=new jc,wl=new bl,El=new jc(0,0,0),Cl=new jc(1,1,1),Sl=new jc,Ml=new jc,Il=new jc,Tl=new bl,Bl=new Vc;class Rl{constructor(t=0,e=0,n=0,i=Rl.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=e,this._z=n,this._order=i}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,n,i=this._order){return this._x=t,this._y=e,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,n=!0){const i=t.elements,r=i[0],s=i[4],a=i[8],o=i[1],c=i[5],l=i[9],h=i[2],u=i[6],d=i[10];switch(e){case"XYZ":this._y=Math.asin(lc(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-l,d),this._z=Math.atan2(-s,r)):(this._x=Math.atan2(u,c),this._z=0);break;case"YXZ":this._x=Math.asin(-lc(l,-1,1)),Math.abs(l)<.9999999?(this._y=Math.atan2(a,d),this._z=Math.atan2(o,c)):(this._y=Math.atan2(-h,r),this._z=0);break;case"ZXY":this._x=Math.asin(lc(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(-h,d),this._z=Math.atan2(-s,c)):(this._y=0,this._z=Math.atan2(o,r));break;case"ZYX":this._y=Math.asin(-lc(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(u,d),this._z=Math.atan2(o,r)):(this._x=0,this._z=Math.atan2(-s,c));break;case"YZX":this._z=Math.asin(lc(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-l,c),this._y=Math.atan2(-h,r)):(this._x=0,this._y=Math.atan2(a,d));break;case"XZY":this._z=Math.asin(-lc(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(u,c),this._y=Math.atan2(a,r)):(this._x=Math.atan2(-l,d),this._y=0)}return this._order=e,!0===n&&this._onChangeCallback(),this}setFromQuaternion(t,e,n){return Tl.makeRotationFromQuaternion(t),this.setFromRotationMatrix(Tl,e,n)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return Bl.setFromEuler(this),this.setFromQuaternion(Bl,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}Rl.DEFAULT_ORDER="XYZ";class Dl{constructor(){this.mask=1}set(t){this.mask=1<<t>>>0}enable(t){this.mask|=1<<t}enableAll(){this.mask=-1}toggle(t){this.mask^=1<<t}disable(t){this.mask&=~(1<<t)}disableAll(){this.mask=0}test(t){return!!(this.mask&t.mask)}isEnabled(t){return!!(this.mask&1<<t)}}let Ll=0;const Pl=new jc,kl=new Vc,Ol=new bl,Ul=new jc,Nl=new jc,Fl=new jc,Ql=new Vc,zl=new jc(1,0,0),Gl=new jc(0,1,0),Hl=new jc(0,0,1),Vl={type:"added"},jl={type:"removed"},Wl={type:"childadded",child:null},ql={type:"childremoved",child:null};class Yl extends ic{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Ll++}),this.uuid=cc(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Yl.DEFAULT_UP.clone();const t=new jc,e=new Rl,n=new Vc,i=new jc(1,1,1);e._onChange((function(){n.setFromEuler(e,!1)})),n._onChange((function(){e.setFromQuaternion(n,void 0,!1)})),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new bl},normalMatrix:{value:new gc}}),this.matrix=new bl,this.matrixWorld=new bl,this.matrixAutoUpdate=Yl.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=Yl.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Dl,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(t){return this.quaternion.premultiply(t),this}setRotationFromAxisAngle(t,e){this.quaternion.setFromAxisAngle(t,e)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,e){return kl.setFromAxisAngle(t,e),this.quaternion.multiply(kl),this}rotateOnWorldAxis(t,e){return kl.setFromAxisAngle(t,e),this.quaternion.premultiply(kl),this}rotateX(t){return this.rotateOnAxis(zl,t)}rotateY(t){return this.rotateOnAxis(Gl,t)}rotateZ(t){return this.rotateOnAxis(Hl,t)}translateOnAxis(t,e){return Pl.copy(t).applyQuaternion(this.quaternion),this.position.add(Pl.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(zl,t)}translateY(t){return this.translateOnAxis(Gl,t)}translateZ(t){return this.translateOnAxis(Hl,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(Ol.copy(this.matrixWorld).invert())}lookAt(t,e,n){t.isVector3?Ul.copy(t):Ul.set(t,e,n);const i=this.parent;this.updateWorldMatrix(!0,!1),Nl.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Ol.lookAt(Nl,Ul,this.up):Ol.lookAt(Ul,Nl,this.up),this.quaternion.setFromRotationMatrix(Ol),i&&(Ol.extractRotation(i.matrixWorld),kl.setFromRotationMatrix(Ol),this.quaternion.premultiply(kl.invert()))}add(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return t===this||t&&t.isObject3D&&(t.removeFromParent(),t.parent=this,this.children.push(t),t.dispatchEvent(Vl),Wl.child=t,this.dispatchEvent(Wl),Wl.child=null),this}remove(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}const e=this.children.indexOf(t);return-1!==e&&(t.parent=null,this.children.splice(e,1),t.dispatchEvent(jl),ql.child=t,this.dispatchEvent(ql),ql.child=null),this}removeFromParent(){const t=this.parent;return null!==t&&t.remove(this),this}clear(){return this.remove(...this.children)}attach(t){return this.updateWorldMatrix(!0,!1),Ol.copy(this.matrixWorld).invert(),null!==t.parent&&(t.parent.updateWorldMatrix(!0,!1),Ol.multiply(t.parent.matrixWorld)),t.applyMatrix4(Ol),t.removeFromParent(),t.parent=this,this.children.push(t),t.updateWorldMatrix(!1,!0),t.dispatchEvent(Vl),Wl.child=t,this.dispatchEvent(Wl),Wl.child=null,this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,e){if(this[t]===e)return this;for(let n=0,i=this.children.length;n<i;n++){const i=this.children[n].getObjectByProperty(t,e);if(void 0!==i)return i}}getObjectsByProperty(t,e,n=[]){this[t]===e&&n.push(this);const i=this.children;for(let r=0,s=i.length;r<s;r++)i[r].getObjectsByProperty(t,e,n);return n}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Nl,t,Fl),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Nl,Ql,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()}raycast(){}traverse(t){t(this);const e=this.children;for(let n=0,i=e.length;n<i;n++)e[n].traverse(t)}traverseVisible(t){if(!1===this.visible)return;t(this);const e=this.children;for(let n=0,i=e.length;n<i;n++)e[n].traverseVisible(t)}traverseAncestors(t){const e=this.parent;null!==e&&(t(e),e.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,t=!0);const e=this.children;for(let n=0,i=e.length;n<i;n++){const i=e[n];!0!==i.matrixWorldAutoUpdate&&!0!==t||i.updateMatrixWorld(t)}}updateWorldMatrix(t,e){const n=this.parent;if(!0===t&&null!==n&&!0===n.matrixWorldAutoUpdate&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),!0===e){const t=this.children;for(let e=0,n=t.length;e<n;e++){const n=t[e];!0===n.matrixWorldAutoUpdate&&n.updateWorldMatrix(!1,!0)}}}toJSON(t){const e=void 0===t||"string"==typeof t,n={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});const i={};function r(e,n){return void 0===e[n.uuid]&&(e[n.uuid]=n.toJSON(t)),n.uuid}if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),!0===this.castShadow&&(i.castShadow=!0),!0===this.receiveShadow&&(i.receiveShadow=!0),!1===this.visible&&(i.visible=!1),!1===this.frustumCulled&&(i.frustumCulled=!1),0!==this.renderOrder&&(i.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),!1===this.matrixAutoUpdate&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.visibility=this._visibility,i.active=this._active,i.bounds=this._bounds.map((t=>({boxInitialized:t.boxInitialized,boxMin:t.box.min.toArray(),boxMax:t.box.max.toArray(),sphereInitialized:t.sphereInitialized,sphereRadius:t.sphere.radius,sphereCenter:t.sphere.center.toArray()}))),i.maxGeometryCount=this._maxGeometryCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.geometryCount=this._geometryCount,i.matricesTexture=this._matricesTexture.toJSON(t),null!==this._colorsTexture&&(i.colorsTexture=this._colorsTexture.toJSON(t)),null!==this.boundingSphere&&(i.boundingSphere={center:i.boundingSphere.center.toArray(),radius:i.boundingSphere.radius}),null!==this.boundingBox&&(i.boundingBox={min:i.boundingBox.min.toArray(),max:i.boundingBox.max.toArray()})),this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(i.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=r(t.geometries,this.geometry);const e=this.geometry.parameters;if(void 0!==e&&void 0!==e.shapes){const n=e.shapes;if(Array.isArray(n))for(let e=0,i=n.length;e<i;e++){const i=n[e];r(t.shapes,i)}else r(t.shapes,n)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(r(t.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){const e=[];for(let n=0,i=this.material.length;n<i;n++)e.push(r(t.materials,this.material[n]));i.material=e}else i.material=r(t.materials,this.material);if(this.children.length>0){i.children=[];for(let e=0;e<this.children.length;e++)i.children.push(this.children[e].toJSON(t).object)}if(this.animations.length>0){i.animations=[];for(let e=0;e<this.animations.length;e++){const n=this.animations[e];i.animations.push(r(t.animations,n))}}if(e){const e=s(t.geometries),i=s(t.materials),r=s(t.textures),a=s(t.images),o=s(t.shapes),c=s(t.skeletons),l=s(t.animations),h=s(t.nodes);e.length>0&&(n.geometries=e),i.length>0&&(n.materials=i),r.length>0&&(n.textures=r),a.length>0&&(n.images=a),o.length>0&&(n.shapes=o),c.length>0&&(n.skeletons=c),l.length>0&&(n.animations=l),h.length>0&&(n.nodes=h)}return n.object=i,n;function s(t){const e=[];for(const n in t){const i=t[n];delete i.metadata,e.push(i)}return e}}clone(t){return(new this.constructor).copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(let e=0;e<t.children.length;e++){const n=t.children[e];this.add(n.clone())}return this}}Yl.DEFAULT_UP=new jc(0,1,0),Yl.DEFAULT_MATRIX_AUTO_UPDATE=!0,Yl.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const Xl=new jc,Jl=new jc,Kl=new jc,Zl=new jc,$l=new jc,th=new jc,eh=new jc,nh=new jc,ih=new jc,rh=new jc;class sh{constructor(t=new jc,e=new jc,n=new jc){this.a=t,this.b=e,this.c=n}static getNormal(t,e,n,i){i.subVectors(n,e),Xl.subVectors(t,e),i.cross(Xl);const r=i.lengthSq();return r>0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)}static getBarycoord(t,e,n,i,r){Xl.subVectors(i,e),Jl.subVectors(n,e),Kl.subVectors(t,e);const s=Xl.dot(Xl),a=Xl.dot(Jl),o=Xl.dot(Kl),c=Jl.dot(Jl),l=Jl.dot(Kl),h=s*c-a*a;if(0===h)return r.set(0,0,0),null;const u=1/h,d=(c*o-a*l)*u,p=(s*l-a*o)*u;return r.set(1-d-p,p,d)}static containsPoint(t,e,n,i){return null!==this.getBarycoord(t,e,n,i,Zl)&&(Zl.x>=0&&Zl.y>=0&&Zl.x+Zl.y<=1)}static getInterpolation(t,e,n,i,r,s,a,o){return null===this.getBarycoord(t,e,n,i,Zl)?(o.x=0,o.y=0,"z"in o&&(o.z=0),"w"in o&&(o.w=0),null):(o.setScalar(0),o.addScaledVector(r,Zl.x),o.addScaledVector(s,Zl.y),o.addScaledVector(a,Zl.z),o)}static isFrontFacing(t,e,n,i){return Xl.subVectors(n,e),Jl.subVectors(t,e),Xl.cross(Jl).dot(i)<0}set(t,e,n){return this.a.copy(t),this.b.copy(e),this.c.copy(n),this}setFromPointsAndIndices(t,e,n,i){return this.a.copy(t[e]),this.b.copy(t[n]),this.c.copy(t[i]),this}setFromAttributeAndIndices(t,e,n,i){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,n),this.c.fromBufferAttribute(t,i),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return Xl.subVectors(this.c,this.b),Jl.subVectors(this.a,this.b),.5*Xl.cross(Jl).length()}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return sh.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return sh.getBarycoord(t,this.a,this.b,this.c,e)}getInterpolation(t,e,n,i,r){return sh.getInterpolation(t,this.a,this.b,this.c,e,n,i,r)}containsPoint(t){return sh.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return sh.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){const n=this.a,i=this.b,r=this.c;let s,a;$l.subVectors(i,n),th.subVectors(r,n),nh.subVectors(t,n);const o=$l.dot(nh),c=th.dot(nh);if(o<=0&&c<=0)return e.copy(n);ih.subVectors(t,i);const l=$l.dot(ih),h=th.dot(ih);if(l>=0&&h<=l)return e.copy(i);const u=o*h-l*c;if(u<=0&&o>=0&&l<=0)return s=o/(o-l),e.copy(n).addScaledVector($l,s);rh.subVectors(t,r);const d=$l.dot(rh),p=th.dot(rh);if(p>=0&&d<=p)return e.copy(r);const f=d*c-o*p;if(f<=0&&c>=0&&p<=0)return a=c/(c-p),e.copy(n).addScaledVector(th,a);const A=l*p-d*h;if(A<=0&&h-l>=0&&d-p>=0)return eh.subVectors(r,i),a=(h-l)/(h-l+(d-p)),e.copy(i).addScaledVector(eh,a);const g=1/(A+f+u);return s=f*g,a=u*g,e.copy(n).addScaledVector($l,s).addScaledVector(th,a)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}const ah={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},oh={h:0,s:0,l:0},ch={h:0,s:0,l:0};function lh(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+6*(e-t)*(2/3-n):t}class hh{constructor(t,e,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(t,e,n)}set(t,e,n){if(void 0===e&&void 0===n){const e=t;e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e)}else this.setRGB(t,e,n);return this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e=Oo){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,Tc.toWorkingColorSpace(this,e),this}setRGB(t,e,n,i=Tc.workingColorSpace){return this.r=t,this.g=e,this.b=n,Tc.toWorkingColorSpace(this,i),this}setHSL(t,e,n,i=Tc.workingColorSpace){if(t=hc(t,1),e=lc(e,0,1),n=lc(n,0,1),0===e)this.r=this.g=this.b=n;else{const i=n<=.5?n*(1+e):n+e-n*e,r=2*n-i;this.r=lh(r,i,t+1/3),this.g=lh(r,i,t),this.b=lh(r,i,t-1/3)}return Tc.toWorkingColorSpace(this,i),this}setStyle(t,e=Oo){function n(t){void 0!==t&&parseFloat(t)}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(t)){let t;const r=i[1],s=i[2];switch(r){case"rgb":case"rgba":if(t=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return n(t[4]),this.setRGB(Math.min(255,parseInt(t[1],10))/255,Math.min(255,parseInt(t[2],10))/255,Math.min(255,parseInt(t[3],10))/255,e);if(t=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return n(t[4]),this.setRGB(Math.min(100,parseInt(t[1],10))/100,Math.min(100,parseInt(t[2],10))/100,Math.min(100,parseInt(t[3],10))/100,e);break;case"hsl":case"hsla":if(t=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return n(t[4]),this.setHSL(parseFloat(t[1])/360,parseFloat(t[2])/100,parseFloat(t[3])/100,e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(t)){const t=i[1],n=t.length;if(3===n)return this.setRGB(parseInt(t.charAt(0),16)/15,parseInt(t.charAt(1),16)/15,parseInt(t.charAt(2),16)/15,e);if(6===n)return this.setHex(parseInt(t,16),e)}else if(t&&t.length>0)return this.setColorName(t,e);return this}setColorName(t,e=Oo){const n=ah[t.toLowerCase()];return void 0!==n&&this.setHex(n,e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copySRGBToLinear(t){return this.r=Bc(t.r),this.g=Bc(t.g),this.b=Bc(t.b),this}copyLinearToSRGB(t){return this.r=Rc(t.r),this.g=Rc(t.g),this.b=Rc(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=Oo){return Tc.fromWorkingColorSpace(uh.copy(this),t),65536*Math.round(lc(255*uh.r,0,255))+256*Math.round(lc(255*uh.g,0,255))+Math.round(lc(255*uh.b,0,255))}getHexString(t=Oo){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=Tc.workingColorSpace){Tc.fromWorkingColorSpace(uh.copy(this),e);const n=uh.r,i=uh.g,r=uh.b,s=Math.max(n,i,r),a=Math.min(n,i,r);let o,c;const l=(a+s)/2;if(a===s)o=0,c=0;else{const t=s-a;switch(c=l<=.5?t/(s+a):t/(2-s-a),s){case n:o=(i-r)/t+(i<r?6:0);break;case i:o=(r-n)/t+2;break;case r:o=(n-i)/t+4}o/=6}return t.h=o,t.s=c,t.l=l,t}getRGB(t,e=Tc.workingColorSpace){return Tc.fromWorkingColorSpace(uh.copy(this),e),t.r=uh.r,t.g=uh.g,t.b=uh.b,t}getStyle(t=Oo){Tc.fromWorkingColorSpace(uh.copy(this),t);const e=uh.r,n=uh.g,i=uh.b;return t!==Oo?`color(${t} ${e.toFixed(3)} ${n.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(255*e)},${Math.round(255*n)},${Math.round(255*i)})`}offsetHSL(t,e,n){return this.getHSL(oh),this.setHSL(oh.h+t,oh.s+e,oh.l+n)}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}multiply(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpColors(t,e,n){return this.r=t.r+(e.r-t.r)*n,this.g=t.g+(e.g-t.g)*n,this.b=t.b+(e.b-t.b)*n,this}lerpHSL(t,e){this.getHSL(oh),t.getHSL(ch);const n=uc(oh.h,ch.h,e),i=uc(oh.s,ch.s,e),r=uc(oh.l,ch.l,e);return this.setHSL(n,i,r),this}setFromVector3(t){return this.r=t.x,this.g=t.y,this.b=t.z,this}applyMatrix3(t){const e=this.r,n=this.g,i=this.b,r=t.elements;return this.r=r[0]*e+r[3]*n+r[6]*i,this.g=r[1]*e+r[4]*n+r[7]*i,this.b=r[2]*e+r[5]*n+r[8]*i,this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this}toArray(t=[],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const uh=new hh;hh.NAMES=ah;let dh=0;class ph extends ic{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:dh++}),this.uuid=cc(),this.name="",this.type="Material",this.blending=1,this.side=Os,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Ws,this.blendDst=qs,this.blendEquation=Fs,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new hh(0,0,0),this.blendAlpha=0,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Vo,this.stencilZFail=Vo,this.stencilZPass=Vo,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(t){this._alphaTest>0!=t>0&&this.version++,this._alphaTest=t}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(void 0!==t)for(const e in t){const n=t[e];if(void 0===n)continue;const i=this[e];void 0!==i&&(i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[e]=n)}}toJSON(t){const e=void 0===t||"string"==typeof t;e&&(t={textures:{},images:{}});const n={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};function i(t){const e=[];for(const n in t){const i=t[n];delete i.metadata,e.push(i)}return e}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),void 0!==this.sheen&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),void 0!==this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),void 0!==this.dispersion&&(n.dispersion=this.dispersion),void 0!==this.iridescence&&(n.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(n.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(t).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(t).uuid),void 0!==this.anisotropy&&(n.anisotropy=this.anisotropy),void 0!==this.anisotropyRotation&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(t).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(t).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(t).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(t).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(t).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(t).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(t).uuid,void 0!==this.combine&&(n.combine=this.combine)),void 0!==this.envMapRotation&&(n.envMapRotation=this.envMapRotation.toArray()),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(n.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.transmission&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(t).uuid),void 0!==this.thickness&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(t).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(n.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(n.size=this.size),null!==this.shadowSide&&(n.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(n.blending=this.blending),this.side!==Os&&(n.side=this.side),!0===this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=!0),this.blendSrc!==Ws&&(n.blendSrc=this.blendSrc),this.blendDst!==qs&&(n.blendDst=this.blendDst),this.blendEquation!==Fs&&(n.blendEquation=this.blendEquation),null!==this.blendSrcAlpha&&(n.blendSrcAlpha=this.blendSrcAlpha),null!==this.blendDstAlpha&&(n.blendDstAlpha=this.blendDstAlpha),null!==this.blendEquationAlpha&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),0!==this.blendAlpha&&(n.blendAlpha=this.blendAlpha),3!==this.depthFunc&&(n.depthFunc=this.depthFunc),!1===this.depthTest&&(n.depthTest=this.depthTest),!1===this.depthWrite&&(n.depthWrite=this.depthWrite),!1===this.colorWrite&&(n.colorWrite=this.colorWrite),255!==this.stencilWriteMask&&(n.stencilWriteMask=this.stencilWriteMask),519!==this.stencilFunc&&(n.stencilFunc=this.stencilFunc),0!==this.stencilRef&&(n.stencilRef=this.stencilRef),255!==this.stencilFuncMask&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Vo&&(n.stencilFail=this.stencilFail),this.stencilZFail!==Vo&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==Vo&&(n.stencilZPass=this.stencilZPass),!0===this.stencilWrite&&(n.stencilWrite=this.stencilWrite),void 0!==this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.alphaHash&&(n.alphaHash=!0),!0===this.alphaToCoverage&&(n.alphaToCoverage=!0),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=!0),!0===this.forceSinglePass&&(n.forceSinglePass=!0),!0===this.wireframe&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(n.flatShading=!0),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),!1===this.fog&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData),e){const e=i(t.textures),r=i(t.images);e.length>0&&(n.textures=e),r.length>0&&(n.images=r)}return n}clone(){return(new this.constructor).copy(this)}copy(t){this.name=t.name,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.blendColor.copy(t.blendColor),this.blendAlpha=t.blendAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;const e=t.clippingPlanes;let n=null;if(null!==e){const t=e.length;n=new Array(t);for(let i=0;i!==t;++i)n[i]=e[i].clone()}return this.clippingPlanes=n,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaHash=t.alphaHash,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.forceSinglePass=t.forceSinglePass,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){!0===t&&this.version++}}class fh extends ph{constructor(t){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new hh(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Rl,this.combine=ia,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}}const Ah=gh();function gh(){const t=new ArrayBuffer(4),e=new Float32Array(t),n=new Uint32Array(t),i=new Uint32Array(512),r=new Uint32Array(512);for(let t=0;t<256;++t){const e=t-127;e<-27?(i[t]=0,i[256|t]=32768,r[t]=24,r[256|t]=24):e<-14?(i[t]=1024>>-e-14,i[256|t]=1024>>-e-14|32768,r[t]=-e-1,r[256|t]=-e-1):e<=15?(i[t]=e+15<<10,i[256|t]=e+15<<10|32768,r[t]=13,r[256|t]=13):e<128?(i[t]=31744,i[256|t]=64512,r[t]=24,r[256|t]=24):(i[t]=31744,i[256|t]=64512,r[t]=13,r[256|t]=13)}const s=new Uint32Array(2048),a=new Uint32Array(64),o=new Uint32Array(64);for(let t=1;t<1024;++t){let e=t<<13,n=0;for(;!(8388608&e);)e<<=1,n-=8388608;e&=-8388609,n+=947912704,s[t]=e|n}for(let t=1024;t<2048;++t)s[t]=939524096+(t-1024<<13);for(let t=1;t<31;++t)a[t]=t<<23;a[31]=1199570944,a[32]=2147483648;for(let t=33;t<63;++t)a[t]=2147483648+(t-32<<23);a[63]=3347054592;for(let t=1;t<64;++t)32!==t&&(o[t]=1024);return{floatView:e,uint32View:n,baseTable:i,shiftTable:r,mantissaTable:s,exponentTable:a,offsetTable:o}}function mh(t){Math.abs(t),t=lc(t,-65504,65504),Ah.floatView[0]=t;const e=Ah.uint32View[0],n=e>>23&511;return Ah.baseTable[n]+((8388607&e)>>Ah.shiftTable[n])}function _h(t){const e=t>>10;return Ah.uint32View[0]=Ah.mantissaTable[Ah.offsetTable[e]+(1023&t)]+Ah.exponentTable[e],Ah.floatView[0]}const vh={toHalfFloat:mh,fromHalfFloat:_h},yh=new jc,bh=new Ac;class xh{constructor(t,e,n=!1){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=n,this.usage=$o,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=ka,this.version=0}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}get updateRange(){return Ec("THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this.gpuType=t.gpuType,this}copyAt(t,e,n){t*=this.itemSize,n*=e.itemSize;for(let i=0,r=this.itemSize;i<r;i++)this.array[t+i]=e.array[n+i];return this}copyArray(t){return this.array.set(t),this}applyMatrix3(t){if(2===this.itemSize)for(let e=0,n=this.count;e<n;e++)bh.fromBufferAttribute(this,e),bh.applyMatrix3(t),this.setXY(e,bh.x,bh.y);else if(3===this.itemSize)for(let e=0,n=this.count;e<n;e++)yh.fromBufferAttribute(this,e),yh.applyMatrix3(t),this.setXYZ(e,yh.x,yh.y,yh.z);return this}applyMatrix4(t){for(let e=0,n=this.count;e<n;e++)yh.fromBufferAttribute(this,e),yh.applyMatrix4(t),this.setXYZ(e,yh.x,yh.y,yh.z);return this}applyNormalMatrix(t){for(let e=0,n=this.count;e<n;e++)yh.fromBufferAttribute(this,e),yh.applyNormalMatrix(t),this.setXYZ(e,yh.x,yh.y,yh.z);return this}transformDirection(t){for(let e=0,n=this.count;e<n;e++)yh.fromBufferAttribute(this,e),yh.transformDirection(t),this.setXYZ(e,yh.x,yh.y,yh.z);return this}set(t,e=0){return this.array.set(t,e),this}getComponent(t,e){let n=this.array[t*this.itemSize+e];return this.normalized&&(n=dc(n,this.array)),n}setComponent(t,e,n){return this.normalized&&(n=pc(n,this.array)),this.array[t*this.itemSize+e]=n,this}getX(t){let e=this.array[t*this.itemSize];return this.normalized&&(e=dc(e,this.array)),e}setX(t,e){return this.normalized&&(e=pc(e,this.array)),this.array[t*this.itemSize]=e,this}getY(t){let e=this.array[t*this.itemSize+1];return this.normalized&&(e=dc(e,this.array)),e}setY(t,e){return this.normalized&&(e=pc(e,this.array)),this.array[t*this.itemSize+1]=e,this}getZ(t){let e=this.array[t*this.itemSize+2];return this.normalized&&(e=dc(e,this.array)),e}setZ(t,e){return this.normalized&&(e=pc(e,this.array)),this.array[t*this.itemSize+2]=e,this}getW(t){let e=this.array[t*this.itemSize+3];return this.normalized&&(e=dc(e,this.array)),e}setW(t,e){return this.normalized&&(e=pc(e,this.array)),this.array[t*this.itemSize+3]=e,this}setXY(t,e,n){return t*=this.itemSize,this.normalized&&(e=pc(e,this.array),n=pc(n,this.array)),this.array[t+0]=e,this.array[t+1]=n,this}setXYZ(t,e,n,i){return t*=this.itemSize,this.normalized&&(e=pc(e,this.array),n=pc(n,this.array),i=pc(i,this.array)),this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=i,this}setXYZW(t,e,n,i,r){return t*=this.itemSize,this.normalized&&(e=pc(e,this.array),n=pc(n,this.array),i=pc(i,this.array),r=pc(r,this.array)),this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=i,this.array[t+3]=r,this}onUpload(t){return this.onUploadCallback=t,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const t={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return""!==this.name&&(t.name=this.name),this.usage!==$o&&(t.usage=this.usage),t}}class wh extends xh{constructor(t,e,n){super(new Uint16Array(t),e,n)}}class Eh extends xh{constructor(t,e,n){super(new Uint32Array(t),e,n)}}class Ch extends xh{constructor(t,e,n){super(new Float32Array(t),e,n)}}let Sh=0;const Mh=new bl,Ih=new Yl,Th=new jc,Bh=new Yc,Rh=new Yc,Dh=new jc;class Lh extends ic{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Sh++}),this.uuid=cc(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(t){return Array.isArray(t)?this.index=new(_c(t)?Eh:wh)(t,1):this.index=t,this}getAttribute(t){return this.attributes[t]}setAttribute(t,e){return this.attributes[t]=e,this}deleteAttribute(t){return delete this.attributes[t],this}hasAttribute(t){return void 0!==this.attributes[t]}addGroup(t,e,n=0){this.groups.push({start:t,count:e,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(t,e){this.drawRange.start=t,this.drawRange.count=e}applyMatrix4(t){const e=this.attributes.position;void 0!==e&&(e.applyMatrix4(t),e.needsUpdate=!0);const n=this.attributes.normal;if(void 0!==n){const e=(new gc).getNormalMatrix(t);n.applyNormalMatrix(e),n.needsUpdate=!0}const i=this.attributes.tangent;return void 0!==i&&(i.transformDirection(t),i.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}applyQuaternion(t){return Mh.makeRotationFromQuaternion(t),this.applyMatrix4(Mh),this}rotateX(t){return Mh.makeRotationX(t),this.applyMatrix4(Mh),this}rotateY(t){return Mh.makeRotationY(t),this.applyMatrix4(Mh),this}rotateZ(t){return Mh.makeRotationZ(t),this.applyMatrix4(Mh),this}translate(t,e,n){return Mh.makeTranslation(t,e,n),this.applyMatrix4(Mh),this}scale(t,e,n){return Mh.makeScale(t,e,n),this.applyMatrix4(Mh),this}lookAt(t){return Ih.lookAt(t),Ih.updateMatrix(),this.applyMatrix4(Ih.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Th).negate(),this.translate(Th.x,Th.y,Th.z),this}setFromPoints(t){const e=[];for(let n=0,i=t.length;n<i;n++){const i=t[n];e.push(i.x,i.y,i.z||0)}return this.setAttribute("position",new Ch(e,3)),this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new Yc);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)this.boundingBox.set(new jc(-1/0,-1/0,-1/0),new jc(1/0,1/0,1/0));else{if(void 0!==t){if(this.boundingBox.setFromBufferAttribute(t),e)for(let t=0,n=e.length;t<n;t++){const n=e[t];Bh.setFromBufferAttribute(n),this.morphTargetsRelative?(Dh.addVectors(this.boundingBox.min,Bh.min),this.boundingBox.expandByPoint(Dh),Dh.addVectors(this.boundingBox.max,Bh.max),this.boundingBox.expandByPoint(Dh)):(this.boundingBox.expandByPoint(Bh.min),this.boundingBox.expandByPoint(Bh.max))}}else this.boundingBox.makeEmpty();isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z)}}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new dl);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)this.boundingSphere.set(new jc,1/0);else if(t){const n=this.boundingSphere.center;if(Bh.setFromBufferAttribute(t),e)for(let t=0,n=e.length;t<n;t++){const n=e[t];Rh.setFromBufferAttribute(n),this.morphTargetsRelative?(Dh.addVectors(Bh.min,Rh.min),Bh.expandByPoint(Dh),Dh.addVectors(Bh.max,Rh.max),Bh.expandByPoint(Dh)):(Bh.expandByPoint(Rh.min),Bh.expandByPoint(Rh.max))}Bh.getCenter(n);let i=0;for(let e=0,r=t.count;e<r;e++)Dh.fromBufferAttribute(t,e),i=Math.max(i,n.distanceToSquared(Dh));if(e)for(let r=0,s=e.length;r<s;r++){const s=e[r],a=this.morphTargetsRelative;for(let e=0,r=s.count;e<r;e++)Dh.fromBufferAttribute(s,e),a&&(Th.fromBufferAttribute(t,e),Dh.add(Th)),i=Math.max(i,n.distanceToSquared(Dh))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)}}computeTangents(){const t=this.index,e=this.attributes;if(null===t||void 0===e.position||void 0===e.normal||void 0===e.uv)return;const n=e.position,i=e.normal,r=e.uv;!1===this.hasAttribute("tangent")&&this.setAttribute("tangent",new xh(new Float32Array(4*n.count),4));const s=this.getAttribute("tangent"),a=[],o=[];for(let t=0;t<n.count;t++)a[t]=new jc,o[t]=new jc;const c=new jc,l=new jc,h=new jc,u=new Ac,d=new Ac,p=new Ac,f=new jc,A=new jc;function g(t,e,i){c.fromBufferAttribute(n,t),l.fromBufferAttribute(n,e),h.fromBufferAttribute(n,i),u.fromBufferAttribute(r,t),d.fromBufferAttribute(r,e),p.fromBufferAttribute(r,i),l.sub(c),h.sub(c),d.sub(u),p.sub(u);const s=1/(d.x*p.y-p.x*d.y);isFinite(s)&&(f.copy(l).multiplyScalar(p.y).addScaledVector(h,-d.y).multiplyScalar(s),A.copy(h).multiplyScalar(d.x).addScaledVector(l,-p.x).multiplyScalar(s),a[t].add(f),a[e].add(f),a[i].add(f),o[t].add(A),o[e].add(A),o[i].add(A))}let m=this.groups;0===m.length&&(m=[{start:0,count:t.count}]);for(let e=0,n=m.length;e<n;++e){const n=m[e],i=n.start;for(let e=i,r=i+n.count;e<r;e+=3)g(t.getX(e+0),t.getX(e+1),t.getX(e+2))}const _=new jc,v=new jc,y=new jc,b=new jc;function x(t){y.fromBufferAttribute(i,t),b.copy(y);const e=a[t];_.copy(e),_.sub(y.multiplyScalar(y.dot(e))).normalize(),v.crossVectors(b,e);const n=v.dot(o[t])<0?-1:1;s.setXYZW(t,_.x,_.y,_.z,n)}for(let e=0,n=m.length;e<n;++e){const n=m[e],i=n.start;for(let e=i,r=i+n.count;e<r;e+=3)x(t.getX(e+0)),x(t.getX(e+1)),x(t.getX(e+2))}}computeVertexNormals(){const t=this.index,e=this.getAttribute("position");if(void 0!==e){let n=this.getAttribute("normal");if(void 0===n)n=new xh(new Float32Array(3*e.count),3),this.setAttribute("normal",n);else for(let t=0,e=n.count;t<e;t++)n.setXYZ(t,0,0,0);const i=new jc,r=new jc,s=new jc,a=new jc,o=new jc,c=new jc,l=new jc,h=new jc;if(t)for(let u=0,d=t.count;u<d;u+=3){const d=t.getX(u+0),p=t.getX(u+1),f=t.getX(u+2);i.fromBufferAttribute(e,d),r.fromBufferAttribute(e,p),s.fromBufferAttribute(e,f),l.subVectors(s,r),h.subVectors(i,r),l.cross(h),a.fromBufferAttribute(n,d),o.fromBufferAttribute(n,p),c.fromBufferAttribute(n,f),a.add(l),o.add(l),c.add(l),n.setXYZ(d,a.x,a.y,a.z),n.setXYZ(p,o.x,o.y,o.z),n.setXYZ(f,c.x,c.y,c.z)}else for(let t=0,a=e.count;t<a;t+=3)i.fromBufferAttribute(e,t+0),r.fromBufferAttribute(e,t+1),s.fromBufferAttribute(e,t+2),l.subVectors(s,r),h.subVectors(i,r),l.cross(h),n.setXYZ(t+0,l.x,l.y,l.z),n.setXYZ(t+1,l.x,l.y,l.z),n.setXYZ(t+2,l.x,l.y,l.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){const t=this.attributes.normal;for(let e=0,n=t.count;e<n;e++)Dh.fromBufferAttribute(t,e),Dh.normalize(),t.setXYZ(e,Dh.x,Dh.y,Dh.z)}toNonIndexed(){function t(t,e){const n=t.array,i=t.itemSize,r=t.normalized,s=new n.constructor(e.length*i);let a=0,o=0;for(let r=0,c=e.length;r<c;r++){a=t.isInterleavedBufferAttribute?e[r]*t.data.stride+t.offset:e[r]*i;for(let t=0;t<i;t++)s[o++]=n[a++]}return new xh(s,i,r)}if(null===this.index)return this;const e=new Lh,n=this.index.array,i=this.attributes;for(const r in i){const s=t(i[r],n);e.setAttribute(r,s)}const r=this.morphAttributes;for(const i in r){const s=[],a=r[i];for(let e=0,i=a.length;e<i;e++){const i=t(a[e],n);s.push(i)}e.morphAttributes[i]=s}e.morphTargetsRelative=this.morphTargetsRelative;const s=this.groups;for(let t=0,n=s.length;t<n;t++){const n=s[t];e.addGroup(n.start,n.count,n.materialIndex)}return e}toJSON(){const t={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,""!==this.name&&(t.name=this.name),Object.keys(this.userData).length>0&&(t.userData=this.userData),void 0!==this.parameters){const e=this.parameters;for(const n in e)void 0!==e[n]&&(t[n]=e[n]);return t}t.data={attributes:{}};const e=this.index;null!==e&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});const n=this.attributes;for(const e in n){const i=n[e];t.data.attributes[e]=i.toJSON(t.data)}const i={};let r=!1;for(const e in this.morphAttributes){const n=this.morphAttributes[e],s=[];for(let e=0,i=n.length;e<i;e++){const i=n[e];s.push(i.toJSON(t.data))}s.length>0&&(i[e]=s,r=!0)}r&&(t.data.morphAttributes=i,t.data.morphTargetsRelative=this.morphTargetsRelative);const s=this.groups;s.length>0&&(t.data.groups=JSON.parse(JSON.stringify(s)));const a=this.boundingSphere;return null!==a&&(t.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),t}clone(){return(new this.constructor).copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const e={};this.name=t.name;const n=t.index;null!==n&&this.setIndex(n.clone(e));const i=t.attributes;for(const t in i){const n=i[t];this.setAttribute(t,n.clone(e))}const r=t.morphAttributes;for(const t in r){const n=[],i=r[t];for(let t=0,r=i.length;t<r;t++)n.push(i[t].clone(e));this.morphAttributes[t]=n}this.morphTargetsRelative=t.morphTargetsRelative;const s=t.groups;for(let t=0,e=s.length;t<e;t++){const e=s[t];this.addGroup(e.start,e.count,e.materialIndex)}const a=t.boundingBox;null!==a&&(this.boundingBox=a.clone());const o=t.boundingSphere;return null!==o&&(this.boundingSphere=o.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const Ph=new bl,kh=new yl,Oh=new dl,Uh=new jc,Nh=new jc,Fh=new jc,Qh=new jc,zh=new jc,Gh=new jc,Hh=new Ac,Vh=new Ac,jh=new Ac,Wh=new jc,qh=new jc,Yh=new jc,Xh=new jc,Jh=new jc;class Kh extends Yl{constructor(t=new Lh,e=new fh){super(),this.isMesh=!0,this.type="Mesh",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),void 0!==t.morphTargetInfluences&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),void 0!==t.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,e=Object.keys(t);if(e.length>0){const n=t[e[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=n.length;t<e;t++){const e=n[t].name||String(t);this.morphTargetInfluences.push(0),this.morphTargetDictionary[e]=t}}}}getVertexPosition(t,e){const n=this.geometry,i=n.attributes.position,r=n.morphAttributes.position,s=n.morphTargetsRelative;e.fromBufferAttribute(i,t);const a=this.morphTargetInfluences;if(r&&a){Gh.set(0,0,0);for(let n=0,i=r.length;n<i;n++){const i=a[n],o=r[n];0!==i&&(zh.fromBufferAttribute(o,t),s?Gh.addScaledVector(zh,i):Gh.addScaledVector(zh.sub(e),i))}e.add(Gh)}return e}raycast(t,e){const n=this.geometry,i=this.material,r=this.matrixWorld;if(void 0!==i){if(null===n.boundingSphere&&n.computeBoundingSphere(),Oh.copy(n.boundingSphere),Oh.applyMatrix4(r),kh.copy(t.ray).recast(t.near),!1===Oh.containsPoint(kh.origin)){if(null===kh.intersectSphere(Oh,Uh))return;if(kh.origin.distanceToSquared(Uh)>(t.far-t.near)**2)return}Ph.copy(r).invert(),kh.copy(t.ray).applyMatrix4(Ph),null!==n.boundingBox&&!1===kh.intersectsBox(n.boundingBox)||this._computeIntersections(t,e,kh)}}_computeIntersections(t,e,n){let i;const r=this.geometry,s=this.material,a=r.index,o=r.attributes.position,c=r.attributes.uv,l=r.attributes.uv1,h=r.attributes.normal,u=r.groups,d=r.drawRange;if(null!==a)if(Array.isArray(s))for(let r=0,o=u.length;r<o;r++){const o=u[r],p=s[o.materialIndex];for(let r=Math.max(o.start,d.start),s=Math.min(a.count,Math.min(o.start+o.count,d.start+d.count));r<s;r+=3){i=Zh(this,p,t,n,c,l,h,a.getX(r),a.getX(r+1),a.getX(r+2)),i&&(i.faceIndex=Math.floor(r/3),i.face.materialIndex=o.materialIndex,e.push(i))}}else{for(let r=Math.max(0,d.start),o=Math.min(a.count,d.start+d.count);r<o;r+=3){i=Zh(this,s,t,n,c,l,h,a.getX(r),a.getX(r+1),a.getX(r+2)),i&&(i.faceIndex=Math.floor(r/3),e.push(i))}}else if(void 0!==o)if(Array.isArray(s))for(let r=0,a=u.length;r<a;r++){const a=u[r],p=s[a.materialIndex];for(let r=Math.max(a.start,d.start),s=Math.min(o.count,Math.min(a.start+a.count,d.start+d.count));r<s;r+=3){i=Zh(this,p,t,n,c,l,h,r,r+1,r+2),i&&(i.faceIndex=Math.floor(r/3),i.face.materialIndex=a.materialIndex,e.push(i))}}else{for(let r=Math.max(0,d.start),a=Math.min(o.count,d.start+d.count);r<a;r+=3){i=Zh(this,s,t,n,c,l,h,r,r+1,r+2),i&&(i.faceIndex=Math.floor(r/3),e.push(i))}}}}function Zh(t,e,n,i,r,s,a,o,c,l){t.getVertexPosition(o,Nh),t.getVertexPosition(c,Fh),t.getVertexPosition(l,Qh);const h=function(t,e,n,i,r,s,a,o){let c;if(c=e.side===Us?i.intersectTriangle(a,s,r,!0,o):i.intersectTriangle(r,s,a,e.side===Os,o),null===c)return null;Jh.copy(o),Jh.applyMatrix4(t.matrixWorld);const l=n.ray.origin.distanceTo(Jh);return l<n.near||l>n.far?null:{distance:l,point:Jh.clone(),object:t}}(t,e,n,i,Nh,Fh,Qh,Xh);if(h){r&&(Hh.fromBufferAttribute(r,o),Vh.fromBufferAttribute(r,c),jh.fromBufferAttribute(r,l),h.uv=sh.getInterpolation(Xh,Nh,Fh,Qh,Hh,Vh,jh,new Ac)),s&&(Hh.fromBufferAttribute(s,o),Vh.fromBufferAttribute(s,c),jh.fromBufferAttribute(s,l),h.uv1=sh.getInterpolation(Xh,Nh,Fh,Qh,Hh,Vh,jh,new Ac)),a&&(Wh.fromBufferAttribute(a,o),qh.fromBufferAttribute(a,c),Yh.fromBufferAttribute(a,l),h.normal=sh.getInterpolation(Xh,Nh,Fh,Qh,Wh,qh,Yh,new jc),h.normal.dot(i.direction)>0&&h.normal.multiplyScalar(-1));const t={a:o,b:c,c:l,normal:new jc,materialIndex:0};sh.getNormal(Nh,Fh,Qh,t.normal),h.face=t}return h}class $h extends Lh{constructor(t=1,e=1,n=1,i=1,r=1,s=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:n,widthSegments:i,heightSegments:r,depthSegments:s};const a=this;i=Math.floor(i),r=Math.floor(r),s=Math.floor(s);const o=[],c=[],l=[],h=[];let u=0,d=0;function p(t,e,n,i,r,s,p,f,A,g,m){const _=s/A,v=p/g,y=s/2,b=p/2,x=f/2,w=A+1,E=g+1;let C=0,S=0;const M=new jc;for(let s=0;s<E;s++){const a=s*v-b;for(let o=0;o<w;o++){const u=o*_-y;M[t]=u*i,M[e]=a*r,M[n]=x,c.push(M.x,M.y,M.z),M[t]=0,M[e]=0,M[n]=f>0?1:-1,l.push(M.x,M.y,M.z),h.push(o/A),h.push(1-s/g),C+=1}}for(let t=0;t<g;t++)for(let e=0;e<A;e++){const n=u+e+w*t,i=u+e+w*(t+1),r=u+(e+1)+w*(t+1),s=u+(e+1)+w*t;o.push(n,i,s),o.push(i,r,s),S+=6}a.addGroup(d,S,m),d+=S,u+=C}p("z","y","x",-1,-1,n,e,t,s,r,0),p("z","y","x",1,-1,n,e,-t,s,r,1),p("x","z","y",1,1,t,n,e,i,s,2),p("x","z","y",1,-1,t,n,-e,i,s,3),p("x","y","z",1,-1,t,e,n,i,r,4),p("x","y","z",-1,-1,t,e,-n,i,r,5),this.setIndex(o),this.setAttribute("position",new Ch(c,3)),this.setAttribute("normal",new Ch(l,3)),this.setAttribute("uv",new Ch(h,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new $h(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}}function tu(t){const e={};for(const n in t){e[n]={};for(const i in t[n]){const r=t[n][i];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?r.isRenderTargetTexture?e[n][i]=null:e[n][i]=r.clone():Array.isArray(r)?e[n][i]=r.slice():e[n][i]=r}}return e}function eu(t){const e={};for(let n=0;n<t.length;n++){const i=tu(t[n]);for(const t in i)e[t]=i[t]}return e}function nu(t){const e=t.getRenderTarget();return null===e?t.outputColorSpace:!0===e.isXRRenderTarget?e.texture.colorSpace:Tc.workingColorSpace}const iu={clone:tu,merge:eu};class ru extends ph{constructor(t){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,void 0!==t&&this.setValues(t)}copy(t){return super.copy(t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=tu(t.uniforms),this.uniformsGroups=function(t){const e=[];for(let n=0;n<t.length;n++)e.push(t[n].clone());return e}(t.uniformsGroups),this.defines=Object.assign({},t.defines),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.fog=t.fog,this.lights=t.lights,this.clipping=t.clipping,this.extensions=Object.assign({},t.extensions),this.glslVersion=t.glslVersion,this}toJSON(t){const e=super.toJSON(t);e.glslVersion=this.glslVersion,e.uniforms={};for(const n in this.uniforms){const i=this.uniforms[n].value;i&&i.isTexture?e.uniforms[n]={type:"t",value:i.toJSON(t).uuid}:i&&i.isColor?e.uniforms[n]={type:"c",value:i.getHex()}:i&&i.isVector2?e.uniforms[n]={type:"v2",value:i.toArray()}:i&&i.isVector3?e.uniforms[n]={type:"v3",value:i.toArray()}:i&&i.isVector4?e.uniforms[n]={type:"v4",value:i.toArray()}:i&&i.isMatrix3?e.uniforms[n]={type:"m3",value:i.toArray()}:i&&i.isMatrix4?e.uniforms[n]={type:"m4",value:i.toArray()}:e.uniforms[n]={value:i}}Object.keys(this.defines).length>0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e.lights=this.lights,e.clipping=this.clipping;const n={};for(const t in this.extensions)!0===this.extensions[t]&&(n[t]=!0);return Object.keys(n).length>0&&(e.extensions=n),e}}class su extends Yl{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new bl,this.projectionMatrix=new bl,this.projectionMatrixInverse=new bl,this.coordinateSystem=ec}copy(t,e){return super.copy(t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this.coordinateSystem=t.coordinateSystem,this}getWorldDirection(t){return super.getWorldDirection(t).negate()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return(new this.constructor).copy(this)}}const au=new jc,ou=new Ac,cu=new Ac;class lu extends su{constructor(t=50,e=1,n=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=n,this.far=i,this.focus=10,this.aspect=e,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=null===t.view?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this}setFocalLength(t){const e=.5*this.getFilmHeight()/t;this.fov=2*oc*Math.atan(e),this.updateProjectionMatrix()}getFocalLength(){const t=Math.tan(.5*ac*this.fov);return.5*this.getFilmHeight()/t}getEffectiveFOV(){return 2*oc*Math.atan(Math.tan(.5*ac*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(t,e,n){au.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),e.set(au.x,au.y).multiplyScalar(-t/au.z),au.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(au.x,au.y).multiplyScalar(-t/au.z)}getViewSize(t,e){return this.getViewBounds(t,ou,cu),e.subVectors(cu,ou)}setViewOffset(t,e,n,i,r,s){this.aspect=t/e,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=s,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=this.near;let e=t*Math.tan(.5*ac*this.fov)/this.zoom,n=2*e,i=this.aspect*n,r=-.5*i;const s=this.view;if(null!==this.view&&this.view.enabled){const t=s.fullWidth,a=s.fullHeight;r+=s.offsetX*i/t,e-=s.offsetY*n/a,i*=s.width/t,n*=s.height/a}const a=this.filmOffset;0!==a&&(r+=t*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,e,e-n,t,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,null!==this.view&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}}const hu=-90;class uu extends Yl{constructor(t,e,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new lu(hu,1,t,e);i.layers=this.layers,this.add(i);const r=new lu(hu,1,t,e);r.layers=this.layers,this.add(r);const s=new lu(hu,1,t,e);s.layers=this.layers,this.add(s);const a=new lu(hu,1,t,e);a.layers=this.layers,this.add(a);const o=new lu(hu,1,t,e);o.layers=this.layers,this.add(o);const c=new lu(hu,1,t,e);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const t=this.coordinateSystem,e=this.children.concat(),[n,i,r,s,a,o]=e;for(const t of e)this.remove(t);if(t===ec)n.up.set(0,1,0),n.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),r.up.set(0,0,-1),r.lookAt(0,1,0),s.up.set(0,0,1),s.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),o.up.set(0,1,0),o.lookAt(0,0,-1);else{if(t!==nc)throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+t);n.up.set(0,-1,0),n.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),r.up.set(0,0,1),r.lookAt(0,1,0),s.up.set(0,0,-1),s.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),o.up.set(0,-1,0),o.lookAt(0,0,-1)}for(const t of e)this.add(t),t.updateMatrixWorld()}update(t,e){null===this.parent&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:i}=this;this.coordinateSystem!==t.coordinateSystem&&(this.coordinateSystem=t.coordinateSystem,this.updateCoordinateSystem());const[r,s,a,o,c,l]=this.children,h=t.getRenderTarget(),u=t.getActiveCubeFace(),d=t.getActiveMipmapLevel(),p=t.xr.enabled;t.xr.enabled=!1;const f=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,t.setRenderTarget(n,0,i),t.render(e,r),t.setRenderTarget(n,1,i),t.render(e,s),t.setRenderTarget(n,2,i),t.render(e,a),t.setRenderTarget(n,3,i),t.render(e,o),t.setRenderTarget(n,4,i),t.render(e,c),n.texture.generateMipmaps=f,t.setRenderTarget(n,5,i),t.render(e,l),t.setRenderTarget(h,u,d),t.xr.enabled=p,n.texture.needsPMREMUpdate=!0}}class du extends Nc{constructor(t,e,n,i,r,s,a,o,c,l){super(t=void 0!==t?t:[],e=void 0!==e?e:ma,n,i,r,s,a,o,c,l),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(t){this.image=t}}class pu extends zc{constructor(t=1,e={}){super(t,t,e),this.isWebGLCubeRenderTarget=!0;const n={width:t,height:t,depth:1},i=[n,n,n,n,n,n];this.texture=new du(i,e.mapping,e.wrapS,e.wrapT,e.magFilter,e.minFilter,e.format,e.type,e.anisotropy,e.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=void 0!==e.generateMipmaps&&e.generateMipmaps,this.texture.minFilter=void 0!==e.minFilter?e.minFilter:Ia}fromEquirectangularTexture(t,e){this.texture.type=e.type,this.texture.colorSpace=e.colorSpace,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:"\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include <begin_vertex>\n\t\t\t\t\t#include <project_vertex>\n\n\t\t\t\t}\n\t\t\t",fragmentShader:"\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include <common>\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t"},i=new $h(5,5,5),r=new ru({name:"CubemapFromEquirect",uniforms:tu(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:Us,blending:0});r.uniforms.tEquirect.value=e;const s=new Kh(i,r),a=e.minFilter;e.minFilter===Ba&&(e.minFilter=Ia);return new uu(1,10,this).update(t,s),e.minFilter=a,s.geometry.dispose(),s.material.dispose(),this}clear(t,e,n,i){const r=t.getRenderTarget();for(let r=0;r<6;r++)t.setRenderTarget(this,r),t.clear(e,n,i);t.setRenderTarget(r)}}const fu=new jc,Au=new jc,gu=new gc;class mu{constructor(t=new jc(1,0,0),e=0){this.isPlane=!0,this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,n,i){return this.normal.set(t,e,n),this.constant=i,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,n){const i=fu.subVectors(n,e).cross(Au.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(i,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){const t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,e){return e.copy(t).addScaledVector(this.normal,-this.distanceToPoint(t))}intersectLine(t,e){const n=t.delta(fu),i=this.normal.dot(n);if(0===i)return 0===this.distanceToPoint(t.start)?e.copy(t.start):null;const r=-(t.start.dot(this.normal)+this.constant)/i;return r<0||r>1?null:e.copy(t.start).addScaledVector(n,r)}intersectsLine(t){const e=this.distanceToPoint(t.start),n=this.distanceToPoint(t.end);return e<0&&n>0||n<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){const n=e||gu.getNormalMatrix(t),i=this.coplanarPoint(fu).applyMatrix4(t),r=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(r),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return(new this.constructor).copy(this)}}const _u=new dl,vu=new jc;class yu{constructor(t=new mu,e=new mu,n=new mu,i=new mu,r=new mu,s=new mu){this.planes=[t,e,n,i,r,s]}set(t,e,n,i,r,s){const a=this.planes;return a[0].copy(t),a[1].copy(e),a[2].copy(n),a[3].copy(i),a[4].copy(r),a[5].copy(s),this}copy(t){const e=this.planes;for(let n=0;n<6;n++)e[n].copy(t.planes[n]);return this}setFromProjectionMatrix(t,e=2e3){const n=this.planes,i=t.elements,r=i[0],s=i[1],a=i[2],o=i[3],c=i[4],l=i[5],h=i[6],u=i[7],d=i[8],p=i[9],f=i[10],A=i[11],g=i[12],m=i[13],_=i[14],v=i[15];if(n[0].setComponents(o-r,u-c,A-d,v-g).normalize(),n[1].setComponents(o+r,u+c,A+d,v+g).normalize(),n[2].setComponents(o+s,u+l,A+p,v+m).normalize(),n[3].setComponents(o-s,u-l,A-p,v-m).normalize(),n[4].setComponents(o-a,u-h,A-f,v-_).normalize(),e===ec)n[5].setComponents(o+a,u+h,A+f,v+_).normalize();else{if(e!==nc)throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+e);n[5].setComponents(a,h,f,_).normalize()}return this}intersectsObject(t){if(void 0!==t.boundingSphere)null===t.boundingSphere&&t.computeBoundingSphere(),_u.copy(t.boundingSphere).applyMatrix4(t.matrixWorld);else{const e=t.geometry;null===e.boundingSphere&&e.computeBoundingSphere(),_u.copy(e.boundingSphere).applyMatrix4(t.matrixWorld)}return this.intersectsSphere(_u)}intersectsSprite(t){return _u.center.set(0,0,0),_u.radius=.7071067811865476,_u.applyMatrix4(t.matrixWorld),this.intersectsSphere(_u)}intersectsSphere(t){const e=this.planes,n=t.center,i=-t.radius;for(let t=0;t<6;t++){if(e[t].distanceToPoint(n)<i)return!1}return!0}intersectsBox(t){const e=this.planes;for(let n=0;n<6;n++){const i=e[n];if(vu.x=i.normal.x>0?t.max.x:t.min.x,vu.y=i.normal.y>0?t.max.y:t.min.y,vu.z=i.normal.z>0?t.max.z:t.min.z,i.distanceToPoint(vu)<0)return!1}return!0}containsPoint(t){const e=this.planes;for(let n=0;n<6;n++)if(e[n].distanceToPoint(t)<0)return!1;return!0}clone(){return(new this.constructor).copy(this)}}function bu(){let t=null,e=!1,n=null,i=null;function r(e,s){n(e,s),i=t.requestAnimationFrame(r)}return{start:function(){!0!==e&&null!==n&&(i=t.requestAnimationFrame(r),e=!0)},stop:function(){t.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(t){n=t},setContext:function(e){t=e}}}function xu(t){const e=new WeakMap;return{get:function(t){return t.isInterleavedBufferAttribute&&(t=t.data),e.get(t)},remove:function(n){n.isInterleavedBufferAttribute&&(n=n.data);const i=e.get(n);i&&(t.deleteBuffer(i.buffer),e.delete(n))},update:function(n,i){if(n.isGLBufferAttribute){const t=e.get(n);return void((!t||t.version<n.version)&&e.set(n,{buffer:n.buffer,type:n.type,bytesPerElement:n.elementSize,version:n.version}))}n.isInterleavedBufferAttribute&&(n=n.data);const r=e.get(n);if(void 0===r)e.set(n,function(e,n){const i=e.array,r=e.usage,s=i.byteLength,a=t.createBuffer();let o;if(t.bindBuffer(n,a),t.bufferData(n,i,r),e.onUploadCallback(),i instanceof Float32Array)o=t.FLOAT;else if(i instanceof Uint16Array)o=e.isFloat16BufferAttribute?t.HALF_FLOAT:t.UNSIGNED_SHORT;else if(i instanceof Int16Array)o=t.SHORT;else if(i instanceof Uint32Array)o=t.UNSIGNED_INT;else if(i instanceof Int32Array)o=t.INT;else if(i instanceof Int8Array)o=t.BYTE;else if(i instanceof Uint8Array)o=t.UNSIGNED_BYTE;else{if(!(i instanceof Uint8ClampedArray))throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+i);o=t.UNSIGNED_BYTE}return{buffer:a,type:o,bytesPerElement:i.BYTES_PER_ELEMENT,version:e.version,size:s}}(n,i));else if(r.version<n.version){if(r.size!==n.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");!function(e,n,i){const r=n.array,s=n._updateRange,a=n.updateRanges;if(t.bindBuffer(i,e),-1===s.count&&0===a.length&&t.bufferSubData(i,0,r),0!==a.length){for(let e=0,n=a.length;e<n;e++){const n=a[e];t.bufferSubData(i,n.start*r.BYTES_PER_ELEMENT,r,n.start,n.count)}n.clearUpdateRanges()}-1!==s.count&&(t.bufferSubData(i,s.offset*r.BYTES_PER_ELEMENT,r,s.offset,s.count),s.count=-1),n.onUploadCallback()}(r.buffer,n,i),r.version=n.version}}}}class wu extends Lh{constructor(t=1,e=1,n=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:n,heightSegments:i};const r=t/2,s=e/2,a=Math.floor(n),o=Math.floor(i),c=a+1,l=o+1,h=t/a,u=e/o,d=[],p=[],f=[],A=[];for(let t=0;t<l;t++){const e=t*u-s;for(let n=0;n<c;n++){const i=n*h-r;p.push(i,-e,0),f.push(0,0,1),A.push(n/a),A.push(1-t/o)}}for(let t=0;t<o;t++)for(let e=0;e<a;e++){const n=e+c*t,i=e+c*(t+1),r=e+1+c*(t+1),s=e+1+c*t;d.push(n,i,s),d.push(i,r,s)}this.setIndex(d),this.setAttribute("position",new Ch(p,3)),this.setAttribute("normal",new Ch(f,3)),this.setAttribute("uv",new Ch(A,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new wu(t.width,t.height,t.widthSegments,t.heightSegments)}}const Eu={alphahash_fragment:"#ifdef USE_ALPHAHASH\n\tif ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;\n#endif",alphahash_pars_fragment:"#ifdef USE_ALPHAHASH\n\tconst float ALPHA_HASH_SCALE = 0.05;\n\tfloat hash2D( vec2 value ) {\n\t\treturn fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );\n\t}\n\tfloat hash3D( vec3 value ) {\n\t\treturn hash2D( vec2( hash2D( value.xy ), value.z ) );\n\t}\n\tfloat getAlphaHashThreshold( vec3 position ) {\n\t\tfloat maxDeriv = max(\n\t\t\tlength( dFdx( position.xyz ) ),\n\t\t\tlength( dFdy( position.xyz ) )\n\t\t);\n\t\tfloat pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );\n\t\tvec2 pixScales = vec2(\n\t\t\texp2( floor( log2( pixScale ) ) ),\n\t\t\texp2( ceil( log2( pixScale ) ) )\n\t\t);\n\t\tvec2 alpha = vec2(\n\t\t\thash3D( floor( pixScales.x * position.xyz ) ),\n\t\t\thash3D( floor( pixScales.y * position.xyz ) )\n\t\t);\n\t\tfloat lerpFactor = fract( log2( pixScale ) );\n\t\tfloat x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;\n\t\tfloat a = min( lerpFactor, 1.0 - lerpFactor );\n\t\tvec3 cases = vec3(\n\t\t\tx * x / ( 2.0 * a * ( 1.0 - a ) ),\n\t\t\t( x - 0.5 * a ) / ( 1.0 - a ),\n\t\t\t1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )\n\t\t);\n\t\tfloat threshold = ( x < ( 1.0 - a ) )\n\t\t\t? ( ( x < a ) ? cases.x : cases.y )\n\t\t\t: cases.z;\n\t\treturn clamp( threshold , 1.0e-6, 1.0 );\n\t}\n#endif",alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef USE_ALPHATEST\n\t#ifdef ALPHA_TO_COVERAGE\n\tdiffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );\n\tif ( diffuseColor.a == 0.0 ) discard;\n\t#else\n\tif ( diffuseColor.a < alphaTest ) discard;\n\t#endif\n#endif",alphatest_pars_fragment:"#ifdef USE_ALPHATEST\n\tuniform float alphaTest;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_CLEARCOAT ) \n\t\tclearcoatSpecularIndirect *= ambientOcclusion;\n\t#endif\n\t#if defined( USE_SHEEN ) \n\t\tsheenSpecularIndirect *= ambientOcclusion;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometryNormal, geometryViewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n\t#endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",batching_pars_vertex:"#ifdef USE_BATCHING\n\tattribute float batchId;\n\tuniform highp sampler2D batchingTexture;\n\tmat4 getBatchingMatrix( const in float i ) {\n\t\tint size = textureSize( batchingTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n#endif\n#ifdef USE_BATCHING_COLOR\n\tuniform sampler2D batchingColorTexture;\n\tvec3 getBatchingColor( const in float i ) {\n\t\tint size = textureSize( batchingColorTexture, 0 ).x;\n\t\tint j = int( i );\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\treturn texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;\n\t}\n#endif",batching_vertex:"#ifdef USE_BATCHING\n\tmat4 batchingMatrix = getBatchingMatrix( batchId );\n#endif",begin_vertex:"vec3 transformed = vec3( position );\n#ifdef USE_ALPHAHASH\n\tvPosition = vec3( position );\n#endif",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"float G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n} // validated",iridescence_fragment:"#ifdef USE_IRIDESCENCE\n\tconst mat3 XYZ_TO_REC709 = mat3(\n\t\t 3.2404542, -0.9692660, 0.0556434,\n\t\t-1.5371385, 1.8760108, -0.2040259,\n\t\t-0.4985314, 0.0415560, 1.0572252\n\t);\n\tvec3 Fresnel0ToIor( vec3 fresnel0 ) {\n\t\tvec3 sqrtF0 = sqrt( fresnel0 );\n\t\treturn ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n\t}\n\tvec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n\t}\n\tfloat IorToFresnel0( float transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n\t}\n\tvec3 evalSensitivity( float OPD, vec3 shift ) {\n\t\tfloat phase = 2.0 * PI * OPD * 1.0e-9;\n\t\tvec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\n\t\tvec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\n\t\tvec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\n\t\tvec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\n\t\txyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );\n\t\txyz /= 1.0685e-7;\n\t\tvec3 rgb = XYZ_TO_REC709 * xyz;\n\t\treturn rgb;\n\t}\n\tvec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n\t\tvec3 I;\n\t\tfloat iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n\t\tfloat sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n\t\tfloat cosTheta2Sq = 1.0 - sinTheta2Sq;\n\t\tif ( cosTheta2Sq < 0.0 ) {\n\t\t\treturn vec3( 1.0 );\n\t\t}\n\t\tfloat cosTheta2 = sqrt( cosTheta2Sq );\n\t\tfloat R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\n\t\tfloat R12 = F_Schlick( R0, 1.0, cosTheta1 );\n\t\tfloat T121 = 1.0 - R12;\n\t\tfloat phi12 = 0.0;\n\t\tif ( iridescenceIOR < outsideIOR ) phi12 = PI;\n\t\tfloat phi21 = PI - phi12;\n\t\tvec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );\t\tvec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\n\t\tvec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\n\t\tvec3 phi23 = vec3( 0.0 );\n\t\tif ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\n\t\tif ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\n\t\tif ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\n\t\tfloat OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n\t\tvec3 phi = vec3( phi21 ) + phi23;\n\t\tvec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\n\t\tvec3 r123 = sqrt( R123 );\n\t\tvec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\n\t\tvec3 C0 = R12 + Rs;\n\t\tI = C0;\n\t\tvec3 Cm = Rs - T121;\n\t\tfor ( int m = 1; m <= 2; ++ m ) {\n\t\t\tCm *= r123;\n\t\t\tvec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\n\t\t\tI += Cm * Sm;\n\t\t}\n\t\treturn max( I, vec3( 0.0 ) );\n\t}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vBumpMapUv );\n\t\tvec2 dSTdy = dFdy( vBumpMapUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\t\tvec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );\n\t\tvec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#ifdef ALPHA_TO_COVERAGE\n\t\tfloat distanceToPlane, distanceGradient;\n\t\tfloat clipOpacity = 1.0;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\tclipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\tif ( clipOpacity == 0.0 ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tfloat unionClipOpacity = 1.0;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\t\tunionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tclipOpacity *= 1.0 - unionClipOpacity;\n\t\t#endif\n\t\tdiffuseColor.a *= clipOpacity;\n\t\tif ( diffuseColor.a == 0.0 ) discard;\n\t#else\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tbool clipped = true;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tif ( clipped ) discard;\n\t\t#endif\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n\tvarying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif\n#ifdef USE_BATCHING_COLOR\n\tvec3 batchingColor = getBatchingColor( batchId );\n\tvColor.xyz *= batchingColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\n#ifdef USE_ALPHAHASH\n\tvarying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat luminance( const in vec3 rgb ) {\n\tconst vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );\n\treturn dot( weights, rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\thighp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\t\t#ifdef texture2DGradEXT\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n\t\t#else\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\t\t#endif\n\t}\n\t#define cubeUV_r0 1.0\n\t#define cubeUV_m0 - 2.0\n\t#define cubeUV_r1 0.8\n\t#define cubeUV_m1 - 1.0\n\t#define cubeUV_r4 0.4\n\t#define cubeUV_m4 2.0\n\t#define cubeUV_r5 0.305\n\t#define cubeUV_m5 3.0\n\t#define cubeUV_r6 0.21\n\t#define cubeUV_m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= cubeUV_r1 ) {\n\t\t\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n\t\t} else if ( roughness >= cubeUV_r4 ) {\n\t\t\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n\t\t} else if ( roughness >= cubeUV_r5 ) {\n\t\t\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n\t\t} else if ( roughness >= cubeUV_r6 ) {\n\t\t\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = objectTangent;\n#endif\n#ifdef USE_BATCHING\n\tmat3 bm = mat3( batchingMatrix );\n\ttransformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );\n\ttransformedNormal = bm * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = bm * transformedTangent;\n\t#endif\n#endif\n#ifdef USE_INSTANCING\n\tmat3 im = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );\n\ttransformedNormal = im * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = im * transformedTangent;\n\t#endif\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\ttransformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",colorspace_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",colorspace_pars_fragment:"\nconst mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3(\n\tvec3( 0.8224621, 0.177538, 0.0 ),\n\tvec3( 0.0331941, 0.9668058, 0.0 ),\n\tvec3( 0.0170827, 0.0723974, 0.9105199 )\n);\nconst mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.2249401, - 0.2249404, 0.0 ),\n\tvec3( - 0.0420569, 1.0420571, 0.0 ),\n\tvec3( - 0.0196376, - 0.0786361, 1.0982735 )\n);\nvec4 LinearSRGBToLinearDisplayP3( in vec4 value ) {\n\treturn vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a );\n}\nvec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) {\n\treturn vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a );\n}\nvec4 LinearTransferOETF( in vec4 value ) {\n\treturn value;\n}\nvec4 sRGBTransferOETF( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn sRGBTransferOETF( value );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform mat3 envMapRotation;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#ifdef USE_ENVMAP\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 reflectVec = reflect( - viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\t#ifdef USE_ANISOTROPY\n\t\tvec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n\t\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\t\tvec3 bentNormal = cross( bitangent, viewDir );\n\t\t\t\tbentNormal = normalize( cross( bentNormal, bitangent ) );\n\t\t\t\tbentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n\t\t\t\treturn getIBLRadiance( viewDir, bentNormal, roughness );\n\t\t\t#else\n\t\t\t\treturn vec3( 0.0 );\n\t\t\t#endif\n\t\t}\n\t#endif\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tvFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\t#else\n\t\tvec2 fw = fwidth( coord ) * 0.5;\n\t\treturn mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n\t#endif\n}",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_fragment:"LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;",lights_lambert_pars_fragment:"varying vec3 vViewPosition;\nstruct LambertMaterial {\n\tvec3 diffuseColor;\n\tfloat specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Lambert\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Lambert",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n\tuniform vec3 lightProbe[ 9 ];\n#endif\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif ( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\tmaterial.ior = ior;\n\t#ifdef USE_SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULAR_COLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n\t\t#endif\n\t\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_DISPERSION\n\tmaterial.dispersion = dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n\tmaterial.iridescence = iridescence;\n\tmaterial.iridescenceIOR = iridescenceIOR;\n\t#ifdef USE_IRIDESCENCEMAP\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n\t#endif\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n\t#else\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\n\t#endif\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\t#ifdef USE_ANISOTROPYMAP\n\t\tmat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n\t\tvec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n\t\tvec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n\t#else\n\t\tvec2 anisotropyV = anisotropyVector;\n\t#endif\n\tmaterial.anisotropy = length( anisotropyV );\n\tif( material.anisotropy == 0.0 ) {\n\t\tanisotropyV = vec2( 1.0, 0.0 );\n\t} else {\n\t\tanisotropyV /= material.anisotropy;\n\t\tmaterial.anisotropy = saturate( material.anisotropy );\n\t}\n\tmaterial.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n\tmaterial.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;\n\tmaterial.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\tfloat dispersion;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\t#ifdef IOR\n\t\tfloat ior;\n\t#endif\n\t#ifdef USE_TRANSMISSION\n\t\tfloat transmission;\n\t\tfloat transmissionAlpha;\n\t\tfloat thickness;\n\t\tfloat attenuationDistance;\n\t\tvec3 attenuationColor;\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat anisotropy;\n\t\tfloat alphaT;\n\t\tvec3 anisotropyT;\n\t\tvec3 anisotropyB;\n\t#endif\n};\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = vec3(0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n\tfloat V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n\t\tfloat gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n\t\tfloat gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n\t\tfloat v = 0.5 / ( gv + gl );\n\t\treturn saturate(v);\n\t}\n\tfloat D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n\t\tfloat a2 = alphaT * alphaB;\n\t\thighp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n\t\thighp float v2 = dot( v, v );\n\t\tfloat w2 = a2 / v2;\n\t\treturn RECIPROCAL_PI * a2 * pow2 ( w2 );\n\t}\n#endif\n#ifdef USE_CLEARCOAT\n\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n\t\tvec3 f0 = material.clearcoatF0;\n\t\tfloat f90 = material.clearcoatF90;\n\t\tfloat roughness = material.clearcoatRoughness;\n\t\tfloat alpha = pow2( roughness );\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\t\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t\treturn F * ( V * D );\n\t}\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\tvec3 f0 = material.specularColor;\n\tfloat f90 = material.specularF90;\n\tfloat roughness = material.roughness;\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t#ifdef USE_IRIDESCENCE\n\t\tF = mix( F, material.iridescenceFresnel, material.iridescence );\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat dotTL = dot( material.anisotropyT, lightDir );\n\t\tfloat dotTV = dot( material.anisotropyT, viewDir );\n\t\tfloat dotTH = dot( material.anisotropyT, halfDir );\n\t\tfloat dotBL = dot( material.anisotropyB, lightDir );\n\t\tfloat dotBV = dot( material.anisotropyB, viewDir );\n\t\tfloat dotBH = dot( material.anisotropyB, halfDir );\n\t\tfloat V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n\t\tfloat D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n\t#else\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t#endif\n\treturn F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\t#ifdef USE_IRIDESCENCE\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\t#else\n\t\tvec3 Fr = specularColor;\n\t#endif\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometryNormal;\n\t\tvec3 viewDir = geometryViewDir;\n\t\tvec3 position = geometryPosition;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\t#ifdef USE_IRIDESCENCE\n\t\tcomputeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n\t#else\n\t\tcomputeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\t#endif\n\tvec3 totalScattering = singleScattering + multiScattering;\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 geometryClearcoatNormal = vec3( 0.0 );\n#ifdef USE_CLEARCOAT\n\tgeometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n\tfloat dotNVi = saturate( dot( normal, geometryViewDir ) );\n\tif ( material.iridescenceThickness == 0.0 ) {\n\t\tmaterial.iridescence = 0.0;\n\t} else {\n\t\tmaterial.iridescence = saturate( material.iridescence );\n\t}\n\tif ( material.iridescence > 0.0 ) {\n\t\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\t\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n\t}\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometryPosition, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tvec4 spotColor;\n\tvec3 spotLightCoord;\n\tbool inSpotLightMap;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometryPosition, directLight );\n\t\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n\t\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n\t\t#else\n\t\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#endif\n\t\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n\t\t\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n\t\t\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n\t\t\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n\t\t\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n\t\t#endif\n\t\t#undef SPOT_LIGHT_MAP_INDEX\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#if defined( USE_LIGHT_PROBES )\n\t\tirradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getIBLIrradiance( geometryNormal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\t#ifdef USE_ANISOTROPY\n\t\tradiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n\t#else\n\t\tradiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF )\n\tgl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\tvFragDepth = 1.0 + gl_Position.w;\n\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 sampledDiffuseColor = texture2D( map, vMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );\n\t\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t#if defined( USE_POINTS_UV )\n\t\tvec2 uv = vUv;\n\t#else\n\t\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tdiffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_POINTS_UV )\n\tvarying vec2 vUv;\n#else\n\t#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t\tuniform mat3 uvTransform;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphinstance_vertex:"#ifdef USE_INSTANCING_MORPH\n\tfloat morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\tfloat morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tmorphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;\n\t}\n#endif",morphcolor_vertex:"#if defined( USE_MORPHCOLORS )\n\tvColor *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t#if defined( USE_COLOR_ALPHA )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n\t\t#elif defined( USE_COLOR )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n\t\t#endif\n\t}\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n\t}\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\t#ifndef USE_INSTANCING_MORPH\n\t\tuniform float morphTargetBaseInfluence;\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t#endif\n\tuniform sampler2DArray morphTargetsTexture;\n\tuniform ivec2 morphTargetsTextureSize;\n\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n\t\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n\t\tint y = texelIndex / morphTargetsTextureSize.x;\n\t\tint x = texelIndex - y * morphTargetsTextureSize.x;\n\t\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\n\t\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\n\t}\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n\t}\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = dFdx( vViewPosition );\n\tvec3 fdy = dFdy( vViewPosition );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal *= faceDirection;\n\t#endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn = getTangentFrame( - vViewPosition, normal,\n\t\t#if defined( USE_NORMALMAP )\n\t\t\tvNormalMapUv\n\t\t#elif defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tvClearcoatNormalMapUv\n\t\t#else\n\t\t\tvUv\n\t\t#endif\n\t\t);\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn[0] *= faceDirection;\n\t\ttbn[1] *= faceDirection;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn2[0] *= faceDirection;\n\t\ttbn2[1] *= faceDirection;\n\t#endif\n#endif\nvec3 nonPerturbedNormal = normal;",normal_fragment_maps:"#ifdef USE_NORMALMAP_OBJECTSPACE\n\tnormal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n\tvec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\tnormal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n\tmat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( uv.st );\n\t\tvec2 st1 = dFdy( uv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n\t\treturn mat3( T * scale, B * scale, N );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = nonPerturbedNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\tclearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif",iridescence_pars_fragment:"#ifdef USE_IRIDESCENCEMAP\n\tuniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform sampler2D iridescenceThicknessMap;\n#endif",opaque_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec2 packDepthToRG( in highp float v ) {\n\treturn packDepthToRGBA( v ).yx;\n}\nfloat unpackRGToDepth( const in highp vec2 v ) {\n\treturn unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn depth * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * depth - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_BATCHING\n\tmvPosition = batchingMatrix * mvPosition;\n#endif\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tfloat shadow = 1.0;\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\t\n\t\tfloat lightToPositionLength = length( lightToPosition );\n\t\tif ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {\n\t\t\tfloat dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\t\tdp += shadowBias;\n\t\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\t\tshadow = (\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t\t) * ( 1.0 / 9.0 );\n\t\t\t#else\n\t\t\t\tshadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n#endif",shadowmap_pars_vertex:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tuniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\tvec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition;\n\t\t#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t\tshadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n\t\t#endif\n\t\tvSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\tuniform highp sampler2D boneTexture;\n\tmat4 getBoneMatrix( const in float i ) {\n\t\tint size = textureSize( boneTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.6605, - 0.1246, - 0.0182 ),\n\tvec3( - 0.5876, 1.1329, - 0.1006 ),\n\tvec3( - 0.0728, - 0.0083, 1.1187 )\n);\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\n\tvec3( 0.6274, 0.0691, 0.0164 ),\n\tvec3( 0.3293, 0.9195, 0.0880 ),\n\tvec3( 0.0433, 0.0113, 0.8956 )\n);\nvec3 agxDefaultContrastApprox( vec3 x ) {\n\tvec3 x2 = x * x;\n\tvec3 x4 = x2 * x2;\n\treturn + 15.5 * x4 * x2\n\t\t- 40.14 * x4 * x\n\t\t+ 31.96 * x4\n\t\t- 6.868 * x2 * x\n\t\t+ 0.4298 * x2\n\t\t+ 0.1191 * x\n\t\t- 0.00232;\n}\nvec3 AgXToneMapping( vec3 color ) {\n\tconst mat3 AgXInsetMatrix = mat3(\n\t\tvec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\n\t\tvec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\n\t\tvec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\n\t);\n\tconst mat3 AgXOutsetMatrix = mat3(\n\t\tvec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\n\t\tvec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\n\t\tvec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\n\t);\n\tconst float AgxMinEv = - 12.47393;\tconst float AgxMaxEv = 4.026069;\n\tcolor *= toneMappingExposure;\n\tcolor = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\n\tcolor = AgXInsetMatrix * color;\n\tcolor = max( color, 1e-10 );\tcolor = log2( color );\n\tcolor = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\n\tcolor = clamp( color, 0.0, 1.0 );\n\tcolor = agxDefaultContrastApprox( color );\n\tcolor = AgXOutsetMatrix * color;\n\tcolor = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\n\tcolor = LINEAR_REC2020_TO_LINEAR_SRGB * color;\n\tcolor = clamp( color, 0.0, 1.0 );\n\treturn color;\n}\nvec3 NeutralToneMapping( vec3 color ) {\n\tconst float StartCompression = 0.8 - 0.04;\n\tconst float Desaturation = 0.15;\n\tcolor *= toneMappingExposure;\n\tfloat x = min( color.r, min( color.g, color.b ) );\n\tfloat offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\n\tcolor -= offset;\n\tfloat peak = max( color.r, max( color.g, color.b ) );\n\tif ( peak < StartCompression ) return color;\n\tfloat d = 1. - StartCompression;\n\tfloat newPeak = 1. - d * d / ( peak + d - StartCompression );\n\tcolor *= newPeak / peak;\n\tfloat g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );\n\treturn mix( color, vec3( newPeak ), g );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n\tmaterial.transmission = transmission;\n\tmaterial.transmissionAlpha = 1.0;\n\tmaterial.thickness = thickness;\n\tmaterial.attenuationDistance = attenuationDistance;\n\tmaterial.attenuationColor = attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tmaterial.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tmaterial.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmitted = getIBLVolumeRefraction(\n\t\tn, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,\n\t\tmaterial.attenuationColor, material.attenuationDistance );\n\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n\ttotalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tfloat w0( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n\t}\n\tfloat w1( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n\t}\n\tfloat w2( float a ){\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n\t}\n\tfloat w3( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * a );\n\t}\n\tfloat g0( float a ) {\n\t\treturn w0( a ) + w1( a );\n\t}\n\tfloat g1( float a ) {\n\t\treturn w2( a ) + w3( a );\n\t}\n\tfloat h0( float a ) {\n\t\treturn - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n\t}\n\tfloat h1( float a ) {\n\t\treturn 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n\t}\n\tvec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n\t\tuv = uv * texelSize.zw + 0.5;\n\t\tvec2 iuv = floor( uv );\n\t\tvec2 fuv = fract( uv );\n\t\tfloat g0x = g0( fuv.x );\n\t\tfloat g1x = g1( fuv.x );\n\t\tfloat h0x = h0( fuv.x );\n\t\tfloat h1x = h1( fuv.x );\n\t\tfloat h0y = h0( fuv.y );\n\t\tfloat h1y = h1( fuv.y );\n\t\tvec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\treturn g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n\t\t\tg1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n\t}\n\tvec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n\t\tvec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n\t\tvec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n\t\tvec2 fLodSizeInv = 1.0 / fLodSize;\n\t\tvec2 cLodSizeInv = 1.0 / cLodSize;\n\t\tvec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n\t\tvec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n\t\treturn mix( fSample, cSample, fract( lod ) );\n\t}\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\treturn textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n\t}\n\tvec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( isinf( attenuationDistance ) ) {\n\t\t\treturn vec3( 1.0 );\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec4 transmittedLight;\n\t\tvec3 transmittance;\n\t\t#ifdef USE_DISPERSION\n\t\t\tfloat halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;\n\t\t\tvec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );\n\t\t\tfor ( int i = 0; i < 3; i ++ ) {\n\t\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );\n\t\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\n\t\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\t\trefractionCoords += 1.0;\n\t\t\t\trefractionCoords /= 2.0;\n\t\t\n\t\t\t\tvec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );\n\t\t\t\ttransmittedLight[ i ] = transmissionSample[ i ];\n\t\t\t\ttransmittedLight.a += transmissionSample.a;\n\t\t\t\ttransmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];\n\t\t\t}\n\t\t\ttransmittedLight.a /= 3.0;\n\t\t\n\t\t#else\n\t\t\n\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\trefractionCoords += 1.0;\n\t\t\trefractionCoords /= 2.0;\n\t\t\ttransmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\t\ttransmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\t\n\t\t#endif\n\t\tvec3 attenuatedColor = transmittance * transmittedLight.rgb;\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\tfloat transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n\t}\n#endif",uv_pars_fragment:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_pars_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tuniform mat3 mapTransform;\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform mat3 alphaMapTransform;\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tuniform mat3 lightMapTransform;\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tuniform mat3 aoMapTransform;\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tuniform mat3 bumpMapTransform;\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tuniform mat3 normalMapTransform;\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tuniform mat3 displacementMapTransform;\n\tvarying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tuniform mat3 emissiveMapTransform;\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tuniform mat3 metalnessMapTransform;\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tuniform mat3 roughnessMapTransform;\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tuniform mat3 anisotropyMapTransform;\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tuniform mat3 clearcoatMapTransform;\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform mat3 clearcoatNormalMapTransform;\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform mat3 clearcoatRoughnessMapTransform;\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tuniform mat3 sheenColorMapTransform;\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tuniform mat3 sheenRoughnessMapTransform;\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tuniform mat3 iridescenceMapTransform;\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform mat3 iridescenceThicknessMapTransform;\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tuniform mat3 specularMapTransform;\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tuniform mat3 specularColorMapTransform;\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tuniform mat3 specularIntensityMapTransform;\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n\tvMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n\tvAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n\tvLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n\tvAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n\tvBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n\tvNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tvDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n\tvMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n\tvSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tvTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n\tvThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_BATCHING\n\t\tworldPosition = batchingMatrix * worldPosition;\n\t#endif\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\ttexColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",backgroundCube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",backgroundCube_frag:"#ifdef ENVMAP_TYPE_CUBE\n\tuniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n\tuniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nuniform mat3 backgroundRotation;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );\n\t#else\n\t\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",cube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n\tgl_FragColor = texColor;\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",depth_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#include <morphinstance_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <clipping_planes_fragment>\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <logdepthbuf_fragment>\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#include <morphinstance_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <clipping_planes_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",meshbasic_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinbase_vertex>\n\t\t#include <skinnormal_vertex>\n\t\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshlambert_frag:"#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_lambert_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_lambert_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t#else\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef USE_SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULAR_COLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_DISPERSION\n\tuniform float dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\tuniform vec2 anisotropyVector;\n\t#ifdef USE_ANISOTROPYMAP\n\t\tuniform sampler2D anisotropyMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <iridescence_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <iridescence_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include <transmission_fragment>\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\n\t#endif\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n#ifdef USE_POINTS_UV\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif\nvoid main() {\n\t#ifdef USE_POINTS_UV\n\t\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\t#endif\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",shadow_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <logdepthbuf_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\t#include <logdepthbuf_fragment>\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n}"},Cu={common:{diffuse:{value:new hh(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new gc},alphaMap:{value:null},alphaMapTransform:{value:new gc},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new gc}},envmap:{envMap:{value:null},envMapRotation:{value:new gc},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new gc}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new gc}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new gc},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new gc},normalScale:{value:new Ac(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new gc},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new gc}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new gc}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new gc}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new hh(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new hh(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new gc},alphaTest:{value:0},uvTransform:{value:new gc}},sprite:{diffuse:{value:new hh(16777215)},opacity:{value:1},center:{value:new Ac(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new gc},alphaMap:{value:null},alphaMapTransform:{value:new gc},alphaTest:{value:0}}},Su={basic:{uniforms:eu([Cu.common,Cu.specularmap,Cu.envmap,Cu.aomap,Cu.lightmap,Cu.fog]),vertexShader:Eu.meshbasic_vert,fragmentShader:Eu.meshbasic_frag},lambert:{uniforms:eu([Cu.common,Cu.specularmap,Cu.envmap,Cu.aomap,Cu.lightmap,Cu.emissivemap,Cu.bumpmap,Cu.normalmap,Cu.displacementmap,Cu.fog,Cu.lights,{emissive:{value:new hh(0)}}]),vertexShader:Eu.meshlambert_vert,fragmentShader:Eu.meshlambert_frag},phong:{uniforms:eu([Cu.common,Cu.specularmap,Cu.envmap,Cu.aomap,Cu.lightmap,Cu.emissivemap,Cu.bumpmap,Cu.normalmap,Cu.displacementmap,Cu.fog,Cu.lights,{emissive:{value:new hh(0)},specular:{value:new hh(1118481)},shininess:{value:30}}]),vertexShader:Eu.meshphong_vert,fragmentShader:Eu.meshphong_frag},standard:{uniforms:eu([Cu.common,Cu.envmap,Cu.aomap,Cu.lightmap,Cu.emissivemap,Cu.bumpmap,Cu.normalmap,Cu.displacementmap,Cu.roughnessmap,Cu.metalnessmap,Cu.fog,Cu.lights,{emissive:{value:new hh(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Eu.meshphysical_vert,fragmentShader:Eu.meshphysical_frag},toon:{uniforms:eu([Cu.common,Cu.aomap,Cu.lightmap,Cu.emissivemap,Cu.bumpmap,Cu.normalmap,Cu.displacementmap,Cu.gradientmap,Cu.fog,Cu.lights,{emissive:{value:new hh(0)}}]),vertexShader:Eu.meshtoon_vert,fragmentShader:Eu.meshtoon_frag},matcap:{uniforms:eu([Cu.common,Cu.bumpmap,Cu.normalmap,Cu.displacementmap,Cu.fog,{matcap:{value:null}}]),vertexShader:Eu.meshmatcap_vert,fragmentShader:Eu.meshmatcap_frag},points:{uniforms:eu([Cu.points,Cu.fog]),vertexShader:Eu.points_vert,fragmentShader:Eu.points_frag},dashed:{uniforms:eu([Cu.common,Cu.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Eu.linedashed_vert,fragmentShader:Eu.linedashed_frag},depth:{uniforms:eu([Cu.common,Cu.displacementmap]),vertexShader:Eu.depth_vert,fragmentShader:Eu.depth_frag},normal:{uniforms:eu([Cu.common,Cu.bumpmap,Cu.normalmap,Cu.displacementmap,{opacity:{value:1}}]),vertexShader:Eu.meshnormal_vert,fragmentShader:Eu.meshnormal_frag},sprite:{uniforms:eu([Cu.sprite,Cu.fog]),vertexShader:Eu.sprite_vert,fragmentShader:Eu.sprite_frag},background:{uniforms:{uvTransform:{value:new gc},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Eu.background_vert,fragmentShader:Eu.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new gc}},vertexShader:Eu.backgroundCube_vert,fragmentShader:Eu.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Eu.cube_vert,fragmentShader:Eu.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Eu.equirect_vert,fragmentShader:Eu.equirect_frag},distanceRGBA:{uniforms:eu([Cu.common,Cu.displacementmap,{referencePosition:{value:new jc},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Eu.distanceRGBA_vert,fragmentShader:Eu.distanceRGBA_frag},shadow:{uniforms:eu([Cu.lights,Cu.fog,{color:{value:new hh(0)},opacity:{value:1}}]),vertexShader:Eu.shadow_vert,fragmentShader:Eu.shadow_frag}};Su.physical={uniforms:eu([Su.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new gc},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new gc},clearcoatNormalScale:{value:new Ac(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new gc},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new gc},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new gc},sheen:{value:0},sheenColor:{value:new hh(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new gc},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new gc},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new gc},transmissionSamplerSize:{value:new Ac},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new gc},attenuationDistance:{value:0},attenuationColor:{value:new hh(0)},specularColor:{value:new hh(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new gc},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new gc},anisotropyVector:{value:new Ac},anisotropyMap:{value:null},anisotropyMapTransform:{value:new gc}}]),vertexShader:Eu.meshphysical_vert,fragmentShader:Eu.meshphysical_frag};const Mu={r:0,b:0,g:0},Iu=new Rl,Tu=new bl;function Bu(t,e,n,i,r,s,a){const o=new hh(0);let c,l,h=!0===s?0:1,u=null,d=0,p=null;function f(t){let i=!0===t.isScene?t.background:null;if(i&&i.isTexture){i=(t.backgroundBlurriness>0?n:e).get(i)}return i}function A(e,n){e.getRGB(Mu,nu(t)),i.buffers.color.setClear(Mu.r,Mu.g,Mu.b,n,a)}return{getClearColor:function(){return o},setClearColor:function(t,e=1){o.set(t),h=e,A(o,h)},getClearAlpha:function(){return h},setClearAlpha:function(t){h=t,A(o,h)},render:function(e){let n=!1;const r=f(e);null===r?A(o,h):r&&r.isColor&&(A(r,1),n=!0);const s=t.xr.getEnvironmentBlendMode();"additive"===s?i.buffers.color.setClear(0,0,0,1,a):"alpha-blend"===s&&i.buffers.color.setClear(0,0,0,0,a),(t.autoClear||n)&&(i.buffers.depth.setTest(!0),i.buffers.depth.setMask(!0),i.buffers.color.setMask(!0),t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil))},addToRenderList:function(e,n){const i=f(n);i&&(i.isCubeTexture||i.mapping===ba)?(void 0===l&&(l=new Kh(new $h(1,1,1),new ru({name:"BackgroundCubeMaterial",uniforms:tu(Su.backgroundCube.uniforms),vertexShader:Su.backgroundCube.vertexShader,fragmentShader:Su.backgroundCube.fragmentShader,side:Us,depthTest:!1,depthWrite:!1,fog:!1})),l.geometry.deleteAttribute("normal"),l.geometry.deleteAttribute("uv"),l.onBeforeRender=function(t,e,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(l.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(l)),Iu.copy(n.backgroundRotation),Iu.x*=-1,Iu.y*=-1,Iu.z*=-1,i.isCubeTexture&&!1===i.isRenderTargetTexture&&(Iu.y*=-1,Iu.z*=-1),l.material.uniforms.envMap.value=i,l.material.uniforms.flipEnvMap.value=i.isCubeTexture&&!1===i.isRenderTargetTexture?-1:1,l.material.uniforms.backgroundBlurriness.value=n.backgroundBlurriness,l.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,l.material.uniforms.backgroundRotation.value.setFromMatrix4(Tu.makeRotationFromEuler(Iu)),l.material.toneMapped=Tc.getTransfer(i.colorSpace)!==zo,u===i&&d===i.version&&p===t.toneMapping||(l.material.needsUpdate=!0,u=i,d=i.version,p=t.toneMapping),l.layers.enableAll(),e.unshift(l,l.geometry,l.material,0,0,null)):i&&i.isTexture&&(void 0===c&&(c=new Kh(new wu(2,2),new ru({name:"BackgroundMaterial",uniforms:tu(Su.background.uniforms),vertexShader:Su.background.vertexShader,fragmentShader:Su.background.fragmentShader,side:Os,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(c)),c.material.uniforms.t2D.value=i,c.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,c.material.toneMapped=Tc.getTransfer(i.colorSpace)!==zo,!0===i.matrixAutoUpdate&&i.updateMatrix(),c.material.uniforms.uvTransform.value.copy(i.matrix),u===i&&d===i.version&&p===t.toneMapping||(c.material.needsUpdate=!0,u=i,d=i.version,p=t.toneMapping),c.layers.enableAll(),e.unshift(c,c.geometry,c.material,0,0,null))}}}function Ru(t,e){const n=t.getParameter(t.MAX_VERTEX_ATTRIBS),i={},r=l(null);let s=r,a=!1;function o(e){return t.bindVertexArray(e)}function c(e){return t.deleteVertexArray(e)}function l(t){const e=[],i=[],r=[];for(let t=0;t<n;t++)e[t]=0,i[t]=0,r[t]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:e,enabledAttributes:i,attributeDivisors:r,object:t,attributes:{},index:null}}function h(){const t=s.newAttributes;for(let e=0,n=t.length;e<n;e++)t[e]=0}function u(t){d(t,0)}function d(e,n){const i=s.newAttributes,r=s.enabledAttributes,a=s.attributeDivisors;i[e]=1,0===r[e]&&(t.enableVertexAttribArray(e),r[e]=1),a[e]!==n&&(t.vertexAttribDivisor(e,n),a[e]=n)}function p(){const e=s.newAttributes,n=s.enabledAttributes;for(let i=0,r=n.length;i<r;i++)n[i]!==e[i]&&(t.disableVertexAttribArray(i),n[i]=0)}function f(e,n,i,r,s,a,o){!0===o?t.vertexAttribIPointer(e,n,i,s,a):t.vertexAttribPointer(e,n,i,r,s,a)}function A(){g(),a=!0,s!==r&&(s=r,o(s.object))}function g(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:function(n,r,c,A,g){let m=!1;const _=function(e,n,r){const s=!0===r.wireframe;let a=i[e.id];void 0===a&&(a={},i[e.id]=a);let o=a[n.id];void 0===o&&(o={},a[n.id]=o);let c=o[s];void 0===c&&(c=l(t.createVertexArray()),o[s]=c);return c}(A,c,r);s!==_&&(s=_,o(s.object)),m=function(t,e,n,i){const r=s.attributes,a=e.attributes;let o=0;const c=n.getAttributes();for(const e in c){if(c[e].location>=0){const n=r[e];let i=a[e];if(void 0===i&&("instanceMatrix"===e&&t.instanceMatrix&&(i=t.instanceMatrix),"instanceColor"===e&&t.instanceColor&&(i=t.instanceColor)),void 0===n)return!0;if(n.attribute!==i)return!0;if(i&&n.data!==i.data)return!0;o++}}return s.attributesNum!==o||s.index!==i}(n,A,c,g),m&&function(t,e,n,i){const r={},a=e.attributes;let o=0;const c=n.getAttributes();for(const e in c){if(c[e].location>=0){let n=a[e];void 0===n&&("instanceMatrix"===e&&t.instanceMatrix&&(n=t.instanceMatrix),"instanceColor"===e&&t.instanceColor&&(n=t.instanceColor));const i={};i.attribute=n,n&&n.data&&(i.data=n.data),r[e]=i,o++}}s.attributes=r,s.attributesNum=o,s.index=i}(n,A,c,g),null!==g&&e.update(g,t.ELEMENT_ARRAY_BUFFER),(m||a)&&(a=!1,function(n,i,r,s){h();const a=s.attributes,o=r.getAttributes(),c=i.defaultAttributeValues;for(const i in o){const r=o[i];if(r.location>=0){let o=a[i];if(void 0===o&&("instanceMatrix"===i&&n.instanceMatrix&&(o=n.instanceMatrix),"instanceColor"===i&&n.instanceColor&&(o=n.instanceColor)),void 0!==o){const i=o.normalized,a=o.itemSize,c=e.get(o);if(void 0===c)continue;const l=c.buffer,h=c.type,p=c.bytesPerElement,A=h===t.INT||h===t.UNSIGNED_INT||o.gpuType===La;if(o.isInterleavedBufferAttribute){const e=o.data,c=e.stride,g=o.offset;if(e.isInstancedInterleavedBuffer){for(let t=0;t<r.locationSize;t++)d(r.location+t,e.meshPerAttribute);!0!==n.isInstancedMesh&&void 0===s._maxInstanceCount&&(s._maxInstanceCount=e.meshPerAttribute*e.count)}else for(let t=0;t<r.locationSize;t++)u(r.location+t);t.bindBuffer(t.ARRAY_BUFFER,l);for(let t=0;t<r.locationSize;t++)f(r.location+t,a/r.locationSize,h,i,c*p,(g+a/r.locationSize*t)*p,A)}else{if(o.isInstancedBufferAttribute){for(let t=0;t<r.locationSize;t++)d(r.location+t,o.meshPerAttribute);!0!==n.isInstancedMesh&&void 0===s._maxInstanceCount&&(s._maxInstanceCount=o.meshPerAttribute*o.count)}else for(let t=0;t<r.locationSize;t++)u(r.location+t);t.bindBuffer(t.ARRAY_BUFFER,l);for(let t=0;t<r.locationSize;t++)f(r.location+t,a/r.locationSize,h,i,a*p,a/r.locationSize*t*p,A)}}else if(void 0!==c){const e=c[i];if(void 0!==e)switch(e.length){case 2:t.vertexAttrib2fv(r.location,e);break;case 3:t.vertexAttrib3fv(r.location,e);break;case 4:t.vertexAttrib4fv(r.location,e);break;default:t.vertexAttrib1fv(r.location,e)}}}}p()}(n,r,c,A),null!==g&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e.get(g).buffer))},reset:A,resetDefaultState:g,dispose:function(){A();for(const t in i){const e=i[t];for(const t in e){const n=e[t];for(const t in n)c(n[t].object),delete n[t];delete e[t]}delete i[t]}},releaseStatesOfGeometry:function(t){if(void 0===i[t.id])return;const e=i[t.id];for(const t in e){const n=e[t];for(const t in n)c(n[t].object),delete n[t];delete e[t]}delete i[t.id]},releaseStatesOfProgram:function(t){for(const e in i){const n=i[e];if(void 0===n[t.id])continue;const r=n[t.id];for(const t in r)c(r[t].object),delete r[t];delete n[t.id]}},initAttributes:h,enableAttribute:u,disableUnusedAttributes:p}}function Du(t,e,n){let i;function r(e,r,s){0!==s&&(t.drawArraysInstanced(i,e,r,s),n.update(r,i,s))}this.setMode=function(t){i=t},this.render=function(e,r){t.drawArrays(i,e,r),n.update(r,i,1)},this.renderInstances=r,this.renderMultiDraw=function(t,r,s){if(0===s)return;const a=e.get("WEBGL_multi_draw");if(null===a)for(let e=0;e<s;e++)this.render(t[e],r[e]);else{a.multiDrawArraysWEBGL(i,t,0,r,0,s);let e=0;for(let t=0;t<s;t++)e+=r[t];n.update(e,i,1)}},this.renderMultiDrawInstances=function(t,s,a,o){if(0===a)return;const c=e.get("WEBGL_multi_draw");if(null===c)for(let e=0;e<t.length;e++)r(t[e],s[e],o[e]);else{c.multiDrawArraysInstancedWEBGL(i,t,0,s,0,o,0,a);let e=0;for(let t=0;t<a;t++)e+=s[t];for(let t=0;t<o.length;t++)n.update(e,i,o[t])}}}function Lu(t,e,n,i){let r;function s(e){if("highp"===e){if(t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let a=void 0!==n.precision?n.precision:"highp";const o=s(a);o!==a&&(a=o);const c=!0===n.logarithmicDepthBuffer,l=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),h=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS);return{isWebGL2:!0,getMaxAnisotropy:function(){if(void 0!==r)return r;if(!0===e.has("EXT_texture_filter_anisotropic")){const n=e.get("EXT_texture_filter_anisotropic");r=t.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r},getMaxPrecision:s,textureFormatReadable:function(e){return e===Qa||i.convert(e)===t.getParameter(t.IMPLEMENTATION_COLOR_READ_FORMAT)},textureTypeReadable:function(n){const r=n===Oa&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(n!==Ra&&i.convert(n)!==t.getParameter(t.IMPLEMENTATION_COLOR_READ_TYPE)&&n!==ka&&!r)},precision:a,logarithmicDepthBuffer:c,maxTextures:l,maxVertexTextures:h,maxTextureSize:t.getParameter(t.MAX_TEXTURE_SIZE),maxCubemapSize:t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),maxAttributes:t.getParameter(t.MAX_VERTEX_ATTRIBS),maxVertexUniforms:t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),maxVaryings:t.getParameter(t.MAX_VARYING_VECTORS),maxFragmentUniforms:t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),vertexTextures:h>0,maxSamples:t.getParameter(t.MAX_SAMPLES)}}function Pu(t){const e=this;let n=null,i=0,r=!1,s=!1;const a=new mu,o=new gc,c={value:null,needsUpdate:!1};function l(t,n,i,r){const s=null!==t?t.length:0;let l=null;if(0!==s){if(l=c.value,!0!==r||null===l){const e=i+4*s,r=n.matrixWorldInverse;o.getNormalMatrix(r),(null===l||l.length<e)&&(l=new Float32Array(e));for(let e=0,n=i;e!==s;++e,n+=4)a.copy(t[e]).applyMatrix4(r,o),a.normal.toArray(l,n),l[n+3]=a.constant}c.value=l,c.needsUpdate=!0}return e.numPlanes=s,e.numIntersection=0,l}this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(t,e){const n=0!==t.length||e||0!==i||r;return r=e,i=t.length,n},this.beginShadows=function(){s=!0,l(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(t,e){n=l(t,e,0)},this.setState=function(a,o,h){const u=a.clippingPlanes,d=a.clipIntersection,p=a.clipShadows,f=t.get(a);if(!r||null===u||0===u.length||s&&!p)s?l(null):function(){c.value!==n&&(c.value=n,c.needsUpdate=i>0);e.numPlanes=i,e.numIntersection=0}();else{const t=s?0:i,e=4*t;let r=f.clippingState||null;c.value=r,r=l(u,o,e,h);for(let t=0;t!==e;++t)r[t]=n[t];f.clippingState=r,this.numIntersection=d?this.numPlanes:0,this.numPlanes+=t}}}function ku(t){let e=new WeakMap;function n(t,e){return e===va?t.mapping=ma:e===ya&&(t.mapping=_a),t}function i(t){const n=t.target;n.removeEventListener("dispose",i);const r=e.get(n);void 0!==r&&(e.delete(n),r.dispose())}return{get:function(r){if(r&&r.isTexture){const s=r.mapping;if(s===va||s===ya){if(e.has(r)){return n(e.get(r).texture,r.mapping)}{const s=r.image;if(s&&s.height>0){const a=new pu(s.height);return a.fromEquirectangularTexture(t,r),e.set(r,a),r.addEventListener("dispose",i),n(a.texture,r.mapping)}return null}}}return r},dispose:function(){e=new WeakMap}}}class Ou extends su{constructor(t=-1,e=1,n=1,i=-1,r=.1,s=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=n,this.bottom=i,this.near=r,this.far=s,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=null===t.view?null:Object.assign({},t.view),this}setViewOffset(t,e,n,i,r,s){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=s,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let r=n-t,s=n+t,a=i+e,o=i-e;if(null!==this.view&&this.view.enabled){const t=(this.right-this.left)/this.view.fullWidth/this.zoom,e=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=t*this.view.offsetX,s=r+t*this.view.width,a-=e*this.view.offsetY,o=a-e*this.view.height}this.projectionMatrix.makeOrthographic(r,s,a,o,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,null!==this.view&&(e.object.view=Object.assign({},this.view)),e}}const Uu=[.125,.215,.35,.446,.526,.582],Nu=20,Fu=new Ou,Qu=new hh;let zu=null,Gu=0,Hu=0,Vu=!1;const ju=(1+Math.sqrt(5))/2,Wu=1/ju,qu=[new jc(-ju,Wu,0),new jc(ju,Wu,0),new jc(-Wu,0,ju),new jc(Wu,0,ju),new jc(0,ju,-Wu),new jc(0,ju,Wu),new jc(-1,1,-1),new jc(1,1,-1),new jc(-1,1,1),new jc(1,1,1)];class Yu{constructor(t){this._renderer=t,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(t,e=0,n=.1,i=100){zu=this._renderer.getRenderTarget(),Gu=this._renderer.getActiveCubeFace(),Hu=this._renderer.getActiveMipmapLevel(),Vu=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const r=this._allocateTargets();return r.depthBuffer=!0,this._sceneToCubeUV(t,n,i,r),e>0&&this._blur(r,0,0,e),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(t,e=null){return this._fromTexture(t,e)}fromCubemap(t,e=null){return this._fromTexture(t,e)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=Zu(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=Ku(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose()}_setSize(t){this._lodMax=Math.floor(Math.log2(t)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let t=0;t<this._lodPlanes.length;t++)this._lodPlanes[t].dispose()}_cleanup(t){this._renderer.setRenderTarget(zu,Gu,Hu),this._renderer.xr.enabled=Vu,t.scissorTest=!1,Ju(t,0,0,t.width,t.height)}_fromTexture(t,e){t.mapping===ma||t.mapping===_a?this._setSize(0===t.image.length?16:t.image[0].width||t.image[0].image.width):this._setSize(t.image.width/4),zu=this._renderer.getRenderTarget(),Gu=this._renderer.getActiveCubeFace(),Hu=this._renderer.getActiveMipmapLevel(),Vu=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const n=e||this._allocateTargets();return this._textureToCubeUV(t,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){const t=3*Math.max(this._cubeSize,112),e=4*this._cubeSize,n={magFilter:Ia,minFilter:Ia,generateMipmaps:!1,type:Oa,format:Qa,colorSpace:Uo,depthBuffer:!1},i=Xu(t,e,n);if(null===this._pingPongRenderTarget||this._pingPongRenderTarget.width!==t||this._pingPongRenderTarget.height!==e){null!==this._pingPongRenderTarget&&this._dispose(),this._pingPongRenderTarget=Xu(t,e,n);const{_lodMax:i}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=function(t){const e=[],n=[],i=[];let r=t;const s=t-4+1+Uu.length;for(let a=0;a<s;a++){const s=Math.pow(2,r);n.push(s);let o=1/s;a>t-4?o=Uu[a-t+4-1]:0===a&&(o=0),i.push(o);const c=1/(s-2),l=-c,h=1+c,u=[l,l,h,l,h,h,l,l,h,h,l,h],d=6,p=6,f=3,A=2,g=1,m=new Float32Array(f*p*d),_=new Float32Array(A*p*d),v=new Float32Array(g*p*d);for(let t=0;t<d;t++){const e=t%3*2/3-1,n=t>2?0:-1,i=[e,n,0,e+2/3,n,0,e+2/3,n+1,0,e,n,0,e+2/3,n+1,0,e,n+1,0];m.set(i,f*p*t),_.set(u,A*p*t);const r=[t,t,t,t,t,t];v.set(r,g*p*t)}const y=new Lh;y.setAttribute("position",new xh(m,f)),y.setAttribute("uv",new xh(_,A)),y.setAttribute("faceIndex",new xh(v,g)),e.push(y),r>4&&r--}return{lodPlanes:e,sizeLods:n,sigmas:i}}(i)),this._blurMaterial=function(t,e,n){const i=new Float32Array(Nu),r=new jc(0,1,0),s=new ru({name:"SphericalGaussianBlur",defines:{n:Nu,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${t}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:$u(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include <cube_uv_reflection_fragment>\n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1});return s}(i,t,e)}return i}_compileMaterial(t){const e=new Kh(this._lodPlanes[0],t);this._renderer.compile(e,Fu)}_sceneToCubeUV(t,e,n,i){const r=new lu(90,1,e,n),s=[1,-1,1,1,1,1],a=[1,1,1,-1,-1,-1],o=this._renderer,c=o.autoClear,l=o.toneMapping;o.getClearColor(Qu),o.toneMapping=aa,o.autoClear=!1;const h=new fh({name:"PMREM.Background",side:Us,depthWrite:!1,depthTest:!1}),u=new Kh(new $h,h);let d=!1;const p=t.background;p?p.isColor&&(h.color.copy(p),t.background=null,d=!0):(h.color.copy(Qu),d=!0);for(let e=0;e<6;e++){const n=e%3;0===n?(r.up.set(0,s[e],0),r.lookAt(a[e],0,0)):1===n?(r.up.set(0,0,s[e]),r.lookAt(0,a[e],0)):(r.up.set(0,s[e],0),r.lookAt(0,0,a[e]));const c=this._cubeSize;Ju(i,n*c,e>2?c:0,c,c),o.setRenderTarget(i),d&&o.render(u,r),o.render(t,r)}u.geometry.dispose(),u.material.dispose(),o.toneMapping=l,o.autoClear=c,t.background=p}_textureToCubeUV(t,e){const n=this._renderer,i=t.mapping===ma||t.mapping===_a;i?(null===this._cubemapMaterial&&(this._cubemapMaterial=Zu()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===t.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=Ku());const r=i?this._cubemapMaterial:this._equirectMaterial,s=new Kh(this._lodPlanes[0],r);r.uniforms.envMap.value=t;const a=this._cubeSize;Ju(e,0,0,3*a,2*a),n.setRenderTarget(e),n.render(s,Fu)}_applyPMREM(t){const e=this._renderer,n=e.autoClear;e.autoClear=!1;const i=this._lodPlanes.length;for(let e=1;e<i;e++){const n=Math.sqrt(this._sigmas[e]*this._sigmas[e]-this._sigmas[e-1]*this._sigmas[e-1]),r=qu[(i-e-1)%qu.length];this._blur(t,e-1,e,n,r)}e.autoClear=n}_blur(t,e,n,i,r){const s=this._pingPongRenderTarget;this._halfBlur(t,s,e,n,i,"latitudinal",r),this._halfBlur(s,t,n,n,i,"longitudinal",r)}_halfBlur(t,e,n,i,r,s,a){const o=this._renderer,c=this._blurMaterial,l=new Kh(this._lodPlanes[i],c),h=c.uniforms,u=this._sizeLods[n]-1,d=isFinite(r)?Math.PI/(2*u):2*Math.PI/39,p=r/d,f=isFinite(r)?1+Math.floor(3*p):Nu,A=[];let g=0;for(let t=0;t<Nu;++t){const e=t/p,n=Math.exp(-e*e/2);A.push(n),0===t?g+=n:t<f&&(g+=2*n)}for(let t=0;t<A.length;t++)A[t]=A[t]/g;h.envMap.value=t.texture,h.samples.value=f,h.weights.value=A,h.latitudinal.value="latitudinal"===s,a&&(h.poleAxis.value=a);const{_lodMax:m}=this;h.dTheta.value=d,h.mipInt.value=m-n;const _=this._sizeLods[i];Ju(e,3*_*(i>m-4?i-m+4:0),4*(this._cubeSize-_),3*_,2*_),o.setRenderTarget(e),o.render(l,Fu)}}function Xu(t,e,n){const i=new zc(t,e,n);return i.texture.mapping=ba,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function Ju(t,e,n,i,r){t.viewport.set(e,n,i,r),t.scissor.set(e,n,i,r)}function Ku(){return new ru({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:$u(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\n\t\t\t#include <common>\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tgl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}function Zu(){return new ru({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:$u(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tuniform float flipEnvMap;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}function $u(){return"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t"}function td(t){let e=new WeakMap,n=null;function i(t){const n=t.target;n.removeEventListener("dispose",i);const r=e.get(n);void 0!==r&&(e.delete(n),r.dispose())}return{get:function(r){if(r&&r.isTexture){const s=r.mapping,a=s===va||s===ya,o=s===ma||s===_a;if(a||o){let s=e.get(r);const c=void 0!==s?s.texture.pmremVersion:0;if(r.isRenderTargetTexture&&r.pmremVersion!==c)return null===n&&(n=new Yu(t)),s=a?n.fromEquirectangular(r,s):n.fromCubemap(r,s),s.texture.pmremVersion=r.pmremVersion,e.set(r,s),s.texture;if(void 0!==s)return s.texture;{const c=r.image;return a&&c&&c.height>0||o&&c&&function(t){let e=0;const n=6;for(let i=0;i<n;i++)void 0!==t[i]&&e++;return e===n}(c)?(null===n&&(n=new Yu(t)),s=a?n.fromEquirectangular(r):n.fromCubemap(r),s.texture.pmremVersion=r.pmremVersion,e.set(r,s),r.addEventListener("dispose",i),s.texture):null}}}return r},dispose:function(){e=new WeakMap,null!==n&&(n.dispose(),n=null)}}}function ed(t){const e={};function n(n){if(void 0!==e[n])return e[n];let i;switch(n){case"WEBGL_depth_texture":i=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=t.getExtension(n)}return e[n]=i,i}return{has:function(t){return null!==n(t)},init:function(){n("EXT_color_buffer_float"),n("WEBGL_clip_cull_distance"),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float"),n("WEBGL_multisampled_render_to_texture"),n("WEBGL_render_shared_exponent")},get:function(t){const e=n(t);return null===e&&Ec("THREE.WebGLRenderer: "+t+" extension not supported."),e}}}function nd(t,e,n,i){const r={},s=new WeakMap;function a(t){const o=t.target;null!==o.index&&e.remove(o.index);for(const t in o.attributes)e.remove(o.attributes[t]);for(const t in o.morphAttributes){const n=o.morphAttributes[t];for(let t=0,i=n.length;t<i;t++)e.remove(n[t])}o.removeEventListener("dispose",a),delete r[o.id];const c=s.get(o);c&&(e.remove(c),s.delete(o)),i.releaseStatesOfGeometry(o),!0===o.isInstancedBufferGeometry&&delete o._maxInstanceCount,n.memory.geometries--}function o(t){const n=[],i=t.index,r=t.attributes.position;let a=0;if(null!==i){const t=i.array;a=i.version;for(let e=0,i=t.length;e<i;e+=3){const i=t[e+0],r=t[e+1],s=t[e+2];n.push(i,r,r,s,s,i)}}else{if(void 0===r)return;{const t=r.array;a=r.version;for(let e=0,i=t.length/3-1;e<i;e+=3){const t=e+0,i=e+1,r=e+2;n.push(t,i,i,r,r,t)}}}const o=new(_c(n)?Eh:wh)(n,1);o.version=a;const c=s.get(t);c&&e.remove(c),s.set(t,o)}return{get:function(t,e){return!0===r[e.id]||(e.addEventListener("dispose",a),r[e.id]=!0,n.memory.geometries++),e},update:function(n){const i=n.attributes;for(const n in i)e.update(i[n],t.ARRAY_BUFFER);const r=n.morphAttributes;for(const n in r){const i=r[n];for(let n=0,r=i.length;n<r;n++)e.update(i[n],t.ARRAY_BUFFER)}},getWireframeAttribute:function(t){const e=s.get(t);if(e){const n=t.index;null!==n&&e.version<n.version&&o(t)}else o(t);return s.get(t)}}}function id(t,e,n){let i,r,s;function a(e,a,o){0!==o&&(t.drawElementsInstanced(i,a,r,e*s,o),n.update(a,i,o))}this.setMode=function(t){i=t},this.setIndex=function(t){r=t.type,s=t.bytesPerElement},this.render=function(e,a){t.drawElements(i,a,r,e*s),n.update(a,i,1)},this.renderInstances=a,this.renderMultiDraw=function(t,a,o){if(0===o)return;const c=e.get("WEBGL_multi_draw");if(null===c)for(let e=0;e<o;e++)this.render(t[e]/s,a[e]);else{c.multiDrawElementsWEBGL(i,a,0,r,t,0,o);let e=0;for(let t=0;t<o;t++)e+=a[t];n.update(e,i,1)}},this.renderMultiDrawInstances=function(t,o,c,l){if(0===c)return;const h=e.get("WEBGL_multi_draw");if(null===h)for(let e=0;e<t.length;e++)a(t[e]/s,o[e],l[e]);else{h.multiDrawElementsInstancedWEBGL(i,o,0,r,t,0,l,0,c);let e=0;for(let t=0;t<c;t++)e+=o[t];for(let t=0;t<l.length;t++)n.update(e,i,l[t])}}}function rd(t){const e={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:e,programs:null,autoReset:!0,reset:function(){e.calls=0,e.triangles=0,e.points=0,e.lines=0},update:function(n,i,r){switch(e.calls++,i){case t.TRIANGLES:e.triangles+=r*(n/3);break;case t.LINES:e.lines+=r*(n/2);break;case t.LINE_STRIP:e.lines+=r*(n-1);break;case t.LINE_LOOP:e.lines+=r*n;break;case t.POINTS:e.points+=r*n}}}}function sd(t,e,n){const i=new WeakMap,r=new Fc;return{update:function(s,a,o){const c=s.morphTargetInfluences,l=a.morphAttributes.position||a.morphAttributes.normal||a.morphAttributes.color,h=void 0!==l?l.length:0;let u=i.get(a);if(void 0===u||u.count!==h){void 0!==u&&u.texture.dispose();const d=void 0!==a.morphAttributes.position,p=void 0!==a.morphAttributes.normal,f=void 0!==a.morphAttributes.color,A=a.morphAttributes.position||[],g=a.morphAttributes.normal||[],m=a.morphAttributes.color||[];let _=0;!0===d&&(_=1),!0===p&&(_=2),!0===f&&(_=3);let v=a.attributes.position.count*_,y=1;v>e.maxTextureSize&&(y=Math.ceil(v/e.maxTextureSize),v=e.maxTextureSize);const b=new Float32Array(v*y*4*h),x=new Gc(b,v,y,h);x.type=ka,x.needsUpdate=!0;const w=4*_;for(let C=0;C<h;C++){const S=A[C],M=g[C],I=m[C],T=v*y*4*C;for(let B=0;B<S.count;B++){const R=B*w;!0===d&&(r.fromBufferAttribute(S,B),b[T+R+0]=r.x,b[T+R+1]=r.y,b[T+R+2]=r.z,b[T+R+3]=0),!0===p&&(r.fromBufferAttribute(M,B),b[T+R+4]=r.x,b[T+R+5]=r.y,b[T+R+6]=r.z,b[T+R+7]=0),!0===f&&(r.fromBufferAttribute(I,B),b[T+R+8]=r.x,b[T+R+9]=r.y,b[T+R+10]=r.z,b[T+R+11]=4===I.itemSize?r.w:1)}}function E(){x.dispose(),i.delete(a),a.removeEventListener("dispose",E)}u={count:h,texture:x,size:new Ac(v,y)},i.set(a,u),a.addEventListener("dispose",E)}if(!0===s.isInstancedMesh&&null!==s.morphTexture)o.getUniforms().setValue(t,"morphTexture",s.morphTexture,n);else{let D=0;for(let P=0;P<c.length;P++)D+=c[P];const L=a.morphTargetsRelative?1:1-D;o.getUniforms().setValue(t,"morphTargetBaseInfluence",L),o.getUniforms().setValue(t,"morphTargetInfluences",c)}o.getUniforms().setValue(t,"morphTargetsTexture",u.texture,n),o.getUniforms().setValue(t,"morphTargetsTextureSize",u.size)}}}function ad(t,e,n,i){let r=new WeakMap;function s(t){const e=t.target;e.removeEventListener("dispose",s),n.remove(e.instanceMatrix),null!==e.instanceColor&&n.remove(e.instanceColor)}return{update:function(a){const o=i.render.frame,c=a.geometry,l=e.get(a,c);if(r.get(l)!==o&&(e.update(l),r.set(l,o)),a.isInstancedMesh&&(!1===a.hasEventListener("dispose",s)&&a.addEventListener("dispose",s),r.get(a)!==o&&(n.update(a.instanceMatrix,t.ARRAY_BUFFER),null!==a.instanceColor&&n.update(a.instanceColor,t.ARRAY_BUFFER),r.set(a,o))),a.isSkinnedMesh){const t=a.skeleton;r.get(t)!==o&&(t.update(),r.set(t,o))}return l},dispose:function(){r=new WeakMap}}}class od extends Nc{constructor(t,e,n,i,r,s,a,o,c,l=1026){if(l!==za&&l!==Ga)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&l===za&&(n=Pa),void 0===n&&l===Ga&&(n=Fa),super(null,i,r,s,a,o,l,n,c),this.isDepthTexture=!0,this.image={width:t,height:e},this.magFilter=void 0!==a?a:Ca,this.minFilter=void 0!==o?o:Ca,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(t){return super.copy(t),this.compareFunction=t.compareFunction,this}toJSON(t){const e=super.toJSON(t);return null!==this.compareFunction&&(e.compareFunction=this.compareFunction),e}}const cd=new Nc,ld=new od(1,1);ld.compareFunction=515;const hd=new Gc,ud=new Hc,dd=new du,pd=[],fd=[],Ad=new Float32Array(16),gd=new Float32Array(9),md=new Float32Array(4);function _d(t,e,n){const i=t[0];if(i<=0||i>0)return t;const r=e*n;let s=pd[r];if(void 0===s&&(s=new Float32Array(r),pd[r]=s),0!==e){i.toArray(s,0);for(let i=1,r=0;i!==e;++i)r+=n,t[i].toArray(s,r)}return s}function vd(t,e){if(t.length!==e.length)return!1;for(let n=0,i=t.length;n<i;n++)if(t[n]!==e[n])return!1;return!0}function yd(t,e){for(let n=0,i=e.length;n<i;n++)t[n]=e[n]}function bd(t,e){let n=fd[e];void 0===n&&(n=new Int32Array(e),fd[e]=n);for(let i=0;i!==e;++i)n[i]=t.allocateTextureUnit();return n}function xd(t,e){const n=this.cache;n[0]!==e&&(t.uniform1f(this.addr,e),n[0]=e)}function wd(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y||(t.uniform2f(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(vd(n,e))return;t.uniform2fv(this.addr,e),yd(n,e)}}function Ed(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z||(t.uniform3f(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else if(void 0!==e.r)n[0]===e.r&&n[1]===e.g&&n[2]===e.b||(t.uniform3f(this.addr,e.r,e.g,e.b),n[0]=e.r,n[1]=e.g,n[2]=e.b);else{if(vd(n,e))return;t.uniform3fv(this.addr,e),yd(n,e)}}function Cd(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z&&n[3]===e.w||(t.uniform4f(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(vd(n,e))return;t.uniform4fv(this.addr,e),yd(n,e)}}function Sd(t,e){const n=this.cache,i=e.elements;if(void 0===i){if(vd(n,e))return;t.uniformMatrix2fv(this.addr,!1,e),yd(n,e)}else{if(vd(n,i))return;md.set(i),t.uniformMatrix2fv(this.addr,!1,md),yd(n,i)}}function Md(t,e){const n=this.cache,i=e.elements;if(void 0===i){if(vd(n,e))return;t.uniformMatrix3fv(this.addr,!1,e),yd(n,e)}else{if(vd(n,i))return;gd.set(i),t.uniformMatrix3fv(this.addr,!1,gd),yd(n,i)}}function Id(t,e){const n=this.cache,i=e.elements;if(void 0===i){if(vd(n,e))return;t.uniformMatrix4fv(this.addr,!1,e),yd(n,e)}else{if(vd(n,i))return;Ad.set(i),t.uniformMatrix4fv(this.addr,!1,Ad),yd(n,i)}}function Td(t,e){const n=this.cache;n[0]!==e&&(t.uniform1i(this.addr,e),n[0]=e)}function Bd(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y||(t.uniform2i(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(vd(n,e))return;t.uniform2iv(this.addr,e),yd(n,e)}}function Rd(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z||(t.uniform3i(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else{if(vd(n,e))return;t.uniform3iv(this.addr,e),yd(n,e)}}function Dd(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z&&n[3]===e.w||(t.uniform4i(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(vd(n,e))return;t.uniform4iv(this.addr,e),yd(n,e)}}function Ld(t,e){const n=this.cache;n[0]!==e&&(t.uniform1ui(this.addr,e),n[0]=e)}function Pd(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y||(t.uniform2ui(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(vd(n,e))return;t.uniform2uiv(this.addr,e),yd(n,e)}}function kd(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z||(t.uniform3ui(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else{if(vd(n,e))return;t.uniform3uiv(this.addr,e),yd(n,e)}}function Od(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z&&n[3]===e.w||(t.uniform4ui(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(vd(n,e))return;t.uniform4uiv(this.addr,e),yd(n,e)}}function Ud(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r);const s=this.type===t.SAMPLER_2D_SHADOW?ld:cd;n.setTexture2D(e||s,r)}function Nd(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.setTexture3D(e||ud,r)}function Fd(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.setTextureCube(e||dd,r)}function Qd(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.setTexture2DArray(e||hd,r)}function zd(t,e){t.uniform1fv(this.addr,e)}function Gd(t,e){const n=_d(e,this.size,2);t.uniform2fv(this.addr,n)}function Hd(t,e){const n=_d(e,this.size,3);t.uniform3fv(this.addr,n)}function Vd(t,e){const n=_d(e,this.size,4);t.uniform4fv(this.addr,n)}function jd(t,e){const n=_d(e,this.size,4);t.uniformMatrix2fv(this.addr,!1,n)}function Wd(t,e){const n=_d(e,this.size,9);t.uniformMatrix3fv(this.addr,!1,n)}function qd(t,e){const n=_d(e,this.size,16);t.uniformMatrix4fv(this.addr,!1,n)}function Yd(t,e){t.uniform1iv(this.addr,e)}function Xd(t,e){t.uniform2iv(this.addr,e)}function Jd(t,e){t.uniform3iv(this.addr,e)}function Kd(t,e){t.uniform4iv(this.addr,e)}function Zd(t,e){t.uniform1uiv(this.addr,e)}function $d(t,e){t.uniform2uiv(this.addr,e)}function tp(t,e){t.uniform3uiv(this.addr,e)}function ep(t,e){t.uniform4uiv(this.addr,e)}function np(t,e,n){const i=this.cache,r=e.length,s=bd(n,r);vd(i,s)||(t.uniform1iv(this.addr,s),yd(i,s));for(let t=0;t!==r;++t)n.setTexture2D(e[t]||cd,s[t])}function ip(t,e,n){const i=this.cache,r=e.length,s=bd(n,r);vd(i,s)||(t.uniform1iv(this.addr,s),yd(i,s));for(let t=0;t!==r;++t)n.setTexture3D(e[t]||ud,s[t])}function rp(t,e,n){const i=this.cache,r=e.length,s=bd(n,r);vd(i,s)||(t.uniform1iv(this.addr,s),yd(i,s));for(let t=0;t!==r;++t)n.setTextureCube(e[t]||dd,s[t])}function sp(t,e,n){const i=this.cache,r=e.length,s=bd(n,r);vd(i,s)||(t.uniform1iv(this.addr,s),yd(i,s));for(let t=0;t!==r;++t)n.setTexture2DArray(e[t]||hd,s[t])}class ap{constructor(t,e,n){this.id=t,this.addr=n,this.cache=[],this.type=e.type,this.setValue=function(t){switch(t){case 5126:return xd;case 35664:return wd;case 35665:return Ed;case 35666:return Cd;case 35674:return Sd;case 35675:return Md;case 35676:return Id;case 5124:case 35670:return Td;case 35667:case 35671:return Bd;case 35668:case 35672:return Rd;case 35669:case 35673:return Dd;case 5125:return Ld;case 36294:return Pd;case 36295:return kd;case 36296:return Od;case 35678:case 36198:case 36298:case 36306:case 35682:return Ud;case 35679:case 36299:case 36307:return Nd;case 35680:case 36300:case 36308:case 36293:return Fd;case 36289:case 36303:case 36311:case 36292:return Qd}}(e.type)}}class op{constructor(t,e,n){this.id=t,this.addr=n,this.cache=[],this.type=e.type,this.size=e.size,this.setValue=function(t){switch(t){case 5126:return zd;case 35664:return Gd;case 35665:return Hd;case 35666:return Vd;case 35674:return jd;case 35675:return Wd;case 35676:return qd;case 5124:case 35670:return Yd;case 35667:case 35671:return Xd;case 35668:case 35672:return Jd;case 35669:case 35673:return Kd;case 5125:return Zd;case 36294:return $d;case 36295:return tp;case 36296:return ep;case 35678:case 36198:case 36298:case 36306:case 35682:return np;case 35679:case 36299:case 36307:return ip;case 35680:case 36300:case 36308:case 36293:return rp;case 36289:case 36303:case 36311:case 36292:return sp}}(e.type)}}class cp{constructor(t){this.id=t,this.seq=[],this.map={}}setValue(t,e,n){const i=this.seq;for(let r=0,s=i.length;r!==s;++r){const s=i[r];s.setValue(t,e[s.id],n)}}}const lp=/(\w+)(\])?(\[|\.)?/g;function hp(t,e){t.seq.push(e),t.map[e.id]=e}function up(t,e,n){const i=t.name,r=i.length;for(lp.lastIndex=0;;){const s=lp.exec(i),a=lp.lastIndex;let o=s[1];const c="]"===s[2],l=s[3];if(c&&(o|=0),void 0===l||"["===l&&a+2===r){hp(n,void 0===l?new ap(o,t,e):new op(o,t,e));break}{let t=n.map[o];void 0===t&&(t=new cp(o),hp(n,t)),n=t}}}class dp{constructor(t,e){this.seq=[],this.map={};const n=t.getProgramParameter(e,t.ACTIVE_UNIFORMS);for(let i=0;i<n;++i){const n=t.getActiveUniform(e,i);up(n,t.getUniformLocation(e,n.name),this)}}setValue(t,e,n,i){const r=this.map[e];void 0!==r&&r.setValue(t,n,i)}setOptional(t,e,n){const i=e[n];void 0!==i&&this.setValue(t,n,i)}static upload(t,e,n,i){for(let r=0,s=e.length;r!==s;++r){const s=e[r],a=n[s.id];!1!==a.needsUpdate&&s.setValue(t,a.value,i)}}static seqWithValue(t,e){const n=[];for(let i=0,r=t.length;i!==r;++i){const r=t[i];r.id in e&&n.push(r)}return n}}function pp(t,e,n){const i=t.createShader(e);return t.shaderSource(i,n),t.compileShader(i),i}const fp=37297;let Ap=0;function gp(t,e,n){const i=t.getShaderParameter(e,t.COMPILE_STATUS),r=t.getShaderInfoLog(e).trim();if(i&&""===r)return"";const s=/ERROR: 0:(\d+)/.exec(r);if(s){const i=parseInt(s[1]);return n.toUpperCase()+"\n\n"+r+"\n\n"+function(t,e){const n=t.split("\n"),i=[],r=Math.max(e-6,0),s=Math.min(e+6,n.length);for(let t=r;t<s;t++){const r=t+1;i.push(`${r===e?">":" "} ${r}: ${n[t]}`)}return i.join("\n")}(t.getShaderSource(e),i)}return r}function mp(t,e){const n=function(t){const e=Tc.getPrimaries(Tc.workingColorSpace),n=Tc.getPrimaries(t);let i;switch(e===n?i="":e===Ho&&n===Go?i="LinearDisplayP3ToLinearSRGB":e===Go&&n===Ho&&(i="LinearSRGBToLinearDisplayP3"),t){case Uo:case Fo:return[i,"LinearTransferOETF"];case Oo:case No:return[i,"sRGBTransferOETF"];default:return[i,"LinearTransferOETF"]}}(e);return`vec4 ${t}( vec4 value ) { return ${n[0]}( ${n[1]}( value ) ); }`}function _p(t,e){let n;switch(e){case oa:n="Linear";break;case ca:n="Reinhard";break;case la:n="OptimizedCineon";break;case ha:n="ACESFilmic";break;case da:n="AgX";break;case pa:n="Neutral";break;case ua:n="Custom";break;default:n="Linear"}return"vec3 "+t+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}function vp(t){return""!==t}function yp(t,e){const n=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return t.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,n).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function bp(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const xp=/^[ \t]*#include +<([\w\d./]+)>/gm;function wp(t){return t.replace(xp,Cp)}const Ep=new Map;function Cp(t,e){let n=Eu[e];if(void 0===n){const t=Ep.get(e);if(void 0===t)throw new Error("Can not resolve #include <"+e+">");n=Eu[t]}return wp(n)}const Sp=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function Mp(t){return t.replace(Sp,Ip)}function Ip(t,e,n,i){let r="";for(let t=parseInt(e);t<parseInt(n);t++)r+=i.replace(/\[\s*i\s*\]/g,"[ "+t+" ]").replace(/UNROLLED_LOOP_INDEX/g,t);return r}function Tp(t){let e=`precision ${t.precision} float;\n\tprecision ${t.precision} int;\n\tprecision ${t.precision} sampler2D;\n\tprecision ${t.precision} samplerCube;\n\tprecision ${t.precision} sampler3D;\n\tprecision ${t.precision} sampler2DArray;\n\tprecision ${t.precision} sampler2DShadow;\n\tprecision ${t.precision} samplerCubeShadow;\n\tprecision ${t.precision} sampler2DArrayShadow;\n\tprecision ${t.precision} isampler2D;\n\tprecision ${t.precision} isampler3D;\n\tprecision ${t.precision} isamplerCube;\n\tprecision ${t.precision} isampler2DArray;\n\tprecision ${t.precision} usampler2D;\n\tprecision ${t.precision} usampler3D;\n\tprecision ${t.precision} usamplerCube;\n\tprecision ${t.precision} usampler2DArray;\n\t`;return"highp"===t.precision?e+="\n#define HIGH_PRECISION":"mediump"===t.precision?e+="\n#define MEDIUM_PRECISION":"lowp"===t.precision&&(e+="\n#define LOW_PRECISION"),e}function Bp(t,e,n,i){const r=t.getContext(),s=n.defines;let a=n.vertexShader,o=n.fragmentShader;const c=function(t){let e="SHADOWMAP_TYPE_BASIC";return t.shadowMapType===Ls?e="SHADOWMAP_TYPE_PCF":t.shadowMapType===Ps?e="SHADOWMAP_TYPE_PCF_SOFT":t.shadowMapType===ks&&(e="SHADOWMAP_TYPE_VSM"),e}(n),l=function(t){let e="ENVMAP_TYPE_CUBE";if(t.envMap)switch(t.envMapMode){case ma:case _a:e="ENVMAP_TYPE_CUBE";break;case ba:e="ENVMAP_TYPE_CUBE_UV"}return e}(n),h=function(t){let e="ENVMAP_MODE_REFLECTION";t.envMap&&t.envMapMode===_a&&(e="ENVMAP_MODE_REFRACTION");return e}(n),u=function(t){let e="ENVMAP_BLENDING_NONE";if(t.envMap)switch(t.combine){case ia:e="ENVMAP_BLENDING_MULTIPLY";break;case ra:e="ENVMAP_BLENDING_MIX";break;case sa:e="ENVMAP_BLENDING_ADD"}return e}(n),d=function(t){const e=t.envMapCubeUVHeight;if(null===e)return null;const n=Math.log2(e)-2,i=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,n),112)),texelHeight:i,maxMip:n}}(n),p=function(t){return[t.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",t.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(vp).join("\n")}(n),f=function(t){const e=[];for(const n in t){const i=t[n];!1!==i&&e.push("#define "+n+" "+i)}return e.join("\n")}(s),A=r.createProgram();let g,m,_=n.glslVersion?"#version "+n.glslVersion+"\n":"";n.isRawShaderMaterial?(g=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,f].filter(vp).join("\n"),g.length>0&&(g+="\n"),m=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,f].filter(vp).join("\n"),m.length>0&&(m+="\n")):(g=[Tp(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,f,n.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",n.batching?"#define USE_BATCHING":"",n.batchingColor?"#define USE_BATCHING_COLOR":"",n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.instancingMorph?"#define USE_INSTANCING_MORPH":"",n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+h:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.displacementMap?"#define USE_DISPLACEMENTMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.mapUv?"#define MAP_UV "+n.mapUv:"",n.alphaMapUv?"#define ALPHAMAP_UV "+n.alphaMapUv:"",n.lightMapUv?"#define LIGHTMAP_UV "+n.lightMapUv:"",n.aoMapUv?"#define AOMAP_UV "+n.aoMapUv:"",n.emissiveMapUv?"#define EMISSIVEMAP_UV "+n.emissiveMapUv:"",n.bumpMapUv?"#define BUMPMAP_UV "+n.bumpMapUv:"",n.normalMapUv?"#define NORMALMAP_UV "+n.normalMapUv:"",n.displacementMapUv?"#define DISPLACEMENTMAP_UV "+n.displacementMapUv:"",n.metalnessMapUv?"#define METALNESSMAP_UV "+n.metalnessMapUv:"",n.roughnessMapUv?"#define ROUGHNESSMAP_UV "+n.roughnessMapUv:"",n.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+n.anisotropyMapUv:"",n.clearcoatMapUv?"#define CLEARCOATMAP_UV "+n.clearcoatMapUv:"",n.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+n.clearcoatNormalMapUv:"",n.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+n.clearcoatRoughnessMapUv:"",n.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+n.iridescenceMapUv:"",n.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+n.iridescenceThicknessMapUv:"",n.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+n.sheenColorMapUv:"",n.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+n.sheenRoughnessMapUv:"",n.specularMapUv?"#define SPECULARMAP_UV "+n.specularMapUv:"",n.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+n.specularColorMapUv:"",n.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+n.specularIntensityMapUv:"",n.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+n.transmissionMapUv:"",n.thicknessMapUv?"#define THICKNESSMAP_UV "+n.thicknessMapUv:"",n.vertexTangents&&!1===n.flatShading?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.morphColors?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+c:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH","\tuniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1","\tattribute vec2 uv1;","#endif","#ifdef USE_UV2","\tattribute vec2 uv2;","#endif","#ifdef USE_UV3","\tattribute vec2 uv3;","#endif","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(vp).join("\n"),m=[Tp(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,f,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+l:"",n.envMap?"#define "+h:"",n.envMap?"#define "+u:"",d?"#define CUBEUV_TEXEL_WIDTH "+d.texelWidth:"",d?"#define CUBEUV_TEXEL_HEIGHT "+d.texelHeight:"",d?"#define CUBEUV_MAX_MIP "+d.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.dispersion?"#define USE_DISPERSION":"",n.iridescence?"#define USE_IRIDESCENCE":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents&&!1===n.flatShading?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor||n.batchingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+c:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==aa?"#define TONE_MAPPING":"",n.toneMapping!==aa?Eu.tonemapping_pars_fragment:"",n.toneMapping!==aa?_p("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",Eu.colorspace_pars_fragment,mp("linearToOutputTexel",n.outputColorSpace),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(vp).join("\n")),a=wp(a),a=yp(a,n),a=bp(a,n),o=wp(o),o=yp(o,n),o=bp(o,n),a=Mp(a),o=Mp(o),!0!==n.isRawShaderMaterial&&(_="#version 300 es\n",g=[p,"#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+g,m=["#define varying in",n.glslVersion===tc?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===tc?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+m);const v=_+g+a,y=_+m+o,b=pp(r,r.VERTEX_SHADER,v),x=pp(r,r.FRAGMENT_SHADER,y);function w(e){if(t.debug.checkShaderErrors){const n=r.getProgramInfoLog(A).trim(),i=r.getShaderInfoLog(b).trim(),s=r.getShaderInfoLog(x).trim();let a=!0,o=!0;if(!1===r.getProgramParameter(A,r.LINK_STATUS))if(a=!1,"function"==typeof t.debug.onShaderError)t.debug.onShaderError(r,A,b,x);else{gp(r,b,"vertex"),gp(r,x,"fragment")}else""!==n||""!==i&&""!==s||(o=!1);o&&(e.diagnostics={runnable:a,programLog:n,vertexShader:{log:i,prefix:g},fragmentShader:{log:s,prefix:m}})}r.deleteShader(b),r.deleteShader(x),E=new dp(r,A),C=function(t,e){const n={},i=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES);for(let r=0;r<i;r++){const i=t.getActiveAttrib(e,r),s=i.name;let a=1;i.type===t.FLOAT_MAT2&&(a=2),i.type===t.FLOAT_MAT3&&(a=3),i.type===t.FLOAT_MAT4&&(a=4),n[s]={type:i.type,location:t.getAttribLocation(e,s),locationSize:a}}return n}(r,A)}let E,C;r.attachShader(A,b),r.attachShader(A,x),void 0!==n.index0AttributeName?r.bindAttribLocation(A,0,n.index0AttributeName):!0===n.morphTargets&&r.bindAttribLocation(A,0,"position"),r.linkProgram(A),this.getUniforms=function(){return void 0===E&&w(this),E},this.getAttributes=function(){return void 0===C&&w(this),C};let S=!1===n.rendererExtensionParallelShaderCompile;return this.isReady=function(){return!1===S&&(S=r.getProgramParameter(A,fp)),S},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(A),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=Ap++,this.cacheKey=e,this.usedTimes=1,this.program=A,this.vertexShader=b,this.fragmentShader=x,this}let Rp=0;class Dp{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(t){const e=t.vertexShader,n=t.fragmentShader,i=this._getShaderStage(e),r=this._getShaderStage(n),s=this._getShaderCacheForMaterial(t);return!1===s.has(i)&&(s.add(i),i.usedTimes++),!1===s.has(r)&&(s.add(r),r.usedTimes++),this}remove(t){const e=this.materialCache.get(t);for(const t of e)t.usedTimes--,0===t.usedTimes&&this.shaderCache.delete(t.code);return this.materialCache.delete(t),this}getVertexShaderID(t){return this._getShaderStage(t.vertexShader).id}getFragmentShaderID(t){return this._getShaderStage(t.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(t){const e=this.materialCache;let n=e.get(t);return void 0===n&&(n=new Set,e.set(t,n)),n}_getShaderStage(t){const e=this.shaderCache;let n=e.get(t);return void 0===n&&(n=new Lp(t),e.set(t,n)),n}}class Lp{constructor(t){this.id=Rp++,this.code=t,this.usedTimes=0}}function Pp(t,e,n,i,r,s,a){const o=new Dl,c=new Dp,l=new Set,h=[],u=r.logarithmicDepthBuffer,d=r.vertexTextures;let p=r.precision;const f={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function A(t){return l.add(t),0===t?"uv":`uv${t}`}return{getParameters:function(s,o,h,g,m){const _=g.fog,v=m.geometry,y=s.isMeshStandardMaterial?g.environment:null,b=(s.isMeshStandardMaterial?n:e).get(s.envMap||y),x=b&&b.mapping===ba?b.image.height:null,w=f[s.type];null!==s.precision&&(p=r.getMaxPrecision(s.precision),s.precision);const E=v.morphAttributes.position||v.morphAttributes.normal||v.morphAttributes.color,C=void 0!==E?E.length:0;let S,M,I,T,B=0;if(void 0!==v.morphAttributes.position&&(B=1),void 0!==v.morphAttributes.normal&&(B=2),void 0!==v.morphAttributes.color&&(B=3),w){const t=Su[w];S=t.vertexShader,M=t.fragmentShader}else S=s.vertexShader,M=s.fragmentShader,c.update(s),I=c.getVertexShaderID(s),T=c.getFragmentShaderID(s);const R=t.getRenderTarget(),D=!0===m.isInstancedMesh,L=!0===m.isBatchedMesh,P=!!s.map,k=!!s.matcap,O=!!b,U=!!s.aoMap,N=!!s.lightMap,F=!!s.bumpMap,Q=!!s.normalMap,z=!!s.displacementMap,G=!!s.emissiveMap,H=!!s.metalnessMap,V=!!s.roughnessMap,j=s.anisotropy>0,W=s.clearcoat>0,q=s.dispersion>0,Y=s.iridescence>0,X=s.sheen>0,J=s.transmission>0,K=j&&!!s.anisotropyMap,Z=W&&!!s.clearcoatMap,$=W&&!!s.clearcoatNormalMap,tt=W&&!!s.clearcoatRoughnessMap,et=Y&&!!s.iridescenceMap,nt=Y&&!!s.iridescenceThicknessMap,it=X&&!!s.sheenColorMap,rt=X&&!!s.sheenRoughnessMap,st=!!s.specularMap,at=!!s.specularColorMap,ot=!!s.specularIntensityMap,ct=J&&!!s.transmissionMap,lt=J&&!!s.thicknessMap,ht=!!s.gradientMap,ut=!!s.alphaMap,dt=s.alphaTest>0,pt=!!s.alphaHash,ft=!!s.extensions;let At=aa;s.toneMapped&&(null!==R&&!0!==R.isXRRenderTarget||(At=t.toneMapping));const gt={shaderID:w,shaderType:s.type,shaderName:s.name,vertexShader:S,fragmentShader:M,defines:s.defines,customVertexShaderID:I,customFragmentShaderID:T,isRawShaderMaterial:!0===s.isRawShaderMaterial,glslVersion:s.glslVersion,precision:p,batching:L,batchingColor:L&&null!==m._colorsTexture,instancing:D,instancingColor:D&&null!==m.instanceColor,instancingMorph:D&&null!==m.morphTexture,supportsVertexTextures:d,outputColorSpace:null===R?t.outputColorSpace:!0===R.isXRRenderTarget?R.texture.colorSpace:Uo,alphaToCoverage:!!s.alphaToCoverage,map:P,matcap:k,envMap:O,envMapMode:O&&b.mapping,envMapCubeUVHeight:x,aoMap:U,lightMap:N,bumpMap:F,normalMap:Q,displacementMap:d&&z,emissiveMap:G,normalMapObjectSpace:Q&&1===s.normalMapType,normalMapTangentSpace:Q&&0===s.normalMapType,metalnessMap:H,roughnessMap:V,anisotropy:j,anisotropyMap:K,clearcoat:W,clearcoatMap:Z,clearcoatNormalMap:$,clearcoatRoughnessMap:tt,dispersion:q,iridescence:Y,iridescenceMap:et,iridescenceThicknessMap:nt,sheen:X,sheenColorMap:it,sheenRoughnessMap:rt,specularMap:st,specularColorMap:at,specularIntensityMap:ot,transmission:J,transmissionMap:ct,thicknessMap:lt,gradientMap:ht,opaque:!1===s.transparent&&1===s.blending&&!1===s.alphaToCoverage,alphaMap:ut,alphaTest:dt,alphaHash:pt,combine:s.combine,mapUv:P&&A(s.map.channel),aoMapUv:U&&A(s.aoMap.channel),lightMapUv:N&&A(s.lightMap.channel),bumpMapUv:F&&A(s.bumpMap.channel),normalMapUv:Q&&A(s.normalMap.channel),displacementMapUv:z&&A(s.displacementMap.channel),emissiveMapUv:G&&A(s.emissiveMap.channel),metalnessMapUv:H&&A(s.metalnessMap.channel),roughnessMapUv:V&&A(s.roughnessMap.channel),anisotropyMapUv:K&&A(s.anisotropyMap.channel),clearcoatMapUv:Z&&A(s.clearcoatMap.channel),clearcoatNormalMapUv:$&&A(s.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:tt&&A(s.clearcoatRoughnessMap.channel),iridescenceMapUv:et&&A(s.iridescenceMap.channel),iridescenceThicknessMapUv:nt&&A(s.iridescenceThicknessMap.channel),sheenColorMapUv:it&&A(s.sheenColorMap.channel),sheenRoughnessMapUv:rt&&A(s.sheenRoughnessMap.channel),specularMapUv:st&&A(s.specularMap.channel),specularColorMapUv:at&&A(s.specularColorMap.channel),specularIntensityMapUv:ot&&A(s.specularIntensityMap.channel),transmissionMapUv:ct&&A(s.transmissionMap.channel),thicknessMapUv:lt&&A(s.thicknessMap.channel),alphaMapUv:ut&&A(s.alphaMap.channel),vertexTangents:!!v.attributes.tangent&&(Q||j),vertexColors:s.vertexColors,vertexAlphas:!0===s.vertexColors&&!!v.attributes.color&&4===v.attributes.color.itemSize,pointsUvs:!0===m.isPoints&&!!v.attributes.uv&&(P||ut),fog:!!_,useFog:!0===s.fog,fogExp2:!!_&&_.isFogExp2,flatShading:!0===s.flatShading,sizeAttenuation:!0===s.sizeAttenuation,logarithmicDepthBuffer:u,skinning:!0===m.isSkinnedMesh,morphTargets:void 0!==v.morphAttributes.position,morphNormals:void 0!==v.morphAttributes.normal,morphColors:void 0!==v.morphAttributes.color,morphTargetsCount:C,morphTextureStride:B,numDirLights:o.directional.length,numPointLights:o.point.length,numSpotLights:o.spot.length,numSpotLightMaps:o.spotLightMap.length,numRectAreaLights:o.rectArea.length,numHemiLights:o.hemi.length,numDirLightShadows:o.directionalShadowMap.length,numPointLightShadows:o.pointShadowMap.length,numSpotLightShadows:o.spotShadowMap.length,numSpotLightShadowsWithMaps:o.numSpotLightShadowsWithMaps,numLightProbes:o.numLightProbes,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:s.dithering,shadowMapEnabled:t.shadowMap.enabled&&h.length>0,shadowMapType:t.shadowMap.type,toneMapping:At,decodeVideoTexture:P&&!0===s.map.isVideoTexture&&Tc.getTransfer(s.map.colorSpace)===zo,premultipliedAlpha:s.premultipliedAlpha,doubleSided:2===s.side,flipSided:s.side===Us,useDepthPacking:s.depthPacking>=0,depthPacking:s.depthPacking||0,index0AttributeName:s.index0AttributeName,extensionClipCullDistance:ft&&!0===s.extensions.clipCullDistance&&i.has("WEBGL_clip_cull_distance"),extensionMultiDraw:ft&&!0===s.extensions.multiDraw&&i.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:s.customProgramCacheKey()};return gt.vertexUv1s=l.has(1),gt.vertexUv2s=l.has(2),gt.vertexUv3s=l.has(3),l.clear(),gt},getProgramCacheKey:function(e){const n=[];if(e.shaderID?n.push(e.shaderID):(n.push(e.customVertexShaderID),n.push(e.customFragmentShaderID)),void 0!==e.defines)for(const t in e.defines)n.push(t),n.push(e.defines[t]);return!1===e.isRawShaderMaterial&&(!function(t,e){t.push(e.precision),t.push(e.outputColorSpace),t.push(e.envMapMode),t.push(e.envMapCubeUVHeight),t.push(e.mapUv),t.push(e.alphaMapUv),t.push(e.lightMapUv),t.push(e.aoMapUv),t.push(e.bumpMapUv),t.push(e.normalMapUv),t.push(e.displacementMapUv),t.push(e.emissiveMapUv),t.push(e.metalnessMapUv),t.push(e.roughnessMapUv),t.push(e.anisotropyMapUv),t.push(e.clearcoatMapUv),t.push(e.clearcoatNormalMapUv),t.push(e.clearcoatRoughnessMapUv),t.push(e.iridescenceMapUv),t.push(e.iridescenceThicknessMapUv),t.push(e.sheenColorMapUv),t.push(e.sheenRoughnessMapUv),t.push(e.specularMapUv),t.push(e.specularColorMapUv),t.push(e.specularIntensityMapUv),t.push(e.transmissionMapUv),t.push(e.thicknessMapUv),t.push(e.combine),t.push(e.fogExp2),t.push(e.sizeAttenuation),t.push(e.morphTargetsCount),t.push(e.morphAttributeCount),t.push(e.numDirLights),t.push(e.numPointLights),t.push(e.numSpotLights),t.push(e.numSpotLightMaps),t.push(e.numHemiLights),t.push(e.numRectAreaLights),t.push(e.numDirLightShadows),t.push(e.numPointLightShadows),t.push(e.numSpotLightShadows),t.push(e.numSpotLightShadowsWithMaps),t.push(e.numLightProbes),t.push(e.shadowMapType),t.push(e.toneMapping),t.push(e.numClippingPlanes),t.push(e.numClipIntersection),t.push(e.depthPacking)}(n,e),function(t,e){o.disableAll(),e.supportsVertexTextures&&o.enable(0);e.instancing&&o.enable(1);e.instancingColor&&o.enable(2);e.instancingMorph&&o.enable(3);e.matcap&&o.enable(4);e.envMap&&o.enable(5);e.normalMapObjectSpace&&o.enable(6);e.normalMapTangentSpace&&o.enable(7);e.clearcoat&&o.enable(8);e.iridescence&&o.enable(9);e.alphaTest&&o.enable(10);e.vertexColors&&o.enable(11);e.vertexAlphas&&o.enable(12);e.vertexUv1s&&o.enable(13);e.vertexUv2s&&o.enable(14);e.vertexUv3s&&o.enable(15);e.vertexTangents&&o.enable(16);e.anisotropy&&o.enable(17);e.alphaHash&&o.enable(18);e.batching&&o.enable(19);e.dispersion&&o.enable(20);e.batchingColor&&o.enable(21);t.push(o.mask),o.disableAll(),e.fog&&o.enable(0);e.useFog&&o.enable(1);e.flatShading&&o.enable(2);e.logarithmicDepthBuffer&&o.enable(3);e.skinning&&o.enable(4);e.morphTargets&&o.enable(5);e.morphNormals&&o.enable(6);e.morphColors&&o.enable(7);e.premultipliedAlpha&&o.enable(8);e.shadowMapEnabled&&o.enable(9);e.doubleSided&&o.enable(10);e.flipSided&&o.enable(11);e.useDepthPacking&&o.enable(12);e.dithering&&o.enable(13);e.transmission&&o.enable(14);e.sheen&&o.enable(15);e.opaque&&o.enable(16);e.pointsUvs&&o.enable(17);e.decodeVideoTexture&&o.enable(18);e.alphaToCoverage&&o.enable(19);t.push(o.mask)}(n,e),n.push(t.outputColorSpace)),n.push(e.customProgramCacheKey),n.join()},getUniforms:function(t){const e=f[t.type];let n;if(e){const t=Su[e];n=iu.clone(t.uniforms)}else n=t.uniforms;return n},acquireProgram:function(e,n){let i;for(let t=0,e=h.length;t<e;t++){const e=h[t];if(e.cacheKey===n){i=e,++i.usedTimes;break}}return void 0===i&&(i=new Bp(t,n,e,s),h.push(i)),i},releaseProgram:function(t){if(0==--t.usedTimes){const e=h.indexOf(t);h[e]=h[h.length-1],h.pop(),t.destroy()}},releaseShaderCache:function(t){c.remove(t)},programs:h,dispose:function(){c.dispose()}}}function kp(){let t=new WeakMap;return{get:function(e){let n=t.get(e);return void 0===n&&(n={},t.set(e,n)),n},remove:function(e){t.delete(e)},update:function(e,n,i){t.get(e)[n]=i},dispose:function(){t=new WeakMap}}}function Op(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.material.id!==e.material.id?t.material.id-e.material.id:t.z!==e.z?t.z-e.z:t.id-e.id}function Up(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function Np(){const t=[];let e=0;const n=[],i=[],r=[];function s(n,i,r,s,a,o){let c=t[e];return void 0===c?(c={id:n.id,object:n,geometry:i,material:r,groupOrder:s,renderOrder:n.renderOrder,z:a,group:o},t[e]=c):(c.id=n.id,c.object=n,c.geometry=i,c.material=r,c.groupOrder=s,c.renderOrder=n.renderOrder,c.z=a,c.group=o),e++,c}return{opaque:n,transmissive:i,transparent:r,init:function(){e=0,n.length=0,i.length=0,r.length=0},push:function(t,e,a,o,c,l){const h=s(t,e,a,o,c,l);a.transmission>0?i.push(h):!0===a.transparent?r.push(h):n.push(h)},unshift:function(t,e,a,o,c,l){const h=s(t,e,a,o,c,l);a.transmission>0?i.unshift(h):!0===a.transparent?r.unshift(h):n.unshift(h)},finish:function(){for(let n=e,i=t.length;n<i;n++){const e=t[n];if(null===e.id)break;e.id=null,e.object=null,e.geometry=null,e.material=null,e.group=null}},sort:function(t,e){n.length>1&&n.sort(t||Op),i.length>1&&i.sort(e||Up),r.length>1&&r.sort(e||Up)}}}function Fp(){let t=new WeakMap;return{get:function(e,n){const i=t.get(e);let r;return void 0===i?(r=new Np,t.set(e,[r])):n>=i.length?(r=new Np,i.push(r)):r=i[n],r},dispose:function(){t=new WeakMap}}}function Qp(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let n;switch(e.type){case"DirectionalLight":n={direction:new jc,color:new hh};break;case"SpotLight":n={position:new jc,direction:new jc,color:new hh,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new jc,color:new hh,distance:0,decay:0};break;case"HemisphereLight":n={direction:new jc,skyColor:new hh,groundColor:new hh};break;case"RectAreaLight":n={color:new hh,position:new jc,halfWidth:new jc,halfHeight:new jc}}return t[e.id]=n,n}}}let zp=0;function Gp(t,e){return(e.castShadow?2:0)-(t.castShadow?2:0)+(e.map?1:0)-(t.map?1:0)}function Hp(t){const e=new Qp,n=function(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let n;switch(e.type){case"DirectionalLight":case"SpotLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ac};break;case"PointLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ac,shadowCameraNear:1,shadowCameraFar:1e3}}return t[e.id]=n,n}}}(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let t=0;t<9;t++)i.probe.push(new jc);const r=new jc,s=new bl,a=new bl;return{setup:function(r){let s=0,a=0,o=0;for(let t=0;t<9;t++)i.probe[t].set(0,0,0);let c=0,l=0,h=0,u=0,d=0,p=0,f=0,A=0,g=0,m=0,_=0;r.sort(Gp);for(let t=0,v=r.length;t<v;t++){const v=r[t],y=v.color,b=v.intensity,x=v.distance,w=v.shadow&&v.shadow.map?v.shadow.map.texture:null;if(v.isAmbientLight)s+=y.r*b,a+=y.g*b,o+=y.b*b;else if(v.isLightProbe){for(let t=0;t<9;t++)i.probe[t].addScaledVector(v.sh.coefficients[t],b);_++}else if(v.isDirectionalLight){const t=e.get(v);if(t.color.copy(v.color).multiplyScalar(v.intensity),v.castShadow){const t=v.shadow,e=n.get(v);e.shadowBias=t.bias,e.shadowNormalBias=t.normalBias,e.shadowRadius=t.radius,e.shadowMapSize=t.mapSize,i.directionalShadow[c]=e,i.directionalShadowMap[c]=w,i.directionalShadowMatrix[c]=v.shadow.matrix,p++}i.directional[c]=t,c++}else if(v.isSpotLight){const t=e.get(v);t.position.setFromMatrixPosition(v.matrixWorld),t.color.copy(y).multiplyScalar(b),t.distance=x,t.coneCos=Math.cos(v.angle),t.penumbraCos=Math.cos(v.angle*(1-v.penumbra)),t.decay=v.decay,i.spot[h]=t;const r=v.shadow;if(v.map&&(i.spotLightMap[g]=v.map,g++,r.updateMatrices(v),v.castShadow&&m++),i.spotLightMatrix[h]=r.matrix,v.castShadow){const t=n.get(v);t.shadowBias=r.bias,t.shadowNormalBias=r.normalBias,t.shadowRadius=r.radius,t.shadowMapSize=r.mapSize,i.spotShadow[h]=t,i.spotShadowMap[h]=w,A++}h++}else if(v.isRectAreaLight){const t=e.get(v);t.color.copy(y).multiplyScalar(b),t.halfWidth.set(.5*v.width,0,0),t.halfHeight.set(0,.5*v.height,0),i.rectArea[u]=t,u++}else if(v.isPointLight){const t=e.get(v);if(t.color.copy(v.color).multiplyScalar(v.intensity),t.distance=v.distance,t.decay=v.decay,v.castShadow){const t=v.shadow,e=n.get(v);e.shadowBias=t.bias,e.shadowNormalBias=t.normalBias,e.shadowRadius=t.radius,e.shadowMapSize=t.mapSize,e.shadowCameraNear=t.camera.near,e.shadowCameraFar=t.camera.far,i.pointShadow[l]=e,i.pointShadowMap[l]=w,i.pointShadowMatrix[l]=v.shadow.matrix,f++}i.point[l]=t,l++}else if(v.isHemisphereLight){const t=e.get(v);t.skyColor.copy(v.color).multiplyScalar(b),t.groundColor.copy(v.groundColor).multiplyScalar(b),i.hemi[d]=t,d++}}u>0&&(!0===t.has("OES_texture_float_linear")?(i.rectAreaLTC1=Cu.LTC_FLOAT_1,i.rectAreaLTC2=Cu.LTC_FLOAT_2):(i.rectAreaLTC1=Cu.LTC_HALF_1,i.rectAreaLTC2=Cu.LTC_HALF_2)),i.ambient[0]=s,i.ambient[1]=a,i.ambient[2]=o;const v=i.hash;v.directionalLength===c&&v.pointLength===l&&v.spotLength===h&&v.rectAreaLength===u&&v.hemiLength===d&&v.numDirectionalShadows===p&&v.numPointShadows===f&&v.numSpotShadows===A&&v.numSpotMaps===g&&v.numLightProbes===_||(i.directional.length=c,i.spot.length=h,i.rectArea.length=u,i.point.length=l,i.hemi.length=d,i.directionalShadow.length=p,i.directionalShadowMap.length=p,i.pointShadow.length=f,i.pointShadowMap.length=f,i.spotShadow.length=A,i.spotShadowMap.length=A,i.directionalShadowMatrix.length=p,i.pointShadowMatrix.length=f,i.spotLightMatrix.length=A+g-m,i.spotLightMap.length=g,i.numSpotLightShadowsWithMaps=m,i.numLightProbes=_,v.directionalLength=c,v.pointLength=l,v.spotLength=h,v.rectAreaLength=u,v.hemiLength=d,v.numDirectionalShadows=p,v.numPointShadows=f,v.numSpotShadows=A,v.numSpotMaps=g,v.numLightProbes=_,i.version=zp++)},setupView:function(t,e){let n=0,o=0,c=0,l=0,h=0;const u=e.matrixWorldInverse;for(let e=0,d=t.length;e<d;e++){const d=t[e];if(d.isDirectionalLight){const t=i.directional[n];t.direction.setFromMatrixPosition(d.matrixWorld),r.setFromMatrixPosition(d.target.matrixWorld),t.direction.sub(r),t.direction.transformDirection(u),n++}else if(d.isSpotLight){const t=i.spot[c];t.position.setFromMatrixPosition(d.matrixWorld),t.position.applyMatrix4(u),t.direction.setFromMatrixPosition(d.matrixWorld),r.setFromMatrixPosition(d.target.matrixWorld),t.direction.sub(r),t.direction.transformDirection(u),c++}else if(d.isRectAreaLight){const t=i.rectArea[l];t.position.setFromMatrixPosition(d.matrixWorld),t.position.applyMatrix4(u),a.identity(),s.copy(d.matrixWorld),s.premultiply(u),a.extractRotation(s),t.halfWidth.set(.5*d.width,0,0),t.halfHeight.set(0,.5*d.height,0),t.halfWidth.applyMatrix4(a),t.halfHeight.applyMatrix4(a),l++}else if(d.isPointLight){const t=i.point[o];t.position.setFromMatrixPosition(d.matrixWorld),t.position.applyMatrix4(u),o++}else if(d.isHemisphereLight){const t=i.hemi[h];t.direction.setFromMatrixPosition(d.matrixWorld),t.direction.transformDirection(u),h++}}},state:i}}function Vp(t){const e=new Hp(t),n=[],i=[];const r={lightsArray:n,shadowsArray:i,camera:null,lights:e,transmissionRenderTarget:{}};return{init:function(t){r.camera=t,n.length=0,i.length=0},state:r,setupLights:function(){e.setup(n)},setupLightsView:function(t){e.setupView(n,t)},pushLight:function(t){n.push(t)},pushShadow:function(t){i.push(t)}}}function jp(t){let e=new WeakMap;return{get:function(n,i=0){const r=e.get(n);let s;return void 0===r?(s=new Vp(t),e.set(n,[s])):i>=r.length?(s=new Vp(t),r.push(s)):s=r[i],s},dispose:function(){e=new WeakMap}}}class Wp extends ph{constructor(t){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=3200,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(t)}copy(t){return super.copy(t),this.depthPacking=t.depthPacking,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this}}class qp extends ph{constructor(t){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(t)}copy(t){return super.copy(t),this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}}function Yp(t,e,n){let i=new yu;const r=new Ac,s=new Ac,a=new Fc,o=new Wp({depthPacking:3201}),c=new qp,l={},h=n.maxTextureSize,u={[Os]:Us,[Us]:Os,[Ns]:2},d=new ru({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Ac},radius:{value:4}},vertexShader:"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n\tconst float samples = float( VSM_SAMPLES );\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),p=d.clone();p.defines.HORIZONTAL_PASS=1;const f=new Lh;f.setAttribute("position",new xh(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const A=new Kh(f,d),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Ls;let m=this.type;function _(n,i){const s=e.update(A);d.defines.VSM_SAMPLES!==n.blurSamples&&(d.defines.VSM_SAMPLES=n.blurSamples,p.defines.VSM_SAMPLES=n.blurSamples,d.needsUpdate=!0,p.needsUpdate=!0),null===n.mapPass&&(n.mapPass=new zc(r.x,r.y)),d.uniforms.shadow_pass.value=n.map.texture,d.uniforms.resolution.value=n.mapSize,d.uniforms.radius.value=n.radius,t.setRenderTarget(n.mapPass),t.clear(),t.renderBufferDirect(i,null,s,d,A,null),p.uniforms.shadow_pass.value=n.mapPass.texture,p.uniforms.resolution.value=n.mapSize,p.uniforms.radius.value=n.radius,t.setRenderTarget(n.map),t.clear(),t.renderBufferDirect(i,null,s,p,A,null)}function v(e,n,i,r){let s=null;const a=!0===i.isPointLight?e.customDistanceMaterial:e.customDepthMaterial;if(void 0!==a)s=a;else if(s=!0===i.isPointLight?c:o,t.localClippingEnabled&&!0===n.clipShadows&&Array.isArray(n.clippingPlanes)&&0!==n.clippingPlanes.length||n.displacementMap&&0!==n.displacementScale||n.alphaMap&&n.alphaTest>0||n.map&&n.alphaTest>0){const t=s.uuid,e=n.uuid;let i=l[t];void 0===i&&(i={},l[t]=i);let r=i[e];void 0===r&&(r=s.clone(),i[e]=r,n.addEventListener("dispose",b)),s=r}if(s.visible=n.visible,s.wireframe=n.wireframe,s.side=r===ks?null!==n.shadowSide?n.shadowSide:n.side:null!==n.shadowSide?n.shadowSide:u[n.side],s.alphaMap=n.alphaMap,s.alphaTest=n.alphaTest,s.map=n.map,s.clipShadows=n.clipShadows,s.clippingPlanes=n.clippingPlanes,s.clipIntersection=n.clipIntersection,s.displacementMap=n.displacementMap,s.displacementScale=n.displacementScale,s.displacementBias=n.displacementBias,s.wireframeLinewidth=n.wireframeLinewidth,s.linewidth=n.linewidth,!0===i.isPointLight&&!0===s.isMeshDistanceMaterial){t.properties.get(s).light=i}return s}function y(n,r,s,a,o){if(!1===n.visible)return;if(n.layers.test(r.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&o===ks)&&(!n.frustumCulled||i.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(s.matrixWorldInverse,n.matrixWorld);const i=e.update(n),c=n.material;if(Array.isArray(c)){const e=i.groups;for(let l=0,h=e.length;l<h;l++){const h=e[l],u=c[h.materialIndex];if(u&&u.visible){const e=v(n,u,a,o);n.onBeforeShadow(t,n,r,s,i,e,h),t.renderBufferDirect(s,null,i,e,n,h),n.onAfterShadow(t,n,r,s,i,e,h)}}}else if(c.visible){const e=v(n,c,a,o);n.onBeforeShadow(t,n,r,s,i,e,null),t.renderBufferDirect(s,null,i,e,n,null),n.onAfterShadow(t,n,r,s,i,e,null)}}const c=n.children;for(let t=0,e=c.length;t<e;t++)y(c[t],r,s,a,o)}function b(t){t.target.removeEventListener("dispose",b);for(const e in l){const n=l[e],i=t.target.uuid;if(i in n){n[i].dispose(),delete n[i]}}}this.render=function(e,n,o){if(!1===g.enabled)return;if(!1===g.autoUpdate&&!1===g.needsUpdate)return;if(0===e.length)return;const c=t.getRenderTarget(),l=t.getActiveCubeFace(),u=t.getActiveMipmapLevel(),d=t.state;d.setBlending(0),d.buffers.color.setClear(1,1,1,1),d.buffers.depth.setTest(!0),d.setScissorTest(!1);const p=m!==ks&&this.type===ks,f=m===ks&&this.type!==ks;for(let c=0,l=e.length;c<l;c++){const l=e[c],u=l.shadow;if(void 0===u)continue;if(!1===u.autoUpdate&&!1===u.needsUpdate)continue;r.copy(u.mapSize);const A=u.getFrameExtents();if(r.multiply(A),s.copy(u.mapSize),(r.x>h||r.y>h)&&(r.x>h&&(s.x=Math.floor(h/A.x),r.x=s.x*A.x,u.mapSize.x=s.x),r.y>h&&(s.y=Math.floor(h/A.y),r.y=s.y*A.y,u.mapSize.y=s.y)),null===u.map||!0===p||!0===f){const t=this.type!==ks?{minFilter:Ca,magFilter:Ca}:{};null!==u.map&&u.map.dispose(),u.map=new zc(r.x,r.y,t),u.map.texture.name=l.name+".shadowMap",u.camera.updateProjectionMatrix()}t.setRenderTarget(u.map),t.clear();const g=u.getViewportCount();for(let t=0;t<g;t++){const e=u.getViewport(t);a.set(s.x*e.x,s.y*e.y,s.x*e.z,s.y*e.w),d.viewport(a),u.updateMatrices(l,t),i=u.getFrustum(),y(n,o,u.camera,l,this.type)}!0!==u.isPointLightShadow&&this.type===ks&&_(u,o),u.needsUpdate=!1}m=this.type,g.needsUpdate=!1,t.setRenderTarget(c,l,u)}}function Xp(t){const e=new function(){let e=!1;const n=new Fc;let i=null;const r=new Fc(0,0,0,0);return{setMask:function(n){i===n||e||(t.colorMask(n,n,n,n),i=n)},setLocked:function(t){e=t},setClear:function(e,i,s,a,o){!0===o&&(e*=a,i*=a,s*=a),n.set(e,i,s,a),!1===r.equals(n)&&(t.clearColor(e,i,s,a),r.copy(n))},reset:function(){e=!1,i=null,r.set(-1,0,0,0)}}},n=new function(){let e=!1,n=null,i=null,r=null;return{setTest:function(e){e?F(t.DEPTH_TEST):Q(t.DEPTH_TEST)},setMask:function(i){n===i||e||(t.depthMask(i),n=i)},setFunc:function(e){if(i!==e){switch(e){case 0:t.depthFunc(t.NEVER);break;case 1:t.depthFunc(t.ALWAYS);break;case 2:t.depthFunc(t.LESS);break;case 3:default:t.depthFunc(t.LEQUAL);break;case 4:t.depthFunc(t.EQUAL);break;case 5:t.depthFunc(t.GEQUAL);break;case 6:t.depthFunc(t.GREATER);break;case 7:t.depthFunc(t.NOTEQUAL)}i=e}},setLocked:function(t){e=t},setClear:function(e){r!==e&&(t.clearDepth(e),r=e)},reset:function(){e=!1,n=null,i=null,r=null}}},i=new function(){let e=!1,n=null,i=null,r=null,s=null,a=null,o=null,c=null,l=null;return{setTest:function(n){e||(n?F(t.STENCIL_TEST):Q(t.STENCIL_TEST))},setMask:function(i){n===i||e||(t.stencilMask(i),n=i)},setFunc:function(e,n,a){i===e&&r===n&&s===a||(t.stencilFunc(e,n,a),i=e,r=n,s=a)},setOp:function(e,n,i){a===e&&o===n&&c===i||(t.stencilOp(e,n,i),a=e,o=n,c=i)},setLocked:function(t){e=t},setClear:function(e){l!==e&&(t.clearStencil(e),l=e)},reset:function(){e=!1,n=null,i=null,r=null,s=null,a=null,o=null,c=null,l=null}}},r=new WeakMap,s=new WeakMap;let a={},o={},c=new WeakMap,l=[],h=null,u=!1,d=null,p=null,f=null,A=null,g=null,m=null,_=null,v=new hh(0,0,0),y=0,b=!1,x=null,w=null,E=null,C=null,S=null;const M=t.getParameter(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let I=!1,T=0;const B=t.getParameter(t.VERSION);-1!==B.indexOf("WebGL")?(T=parseFloat(/^WebGL (\d)/.exec(B)[1]),I=T>=1):-1!==B.indexOf("OpenGL ES")&&(T=parseFloat(/^OpenGL ES (\d)/.exec(B)[1]),I=T>=2);let R=null,D={};const L=t.getParameter(t.SCISSOR_BOX),P=t.getParameter(t.VIEWPORT),k=(new Fc).fromArray(L),O=(new Fc).fromArray(P);function U(e,n,i,r){const s=new Uint8Array(4),a=t.createTexture();t.bindTexture(e,a),t.texParameteri(e,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(e,t.TEXTURE_MAG_FILTER,t.NEAREST);for(let a=0;a<i;a++)e===t.TEXTURE_3D||e===t.TEXTURE_2D_ARRAY?t.texImage3D(n,0,t.RGBA,1,1,r,0,t.RGBA,t.UNSIGNED_BYTE,s):t.texImage2D(n+a,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,s);return a}const N={};function F(e){!0!==a[e]&&(t.enable(e),a[e]=!0)}function Q(e){!1!==a[e]&&(t.disable(e),a[e]=!1)}N[t.TEXTURE_2D]=U(t.TEXTURE_2D,t.TEXTURE_2D,1),N[t.TEXTURE_CUBE_MAP]=U(t.TEXTURE_CUBE_MAP,t.TEXTURE_CUBE_MAP_POSITIVE_X,6),N[t.TEXTURE_2D_ARRAY]=U(t.TEXTURE_2D_ARRAY,t.TEXTURE_2D_ARRAY,1,1),N[t.TEXTURE_3D]=U(t.TEXTURE_3D,t.TEXTURE_3D,1,1),e.setClear(0,0,0,1),n.setClear(1),i.setClear(0),F(t.DEPTH_TEST),n.setFunc(3),V(!1),j(1),F(t.CULL_FACE),H(0);const z={[Fs]:t.FUNC_ADD,[Qs]:t.FUNC_SUBTRACT,[zs]:t.FUNC_REVERSE_SUBTRACT};z[103]=t.MIN,z[104]=t.MAX;const G={[Gs]:t.ZERO,[Hs]:t.ONE,[Vs]:t.SRC_COLOR,[Ws]:t.SRC_ALPHA,[Zs]:t.SRC_ALPHA_SATURATE,[Js]:t.DST_COLOR,[Ys]:t.DST_ALPHA,[js]:t.ONE_MINUS_SRC_COLOR,[qs]:t.ONE_MINUS_SRC_ALPHA,[Ks]:t.ONE_MINUS_DST_COLOR,[Xs]:t.ONE_MINUS_DST_ALPHA,[$s]:t.CONSTANT_COLOR,[ta]:t.ONE_MINUS_CONSTANT_COLOR,[ea]:t.CONSTANT_ALPHA,[na]:t.ONE_MINUS_CONSTANT_ALPHA};function H(e,n,i,r,s,a,o,c,l,h){if(0!==e){if(!1===u&&(F(t.BLEND),u=!0),5===e)s=s||n,a=a||i,o=o||r,n===p&&s===g||(t.blendEquationSeparate(z[n],z[s]),p=n,g=s),i===f&&r===A&&a===m&&o===_||(t.blendFuncSeparate(G[i],G[r],G[a],G[o]),f=i,A=r,m=a,_=o),!1!==c.equals(v)&&l===y||(t.blendColor(c.r,c.g,c.b,l),v.copy(c),y=l),d=e,b=!1;else if(e!==d||h!==b){if(p===Fs&&g===Fs||(t.blendEquation(t.FUNC_ADD),p=Fs,g=Fs),h)switch(e){case 1:t.blendFuncSeparate(t.ONE,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case 2:t.blendFunc(t.ONE,t.ONE);break;case 3:t.blendFuncSeparate(t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ZERO,t.ONE);break;case 4:t.blendFuncSeparate(t.ZERO,t.SRC_COLOR,t.ZERO,t.SRC_ALPHA)}else switch(e){case 1:t.blendFuncSeparate(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case 2:t.blendFunc(t.SRC_ALPHA,t.ONE);break;case 3:t.blendFuncSeparate(t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ZERO,t.ONE);break;case 4:t.blendFunc(t.ZERO,t.SRC_COLOR)}f=null,A=null,m=null,_=null,v.set(0,0,0),y=0,d=e,b=h}}else!0===u&&(Q(t.BLEND),u=!1)}function V(e){x!==e&&(e?t.frontFace(t.CW):t.frontFace(t.CCW),x=e)}function j(e){0!==e?(F(t.CULL_FACE),e!==w&&(1===e?t.cullFace(t.BACK):2===e?t.cullFace(t.FRONT):t.cullFace(t.FRONT_AND_BACK))):Q(t.CULL_FACE),w=e}function W(e,n,i){e?(F(t.POLYGON_OFFSET_FILL),C===n&&S===i||(t.polygonOffset(n,i),C=n,S=i)):Q(t.POLYGON_OFFSET_FILL)}return{buffers:{color:e,depth:n,stencil:i},enable:F,disable:Q,bindFramebuffer:function(e,n){return o[e]!==n&&(t.bindFramebuffer(e,n),o[e]=n,e===t.DRAW_FRAMEBUFFER&&(o[t.FRAMEBUFFER]=n),e===t.FRAMEBUFFER&&(o[t.DRAW_FRAMEBUFFER]=n),!0)},drawBuffers:function(e,n){let i=l,r=!1;if(e){i=c.get(n),void 0===i&&(i=[],c.set(n,i));const s=e.textures;if(i.length!==s.length||i[0]!==t.COLOR_ATTACHMENT0){for(let e=0,n=s.length;e<n;e++)i[e]=t.COLOR_ATTACHMENT0+e;i.length=s.length,r=!0}}else i[0]!==t.BACK&&(i[0]=t.BACK,r=!0);r&&t.drawBuffers(i)},useProgram:function(e){return h!==e&&(t.useProgram(e),h=e,!0)},setBlending:H,setMaterial:function(r,s){2===r.side?Q(t.CULL_FACE):F(t.CULL_FACE);let a=r.side===Us;s&&(a=!a),V(a),1===r.blending&&!1===r.transparent?H(0):H(r.blending,r.blendEquation,r.blendSrc,r.blendDst,r.blendEquationAlpha,r.blendSrcAlpha,r.blendDstAlpha,r.blendColor,r.blendAlpha,r.premultipliedAlpha),n.setFunc(r.depthFunc),n.setTest(r.depthTest),n.setMask(r.depthWrite),e.setMask(r.colorWrite);const o=r.stencilWrite;i.setTest(o),o&&(i.setMask(r.stencilWriteMask),i.setFunc(r.stencilFunc,r.stencilRef,r.stencilFuncMask),i.setOp(r.stencilFail,r.stencilZFail,r.stencilZPass)),W(r.polygonOffset,r.polygonOffsetFactor,r.polygonOffsetUnits),!0===r.alphaToCoverage?F(t.SAMPLE_ALPHA_TO_COVERAGE):Q(t.SAMPLE_ALPHA_TO_COVERAGE)},setFlipSided:V,setCullFace:j,setLineWidth:function(e){e!==E&&(I&&t.lineWidth(e),E=e)},setPolygonOffset:W,setScissorTest:function(e){e?F(t.SCISSOR_TEST):Q(t.SCISSOR_TEST)},activeTexture:function(e){void 0===e&&(e=t.TEXTURE0+M-1),R!==e&&(t.activeTexture(e),R=e)},bindTexture:function(e,n,i){void 0===i&&(i=null===R?t.TEXTURE0+M-1:R);let r=D[i];void 0===r&&(r={type:void 0,texture:void 0},D[i]=r),r.type===e&&r.texture===n||(R!==i&&(t.activeTexture(i),R=i),t.bindTexture(e,n||N[e]),r.type=e,r.texture=n)},unbindTexture:function(){const e=D[R];void 0!==e&&void 0!==e.type&&(t.bindTexture(e.type,null),e.type=void 0,e.texture=void 0)},compressedTexImage2D:function(){try{t.compressedTexImage2D.apply(t,arguments)}catch(t){}},compressedTexImage3D:function(){try{t.compressedTexImage3D.apply(t,arguments)}catch(t){}},texImage2D:function(){try{t.texImage2D.apply(t,arguments)}catch(t){}},texImage3D:function(){try{t.texImage3D.apply(t,arguments)}catch(t){}},updateUBOMapping:function(e,n){let i=s.get(n);void 0===i&&(i=new WeakMap,s.set(n,i));let r=i.get(e);void 0===r&&(r=t.getUniformBlockIndex(n,e.name),i.set(e,r))},uniformBlockBinding:function(e,n){const i=s.get(n).get(e);r.get(n)!==i&&(t.uniformBlockBinding(n,i,e.__bindingPointIndex),r.set(n,i))},texStorage2D:function(){try{t.texStorage2D.apply(t,arguments)}catch(t){}},texStorage3D:function(){try{t.texStorage3D.apply(t,arguments)}catch(t){}},texSubImage2D:function(){try{t.texSubImage2D.apply(t,arguments)}catch(t){}},texSubImage3D:function(){try{t.texSubImage3D.apply(t,arguments)}catch(t){}},compressedTexSubImage2D:function(){try{t.compressedTexSubImage2D.apply(t,arguments)}catch(t){}},compressedTexSubImage3D:function(){try{t.compressedTexSubImage3D.apply(t,arguments)}catch(t){}},scissor:function(e){!1===k.equals(e)&&(t.scissor(e.x,e.y,e.z,e.w),k.copy(e))},viewport:function(e){!1===O.equals(e)&&(t.viewport(e.x,e.y,e.z,e.w),O.copy(e))},reset:function(){t.disable(t.BLEND),t.disable(t.CULL_FACE),t.disable(t.DEPTH_TEST),t.disable(t.POLYGON_OFFSET_FILL),t.disable(t.SCISSOR_TEST),t.disable(t.STENCIL_TEST),t.disable(t.SAMPLE_ALPHA_TO_COVERAGE),t.blendEquation(t.FUNC_ADD),t.blendFunc(t.ONE,t.ZERO),t.blendFuncSeparate(t.ONE,t.ZERO,t.ONE,t.ZERO),t.blendColor(0,0,0,0),t.colorMask(!0,!0,!0,!0),t.clearColor(0,0,0,0),t.depthMask(!0),t.depthFunc(t.LESS),t.clearDepth(1),t.stencilMask(4294967295),t.stencilFunc(t.ALWAYS,0,4294967295),t.stencilOp(t.KEEP,t.KEEP,t.KEEP),t.clearStencil(0),t.cullFace(t.BACK),t.frontFace(t.CCW),t.polygonOffset(0,0),t.activeTexture(t.TEXTURE0),t.bindFramebuffer(t.FRAMEBUFFER,null),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),t.bindFramebuffer(t.READ_FRAMEBUFFER,null),t.useProgram(null),t.lineWidth(1),t.scissor(0,0,t.canvas.width,t.canvas.height),t.viewport(0,0,t.canvas.width,t.canvas.height),a={},R=null,D={},o={},c=new WeakMap,l=[],h=null,u=!1,d=null,p=null,f=null,A=null,g=null,m=null,_=null,v=new hh(0,0,0),y=0,b=!1,x=null,w=null,E=null,C=null,S=null,k.set(0,0,t.canvas.width,t.canvas.height),O.set(0,0,t.canvas.width,t.canvas.height),e.reset(),n.reset(),i.reset()}}}function Jp(t,e,n,i,r,s,a){const o=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,c="undefined"!=typeof navigator&&/OculusBrowser/g.test(navigator.userAgent),l=new Ac,h=new WeakMap;let u;const d=new WeakMap;let p=!1;try{p="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(t){}function f(t,e){return p?new OffscreenCanvas(t,e):bc("canvas")}function A(t,e,n){let i=1;const r=Q(t);if((r.width>n||r.height>n)&&(i=n/Math.max(r.width,r.height)),i<1){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap||"undefined"!=typeof VideoFrame&&t instanceof VideoFrame){const n=Math.floor(i*r.width),s=Math.floor(i*r.height);void 0===u&&(u=f(n,s));const a=e?f(n,s):u;a.width=n,a.height=s;return a.getContext("2d").drawImage(t,0,0,n,s),a}return t}return t}function g(t){return t.generateMipmaps&&t.minFilter!==Ca&&t.minFilter!==Ia}function m(e){t.generateMipmap(e)}function _(n,i,r,s,a=!1){if(null!==n&&void 0!==t[n])return t[n];let o=i;if(i===t.RED&&(r===t.FLOAT&&(o=t.R32F),r===t.HALF_FLOAT&&(o=t.R16F),r===t.UNSIGNED_BYTE&&(o=t.R8)),i===t.RED_INTEGER&&(r===t.UNSIGNED_BYTE&&(o=t.R8UI),r===t.UNSIGNED_SHORT&&(o=t.R16UI),r===t.UNSIGNED_INT&&(o=t.R32UI),r===t.BYTE&&(o=t.R8I),r===t.SHORT&&(o=t.R16I),r===t.INT&&(o=t.R32I)),i===t.RG&&(r===t.FLOAT&&(o=t.RG32F),r===t.HALF_FLOAT&&(o=t.RG16F),r===t.UNSIGNED_BYTE&&(o=t.RG8)),i===t.RG_INTEGER&&(r===t.UNSIGNED_BYTE&&(o=t.RG8UI),r===t.UNSIGNED_SHORT&&(o=t.RG16UI),r===t.UNSIGNED_INT&&(o=t.RG32UI),r===t.BYTE&&(o=t.RG8I),r===t.SHORT&&(o=t.RG16I),r===t.INT&&(o=t.RG32I)),i===t.RGB&&r===t.UNSIGNED_INT_5_9_9_9_REV&&(o=t.RGB9_E5),i===t.RGBA){const e=a?Qo:Tc.getTransfer(s);r===t.FLOAT&&(o=t.RGBA32F),r===t.HALF_FLOAT&&(o=t.RGBA16F),r===t.UNSIGNED_BYTE&&(o=e===zo?t.SRGB8_ALPHA8:t.RGBA8),r===t.UNSIGNED_SHORT_4_4_4_4&&(o=t.RGBA4),r===t.UNSIGNED_SHORT_5_5_5_1&&(o=t.RGB5_A1)}return o!==t.R16F&&o!==t.R32F&&o!==t.RG16F&&o!==t.RG32F&&o!==t.RGBA16F&&o!==t.RGBA32F||e.get("EXT_color_buffer_float"),o}function v(e,n){let i;return e?null===n||n===Pa||n===Fa?i=t.DEPTH24_STENCIL8:n===ka?i=t.DEPTH32F_STENCIL8:n===Da&&(i=t.DEPTH24_STENCIL8):null===n||n===Pa||n===Fa?i=t.DEPTH_COMPONENT24:n===ka?i=t.DEPTH_COMPONENT32F:n===Da&&(i=t.DEPTH_COMPONENT16),i}function y(t,e){return!0===g(t)||t.isFramebufferTexture&&t.minFilter!==Ca&&t.minFilter!==Ia?Math.log2(Math.max(e.width,e.height))+1:void 0!==t.mipmaps&&t.mipmaps.length>0?t.mipmaps.length:t.isCompressedTexture&&Array.isArray(t.image)?e.mipmaps.length:1}function b(t){const e=t.target;e.removeEventListener("dispose",b),function(t){const e=i.get(t);if(void 0===e.__webglInit)return;const n=t.source,r=d.get(n);if(r){const i=r[e.__cacheKey];i.usedTimes--,0===i.usedTimes&&w(t),0===Object.keys(r).length&&d.delete(n)}i.remove(t)}(e),e.isVideoTexture&&h.delete(e)}function x(e){const n=e.target;n.removeEventListener("dispose",x),function(e){const n=i.get(e);e.depthTexture&&e.depthTexture.dispose();if(e.isWebGLCubeRenderTarget)for(let e=0;e<6;e++){if(Array.isArray(n.__webglFramebuffer[e]))for(let i=0;i<n.__webglFramebuffer[e].length;i++)t.deleteFramebuffer(n.__webglFramebuffer[e][i]);else t.deleteFramebuffer(n.__webglFramebuffer[e]);n.__webglDepthbuffer&&t.deleteRenderbuffer(n.__webglDepthbuffer[e])}else{if(Array.isArray(n.__webglFramebuffer))for(let e=0;e<n.__webglFramebuffer.length;e++)t.deleteFramebuffer(n.__webglFramebuffer[e]);else t.deleteFramebuffer(n.__webglFramebuffer);if(n.__webglDepthbuffer&&t.deleteRenderbuffer(n.__webglDepthbuffer),n.__webglMultisampledFramebuffer&&t.deleteFramebuffer(n.__webglMultisampledFramebuffer),n.__webglColorRenderbuffer)for(let e=0;e<n.__webglColorRenderbuffer.length;e++)n.__webglColorRenderbuffer[e]&&t.deleteRenderbuffer(n.__webglColorRenderbuffer[e]);n.__webglDepthRenderbuffer&&t.deleteRenderbuffer(n.__webglDepthRenderbuffer)}const r=e.textures;for(let e=0,n=r.length;e<n;e++){const n=i.get(r[e]);n.__webglTexture&&(t.deleteTexture(n.__webglTexture),a.memory.textures--),i.remove(r[e])}i.remove(e)}(n)}function w(e){const n=i.get(e);t.deleteTexture(n.__webglTexture);const r=e.source;delete d.get(r)[n.__cacheKey],a.memory.textures--}let E=0;function C(e,r){const s=i.get(e);if(e.isVideoTexture&&function(t){const e=a.render.frame;h.get(t)!==e&&(h.set(t,e),t.update())}(e),!1===e.isRenderTargetTexture&&e.version>0&&s.__version!==e.version){const t=e.image;if(null===t);else if(!1!==t.complete)return void R(s,e,r)}n.bindTexture(t.TEXTURE_2D,s.__webglTexture,t.TEXTURE0+r)}const S={[xa]:t.REPEAT,[wa]:t.CLAMP_TO_EDGE,[Ea]:t.MIRRORED_REPEAT},M={[Ca]:t.NEAREST,[Sa]:t.NEAREST_MIPMAP_NEAREST,[Ma]:t.NEAREST_MIPMAP_LINEAR,[Ia]:t.LINEAR,[Ta]:t.LINEAR_MIPMAP_NEAREST,[Ba]:t.LINEAR_MIPMAP_LINEAR},I={[jo]:t.NEVER,[Zo]:t.ALWAYS,[Wo]:t.LESS,[Yo]:t.LEQUAL,[qo]:t.EQUAL,[Ko]:t.GEQUAL,[Xo]:t.GREATER,[Jo]:t.NOTEQUAL};function T(n,s){if(s.type===ka&&!1===e.has("OES_texture_float_linear")&&(s.magFilter===Ia||s.magFilter===Ta||s.magFilter===Ma||s.magFilter===Ba||s.minFilter===Ia||s.minFilter===Ta||s.minFilter===Ma||s.minFilter),t.texParameteri(n,t.TEXTURE_WRAP_S,S[s.wrapS]),t.texParameteri(n,t.TEXTURE_WRAP_T,S[s.wrapT]),n!==t.TEXTURE_3D&&n!==t.TEXTURE_2D_ARRAY||t.texParameteri(n,t.TEXTURE_WRAP_R,S[s.wrapR]),t.texParameteri(n,t.TEXTURE_MAG_FILTER,M[s.magFilter]),t.texParameteri(n,t.TEXTURE_MIN_FILTER,M[s.minFilter]),s.compareFunction&&(t.texParameteri(n,t.TEXTURE_COMPARE_MODE,t.COMPARE_REF_TO_TEXTURE),t.texParameteri(n,t.TEXTURE_COMPARE_FUNC,I[s.compareFunction])),!0===e.has("EXT_texture_filter_anisotropic")){if(s.magFilter===Ca)return;if(s.minFilter!==Ma&&s.minFilter!==Ba)return;if(s.type===ka&&!1===e.has("OES_texture_float_linear"))return;if(s.anisotropy>1||i.get(s).__currentAnisotropy){const a=e.get("EXT_texture_filter_anisotropic");t.texParameterf(n,a.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(s.anisotropy,r.getMaxAnisotropy())),i.get(s).__currentAnisotropy=s.anisotropy}}}function B(e,n){let i=!1;void 0===e.__webglInit&&(e.__webglInit=!0,n.addEventListener("dispose",b));const r=n.source;let s=d.get(r);void 0===s&&(s={},d.set(r,s));const o=function(t){const e=[];return e.push(t.wrapS),e.push(t.wrapT),e.push(t.wrapR||0),e.push(t.magFilter),e.push(t.minFilter),e.push(t.anisotropy),e.push(t.internalFormat),e.push(t.format),e.push(t.type),e.push(t.generateMipmaps),e.push(t.premultiplyAlpha),e.push(t.flipY),e.push(t.unpackAlignment),e.push(t.colorSpace),e.join()}(n);if(o!==e.__cacheKey){void 0===s[o]&&(s[o]={texture:t.createTexture(),usedTimes:0},a.memory.textures++,i=!0),s[o].usedTimes++;const r=s[e.__cacheKey];void 0!==r&&(s[e.__cacheKey].usedTimes--,0===r.usedTimes&&w(n)),e.__cacheKey=o,e.__webglTexture=s[o].texture}return i}function R(e,a,o){let c=t.TEXTURE_2D;(a.isDataArrayTexture||a.isCompressedArrayTexture)&&(c=t.TEXTURE_2D_ARRAY),a.isData3DTexture&&(c=t.TEXTURE_3D);const l=B(e,a),h=a.source;n.bindTexture(c,e.__webglTexture,t.TEXTURE0+o);const u=i.get(h);if(h.version!==u.__version||!0===l){n.activeTexture(t.TEXTURE0+o);const e=Tc.getPrimaries(Tc.workingColorSpace),i=a.colorSpace===ko?null:Tc.getPrimaries(a.colorSpace),d=a.colorSpace===ko||e===i?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,a.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,a.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,d);let p=A(a.image,!1,r.maxTextureSize);p=F(a,p);const f=s.convert(a.format,a.colorSpace),b=s.convert(a.type);let x,w=_(a.internalFormat,f,b,a.colorSpace,a.isVideoTexture);T(c,a);const E=a.mipmaps,C=!0!==a.isVideoTexture,S=void 0===u.__version||!0===l,M=h.dataReady,I=y(a,p);if(a.isDepthTexture)w=v(a.format===Ga,a.type),S&&(C?n.texStorage2D(t.TEXTURE_2D,1,w,p.width,p.height):n.texImage2D(t.TEXTURE_2D,0,w,p.width,p.height,0,f,b,null));else if(a.isDataTexture)if(E.length>0){C&&S&&n.texStorage2D(t.TEXTURE_2D,I,w,E[0].width,E[0].height);for(let e=0,i=E.length;e<i;e++)x=E[e],C?M&&n.texSubImage2D(t.TEXTURE_2D,e,0,0,x.width,x.height,f,b,x.data):n.texImage2D(t.TEXTURE_2D,e,w,x.width,x.height,0,f,b,x.data);a.generateMipmaps=!1}else C?(S&&n.texStorage2D(t.TEXTURE_2D,I,w,p.width,p.height),M&&n.texSubImage2D(t.TEXTURE_2D,0,0,0,p.width,p.height,f,b,p.data)):n.texImage2D(t.TEXTURE_2D,0,w,p.width,p.height,0,f,b,p.data);else if(a.isCompressedTexture)if(a.isCompressedArrayTexture){C&&S&&n.texStorage3D(t.TEXTURE_2D_ARRAY,I,w,E[0].width,E[0].height,p.depth);for(let e=0,i=E.length;e<i;e++)if(x=E[e],a.format!==Qa){if(null!==f)if(C){if(M)if(a.layerUpdates.size>0){for(const i of a.layerUpdates){const r=x.width*x.height;n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,e,0,0,i,x.width,x.height,1,f,x.data.slice(r*i,r*(i+1)),0,0)}a.clearLayerUpdates()}else n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,e,0,0,0,x.width,x.height,p.depth,f,x.data,0,0)}else n.compressedTexImage3D(t.TEXTURE_2D_ARRAY,e,w,x.width,x.height,p.depth,0,x.data,0,0)}else C?M&&n.texSubImage3D(t.TEXTURE_2D_ARRAY,e,0,0,0,x.width,x.height,p.depth,f,b,x.data):n.texImage3D(t.TEXTURE_2D_ARRAY,e,w,x.width,x.height,p.depth,0,f,b,x.data)}else{C&&S&&n.texStorage2D(t.TEXTURE_2D,I,w,E[0].width,E[0].height);for(let e=0,i=E.length;e<i;e++)x=E[e],a.format!==Qa?null!==f&&(C?M&&n.compressedTexSubImage2D(t.TEXTURE_2D,e,0,0,x.width,x.height,f,x.data):n.compressedTexImage2D(t.TEXTURE_2D,e,w,x.width,x.height,0,x.data)):C?M&&n.texSubImage2D(t.TEXTURE_2D,e,0,0,x.width,x.height,f,b,x.data):n.texImage2D(t.TEXTURE_2D,e,w,x.width,x.height,0,f,b,x.data)}else if(a.isDataArrayTexture)if(C){if(S&&n.texStorage3D(t.TEXTURE_2D_ARRAY,I,w,p.width,p.height,p.depth),M)if(a.layerUpdates.size>0){let e;switch(b){case t.UNSIGNED_BYTE:switch(f){case t.ALPHA:case t.LUMINANCE:e=1;break;case t.LUMINANCE_ALPHA:e=2;break;case t.RGB:e=3;break;case t.RGBA:e=4;break;default:throw new Error(`Unknown texel size for format ${f}.`)}break;case t.UNSIGNED_SHORT_4_4_4_4:case t.UNSIGNED_SHORT_5_5_5_1:case t.UNSIGNED_SHORT_5_6_5:e=1;break;default:throw new Error(`Unknown texel size for type ${b}.`)}const i=p.width*p.height*e;for(const e of a.layerUpdates)n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,e,p.width,p.height,1,f,b,p.data.slice(i*e,i*(e+1)));a.clearLayerUpdates()}else n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,0,p.width,p.height,p.depth,f,b,p.data)}else n.texImage3D(t.TEXTURE_2D_ARRAY,0,w,p.width,p.height,p.depth,0,f,b,p.data);else if(a.isData3DTexture)C?(S&&n.texStorage3D(t.TEXTURE_3D,I,w,p.width,p.height,p.depth),M&&n.texSubImage3D(t.TEXTURE_3D,0,0,0,0,p.width,p.height,p.depth,f,b,p.data)):n.texImage3D(t.TEXTURE_3D,0,w,p.width,p.height,p.depth,0,f,b,p.data);else if(a.isFramebufferTexture){if(S)if(C)n.texStorage2D(t.TEXTURE_2D,I,w,p.width,p.height);else{let e=p.width,i=p.height;for(let r=0;r<I;r++)n.texImage2D(t.TEXTURE_2D,r,w,e,i,0,f,b,null),e>>=1,i>>=1}}else if(E.length>0){if(C&&S){const e=Q(E[0]);n.texStorage2D(t.TEXTURE_2D,I,w,e.width,e.height)}for(let e=0,i=E.length;e<i;e++)x=E[e],C?M&&n.texSubImage2D(t.TEXTURE_2D,e,0,0,f,b,x):n.texImage2D(t.TEXTURE_2D,e,w,f,b,x);a.generateMipmaps=!1}else if(C){if(S){const e=Q(p);n.texStorage2D(t.TEXTURE_2D,I,w,e.width,e.height)}M&&n.texSubImage2D(t.TEXTURE_2D,0,0,0,f,b,p)}else n.texImage2D(t.TEXTURE_2D,0,w,f,b,p);g(a)&&m(c),u.__version=h.version,a.onUpdate&&a.onUpdate(a)}e.__version=a.version}function D(e,r,a,c,l,h){const u=s.convert(a.format,a.colorSpace),d=s.convert(a.type),p=_(a.internalFormat,u,d,a.colorSpace);if(!i.get(r).__hasExternalTextures){const e=Math.max(1,r.width>>h),i=Math.max(1,r.height>>h);l===t.TEXTURE_3D||l===t.TEXTURE_2D_ARRAY?n.texImage3D(l,h,p,e,i,r.depth,0,u,d,null):n.texImage2D(l,h,p,e,i,0,u,d,null)}n.bindFramebuffer(t.FRAMEBUFFER,e),N(r)?o.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,c,l,i.get(a).__webglTexture,0,U(r)):(l===t.TEXTURE_2D||l>=t.TEXTURE_CUBE_MAP_POSITIVE_X&&l<=t.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&t.framebufferTexture2D(t.FRAMEBUFFER,c,l,i.get(a).__webglTexture,h),n.bindFramebuffer(t.FRAMEBUFFER,null)}function L(e,n,i){if(t.bindRenderbuffer(t.RENDERBUFFER,e),n.depthBuffer){const r=n.depthTexture,s=r&&r.isDepthTexture?r.type:null,a=v(n.stencilBuffer,s),c=n.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,l=U(n);N(n)?o.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,l,a,n.width,n.height):i?t.renderbufferStorageMultisample(t.RENDERBUFFER,l,a,n.width,n.height):t.renderbufferStorage(t.RENDERBUFFER,a,n.width,n.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,c,t.RENDERBUFFER,e)}else{const e=n.textures;for(let r=0;r<e.length;r++){const a=e[r],c=s.convert(a.format,a.colorSpace),l=s.convert(a.type),h=_(a.internalFormat,c,l,a.colorSpace),u=U(n);i&&!1===N(n)?t.renderbufferStorageMultisample(t.RENDERBUFFER,u,h,n.width,n.height):N(n)?o.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,u,h,n.width,n.height):t.renderbufferStorage(t.RENDERBUFFER,h,n.width,n.height)}}t.bindRenderbuffer(t.RENDERBUFFER,null)}function P(e){const r=i.get(e),s=!0===e.isWebGLCubeRenderTarget;if(e.depthTexture&&!r.__autoAllocateDepthBuffer){if(s)throw new Error("target.depthTexture not supported in Cube render targets");!function(e,r){if(r&&r.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(n.bindFramebuffer(t.FRAMEBUFFER,e),!r.depthTexture||!r.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");i.get(r.depthTexture).__webglTexture&&r.depthTexture.image.width===r.width&&r.depthTexture.image.height===r.height||(r.depthTexture.image.width=r.width,r.depthTexture.image.height=r.height,r.depthTexture.needsUpdate=!0),C(r.depthTexture,0);const s=i.get(r.depthTexture).__webglTexture,a=U(r);if(r.depthTexture.format===za)N(r)?o.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,s,0,a):t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,s,0);else{if(r.depthTexture.format!==Ga)throw new Error("Unknown depthTexture format");N(r)?o.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,s,0,a):t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,s,0)}}(r.__webglFramebuffer,e)}else if(s){r.__webglDepthbuffer=[];for(let i=0;i<6;i++)n.bindFramebuffer(t.FRAMEBUFFER,r.__webglFramebuffer[i]),r.__webglDepthbuffer[i]=t.createRenderbuffer(),L(r.__webglDepthbuffer[i],e,!1)}else n.bindFramebuffer(t.FRAMEBUFFER,r.__webglFramebuffer),r.__webglDepthbuffer=t.createRenderbuffer(),L(r.__webglDepthbuffer,e,!1);n.bindFramebuffer(t.FRAMEBUFFER,null)}const k=[],O=[];function U(t){return Math.min(r.maxSamples,t.samples)}function N(t){const n=i.get(t);return t.samples>0&&!0===e.has("WEBGL_multisampled_render_to_texture")&&!1!==n.__useRenderToTexture}function F(t,e){const n=t.colorSpace;t.format,t.type;return!0===t.isCompressedTexture||!0===t.isVideoTexture||n!==Uo&&n!==ko&&Tc.getTransfer(n),e}function Q(t){return"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement?(l.width=t.naturalWidth||t.width,l.height=t.naturalHeight||t.height):"undefined"!=typeof VideoFrame&&t instanceof VideoFrame?(l.width=t.displayWidth,l.height=t.displayHeight):(l.width=t.width,l.height=t.height),l}this.allocateTextureUnit=function(){const t=E;return r.maxTextures,E+=1,t},this.resetTextureUnits=function(){E=0},this.setTexture2D=C,this.setTexture2DArray=function(e,r){const s=i.get(e);e.version>0&&s.__version!==e.version?R(s,e,r):n.bindTexture(t.TEXTURE_2D_ARRAY,s.__webglTexture,t.TEXTURE0+r)},this.setTexture3D=function(e,r){const s=i.get(e);e.version>0&&s.__version!==e.version?R(s,e,r):n.bindTexture(t.TEXTURE_3D,s.__webglTexture,t.TEXTURE0+r)},this.setTextureCube=function(e,a){const o=i.get(e);e.version>0&&o.__version!==e.version?function(e,a,o){if(6!==a.image.length)return;const c=B(e,a),l=a.source;n.bindTexture(t.TEXTURE_CUBE_MAP,e.__webglTexture,t.TEXTURE0+o);const h=i.get(l);if(l.version!==h.__version||!0===c){n.activeTexture(t.TEXTURE0+o);const e=Tc.getPrimaries(Tc.workingColorSpace),i=a.colorSpace===ko?null:Tc.getPrimaries(a.colorSpace),u=a.colorSpace===ko||e===i?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,a.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,a.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,u);const d=a.isCompressedTexture||a.image[0].isCompressedTexture,p=a.image[0]&&a.image[0].isDataTexture,f=[];for(let t=0;t<6;t++)f[t]=d||p?p?a.image[t].image:a.image[t]:A(a.image[t],!0,r.maxCubemapSize),f[t]=F(a,f[t]);const v=f[0],b=s.convert(a.format,a.colorSpace),x=s.convert(a.type),w=_(a.internalFormat,b,x,a.colorSpace),E=!0!==a.isVideoTexture,C=void 0===h.__version||!0===c,S=l.dataReady;let M,I=y(a,v);if(T(t.TEXTURE_CUBE_MAP,a),d){E&&C&&n.texStorage2D(t.TEXTURE_CUBE_MAP,I,w,v.width,v.height);for(let e=0;e<6;e++){M=f[e].mipmaps;for(let i=0;i<M.length;i++){const r=M[i];a.format!==Qa?null!==b&&(E?S&&n.compressedTexSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,i,0,0,r.width,r.height,b,r.data):n.compressedTexImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,i,w,r.width,r.height,0,r.data)):E?S&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,i,0,0,r.width,r.height,b,x,r.data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,i,w,r.width,r.height,0,b,x,r.data)}}}else{if(M=a.mipmaps,E&&C){M.length>0&&I++;const e=Q(f[0]);n.texStorage2D(t.TEXTURE_CUBE_MAP,I,w,e.width,e.height)}for(let e=0;e<6;e++)if(p){E?S&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,0,0,f[e].width,f[e].height,b,x,f[e].data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,w,f[e].width,f[e].height,0,b,x,f[e].data);for(let i=0;i<M.length;i++){const r=M[i].image[e].image;E?S&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,i+1,0,0,r.width,r.height,b,x,r.data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,i+1,w,r.width,r.height,0,b,x,r.data)}}else{E?S&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,0,0,b,x,f[e]):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,w,b,x,f[e]);for(let i=0;i<M.length;i++){const r=M[i];E?S&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,i+1,0,0,b,x,r.image[e]):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,i+1,w,b,x,r.image[e])}}}g(a)&&m(t.TEXTURE_CUBE_MAP),h.__version=l.version,a.onUpdate&&a.onUpdate(a)}e.__version=a.version}(o,e,a):n.bindTexture(t.TEXTURE_CUBE_MAP,o.__webglTexture,t.TEXTURE0+a)},this.rebindTextures=function(e,n,r){const s=i.get(e);void 0!==n&&D(s.__webglFramebuffer,e,e.texture,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,0),void 0!==r&&P(e)},this.setupRenderTarget=function(e){const r=e.texture,o=i.get(e),c=i.get(r);e.addEventListener("dispose",x);const l=e.textures,h=!0===e.isWebGLCubeRenderTarget,u=l.length>1;if(u||(void 0===c.__webglTexture&&(c.__webglTexture=t.createTexture()),c.__version=r.version,a.memory.textures++),h){o.__webglFramebuffer=[];for(let e=0;e<6;e++)if(r.mipmaps&&r.mipmaps.length>0){o.__webglFramebuffer[e]=[];for(let n=0;n<r.mipmaps.length;n++)o.__webglFramebuffer[e][n]=t.createFramebuffer()}else o.__webglFramebuffer[e]=t.createFramebuffer()}else{if(r.mipmaps&&r.mipmaps.length>0){o.__webglFramebuffer=[];for(let e=0;e<r.mipmaps.length;e++)o.__webglFramebuffer[e]=t.createFramebuffer()}else o.__webglFramebuffer=t.createFramebuffer();if(u)for(let e=0,n=l.length;e<n;e++){const n=i.get(l[e]);void 0===n.__webglTexture&&(n.__webglTexture=t.createTexture(),a.memory.textures++)}if(e.samples>0&&!1===N(e)){o.__webglMultisampledFramebuffer=t.createFramebuffer(),o.__webglColorRenderbuffer=[],n.bindFramebuffer(t.FRAMEBUFFER,o.__webglMultisampledFramebuffer);for(let n=0;n<l.length;n++){const i=l[n];o.__webglColorRenderbuffer[n]=t.createRenderbuffer(),t.bindRenderbuffer(t.RENDERBUFFER,o.__webglColorRenderbuffer[n]);const r=s.convert(i.format,i.colorSpace),a=s.convert(i.type),c=_(i.internalFormat,r,a,i.colorSpace,!0===e.isXRRenderTarget),h=U(e);t.renderbufferStorageMultisample(t.RENDERBUFFER,h,c,e.width,e.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+n,t.RENDERBUFFER,o.__webglColorRenderbuffer[n])}t.bindRenderbuffer(t.RENDERBUFFER,null),e.depthBuffer&&(o.__webglDepthRenderbuffer=t.createRenderbuffer(),L(o.__webglDepthRenderbuffer,e,!0)),n.bindFramebuffer(t.FRAMEBUFFER,null)}}if(h){n.bindTexture(t.TEXTURE_CUBE_MAP,c.__webglTexture),T(t.TEXTURE_CUBE_MAP,r);for(let n=0;n<6;n++)if(r.mipmaps&&r.mipmaps.length>0)for(let i=0;i<r.mipmaps.length;i++)D(o.__webglFramebuffer[n][i],e,r,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+n,i);else D(o.__webglFramebuffer[n],e,r,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+n,0);g(r)&&m(t.TEXTURE_CUBE_MAP),n.unbindTexture()}else if(u){for(let r=0,s=l.length;r<s;r++){const s=l[r],a=i.get(s);n.bindTexture(t.TEXTURE_2D,a.__webglTexture),T(t.TEXTURE_2D,s),D(o.__webglFramebuffer,e,s,t.COLOR_ATTACHMENT0+r,t.TEXTURE_2D,0),g(s)&&m(t.TEXTURE_2D)}n.unbindTexture()}else{let i=t.TEXTURE_2D;if((e.isWebGL3DRenderTarget||e.isWebGLArrayRenderTarget)&&(i=e.isWebGL3DRenderTarget?t.TEXTURE_3D:t.TEXTURE_2D_ARRAY),n.bindTexture(i,c.__webglTexture),T(i,r),r.mipmaps&&r.mipmaps.length>0)for(let n=0;n<r.mipmaps.length;n++)D(o.__webglFramebuffer[n],e,r,t.COLOR_ATTACHMENT0,i,n);else D(o.__webglFramebuffer,e,r,t.COLOR_ATTACHMENT0,i,0);g(r)&&m(i),n.unbindTexture()}e.depthBuffer&&P(e)},this.updateRenderTargetMipmap=function(e){const r=e.textures;for(let s=0,a=r.length;s<a;s++){const a=r[s];if(g(a)){const r=e.isWebGLCubeRenderTarget?t.TEXTURE_CUBE_MAP:t.TEXTURE_2D,s=i.get(a).__webglTexture;n.bindTexture(r,s),m(r),n.unbindTexture()}}},this.updateMultisampleRenderTarget=function(e){if(e.samples>0)if(!1===N(e)){const r=e.textures,s=e.width,a=e.height;let o=t.COLOR_BUFFER_BIT;const l=e.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,h=i.get(e),u=r.length>1;if(u)for(let e=0;e<r.length;e++)n.bindFramebuffer(t.FRAMEBUFFER,h.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+e,t.RENDERBUFFER,null),n.bindFramebuffer(t.FRAMEBUFFER,h.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+e,t.TEXTURE_2D,null,0);n.bindFramebuffer(t.READ_FRAMEBUFFER,h.__webglMultisampledFramebuffer),n.bindFramebuffer(t.DRAW_FRAMEBUFFER,h.__webglFramebuffer);for(let n=0;n<r.length;n++){if(e.resolveDepthBuffer&&(e.depthBuffer&&(o|=t.DEPTH_BUFFER_BIT),e.stencilBuffer&&e.resolveStencilBuffer&&(o|=t.STENCIL_BUFFER_BIT)),u){t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.RENDERBUFFER,h.__webglColorRenderbuffer[n]);const e=i.get(r[n]).__webglTexture;t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,e,0)}t.blitFramebuffer(0,0,s,a,0,0,s,a,o,t.NEAREST),!0===c&&(k.length=0,O.length=0,k.push(t.COLOR_ATTACHMENT0+n),e.depthBuffer&&!1===e.resolveDepthBuffer&&(k.push(l),O.push(l),t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,O)),t.invalidateFramebuffer(t.READ_FRAMEBUFFER,k))}if(n.bindFramebuffer(t.READ_FRAMEBUFFER,null),n.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),u)for(let e=0;e<r.length;e++){n.bindFramebuffer(t.FRAMEBUFFER,h.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+e,t.RENDERBUFFER,h.__webglColorRenderbuffer[e]);const s=i.get(r[e]).__webglTexture;n.bindFramebuffer(t.FRAMEBUFFER,h.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+e,t.TEXTURE_2D,s,0)}n.bindFramebuffer(t.DRAW_FRAMEBUFFER,h.__webglMultisampledFramebuffer)}else if(e.depthBuffer&&!1===e.resolveDepthBuffer&&c){const n=e.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,[n])}},this.setupDepthRenderbuffer=P,this.setupFrameBufferTexture=D,this.useMultisampledRTT=N}function Kp(t,e){return{convert:function(n,i=ko){let r;const s=Tc.getTransfer(i);if(n===Ra)return t.UNSIGNED_BYTE;if(n===Ua)return t.UNSIGNED_SHORT_4_4_4_4;if(n===Na)return t.UNSIGNED_SHORT_5_5_5_1;if(35902===n)return t.UNSIGNED_INT_5_9_9_9_REV;if(1010===n)return t.BYTE;if(1011===n)return t.SHORT;if(n===Da)return t.UNSIGNED_SHORT;if(n===La)return t.INT;if(n===Pa)return t.UNSIGNED_INT;if(n===ka)return t.FLOAT;if(n===Oa)return t.HALF_FLOAT;if(1021===n)return t.ALPHA;if(1022===n)return t.RGB;if(n===Qa)return t.RGBA;if(1024===n)return t.LUMINANCE;if(1025===n)return t.LUMINANCE_ALPHA;if(n===za)return t.DEPTH_COMPONENT;if(n===Ga)return t.DEPTH_STENCIL;if(n===Ha)return t.RED;if(n===Va)return t.RED_INTEGER;if(n===ja)return t.RG;if(n===Wa)return t.RG_INTEGER;if(n===qa)return t.RGBA_INTEGER;if(n===Ya||n===Xa||n===Ja||n===Ka)if(s===zo){if(r=e.get("WEBGL_compressed_texture_s3tc_srgb"),null===r)return null;if(n===Ya)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Xa)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Ja)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Ka)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(r=e.get("WEBGL_compressed_texture_s3tc"),null===r)return null;if(n===Ya)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Xa)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Ja)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Ka)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(n===Za||n===$a||n===to||n===eo){if(r=e.get("WEBGL_compressed_texture_pvrtc"),null===r)return null;if(n===Za)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===$a)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===to)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===eo)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(n===no||n===io||n===ro){if(r=e.get("WEBGL_compressed_texture_etc"),null===r)return null;if(n===no||n===io)return s===zo?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(n===ro)return s===zo?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC}if(n===so||n===ao||n===oo||n===co||n===lo||n===ho||n===uo||n===po||n===fo||n===Ao||n===go||n===mo||n===_o||n===vo){if(r=e.get("WEBGL_compressed_texture_astc"),null===r)return null;if(n===so)return s===zo?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===ao)return s===zo?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===oo)return s===zo?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===co)return s===zo?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===lo)return s===zo?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===ho)return s===zo?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===uo)return s===zo?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===po)return s===zo?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===fo)return s===zo?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===Ao)return s===zo?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===go)return s===zo?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===mo)return s===zo?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===_o)return s===zo?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===vo)return s===zo?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}if(n===yo||n===bo||n===xo){if(r=e.get("EXT_texture_compression_bptc"),null===r)return null;if(n===yo)return s===zo?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===bo)return r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===xo)return r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}if(36283===n||n===wo||n===Eo||n===Co){if(r=e.get("EXT_texture_compression_rgtc"),null===r)return null;if(n===yo)return r.COMPRESSED_RED_RGTC1_EXT;if(n===wo)return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===Eo)return r.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===Co)return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}return n===Fa?t.UNSIGNED_INT_24_8:void 0!==t[n]?t[n]:null}}}class Zp extends lu{constructor(t=[]){super(),this.isArrayCamera=!0,this.cameras=t}}class $p extends Yl{constructor(){super(),this.isGroup=!0,this.type="Group"}}const tf={type:"move"};class ef{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new $p,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return null===this._targetRay&&(this._targetRay=new $p,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new jc,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new jc),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new $p,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new jc,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new jc),this._grip}dispatchEvent(t){return null!==this._targetRay&&this._targetRay.dispatchEvent(t),null!==this._grip&&this._grip.dispatchEvent(t),null!==this._hand&&this._hand.dispatchEvent(t),this}connect(t){if(t&&t.hand){const e=this._hand;if(e)for(const n of t.hand.values())this._getHandJoint(e,n)}return this.dispatchEvent({type:"connected",data:t}),this}disconnect(t){return this.dispatchEvent({type:"disconnected",data:t}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}update(t,e,n){let i=null,r=null,s=null;const a=this._targetRay,o=this._grip,c=this._hand;if(t&&"visible-blurred"!==e.session.visibilityState){if(c&&t.hand){s=!0;for(const i of t.hand.values()){const t=e.getJointPose(i,n),r=this._getHandJoint(c,i);null!==t&&(r.matrix.fromArray(t.transform.matrix),r.matrix.decompose(r.position,r.rotation,r.scale),r.matrixWorldNeedsUpdate=!0,r.jointRadius=t.radius),r.visible=null!==t}const i=c.joints["index-finger-tip"],r=c.joints["thumb-tip"],a=i.position.distanceTo(r.position),o=.02,l=.005;c.inputState.pinching&&a>o+l?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!c.inputState.pinching&&a<=o-l&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else null!==o&&t.gripSpace&&(r=e.getPose(t.gripSpace,n),null!==r&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1));null!==a&&(i=e.getPose(t.targetRaySpace,n),null===i&&null!==r&&(i=r),null!==i&&(a.matrix.fromArray(i.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,i.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(i.linearVelocity)):a.hasLinearVelocity=!1,i.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(i.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(tf)))}return null!==a&&(a.visible=null!==i),null!==o&&(o.visible=null!==r),null!==c&&(c.visible=null!==s),this}_getHandJoint(t,e){if(void 0===t.joints[e.jointName]){const n=new $p;n.matrixAutoUpdate=!1,n.visible=!1,t.joints[e.jointName]=n,t.add(n)}return t.joints[e.jointName]}}class nf{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(t,e,n){if(null===this.texture){const i=new Nc;t.properties.get(i).__webglTexture=e.texture,e.depthNear==n.depthNear&&e.depthFar==n.depthFar||(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=i}}getMesh(t){if(null!==this.texture&&null===this.mesh){const e=t.cameras[0].viewport,n=new ru({vertexShader:"\nvoid main() {\n\n\tgl_Position = vec4( position, 1.0 );\n\n}",fragmentShader:"\nuniform sampler2DArray depthColor;\nuniform float depthWidth;\nuniform float depthHeight;\n\nvoid main() {\n\n\tvec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );\n\n\tif ( coord.x >= 1.0 ) {\n\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;\n\n\t} else {\n\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;\n\n\t}\n\n}",uniforms:{depthColor:{value:this.texture},depthWidth:{value:e.z},depthHeight:{value:e.w}}});this.mesh=new Kh(new wu(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}}class rf extends ic{constructor(t,e){super();const n=this;let i=null,r=1,s=null,a="local-floor",o=1,c=null,l=null,h=null,u=null,d=null,p=null;const f=new nf,A=e.getContextAttributes();let g=null,m=null;const _=[],v=[],y=new Ac;let b=null;const x=new lu;x.layers.enable(1),x.viewport=new Fc;const w=new lu;w.layers.enable(2),w.viewport=new Fc;const E=[x,w],C=new Zp;C.layers.enable(1),C.layers.enable(2);let S=null,M=null;function I(t){const e=v.indexOf(t.inputSource);if(-1===e)return;const n=_[e];void 0!==n&&(n.update(t.inputSource,t.frame,c||s),n.dispatchEvent({type:t.type,data:t.inputSource}))}function T(){i.removeEventListener("select",I),i.removeEventListener("selectstart",I),i.removeEventListener("selectend",I),i.removeEventListener("squeeze",I),i.removeEventListener("squeezestart",I),i.removeEventListener("squeezeend",I),i.removeEventListener("end",T),i.removeEventListener("inputsourceschange",B);for(let t=0;t<_.length;t++){const e=v[t];null!==e&&(v[t]=null,_[t].disconnect(e))}S=null,M=null,f.reset(),t.setRenderTarget(g),d=null,u=null,h=null,i=null,m=null,k.stop(),n.isPresenting=!1,t.setPixelRatio(b),t.setSize(y.width,y.height,!1),n.dispatchEvent({type:"sessionend"})}function B(t){for(let e=0;e<t.removed.length;e++){const n=t.removed[e],i=v.indexOf(n);i>=0&&(v[i]=null,_[i].disconnect(n))}for(let e=0;e<t.added.length;e++){const n=t.added[e];let i=v.indexOf(n);if(-1===i){for(let t=0;t<_.length;t++){if(t>=v.length){v.push(n),i=t;break}if(null===v[t]){v[t]=n,i=t;break}}if(-1===i)break}const r=_[i];r&&r.connect(n)}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(t){let e=_[t];return void 0===e&&(e=new ef,_[t]=e),e.getTargetRaySpace()},this.getControllerGrip=function(t){let e=_[t];return void 0===e&&(e=new ef,_[t]=e),e.getGripSpace()},this.getHand=function(t){let e=_[t];return void 0===e&&(e=new ef,_[t]=e),e.getHandSpace()},this.setFramebufferScaleFactor=function(t){r=t,n.isPresenting},this.setReferenceSpaceType=function(t){a=t,n.isPresenting},this.getReferenceSpace=function(){return c||s},this.setReferenceSpace=function(t){c=t},this.getBaseLayer=function(){return null!==u?u:d},this.getBinding=function(){return h},this.getFrame=function(){return p},this.getSession=function(){return i},this.setSession=async function(l){if(i=l,null!==i){if(g=t.getRenderTarget(),i.addEventListener("select",I),i.addEventListener("selectstart",I),i.addEventListener("selectend",I),i.addEventListener("squeeze",I),i.addEventListener("squeezestart",I),i.addEventListener("squeezeend",I),i.addEventListener("end",T),i.addEventListener("inputsourceschange",B),!0!==A.xrCompatible&&await e.makeXRCompatible(),b=t.getPixelRatio(),t.getSize(y),void 0===i.renderState.layers){const n={antialias:A.antialias,alpha:!0,depth:A.depth,stencil:A.stencil,framebufferScaleFactor:r};d=new XRWebGLLayer(i,e,n),i.updateRenderState({baseLayer:d}),t.setPixelRatio(1),t.setSize(d.framebufferWidth,d.framebufferHeight,!1),m=new zc(d.framebufferWidth,d.framebufferHeight,{format:Qa,type:Ra,colorSpace:t.outputColorSpace,stencilBuffer:A.stencil})}else{let n=null,s=null,a=null;A.depth&&(a=A.stencil?e.DEPTH24_STENCIL8:e.DEPTH_COMPONENT24,n=A.stencil?Ga:za,s=A.stencil?Fa:Pa);const o={colorFormat:e.RGBA8,depthFormat:a,scaleFactor:r};h=new XRWebGLBinding(i,e),u=h.createProjectionLayer(o),i.updateRenderState({layers:[u]}),t.setPixelRatio(1),t.setSize(u.textureWidth,u.textureHeight,!1),m=new zc(u.textureWidth,u.textureHeight,{format:Qa,type:Ra,depthTexture:new od(u.textureWidth,u.textureHeight,s,void 0,void 0,void 0,void 0,void 0,void 0,n),stencilBuffer:A.stencil,colorSpace:t.outputColorSpace,samples:A.antialias?4:0,resolveDepthBuffer:!1===u.ignoreDepthValues})}m.isXRRenderTarget=!0,this.setFoveation(o),c=null,s=await i.requestReferenceSpace(a),k.setContext(i),k.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(null!==i)return i.environmentBlendMode};const R=new jc,D=new jc;function L(t,e){null===e?t.matrixWorld.copy(t.matrix):t.matrixWorld.multiplyMatrices(e.matrixWorld,t.matrix),t.matrixWorldInverse.copy(t.matrixWorld).invert()}this.updateCamera=function(t){if(null===i)return;null!==f.texture&&(t.near=f.depthNear,t.far=f.depthFar),C.near=w.near=x.near=t.near,C.far=w.far=x.far=t.far,S===C.near&&M===C.far||(i.updateRenderState({depthNear:C.near,depthFar:C.far}),S=C.near,M=C.far,x.near=S,x.far=M,w.near=S,w.far=M,x.updateProjectionMatrix(),w.updateProjectionMatrix(),t.updateProjectionMatrix());const e=t.parent,n=C.cameras;L(C,e);for(let t=0;t<n.length;t++)L(n[t],e);2===n.length?function(t,e,n){R.setFromMatrixPosition(e.matrixWorld),D.setFromMatrixPosition(n.matrixWorld);const i=R.distanceTo(D),r=e.projectionMatrix.elements,s=n.projectionMatrix.elements,a=r[14]/(r[10]-1),o=r[14]/(r[10]+1),c=(r[9]+1)/r[5],l=(r[9]-1)/r[5],h=(r[8]-1)/r[0],u=(s[8]+1)/s[0],d=a*h,p=a*u,f=i/(-h+u),A=f*-h;e.matrixWorld.decompose(t.position,t.quaternion,t.scale),t.translateX(A),t.translateZ(f),t.matrixWorld.compose(t.position,t.quaternion,t.scale),t.matrixWorldInverse.copy(t.matrixWorld).invert();const g=a+f,m=o+f,_=d-A,v=p+(i-A),y=c*o/m*g,b=l*o/m*g;t.projectionMatrix.makePerspective(_,v,y,b,g,m),t.projectionMatrixInverse.copy(t.projectionMatrix).invert()}(C,x,w):C.projectionMatrix.copy(x.projectionMatrix),function(t,e,n){null===n?t.matrix.copy(e.matrixWorld):(t.matrix.copy(n.matrixWorld),t.matrix.invert(),t.matrix.multiply(e.matrixWorld));t.matrix.decompose(t.position,t.quaternion,t.scale),t.updateMatrixWorld(!0),t.projectionMatrix.copy(e.projectionMatrix),t.projectionMatrixInverse.copy(e.projectionMatrixInverse),t.isPerspectiveCamera&&(t.fov=2*oc*Math.atan(1/t.projectionMatrix.elements[5]),t.zoom=1)}(t,C,e)},this.getCamera=function(){return C},this.getFoveation=function(){if(null!==u||null!==d)return o},this.setFoveation=function(t){o=t,null!==u&&(u.fixedFoveation=t),null!==d&&void 0!==d.fixedFoveation&&(d.fixedFoveation=t)},this.hasDepthSensing=function(){return null!==f.texture},this.getDepthSensingMesh=function(){return f.getMesh(C)};let P=null;const k=new bu;k.setAnimationLoop((function(e,r){if(l=r.getViewerPose(c||s),p=r,null!==l){const e=l.views;null!==d&&(t.setRenderTargetFramebuffer(m,d.framebuffer),t.setRenderTarget(m));let n=!1;e.length!==C.cameras.length&&(C.cameras.length=0,n=!0);for(let i=0;i<e.length;i++){const r=e[i];let s=null;if(null!==d)s=d.getViewport(r);else{const e=h.getViewSubImage(u,r);s=e.viewport,0===i&&(t.setRenderTargetTextures(m,e.colorTexture,u.ignoreDepthValues?void 0:e.depthStencilTexture),t.setRenderTarget(m))}let a=E[i];void 0===a&&(a=new lu,a.layers.enable(i),a.viewport=new Fc,E[i]=a),a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.quaternion,a.scale),a.projectionMatrix.fromArray(r.projectionMatrix),a.projectionMatrixInverse.copy(a.projectionMatrix).invert(),a.viewport.set(s.x,s.y,s.width,s.height),0===i&&(C.matrix.copy(a.matrix),C.matrix.decompose(C.position,C.quaternion,C.scale)),!0===n&&C.cameras.push(a)}const r=i.enabledFeatures;if(r&&r.includes("depth-sensing")){const n=h.getDepthInformation(e[0]);n&&n.isValid&&n.texture&&f.init(t,n,i.renderState)}}for(let t=0;t<_.length;t++){const e=v[t],n=_[t];null!==e&&void 0!==n&&n.update(e,r,c||s)}P&&P(e,r),r.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:r}),p=null})),this.setAnimationLoop=function(t){P=t},this.dispose=function(){}}}const sf=new Rl,af=new bl;function of(t,e){function n(t,e){!0===t.matrixAutoUpdate&&t.updateMatrix(),e.value.copy(t.matrix)}function i(t,i){t.opacity.value=i.opacity,i.color&&t.diffuse.value.copy(i.color),i.emissive&&t.emissive.value.copy(i.emissive).multiplyScalar(i.emissiveIntensity),i.map&&(t.map.value=i.map,n(i.map,t.mapTransform)),i.alphaMap&&(t.alphaMap.value=i.alphaMap,n(i.alphaMap,t.alphaMapTransform)),i.bumpMap&&(t.bumpMap.value=i.bumpMap,n(i.bumpMap,t.bumpMapTransform),t.bumpScale.value=i.bumpScale,i.side===Us&&(t.bumpScale.value*=-1)),i.normalMap&&(t.normalMap.value=i.normalMap,n(i.normalMap,t.normalMapTransform),t.normalScale.value.copy(i.normalScale),i.side===Us&&t.normalScale.value.negate()),i.displacementMap&&(t.displacementMap.value=i.displacementMap,n(i.displacementMap,t.displacementMapTransform),t.displacementScale.value=i.displacementScale,t.displacementBias.value=i.displacementBias),i.emissiveMap&&(t.emissiveMap.value=i.emissiveMap,n(i.emissiveMap,t.emissiveMapTransform)),i.specularMap&&(t.specularMap.value=i.specularMap,n(i.specularMap,t.specularMapTransform)),i.alphaTest>0&&(t.alphaTest.value=i.alphaTest);const r=e.get(i),s=r.envMap,a=r.envMapRotation;s&&(t.envMap.value=s,sf.copy(a),sf.x*=-1,sf.y*=-1,sf.z*=-1,s.isCubeTexture&&!1===s.isRenderTargetTexture&&(sf.y*=-1,sf.z*=-1),t.envMapRotation.value.setFromMatrix4(af.makeRotationFromEuler(sf)),t.flipEnvMap.value=s.isCubeTexture&&!1===s.isRenderTargetTexture?-1:1,t.reflectivity.value=i.reflectivity,t.ior.value=i.ior,t.refractionRatio.value=i.refractionRatio),i.lightMap&&(t.lightMap.value=i.lightMap,t.lightMapIntensity.value=i.lightMapIntensity,n(i.lightMap,t.lightMapTransform)),i.aoMap&&(t.aoMap.value=i.aoMap,t.aoMapIntensity.value=i.aoMapIntensity,n(i.aoMap,t.aoMapTransform))}return{refreshFogUniforms:function(e,n){n.color.getRGB(e.fogColor.value,nu(t)),n.isFog?(e.fogNear.value=n.near,e.fogFar.value=n.far):n.isFogExp2&&(e.fogDensity.value=n.density)},refreshMaterialUniforms:function(t,r,s,a,o){r.isMeshBasicMaterial||r.isMeshLambertMaterial?i(t,r):r.isMeshToonMaterial?(i(t,r),function(t,e){e.gradientMap&&(t.gradientMap.value=e.gradientMap)}(t,r)):r.isMeshPhongMaterial?(i(t,r),function(t,e){t.specular.value.copy(e.specular),t.shininess.value=Math.max(e.shininess,1e-4)}(t,r)):r.isMeshStandardMaterial?(i(t,r),function(t,e){t.metalness.value=e.metalness,e.metalnessMap&&(t.metalnessMap.value=e.metalnessMap,n(e.metalnessMap,t.metalnessMapTransform));t.roughness.value=e.roughness,e.roughnessMap&&(t.roughnessMap.value=e.roughnessMap,n(e.roughnessMap,t.roughnessMapTransform));e.envMap&&(t.envMapIntensity.value=e.envMapIntensity)}(t,r),r.isMeshPhysicalMaterial&&function(t,e,i){t.ior.value=e.ior,e.sheen>0&&(t.sheenColor.value.copy(e.sheenColor).multiplyScalar(e.sheen),t.sheenRoughness.value=e.sheenRoughness,e.sheenColorMap&&(t.sheenColorMap.value=e.sheenColorMap,n(e.sheenColorMap,t.sheenColorMapTransform)),e.sheenRoughnessMap&&(t.sheenRoughnessMap.value=e.sheenRoughnessMap,n(e.sheenRoughnessMap,t.sheenRoughnessMapTransform)));e.clearcoat>0&&(t.clearcoat.value=e.clearcoat,t.clearcoatRoughness.value=e.clearcoatRoughness,e.clearcoatMap&&(t.clearcoatMap.value=e.clearcoatMap,n(e.clearcoatMap,t.clearcoatMapTransform)),e.clearcoatRoughnessMap&&(t.clearcoatRoughnessMap.value=e.clearcoatRoughnessMap,n(e.clearcoatRoughnessMap,t.clearcoatRoughnessMapTransform)),e.clearcoatNormalMap&&(t.clearcoatNormalMap.value=e.clearcoatNormalMap,n(e.clearcoatNormalMap,t.clearcoatNormalMapTransform),t.clearcoatNormalScale.value.copy(e.clearcoatNormalScale),e.side===Us&&t.clearcoatNormalScale.value.negate()));e.dispersion>0&&(t.dispersion.value=e.dispersion);e.iridescence>0&&(t.iridescence.value=e.iridescence,t.iridescenceIOR.value=e.iridescenceIOR,t.iridescenceThicknessMinimum.value=e.iridescenceThicknessRange[0],t.iridescenceThicknessMaximum.value=e.iridescenceThicknessRange[1],e.iridescenceMap&&(t.iridescenceMap.value=e.iridescenceMap,n(e.iridescenceMap,t.iridescenceMapTransform)),e.iridescenceThicknessMap&&(t.iridescenceThicknessMap.value=e.iridescenceThicknessMap,n(e.iridescenceThicknessMap,t.iridescenceThicknessMapTransform)));e.transmission>0&&(t.transmission.value=e.transmission,t.transmissionSamplerMap.value=i.texture,t.transmissionSamplerSize.value.set(i.width,i.height),e.transmissionMap&&(t.transmissionMap.value=e.transmissionMap,n(e.transmissionMap,t.transmissionMapTransform)),t.thickness.value=e.thickness,e.thicknessMap&&(t.thicknessMap.value=e.thicknessMap,n(e.thicknessMap,t.thicknessMapTransform)),t.attenuationDistance.value=e.attenuationDistance,t.attenuationColor.value.copy(e.attenuationColor));e.anisotropy>0&&(t.anisotropyVector.value.set(e.anisotropy*Math.cos(e.anisotropyRotation),e.anisotropy*Math.sin(e.anisotropyRotation)),e.anisotropyMap&&(t.anisotropyMap.value=e.anisotropyMap,n(e.anisotropyMap,t.anisotropyMapTransform)));t.specularIntensity.value=e.specularIntensity,t.specularColor.value.copy(e.specularColor),e.specularColorMap&&(t.specularColorMap.value=e.specularColorMap,n(e.specularColorMap,t.specularColorMapTransform));e.specularIntensityMap&&(t.specularIntensityMap.value=e.specularIntensityMap,n(e.specularIntensityMap,t.specularIntensityMapTransform))}(t,r,o)):r.isMeshMatcapMaterial?(i(t,r),function(t,e){e.matcap&&(t.matcap.value=e.matcap)}(t,r)):r.isMeshDepthMaterial?i(t,r):r.isMeshDistanceMaterial?(i(t,r),function(t,n){const i=e.get(n).light;t.referencePosition.value.setFromMatrixPosition(i.matrixWorld),t.nearDistance.value=i.shadow.camera.near,t.farDistance.value=i.shadow.camera.far}(t,r)):r.isMeshNormalMaterial?i(t,r):r.isLineBasicMaterial?(function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,e.map&&(t.map.value=e.map,n(e.map,t.mapTransform))}(t,r),r.isLineDashedMaterial&&function(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}(t,r)):r.isPointsMaterial?function(t,e,i,r){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.size.value=e.size*i,t.scale.value=.5*r,e.map&&(t.map.value=e.map,n(e.map,t.uvTransform));e.alphaMap&&(t.alphaMap.value=e.alphaMap,n(e.alphaMap,t.alphaMapTransform));e.alphaTest>0&&(t.alphaTest.value=e.alphaTest)}(t,r,s,a):r.isSpriteMaterial?function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.rotation.value=e.rotation,e.map&&(t.map.value=e.map,n(e.map,t.mapTransform));e.alphaMap&&(t.alphaMap.value=e.alphaMap,n(e.alphaMap,t.alphaMapTransform));e.alphaTest>0&&(t.alphaTest.value=e.alphaTest)}(t,r):r.isShadowMaterial?(t.color.value.copy(r.color),t.opacity.value=r.opacity):r.isShaderMaterial&&(r.uniformsNeedUpdate=!1)}}}function cf(t,e,n,i){let r={},s={},a=[];const o=t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS);function c(t,e,n,i){const r=t.value,s=e+"_"+n;if(void 0===i[s])return i[s]="number"==typeof r||"boolean"==typeof r?r:r.clone(),!0;{const t=i[s];if("number"==typeof r||"boolean"==typeof r){if(t!==r)return i[s]=r,!0}else if(!1===t.equals(r))return t.copy(r),!0}return!1}function l(t){const e={boundary:0,storage:0};return"number"==typeof t||"boolean"==typeof t?(e.boundary=4,e.storage=4):t.isVector2?(e.boundary=8,e.storage=8):t.isVector3||t.isColor?(e.boundary=16,e.storage=12):t.isVector4?(e.boundary=16,e.storage=16):t.isMatrix3?(e.boundary=48,e.storage=48):t.isMatrix4?(e.boundary=64,e.storage=64):t.isTexture,e}function h(e){const n=e.target;n.removeEventListener("dispose",h);const i=a.indexOf(n.__bindingPointIndex);a.splice(i,1),t.deleteBuffer(r[n.id]),delete r[n.id],delete s[n.id]}return{bind:function(t,e){const n=e.program;i.uniformBlockBinding(t,n)},update:function(n,u){let d=r[n.id];void 0===d&&(!function(t){const e=t.uniforms;let n=0;const i=16;for(let t=0,r=e.length;t<r;t++){const r=Array.isArray(e[t])?e[t]:[e[t]];for(let t=0,e=r.length;t<e;t++){const e=r[t],s=Array.isArray(e.value)?e.value:[e.value];for(let t=0,r=s.length;t<r;t++){const r=l(s[t]),a=n%i;0!==a&&i-a<r.boundary&&(n+=i-a),e.__data=new Float32Array(r.storage/Float32Array.BYTES_PER_ELEMENT),e.__offset=n,n+=r.storage}}}const r=n%i;r>0&&(n+=i-r);t.__size=n,t.__cache={}}(n),d=function(e){const n=function(){for(let t=0;t<o;t++)if(-1===a.indexOf(t))return a.push(t),t;return 0}();e.__bindingPointIndex=n;const i=t.createBuffer(),r=e.__size,s=e.usage;return t.bindBuffer(t.UNIFORM_BUFFER,i),t.bufferData(t.UNIFORM_BUFFER,r,s),t.bindBuffer(t.UNIFORM_BUFFER,null),t.bindBufferBase(t.UNIFORM_BUFFER,n,i),i}(n),r[n.id]=d,n.addEventListener("dispose",h));const p=u.program;i.updateUBOMapping(n,p);const f=e.render.frame;s[n.id]!==f&&(!function(e){const n=r[e.id],i=e.uniforms,s=e.__cache;t.bindBuffer(t.UNIFORM_BUFFER,n);for(let e=0,n=i.length;e<n;e++){const n=Array.isArray(i[e])?i[e]:[i[e]];for(let i=0,r=n.length;i<r;i++){const r=n[i];if(!0===c(r,e,i,s)){const e=r.__offset,n=Array.isArray(r.value)?r.value:[r.value];let i=0;for(let s=0;s<n.length;s++){const a=n[s],o=l(a);"number"==typeof a||"boolean"==typeof a?(r.__data[0]=a,t.bufferSubData(t.UNIFORM_BUFFER,e+i,r.__data)):a.isMatrix3?(r.__data[0]=a.elements[0],r.__data[1]=a.elements[1],r.__data[2]=a.elements[2],r.__data[3]=0,r.__data[4]=a.elements[3],r.__data[5]=a.elements[4],r.__data[6]=a.elements[5],r.__data[7]=0,r.__data[8]=a.elements[6],r.__data[9]=a.elements[7],r.__data[10]=a.elements[8],r.__data[11]=0):(a.toArray(r.__data,i),i+=o.storage/Float32Array.BYTES_PER_ELEMENT)}t.bufferSubData(t.UNIFORM_BUFFER,e,r.__data)}}}t.bindBuffer(t.UNIFORM_BUFFER,null)}(n),s[n.id]=f)},dispose:function(){for(const e in r)t.deleteBuffer(r[e]);a=[],r={},s={}}}}class lf{constructor(t={}){const{canvas:e=xc(),context:n=null,depth:i=!0,stencil:r=!1,alpha:s=!1,antialias:a=!1,premultipliedAlpha:o=!0,preserveDrawingBuffer:c=!1,powerPreference:l="default",failIfMajorPerformanceCaveat:h=!1}=t;let u;if(this.isWebGLRenderer=!0,null!==n){if("undefined"!=typeof WebGLRenderingContext&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");u=n.getContextAttributes().alpha}else u=s;const d=new Uint32Array(4),p=new Int32Array(4);let f=null,A=null;const g=[],m=[];this.domElement=e,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=Oo,this.toneMapping=aa,this.toneMappingExposure=1;const _=this;let v=!1,y=0,b=0,x=null,w=-1,E=null;const C=new Fc,S=new Fc;let M=null;const I=new hh(0);let T=0,B=e.width,R=e.height,D=1,L=null,P=null;const k=new Fc(0,0,B,R),O=new Fc(0,0,B,R);let U=!1;const N=new yu;let F=!1,Q=!1;const z=new bl,G=new jc,H={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let V=!1;function j(){return null===x?D:1}let W,q,Y,X,J,K,Z,$,tt,et,nt,it,rt,st,at,ot,ct,lt,ht,ut,dt,pt,ft,At,gt=n;function mt(t,n){return e.getContext(t,n)}try{const t={alpha:!0,depth:i,stencil:r,antialias:a,premultipliedAlpha:o,preserveDrawingBuffer:c,powerPreference:l,failIfMajorPerformanceCaveat:h};if("setAttribute"in e&&e.setAttribute("data-engine",`three.js r${Bs}`),e.addEventListener("webglcontextlost",yt,!1),e.addEventListener("webglcontextrestored",bt,!1),e.addEventListener("webglcontextcreationerror",xt,!1),null===gt){const e="webgl2";if(gt=mt(e,t),null===gt)throw mt(e)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(t){throw t}function _t(){W=new ed(gt),W.init(),pt=new Kp(gt,W),q=new Lu(gt,W,t,pt),Y=new Xp(gt),X=new rd(gt),J=new kp,K=new Jp(gt,W,Y,J,q,pt,X),Z=new ku(_),$=new td(_),tt=new xu(gt),ft=new Ru(gt,tt),et=new nd(gt,tt,X,ft),nt=new ad(gt,et,tt,X),ht=new sd(gt,q,K),ot=new Pu(J),it=new Pp(_,Z,$,W,q,ft,ot),rt=new of(_,J),st=new Fp,at=new jp(W),lt=new Bu(_,Z,$,Y,nt,u,o),ct=new Yp(_,nt,q),At=new cf(gt,X,q,Y),ut=new Du(gt,W,X),dt=new id(gt,W,X),X.programs=it.programs,_.capabilities=q,_.extensions=W,_.properties=J,_.renderLists=st,_.shadowMap=ct,_.state=Y,_.info=X}_t();const vt=new rf(_,gt);function yt(t){t.preventDefault(),v=!0}function bt(){v=!1;const t=X.autoReset,e=ct.enabled,n=ct.autoUpdate,i=ct.needsUpdate,r=ct.type;_t(),X.autoReset=t,ct.enabled=e,ct.autoUpdate=n,ct.needsUpdate=i,ct.type=r}function xt(t){}function wt(t){const e=t.target;e.removeEventListener("dispose",wt),function(t){(function(t){const e=J.get(t).programs;void 0!==e&&(e.forEach((function(t){it.releaseProgram(t)})),t.isShaderMaterial&&it.releaseShaderCache(t))})(t),J.remove(t)}(e)}function Et(t,e,n){!0===t.transparent&&2===t.side&&!1===t.forceSinglePass?(t.side=Us,t.needsUpdate=!0,Pt(t,e,n),t.side=Os,t.needsUpdate=!0,Pt(t,e,n),t.side=2):Pt(t,e,n)}this.xr=vt,this.getContext=function(){return gt},this.getContextAttributes=function(){return gt.getContextAttributes()},this.forceContextLoss=function(){const t=W.get("WEBGL_lose_context");t&&t.loseContext()},this.forceContextRestore=function(){const t=W.get("WEBGL_lose_context");t&&t.restoreContext()},this.getPixelRatio=function(){return D},this.setPixelRatio=function(t){void 0!==t&&(D=t,this.setSize(B,R,!1))},this.getSize=function(t){return t.set(B,R)},this.setSize=function(t,n,i=!0){vt.isPresenting||(B=t,R=n,e.width=Math.floor(t*D),e.height=Math.floor(n*D),!0===i&&(e.style.width=t+"px",e.style.height=n+"px"),this.setViewport(0,0,t,n))},this.getDrawingBufferSize=function(t){return t.set(B*D,R*D).floor()},this.setDrawingBufferSize=function(t,n,i){B=t,R=n,D=i,e.width=Math.floor(t*i),e.height=Math.floor(n*i),this.setViewport(0,0,t,n)},this.getCurrentViewport=function(t){return t.copy(C)},this.getViewport=function(t){return t.copy(k)},this.setViewport=function(t,e,n,i){t.isVector4?k.set(t.x,t.y,t.z,t.w):k.set(t,e,n,i),Y.viewport(C.copy(k).multiplyScalar(D).round())},this.getScissor=function(t){return t.copy(O)},this.setScissor=function(t,e,n,i){t.isVector4?O.set(t.x,t.y,t.z,t.w):O.set(t,e,n,i),Y.scissor(S.copy(O).multiplyScalar(D).round())},this.getScissorTest=function(){return U},this.setScissorTest=function(t){Y.setScissorTest(U=t)},this.setOpaqueSort=function(t){L=t},this.setTransparentSort=function(t){P=t},this.getClearColor=function(t){return t.copy(lt.getClearColor())},this.setClearColor=function(){lt.setClearColor.apply(lt,arguments)},this.getClearAlpha=function(){return lt.getClearAlpha()},this.setClearAlpha=function(){lt.setClearAlpha.apply(lt,arguments)},this.clear=function(t=!0,e=!0,n=!0){let i=0;if(t){let t=!1;if(null!==x){const e=x.texture.format;t=e===qa||e===Wa||e===Va}if(t){const t=x.texture.type,e=t===Ra||t===Pa||t===Da||t===Fa||t===Ua||t===Na,n=lt.getClearColor(),i=lt.getClearAlpha(),r=n.r,s=n.g,a=n.b;e?(d[0]=r,d[1]=s,d[2]=a,d[3]=i,gt.clearBufferuiv(gt.COLOR,0,d)):(p[0]=r,p[1]=s,p[2]=a,p[3]=i,gt.clearBufferiv(gt.COLOR,0,p))}else i|=gt.COLOR_BUFFER_BIT}e&&(i|=gt.DEPTH_BUFFER_BIT),n&&(i|=gt.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),gt.clear(i)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){e.removeEventListener("webglcontextlost",yt,!1),e.removeEventListener("webglcontextrestored",bt,!1),e.removeEventListener("webglcontextcreationerror",xt,!1),st.dispose(),at.dispose(),J.dispose(),Z.dispose(),$.dispose(),nt.dispose(),ft.dispose(),At.dispose(),it.dispose(),vt.dispose(),vt.removeEventListener("sessionstart",St),vt.removeEventListener("sessionend",Mt),It.stop()},this.renderBufferDirect=function(t,e,n,i,r,s){null===e&&(e=H);const a=r.isMesh&&r.matrixWorld.determinant()<0,o=function(t,e,n,i,r){!0!==e.isScene&&(e=H);K.resetTextureUnits();const s=e.fog,a=i.isMeshStandardMaterial?e.environment:null,o=null===x?_.outputColorSpace:!0===x.isXRRenderTarget?x.texture.colorSpace:Uo,c=(i.isMeshStandardMaterial?$:Z).get(i.envMap||a),l=!0===i.vertexColors&&!!n.attributes.color&&4===n.attributes.color.itemSize,h=!!n.attributes.tangent&&(!!i.normalMap||i.anisotropy>0),u=!!n.morphAttributes.position,d=!!n.morphAttributes.normal,p=!!n.morphAttributes.color;let f=aa;i.toneMapped&&(null!==x&&!0!==x.isXRRenderTarget||(f=_.toneMapping));const g=n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color,m=void 0!==g?g.length:0,v=J.get(i),y=A.state.lights;if(!0===F&&(!0===Q||t!==E)){const e=t===E&&i.id===w;ot.setState(i,t,e)}let b=!1;i.version===v.__version?v.needsLights&&v.lightsStateVersion!==y.state.version||v.outputColorSpace!==o||r.isBatchedMesh&&!1===v.batching?b=!0:r.isBatchedMesh||!0!==v.batching?r.isBatchedMesh&&!0===v.batchingColor&&null===r.colorTexture||r.isBatchedMesh&&!1===v.batchingColor&&null!==r.colorTexture||r.isInstancedMesh&&!1===v.instancing?b=!0:r.isInstancedMesh||!0!==v.instancing?r.isSkinnedMesh&&!1===v.skinning?b=!0:r.isSkinnedMesh||!0!==v.skinning?r.isInstancedMesh&&!0===v.instancingColor&&null===r.instanceColor||r.isInstancedMesh&&!1===v.instancingColor&&null!==r.instanceColor||r.isInstancedMesh&&!0===v.instancingMorph&&null===r.morphTexture||r.isInstancedMesh&&!1===v.instancingMorph&&null!==r.morphTexture||v.envMap!==c||!0===i.fog&&v.fog!==s?b=!0:void 0===v.numClippingPlanes||v.numClippingPlanes===ot.numPlanes&&v.numIntersection===ot.numIntersection?(v.vertexAlphas!==l||v.vertexTangents!==h||v.morphTargets!==u||v.morphNormals!==d||v.morphColors!==p||v.toneMapping!==f||v.morphTargetsCount!==m)&&(b=!0):b=!0:b=!0:b=!0:b=!0:(b=!0,v.__version=i.version);let C=v.currentProgram;!0===b&&(C=Pt(i,e,r));let S=!1,M=!1,I=!1;const T=C.getUniforms(),B=v.uniforms;Y.useProgram(C.program)&&(S=!0,M=!0,I=!0);i.id!==w&&(w=i.id,M=!0);if(S||E!==t){T.setValue(gt,"projectionMatrix",t.projectionMatrix),T.setValue(gt,"viewMatrix",t.matrixWorldInverse);const e=T.map.cameraPosition;void 0!==e&&e.setValue(gt,G.setFromMatrixPosition(t.matrixWorld)),q.logarithmicDepthBuffer&&T.setValue(gt,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),(i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial)&&T.setValue(gt,"isOrthographic",!0===t.isOrthographicCamera),E!==t&&(E=t,M=!0,I=!0)}if(r.isSkinnedMesh){T.setOptional(gt,r,"bindMatrix"),T.setOptional(gt,r,"bindMatrixInverse");const t=r.skeleton;t&&(null===t.boneTexture&&t.computeBoneTexture(),T.setValue(gt,"boneTexture",t.boneTexture,K))}r.isBatchedMesh&&(T.setOptional(gt,r,"batchingTexture"),T.setValue(gt,"batchingTexture",r._matricesTexture,K),T.setOptional(gt,r,"batchingColorTexture"),null!==r._colorsTexture&&T.setValue(gt,"batchingColorTexture",r._colorsTexture,K));const L=n.morphAttributes;void 0===L.position&&void 0===L.normal&&void 0===L.color||ht.update(r,n,C);(M||v.receiveShadow!==r.receiveShadow)&&(v.receiveShadow=r.receiveShadow,T.setValue(gt,"receiveShadow",r.receiveShadow));i.isMeshGouraudMaterial&&null!==i.envMap&&(B.envMap.value=c,B.flipEnvMap.value=c.isCubeTexture&&!1===c.isRenderTargetTexture?-1:1);i.isMeshStandardMaterial&&null===i.envMap&&null!==e.environment&&(B.envMapIntensity.value=e.environmentIntensity);M&&(T.setValue(gt,"toneMappingExposure",_.toneMappingExposure),v.needsLights&&(k=I,(P=B).ambientLightColor.needsUpdate=k,P.lightProbe.needsUpdate=k,P.directionalLights.needsUpdate=k,P.directionalLightShadows.needsUpdate=k,P.pointLights.needsUpdate=k,P.pointLightShadows.needsUpdate=k,P.spotLights.needsUpdate=k,P.spotLightShadows.needsUpdate=k,P.rectAreaLights.needsUpdate=k,P.hemisphereLights.needsUpdate=k),s&&!0===i.fog&&rt.refreshFogUniforms(B,s),rt.refreshMaterialUniforms(B,i,D,R,A.state.transmissionRenderTarget[t.id]),dp.upload(gt,kt(v),B,K));var P,k;i.isShaderMaterial&&!0===i.uniformsNeedUpdate&&(dp.upload(gt,kt(v),B,K),i.uniformsNeedUpdate=!1);i.isSpriteMaterial&&T.setValue(gt,"center",r.center);if(T.setValue(gt,"modelViewMatrix",r.modelViewMatrix),T.setValue(gt,"normalMatrix",r.normalMatrix),T.setValue(gt,"modelMatrix",r.matrixWorld),i.isShaderMaterial||i.isRawShaderMaterial){const t=i.uniformsGroups;for(let e=0,n=t.length;e<n;e++){const n=t[e];At.update(n,C),At.bind(n,C)}}return C}(t,e,n,i,r);Y.setMaterial(i,a);let c=n.index,l=1;if(!0===i.wireframe){if(c=et.getWireframeAttribute(n),void 0===c)return;l=2}const h=n.drawRange,u=n.attributes.position;let d=h.start*l,p=(h.start+h.count)*l;null!==s&&(d=Math.max(d,s.start*l),p=Math.min(p,(s.start+s.count)*l)),null!==c?(d=Math.max(d,0),p=Math.min(p,c.count)):null!=u&&(d=Math.max(d,0),p=Math.min(p,u.count));const f=p-d;if(f<0||f===1/0)return;let g;ft.setup(r,i,o,n,c);let m=ut;if(null!==c&&(g=tt.get(c),m=dt,m.setIndex(g)),r.isMesh)!0===i.wireframe?(Y.setLineWidth(i.wireframeLinewidth*j()),m.setMode(gt.LINES)):m.setMode(gt.TRIANGLES);else if(r.isLine){let t=i.linewidth;void 0===t&&(t=1),Y.setLineWidth(t*j()),r.isLineSegments?m.setMode(gt.LINES):r.isLineLoop?m.setMode(gt.LINE_LOOP):m.setMode(gt.LINE_STRIP)}else r.isPoints?m.setMode(gt.POINTS):r.isSprite&&m.setMode(gt.TRIANGLES);if(r.isBatchedMesh)null!==r._multiDrawInstances?m.renderMultiDrawInstances(r._multiDrawStarts,r._multiDrawCounts,r._multiDrawCount,r._multiDrawInstances):m.renderMultiDraw(r._multiDrawStarts,r._multiDrawCounts,r._multiDrawCount);else if(r.isInstancedMesh)m.renderInstances(d,f,r.count);else if(n.isInstancedBufferGeometry){const t=void 0!==n._maxInstanceCount?n._maxInstanceCount:1/0,e=Math.min(n.instanceCount,t);m.renderInstances(d,f,e)}else m.render(d,f)},this.compile=function(t,e,n=null){null===n&&(n=t),A=at.get(n),A.init(e),m.push(A),n.traverseVisible((function(t){t.isLight&&t.layers.test(e.layers)&&(A.pushLight(t),t.castShadow&&A.pushShadow(t))})),t!==n&&t.traverseVisible((function(t){t.isLight&&t.layers.test(e.layers)&&(A.pushLight(t),t.castShadow&&A.pushShadow(t))})),A.setupLights();const i=new Set;return t.traverse((function(t){const e=t.material;if(e)if(Array.isArray(e))for(let r=0;r<e.length;r++){const s=e[r];Et(s,n,t),i.add(s)}else Et(e,n,t),i.add(e)})),m.pop(),A=null,i},this.compileAsync=function(t,e,n=null){const i=this.compile(t,e,n);return new Promise((e=>{function n(){i.forEach((function(t){J.get(t).currentProgram.isReady()&&i.delete(t)})),0!==i.size?setTimeout(n,10):e(t)}null!==W.get("KHR_parallel_shader_compile")?n():setTimeout(n,10)}))};let Ct=null;function St(){It.stop()}function Mt(){It.start()}const It=new bu;function Tt(t,e,n,i){if(!1===t.visible)return;if(t.layers.test(e.layers))if(t.isGroup)n=t.renderOrder;else if(t.isLOD)!0===t.autoUpdate&&t.update(e);else if(t.isLight)A.pushLight(t),t.castShadow&&A.pushShadow(t);else if(t.isSprite){if(!t.frustumCulled||N.intersectsSprite(t)){i&&G.setFromMatrixPosition(t.matrixWorld).applyMatrix4(z);const e=nt.update(t),r=t.material;r.visible&&f.push(t,e,r,n,G.z,null)}}else if((t.isMesh||t.isLine||t.isPoints)&&(!t.frustumCulled||N.intersectsObject(t))){const e=nt.update(t),r=t.material;if(i&&(void 0!==t.boundingSphere?(null===t.boundingSphere&&t.computeBoundingSphere(),G.copy(t.boundingSphere.center)):(null===e.boundingSphere&&e.computeBoundingSphere(),G.copy(e.boundingSphere.center)),G.applyMatrix4(t.matrixWorld).applyMatrix4(z)),Array.isArray(r)){const i=e.groups;for(let s=0,a=i.length;s<a;s++){const a=i[s],o=r[a.materialIndex];o&&o.visible&&f.push(t,e,o,n,G.z,a)}}else r.visible&&f.push(t,e,r,n,G.z,null)}const r=t.children;for(let t=0,s=r.length;t<s;t++)Tt(r[t],e,n,i)}function Bt(t,e,n,i){const r=t.opaque,s=t.transmissive,a=t.transparent;A.setupLightsView(n),!0===F&&ot.setGlobalState(_.clippingPlanes,n),i&&Y.viewport(C.copy(i)),r.length>0&&Dt(r,e,n),s.length>0&&Dt(s,e,n),a.length>0&&Dt(a,e,n),Y.buffers.depth.setTest(!0),Y.buffers.depth.setMask(!0),Y.buffers.color.setMask(!0),Y.setPolygonOffset(!1)}function Rt(t,e,n,i){if(null!==(!0===n.isScene?n.overrideMaterial:null))return;void 0===A.state.transmissionRenderTarget[i.id]&&(A.state.transmissionRenderTarget[i.id]=new zc(1,1,{generateMipmaps:!0,type:W.has("EXT_color_buffer_half_float")||W.has("EXT_color_buffer_float")?Oa:Ra,minFilter:Ba,samples:4,stencilBuffer:r,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Tc.workingColorSpace}));const s=A.state.transmissionRenderTarget[i.id],a=i.viewport||C;s.setSize(a.z,a.w);const o=_.getRenderTarget();_.setRenderTarget(s),_.getClearColor(I),T=_.getClearAlpha(),T<1&&_.setClearColor(16777215,.5),V?lt.render(n):_.clear();const c=_.toneMapping;_.toneMapping=aa;const l=i.viewport;if(void 0!==i.viewport&&(i.viewport=void 0),A.setupLightsView(i),!0===F&&ot.setGlobalState(_.clippingPlanes,i),Dt(t,n,i),K.updateMultisampleRenderTarget(s),K.updateRenderTargetMipmap(s),!1===W.has("WEBGL_multisampled_render_to_texture")){let t=!1;for(let r=0,s=e.length;r<s;r++){const s=e[r],a=s.object,o=s.geometry,c=s.material,l=s.group;if(2===c.side&&a.layers.test(i.layers)){const e=c.side;c.side=Us,c.needsUpdate=!0,Lt(a,n,i,o,c,l),c.side=e,c.needsUpdate=!0,t=!0}}!0===t&&(K.updateMultisampleRenderTarget(s),K.updateRenderTargetMipmap(s))}_.setRenderTarget(o),_.setClearColor(I,T),void 0!==l&&(i.viewport=l),_.toneMapping=c}function Dt(t,e,n){const i=!0===e.isScene?e.overrideMaterial:null;for(let r=0,s=t.length;r<s;r++){const s=t[r],a=s.object,o=s.geometry,c=null===i?s.material:i,l=s.group;a.layers.test(n.layers)&&Lt(a,e,n,o,c,l)}}function Lt(t,e,n,i,r,s){t.onBeforeRender(_,e,n,i,r,s),t.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix),r.onBeforeRender(_,e,n,i,t,s),!0===r.transparent&&2===r.side&&!1===r.forceSinglePass?(r.side=Us,r.needsUpdate=!0,_.renderBufferDirect(n,e,i,r,t,s),r.side=Os,r.needsUpdate=!0,_.renderBufferDirect(n,e,i,r,t,s),r.side=2):_.renderBufferDirect(n,e,i,r,t,s),t.onAfterRender(_,e,n,i,r,s)}function Pt(t,e,n){!0!==e.isScene&&(e=H);const i=J.get(t),r=A.state.lights,s=A.state.shadowsArray,a=r.state.version,o=it.getParameters(t,r.state,s,e,n),c=it.getProgramCacheKey(o);let l=i.programs;i.environment=t.isMeshStandardMaterial?e.environment:null,i.fog=e.fog,i.envMap=(t.isMeshStandardMaterial?$:Z).get(t.envMap||i.environment),i.envMapRotation=null!==i.environment&&null===t.envMap?e.environmentRotation:t.envMapRotation,void 0===l&&(t.addEventListener("dispose",wt),l=new Map,i.programs=l);let h=l.get(c);if(void 0!==h){if(i.currentProgram===h&&i.lightsStateVersion===a)return Ot(t,o),h}else o.uniforms=it.getUniforms(t),t.onBuild(n,o,_),t.onBeforeCompile(o,_),h=it.acquireProgram(o,c),l.set(c,h),i.uniforms=o.uniforms;const u=i.uniforms;return(t.isShaderMaterial||t.isRawShaderMaterial)&&!0!==t.clipping||(u.clippingPlanes=ot.uniform),Ot(t,o),i.needsLights=function(t){return t.isMeshLambertMaterial||t.isMeshToonMaterial||t.isMeshPhongMaterial||t.isMeshStandardMaterial||t.isShadowMaterial||t.isShaderMaterial&&!0===t.lights}(t),i.lightsStateVersion=a,i.needsLights&&(u.ambientLightColor.value=r.state.ambient,u.lightProbe.value=r.state.probe,u.directionalLights.value=r.state.directional,u.directionalLightShadows.value=r.state.directionalShadow,u.spotLights.value=r.state.spot,u.spotLightShadows.value=r.state.spotShadow,u.rectAreaLights.value=r.state.rectArea,u.ltc_1.value=r.state.rectAreaLTC1,u.ltc_2.value=r.state.rectAreaLTC2,u.pointLights.value=r.state.point,u.pointLightShadows.value=r.state.pointShadow,u.hemisphereLights.value=r.state.hemi,u.directionalShadowMap.value=r.state.directionalShadowMap,u.directionalShadowMatrix.value=r.state.directionalShadowMatrix,u.spotShadowMap.value=r.state.spotShadowMap,u.spotLightMatrix.value=r.state.spotLightMatrix,u.spotLightMap.value=r.state.spotLightMap,u.pointShadowMap.value=r.state.pointShadowMap,u.pointShadowMatrix.value=r.state.pointShadowMatrix),i.currentProgram=h,i.uniformsList=null,h}function kt(t){if(null===t.uniformsList){const e=t.currentProgram.getUniforms();t.uniformsList=dp.seqWithValue(e.seq,t.uniforms)}return t.uniformsList}function Ot(t,e){const n=J.get(t);n.outputColorSpace=e.outputColorSpace,n.batching=e.batching,n.batchingColor=e.batchingColor,n.instancing=e.instancing,n.instancingColor=e.instancingColor,n.instancingMorph=e.instancingMorph,n.skinning=e.skinning,n.morphTargets=e.morphTargets,n.morphNormals=e.morphNormals,n.morphColors=e.morphColors,n.morphTargetsCount=e.morphTargetsCount,n.numClippingPlanes=e.numClippingPlanes,n.numIntersection=e.numClipIntersection,n.vertexAlphas=e.vertexAlphas,n.vertexTangents=e.vertexTangents,n.toneMapping=e.toneMapping}It.setAnimationLoop((function(t){Ct&&Ct(t)})),"undefined"!=typeof self&&It.setContext(self),this.setAnimationLoop=function(t){Ct=t,vt.setAnimationLoop(t),null===t?It.stop():It.start()},vt.addEventListener("sessionstart",St),vt.addEventListener("sessionend",Mt),this.render=function(t,e){if(void 0!==e&&!0!==e.isCamera)return;if(!0===v)return;if(!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),null===e.parent&&!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),!0===vt.enabled&&!0===vt.isPresenting&&(!0===vt.cameraAutoUpdate&&vt.updateCamera(e),e=vt.getCamera()),!0===t.isScene&&t.onBeforeRender(_,t,e,x),A=at.get(t,m.length),A.init(e),m.push(A),z.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),N.setFromProjectionMatrix(z),Q=this.localClippingEnabled,F=ot.init(this.clippingPlanes,Q),f=st.get(t,g.length),f.init(),g.push(f),!0===vt.enabled&&!0===vt.isPresenting){const t=_.xr.getDepthSensingMesh();null!==t&&Tt(t,e,-1/0,_.sortObjects)}Tt(t,e,0,_.sortObjects),f.finish(),!0===_.sortObjects&&f.sort(L,P),V=!1===vt.enabled||!1===vt.isPresenting||!1===vt.hasDepthSensing(),V&<.addToRenderList(f,t),this.info.render.frame++,!0===F&&ot.beginShadows();const n=A.state.shadowsArray;ct.render(n,t,e),!0===F&&ot.endShadows(),!0===this.info.autoReset&&this.info.reset();const i=f.opaque,r=f.transmissive;if(A.setupLights(),e.isArrayCamera){const n=e.cameras;if(r.length>0)for(let e=0,s=n.length;e<s;e++){Rt(i,r,t,n[e])}V&<.render(t);for(let e=0,i=n.length;e<i;e++){const i=n[e];Bt(f,t,i,i.viewport)}}else r.length>0&&Rt(i,r,t,e),V&<.render(t),Bt(f,t,e);null!==x&&(K.updateMultisampleRenderTarget(x),K.updateRenderTargetMipmap(x)),!0===t.isScene&&t.onAfterRender(_,t,e),ft.resetDefaultState(),w=-1,E=null,m.pop(),m.length>0?(A=m[m.length-1],!0===F&&ot.setGlobalState(_.clippingPlanes,A.state.camera)):A=null,g.pop(),f=g.length>0?g[g.length-1]:null},this.getActiveCubeFace=function(){return y},this.getActiveMipmapLevel=function(){return b},this.getRenderTarget=function(){return x},this.setRenderTargetTextures=function(t,e,n){J.get(t.texture).__webglTexture=e,J.get(t.depthTexture).__webglTexture=n;const i=J.get(t);i.__hasExternalTextures=!0,i.__autoAllocateDepthBuffer=void 0===n,i.__autoAllocateDepthBuffer||!0===W.has("WEBGL_multisampled_render_to_texture")&&(i.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(t,e){const n=J.get(t);n.__webglFramebuffer=e,n.__useDefaultFramebuffer=void 0===e},this.setRenderTarget=function(t,e=0,n=0){x=t,y=e,b=n;let i=!0,r=null,s=!1,a=!1;if(t){const o=J.get(t);void 0!==o.__useDefaultFramebuffer?(Y.bindFramebuffer(gt.FRAMEBUFFER,null),i=!1):void 0===o.__webglFramebuffer?K.setupRenderTarget(t):o.__hasExternalTextures&&K.rebindTextures(t,J.get(t.texture).__webglTexture,J.get(t.depthTexture).__webglTexture);const c=t.texture;(c.isData3DTexture||c.isDataArrayTexture||c.isCompressedArrayTexture)&&(a=!0);const l=J.get(t).__webglFramebuffer;t.isWebGLCubeRenderTarget?(r=Array.isArray(l[e])?l[e][n]:l[e],s=!0):r=t.samples>0&&!1===K.useMultisampledRTT(t)?J.get(t).__webglMultisampledFramebuffer:Array.isArray(l)?l[n]:l,C.copy(t.viewport),S.copy(t.scissor),M=t.scissorTest}else C.copy(k).multiplyScalar(D).floor(),S.copy(O).multiplyScalar(D).floor(),M=U;if(Y.bindFramebuffer(gt.FRAMEBUFFER,r)&&i&&Y.drawBuffers(t,r),Y.viewport(C),Y.scissor(S),Y.setScissorTest(M),s){const i=J.get(t.texture);gt.framebufferTexture2D(gt.FRAMEBUFFER,gt.COLOR_ATTACHMENT0,gt.TEXTURE_CUBE_MAP_POSITIVE_X+e,i.__webglTexture,n)}else if(a){const i=J.get(t.texture),r=e||0;gt.framebufferTextureLayer(gt.FRAMEBUFFER,gt.COLOR_ATTACHMENT0,i.__webglTexture,n||0,r)}w=-1},this.readRenderTargetPixels=function(t,e,n,i,r,s,a){if(!t||!t.isWebGLRenderTarget)return;let o=J.get(t).__webglFramebuffer;if(t.isWebGLCubeRenderTarget&&void 0!==a&&(o=o[a]),o){Y.bindFramebuffer(gt.FRAMEBUFFER,o);try{const a=t.texture,o=a.format,c=a.type;if(!q.textureFormatReadable(o))return;if(!q.textureTypeReadable(c))return;e>=0&&e<=t.width-i&&n>=0&&n<=t.height-r&>.readPixels(e,n,i,r,pt.convert(o),pt.convert(c),s)}finally{const t=null!==x?J.get(x).__webglFramebuffer:null;Y.bindFramebuffer(gt.FRAMEBUFFER,t)}}},this.readRenderTargetPixelsAsync=async function(t,e,n,i,r,s,a){if(!t||!t.isWebGLRenderTarget)throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let o=J.get(t).__webglFramebuffer;if(t.isWebGLCubeRenderTarget&&void 0!==a&&(o=o[a]),o){Y.bindFramebuffer(gt.FRAMEBUFFER,o);try{const a=t.texture,o=a.format,c=a.type;if(!q.textureFormatReadable(o))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!q.textureTypeReadable(c))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(e>=0&&e<=t.width-i&&n>=0&&n<=t.height-r){const t=gt.createBuffer();gt.bindBuffer(gt.PIXEL_PACK_BUFFER,t),gt.bufferData(gt.PIXEL_PACK_BUFFER,s.byteLength,gt.STREAM_READ),gt.readPixels(e,n,i,r,pt.convert(o),pt.convert(c),0),gt.flush();const a=gt.fenceSync(gt.SYNC_GPU_COMMANDS_COMPLETE,0);await function(t,e,n){return new Promise((function(i,r){setTimeout((function s(){switch(t.clientWaitSync(e,t.SYNC_FLUSH_COMMANDS_BIT,0)){case t.WAIT_FAILED:r();break;case t.TIMEOUT_EXPIRED:setTimeout(s,n);break;default:i()}}),n)}))}(gt,a,4);try{gt.bindBuffer(gt.PIXEL_PACK_BUFFER,t),gt.getBufferSubData(gt.PIXEL_PACK_BUFFER,0,s)}finally{gt.deleteBuffer(t),gt.deleteSync(a)}return s}}finally{const t=null!==x?J.get(x).__webglFramebuffer:null;Y.bindFramebuffer(gt.FRAMEBUFFER,t)}}},this.copyFramebufferToTexture=function(t,e=null,n=0){!0!==t.isTexture&&(e=arguments[0]||null,t=arguments[1]);const i=Math.pow(2,-n),r=Math.floor(t.image.width*i),s=Math.floor(t.image.height*i),a=null!==e?e.x:0,o=null!==e?e.y:0;K.setTexture2D(t,0),gt.copyTexSubImage2D(gt.TEXTURE_2D,n,0,0,a,o,r,s),Y.unbindTexture()},this.copyTextureToTexture=function(t,e,n=null,i=null,r=0){let s,a,o,c,l,h;!0!==t.isTexture&&(i=arguments[0]||null,t=arguments[1],e=arguments[2],r=arguments[3]||0,n=null),null!==n?(s=n.max.x-n.min.x,a=n.max.y-n.min.y,o=n.min.x,c=n.min.y):(s=t.image.width,a=t.image.height,o=0,c=0),null!==i?(l=i.x,h=i.y):(l=0,h=0);const u=pt.convert(e.format),d=pt.convert(e.type);K.setTexture2D(e,0),gt.pixelStorei(gt.UNPACK_FLIP_Y_WEBGL,e.flipY),gt.pixelStorei(gt.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.premultiplyAlpha),gt.pixelStorei(gt.UNPACK_ALIGNMENT,e.unpackAlignment);const p=gt.getParameter(gt.UNPACK_ROW_LENGTH),f=gt.getParameter(gt.UNPACK_IMAGE_HEIGHT),A=gt.getParameter(gt.UNPACK_SKIP_PIXELS),g=gt.getParameter(gt.UNPACK_SKIP_ROWS),m=gt.getParameter(gt.UNPACK_SKIP_IMAGES),_=t.isCompressedTexture?t.mipmaps[r]:t.image;gt.pixelStorei(gt.UNPACK_ROW_LENGTH,_.width),gt.pixelStorei(gt.UNPACK_IMAGE_HEIGHT,_.height),gt.pixelStorei(gt.UNPACK_SKIP_PIXELS,o),gt.pixelStorei(gt.UNPACK_SKIP_ROWS,c),t.isDataTexture?gt.texSubImage2D(gt.TEXTURE_2D,r,l,h,s,a,u,d,_.data):t.isCompressedTexture?gt.compressedTexSubImage2D(gt.TEXTURE_2D,r,l,h,_.width,_.height,u,_.data):gt.texSubImage2D(gt.TEXTURE_2D,r,l,h,u,d,_),gt.pixelStorei(gt.UNPACK_ROW_LENGTH,p),gt.pixelStorei(gt.UNPACK_IMAGE_HEIGHT,f),gt.pixelStorei(gt.UNPACK_SKIP_PIXELS,A),gt.pixelStorei(gt.UNPACK_SKIP_ROWS,g),gt.pixelStorei(gt.UNPACK_SKIP_IMAGES,m),0===r&&e.generateMipmaps&>.generateMipmap(gt.TEXTURE_2D),Y.unbindTexture()},this.copyTextureToTexture3D=function(t,e,n=null,i=null,r=0){let s,a,o,c,l,h,u,d,p;!0!==t.isTexture&&(n=arguments[0]||null,i=arguments[1]||null,t=arguments[2],e=arguments[3],r=arguments[4]||0);const f=t.isCompressedTexture?t.mipmaps[r]:t.image;null!==n?(s=n.max.x-n.min.x,a=n.max.y-n.min.y,o=n.max.z-n.min.z,c=n.min.x,l=n.min.y,h=n.min.z):(s=f.width,a=f.height,o=f.depth,c=0,l=0,h=0),null!==i?(u=i.x,d=i.y,p=i.z):(u=0,d=0,p=0);const A=pt.convert(e.format),g=pt.convert(e.type);let m;if(e.isData3DTexture)K.setTexture3D(e,0),m=gt.TEXTURE_3D;else{if(!e.isDataArrayTexture&&!e.isCompressedArrayTexture)return;K.setTexture2DArray(e,0),m=gt.TEXTURE_2D_ARRAY}gt.pixelStorei(gt.UNPACK_FLIP_Y_WEBGL,e.flipY),gt.pixelStorei(gt.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.premultiplyAlpha),gt.pixelStorei(gt.UNPACK_ALIGNMENT,e.unpackAlignment);const _=gt.getParameter(gt.UNPACK_ROW_LENGTH),v=gt.getParameter(gt.UNPACK_IMAGE_HEIGHT),y=gt.getParameter(gt.UNPACK_SKIP_PIXELS),b=gt.getParameter(gt.UNPACK_SKIP_ROWS),x=gt.getParameter(gt.UNPACK_SKIP_IMAGES);gt.pixelStorei(gt.UNPACK_ROW_LENGTH,f.width),gt.pixelStorei(gt.UNPACK_IMAGE_HEIGHT,f.height),gt.pixelStorei(gt.UNPACK_SKIP_PIXELS,c),gt.pixelStorei(gt.UNPACK_SKIP_ROWS,l),gt.pixelStorei(gt.UNPACK_SKIP_IMAGES,h),t.isDataTexture||t.isData3DTexture?gt.texSubImage3D(m,r,u,d,p,s,a,o,A,g,f.data):e.isCompressedArrayTexture?gt.compressedTexSubImage3D(m,r,u,d,p,s,a,o,A,f.data):gt.texSubImage3D(m,r,u,d,p,s,a,o,A,g,f),gt.pixelStorei(gt.UNPACK_ROW_LENGTH,_),gt.pixelStorei(gt.UNPACK_IMAGE_HEIGHT,v),gt.pixelStorei(gt.UNPACK_SKIP_PIXELS,y),gt.pixelStorei(gt.UNPACK_SKIP_ROWS,b),gt.pixelStorei(gt.UNPACK_SKIP_IMAGES,x),0===r&&e.generateMipmaps&>.generateMipmap(m),Y.unbindTexture()},this.initRenderTarget=function(t){void 0===J.get(t).__webglFramebuffer&&K.setupRenderTarget(t)},this.initTexture=function(t){t.isCubeTexture?K.setTextureCube(t,0):t.isData3DTexture?K.setTexture3D(t,0):t.isDataArrayTexture||t.isCompressedArrayTexture?K.setTexture2DArray(t,0):K.setTexture2D(t,0),Y.unbindTexture()},this.resetState=function(){y=0,b=0,x=null,Y.reset(),ft.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return ec}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(t){this._outputColorSpace=t;const e=this.getContext();e.drawingBufferColorSpace=t===No?"display-p3":"srgb",e.unpackColorSpace=Tc.workingColorSpace===Fo?"display-p3":"srgb"}}class hf{constructor(t,e=25e-5){this.isFogExp2=!0,this.name="",this.color=new hh(t),this.density=e}clone(){return new hf(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class uf{constructor(t,e=1,n=1e3){this.isFog=!0,this.name="",this.color=new hh(t),this.near=e,this.far=n}clone(){return new uf(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class df extends Yl{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new Rl,this.environmentIntensity=1,this.environmentRotation=new Rl,this.overrideMaterial=null,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,e){return super.copy(t,e),null!==t.background&&(this.background=t.background.clone()),null!==t.environment&&(this.environment=t.environment.clone()),null!==t.fog&&(this.fog=t.fog.clone()),this.backgroundBlurriness=t.backgroundBlurriness,this.backgroundIntensity=t.backgroundIntensity,this.backgroundRotation.copy(t.backgroundRotation),this.environmentIntensity=t.environmentIntensity,this.environmentRotation.copy(t.environmentRotation),null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){const e=super.toJSON(t);return null!==this.fog&&(e.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(e.object.backgroundBlurriness=this.backgroundBlurriness),1!==this.backgroundIntensity&&(e.object.backgroundIntensity=this.backgroundIntensity),e.object.backgroundRotation=this.backgroundRotation.toArray(),1!==this.environmentIntensity&&(e.object.environmentIntensity=this.environmentIntensity),e.object.environmentRotation=this.environmentRotation.toArray(),e}}class pf{constructor(t,e){this.isInterleavedBuffer=!0,this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.usage=$o,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.version=0,this.uuid=cc()}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}get updateRange(){return Ec("THREE.InterleavedBuffer: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this}copyAt(t,e,n){t*=this.stride,n*=e.stride;for(let i=0,r=this.stride;i<r;i++)this.array[t+i]=e.array[n+i];return this}set(t,e=0){return this.array.set(t,e),this}clone(t){void 0===t.arrayBuffers&&(t.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=cc()),void 0===t.arrayBuffers[this.array.buffer._uuid]&&(t.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const e=new this.array.constructor(t.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(e,this.stride);return n.setUsage(this.usage),n}onUpload(t){return this.onUploadCallback=t,this}toJSON(t){return void 0===t.arrayBuffers&&(t.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=cc()),void 0===t.arrayBuffers[this.array.buffer._uuid]&&(t.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const ff=new jc;class Af{constructor(t,e,n,i=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=t,this.itemSize=e,this.offset=n,this.normalized=i}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(t){this.data.needsUpdate=t}applyMatrix4(t){for(let e=0,n=this.data.count;e<n;e++)ff.fromBufferAttribute(this,e),ff.applyMatrix4(t),this.setXYZ(e,ff.x,ff.y,ff.z);return this}applyNormalMatrix(t){for(let e=0,n=this.count;e<n;e++)ff.fromBufferAttribute(this,e),ff.applyNormalMatrix(t),this.setXYZ(e,ff.x,ff.y,ff.z);return this}transformDirection(t){for(let e=0,n=this.count;e<n;e++)ff.fromBufferAttribute(this,e),ff.transformDirection(t),this.setXYZ(e,ff.x,ff.y,ff.z);return this}getComponent(t,e){let n=this.array[t*this.data.stride+this.offset+e];return this.normalized&&(n=dc(n,this.array)),n}setComponent(t,e,n){return this.normalized&&(n=pc(n,this.array)),this.data.array[t*this.data.stride+this.offset+e]=n,this}setX(t,e){return this.normalized&&(e=pc(e,this.array)),this.data.array[t*this.data.stride+this.offset]=e,this}setY(t,e){return this.normalized&&(e=pc(e,this.array)),this.data.array[t*this.data.stride+this.offset+1]=e,this}setZ(t,e){return this.normalized&&(e=pc(e,this.array)),this.data.array[t*this.data.stride+this.offset+2]=e,this}setW(t,e){return this.normalized&&(e=pc(e,this.array)),this.data.array[t*this.data.stride+this.offset+3]=e,this}getX(t){let e=this.data.array[t*this.data.stride+this.offset];return this.normalized&&(e=dc(e,this.array)),e}getY(t){let e=this.data.array[t*this.data.stride+this.offset+1];return this.normalized&&(e=dc(e,this.array)),e}getZ(t){let e=this.data.array[t*this.data.stride+this.offset+2];return this.normalized&&(e=dc(e,this.array)),e}getW(t){let e=this.data.array[t*this.data.stride+this.offset+3];return this.normalized&&(e=dc(e,this.array)),e}setXY(t,e,n){return t=t*this.data.stride+this.offset,this.normalized&&(e=pc(e,this.array),n=pc(n,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=n,this}setXYZ(t,e,n,i){return t=t*this.data.stride+this.offset,this.normalized&&(e=pc(e,this.array),n=pc(n,this.array),i=pc(i,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=n,this.data.array[t+2]=i,this}setXYZW(t,e,n,i,r){return t=t*this.data.stride+this.offset,this.normalized&&(e=pc(e,this.array),n=pc(n,this.array),i=pc(i,this.array),r=pc(r,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=n,this.data.array[t+2]=i,this.data.array[t+3]=r,this}clone(t){if(void 0===t){const t=[];for(let e=0;e<this.count;e++){const n=e*this.data.stride+this.offset;for(let e=0;e<this.itemSize;e++)t.push(this.data.array[n+e])}return new xh(new this.array.constructor(t),this.itemSize,this.normalized)}return void 0===t.interleavedBuffers&&(t.interleavedBuffers={}),void 0===t.interleavedBuffers[this.data.uuid]&&(t.interleavedBuffers[this.data.uuid]=this.data.clone(t)),new Af(t.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(t){if(void 0===t){const t=[];for(let e=0;e<this.count;e++){const n=e*this.data.stride+this.offset;for(let e=0;e<this.itemSize;e++)t.push(this.data.array[n+e])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}return void 0===t.interleavedBuffers&&(t.interleavedBuffers={}),void 0===t.interleavedBuffers[this.data.uuid]&&(t.interleavedBuffers[this.data.uuid]=this.data.toJSON(t)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}class gf extends ph{constructor(t){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new hh(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.rotation=t.rotation,this.sizeAttenuation=t.sizeAttenuation,this.fog=t.fog,this}}let mf;const _f=new jc,vf=new jc,yf=new jc,bf=new Ac,xf=new Ac,wf=new bl,Ef=new jc,Cf=new jc,Sf=new jc,Mf=new Ac,If=new Ac,Tf=new Ac;class Bf extends Yl{constructor(t=new gf){if(super(),this.isSprite=!0,this.type="Sprite",void 0===mf){mf=new Lh;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),e=new pf(t,5);mf.setIndex([0,1,2,0,2,3]),mf.setAttribute("position",new Af(e,3,0,!1)),mf.setAttribute("uv",new Af(e,2,3,!1))}this.geometry=mf,this.material=t,this.center=new Ac(.5,.5)}raycast(t,e){t.camera,vf.setFromMatrixScale(this.matrixWorld),wf.copy(t.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(t.camera.matrixWorldInverse,this.matrixWorld),yf.setFromMatrixPosition(this.modelViewMatrix),t.camera.isPerspectiveCamera&&!1===this.material.sizeAttenuation&&vf.multiplyScalar(-yf.z);const n=this.material.rotation;let i,r;0!==n&&(r=Math.cos(n),i=Math.sin(n));const s=this.center;Rf(Ef.set(-.5,-.5,0),yf,s,vf,i,r),Rf(Cf.set(.5,-.5,0),yf,s,vf,i,r),Rf(Sf.set(.5,.5,0),yf,s,vf,i,r),Mf.set(0,0),If.set(1,0),Tf.set(1,1);let a=t.ray.intersectTriangle(Ef,Cf,Sf,!1,_f);if(null===a&&(Rf(Cf.set(-.5,.5,0),yf,s,vf,i,r),If.set(0,1),a=t.ray.intersectTriangle(Ef,Sf,Cf,!1,_f),null===a))return;const o=t.ray.origin.distanceTo(_f);o<t.near||o>t.far||e.push({distance:o,point:_f.clone(),uv:sh.getInterpolation(_f,Ef,Cf,Sf,Mf,If,Tf,new Ac),face:null,object:this})}copy(t,e){return super.copy(t,e),void 0!==t.center&&this.center.copy(t.center),this.material=t.material,this}}function Rf(t,e,n,i,r,s){bf.subVectors(t,n).addScalar(.5).multiply(i),void 0!==r?(xf.x=s*bf.x-r*bf.y,xf.y=r*bf.x+s*bf.y):xf.copy(bf),t.copy(e),t.x+=xf.x,t.y+=xf.y,t.applyMatrix4(wf)}const Df=new jc,Lf=new jc;class Pf extends Yl{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(t){super.copy(t,!1);const e=t.levels;for(let t=0,n=e.length;t<n;t++){const n=e[t];this.addLevel(n.object.clone(),n.distance,n.hysteresis)}return this.autoUpdate=t.autoUpdate,this}addLevel(t,e=0,n=0){e=Math.abs(e);const i=this.levels;let r;for(r=0;r<i.length&&!(e<i[r].distance);r++);return i.splice(r,0,{distance:e,hysteresis:n,object:t}),this.add(t),this}getCurrentLevel(){return this._currentLevel}getObjectForDistance(t){const e=this.levels;if(e.length>0){let n,i;for(n=1,i=e.length;n<i;n++){let i=e[n].distance;if(e[n].object.visible&&(i-=i*e[n].hysteresis),t<i)break}return e[n-1].object}return null}raycast(t,e){if(this.levels.length>0){Df.setFromMatrixPosition(this.matrixWorld);const n=t.ray.origin.distanceTo(Df);this.getObjectForDistance(n).raycast(t,e)}}update(t){const e=this.levels;if(e.length>1){Df.setFromMatrixPosition(t.matrixWorld),Lf.setFromMatrixPosition(this.matrixWorld);const n=Df.distanceTo(Lf)/t.zoom;let i,r;for(e[0].object.visible=!0,i=1,r=e.length;i<r;i++){let t=e[i].distance;if(e[i].object.visible&&(t-=t*e[i].hysteresis),!(n>=t))break;e[i-1].object.visible=!1,e[i].object.visible=!0}for(this._currentLevel=i-1;i<r;i++)e[i].object.visible=!1}}toJSON(t){const e=super.toJSON(t);!1===this.autoUpdate&&(e.object.autoUpdate=!1),e.object.levels=[];const n=this.levels;for(let t=0,i=n.length;t<i;t++){const i=n[t];e.object.levels.push({object:i.object.uuid,distance:i.distance,hysteresis:i.hysteresis})}return e}}const kf=new jc,Of=new Fc,Uf=new Fc,Nf=new jc,Ff=new bl,Qf=new jc,zf=new dl,Gf=new bl,Hf=new yl;class Vf extends Kh{constructor(t,e){super(t,e),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=fa,this.bindMatrix=new bl,this.bindMatrixInverse=new bl,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const t=this.geometry;null===this.boundingBox&&(this.boundingBox=new Yc),this.boundingBox.makeEmpty();const e=t.getAttribute("position");for(let t=0;t<e.count;t++)this.getVertexPosition(t,Qf),this.boundingBox.expandByPoint(Qf)}computeBoundingSphere(){const t=this.geometry;null===this.boundingSphere&&(this.boundingSphere=new dl),this.boundingSphere.makeEmpty();const e=t.getAttribute("position");for(let t=0;t<e.count;t++)this.getVertexPosition(t,Qf),this.boundingSphere.expandByPoint(Qf)}copy(t,e){return super.copy(t,e),this.bindMode=t.bindMode,this.bindMatrix.copy(t.bindMatrix),this.bindMatrixInverse.copy(t.bindMatrixInverse),this.skeleton=t.skeleton,null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),this}raycast(t,e){const n=this.material,i=this.matrixWorld;void 0!==n&&(null===this.boundingSphere&&this.computeBoundingSphere(),zf.copy(this.boundingSphere),zf.applyMatrix4(i),!1!==t.ray.intersectsSphere(zf)&&(Gf.copy(i).invert(),Hf.copy(t.ray).applyMatrix4(Gf),null!==this.boundingBox&&!1===Hf.intersectsBox(this.boundingBox)||this._computeIntersections(t,e,Hf)))}getVertexPosition(t,e){return super.getVertexPosition(t,e),this.applyBoneTransform(t,e),e}bind(t,e){this.skeleton=t,void 0===e&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.copy(e).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const t=new Fc,e=this.geometry.attributes.skinWeight;for(let n=0,i=e.count;n<i;n++){t.fromBufferAttribute(e,n);const i=1/t.manhattanLength();i!==1/0?t.multiplyScalar(i):t.set(1,0,0,0),e.setXYZW(n,t.x,t.y,t.z,t.w)}}updateMatrixWorld(t){super.updateMatrixWorld(t),this.bindMode===fa?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===Aa&&this.bindMatrixInverse.copy(this.bindMatrix).invert()}applyBoneTransform(t,e){const n=this.skeleton,i=this.geometry;Of.fromBufferAttribute(i.attributes.skinIndex,t),Uf.fromBufferAttribute(i.attributes.skinWeight,t),kf.copy(e).applyMatrix4(this.bindMatrix),e.set(0,0,0);for(let t=0;t<4;t++){const i=Uf.getComponent(t);if(0!==i){const r=Of.getComponent(t);Ff.multiplyMatrices(n.bones[r].matrixWorld,n.boneInverses[r]),e.addScaledVector(Nf.copy(kf).applyMatrix4(Ff),i)}}return e.applyMatrix4(this.bindMatrixInverse)}}class jf extends Yl{constructor(){super(),this.isBone=!0,this.type="Bone"}}class Wf extends Nc{constructor(t=null,e=1,n=1,i,r,s,a,o,c=1003,l=1003,h,u){super(null,s,a,o,c,l,i,r,h,u),this.isDataTexture=!0,this.image={data:t,width:e,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const qf=new bl,Yf=new bl;class Xf{constructor(t=[],e=[]){this.uuid=cc(),this.bones=t.slice(0),this.boneInverses=e,this.boneMatrices=null,this.boneTexture=null,this.init()}init(){const t=this.bones,e=this.boneInverses;if(this.boneMatrices=new Float32Array(16*t.length),0===e.length)this.calculateInverses();else if(t.length!==e.length){this.boneInverses=[];for(let t=0,e=this.bones.length;t<e;t++)this.boneInverses.push(new bl)}}calculateInverses(){this.boneInverses.length=0;for(let t=0,e=this.bones.length;t<e;t++){const e=new bl;this.bones[t]&&e.copy(this.bones[t].matrixWorld).invert(),this.boneInverses.push(e)}}pose(){for(let t=0,e=this.bones.length;t<e;t++){const e=this.bones[t];e&&e.matrixWorld.copy(this.boneInverses[t]).invert()}for(let t=0,e=this.bones.length;t<e;t++){const e=this.bones[t];e&&(e.parent&&e.parent.isBone?(e.matrix.copy(e.parent.matrixWorld).invert(),e.matrix.multiply(e.matrixWorld)):e.matrix.copy(e.matrixWorld),e.matrix.decompose(e.position,e.quaternion,e.scale))}}update(){const t=this.bones,e=this.boneInverses,n=this.boneMatrices,i=this.boneTexture;for(let i=0,r=t.length;i<r;i++){const r=t[i]?t[i].matrixWorld:Yf;qf.multiplyMatrices(r,e[i]),qf.toArray(n,16*i)}null!==i&&(i.needsUpdate=!0)}clone(){return new Xf(this.bones,this.boneInverses)}computeBoneTexture(){let t=Math.sqrt(4*this.bones.length);t=4*Math.ceil(t/4),t=Math.max(t,4);const e=new Float32Array(t*t*4);e.set(this.boneMatrices);const n=new Wf(e,t,t,Qa,ka);return n.needsUpdate=!0,this.boneMatrices=e,this.boneTexture=n,this}getBoneByName(t){for(let e=0,n=this.bones.length;e<n;e++){const n=this.bones[e];if(n.name===t)return n}}dispose(){null!==this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(t,e){this.uuid=t.uuid;for(let n=0,i=t.bones.length;n<i;n++){let i=e[t.bones[n]];void 0===i&&(i=new jf),this.bones.push(i),this.boneInverses.push((new bl).fromArray(t.boneInverses[n]))}return this.init(),this}toJSON(){const t={metadata:{version:4.6,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};t.uuid=this.uuid;const e=this.bones,n=this.boneInverses;for(let i=0,r=e.length;i<r;i++){const r=e[i];t.bones.push(r.uuid);const s=n[i];t.boneInverses.push(s.toArray())}return t}}class Jf extends xh{constructor(t,e,n,i=1){super(t,e,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=i}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}toJSON(){const t=super.toJSON();return t.meshPerAttribute=this.meshPerAttribute,t.isInstancedBufferAttribute=!0,t}}const Kf=new bl,Zf=new bl,$f=[],tA=new Yc,eA=new bl,nA=new Kh,iA=new dl;class rA extends Kh{constructor(t,e,n){super(t,e),this.isInstancedMesh=!0,this.instanceMatrix=new Jf(new Float32Array(16*n),16),this.instanceColor=null,this.morphTexture=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let t=0;t<n;t++)this.setMatrixAt(t,eA)}computeBoundingBox(){const t=this.geometry,e=this.count;null===this.boundingBox&&(this.boundingBox=new Yc),null===t.boundingBox&&t.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<e;n++)this.getMatrixAt(n,Kf),tA.copy(t.boundingBox).applyMatrix4(Kf),this.boundingBox.union(tA)}computeBoundingSphere(){const t=this.geometry,e=this.count;null===this.boundingSphere&&(this.boundingSphere=new dl),null===t.boundingSphere&&t.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<e;n++)this.getMatrixAt(n,Kf),iA.copy(t.boundingSphere).applyMatrix4(Kf),this.boundingSphere.union(iA)}copy(t,e){return super.copy(t,e),this.instanceMatrix.copy(t.instanceMatrix),null!==t.morphTexture&&(this.morphTexture=t.morphTexture.clone()),null!==t.instanceColor&&(this.instanceColor=t.instanceColor.clone()),this.count=t.count,null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),this}getColorAt(t,e){e.fromArray(this.instanceColor.array,3*t)}getMatrixAt(t,e){e.fromArray(this.instanceMatrix.array,16*t)}getMorphAt(t,e){const n=e.morphTargetInfluences,i=this.morphTexture.source.data.data,r=t*(n.length+1)+1;for(let t=0;t<n.length;t++)n[t]=i[r+t]}raycast(t,e){const n=this.matrixWorld,i=this.count;if(nA.geometry=this.geometry,nA.material=this.material,void 0!==nA.material&&(null===this.boundingSphere&&this.computeBoundingSphere(),iA.copy(this.boundingSphere),iA.applyMatrix4(n),!1!==t.ray.intersectsSphere(iA)))for(let r=0;r<i;r++){this.getMatrixAt(r,Kf),Zf.multiplyMatrices(n,Kf),nA.matrixWorld=Zf,nA.raycast(t,$f);for(let t=0,n=$f.length;t<n;t++){const n=$f[t];n.instanceId=r,n.object=this,e.push(n)}$f.length=0}}setColorAt(t,e){null===this.instanceColor&&(this.instanceColor=new Jf(new Float32Array(3*this.instanceMatrix.count),3)),e.toArray(this.instanceColor.array,3*t)}setMatrixAt(t,e){e.toArray(this.instanceMatrix.array,16*t)}setMorphAt(t,e){const n=e.morphTargetInfluences,i=n.length+1;null===this.morphTexture&&(this.morphTexture=new Wf(new Float32Array(i*this.count),i,this.count,Ha,ka));const r=this.morphTexture.source.data.data;let s=0;for(let t=0;t<n.length;t++)s+=n[t];const a=this.geometry.morphTargetsRelative?1:1-s,o=i*t;r[o]=a,r.set(n,o+1)}updateMorphTargets(){}dispose(){return this.dispatchEvent({type:"dispose"}),null!==this.morphTexture&&(this.morphTexture.dispose(),this.morphTexture=null),this}}function sA(t,e){return t.z-e.z}function aA(t,e){return e.z-t.z}class oA{constructor(){this.index=0,this.pool=[],this.list=[]}push(t,e){const n=this.pool,i=this.list;this.index>=n.length&&n.push({start:-1,count:-1,z:-1});const r=n[this.index];i.push(r),this.index++,r.start=t.start,r.count=t.count,r.z=e}reset(){this.list.length=0,this.index=0}}const cA="batchId",lA=new bl,hA=new bl,uA=new bl,dA=new hh(1,1,1),pA=new bl,fA=new yu,AA=new Yc,gA=new dl,mA=new jc,_A=new jc,vA=new jc,yA=new oA,bA=new Kh,xA=[];function wA(t,e,n=0){const i=e.itemSize;if(t.isInterleavedBufferAttribute||t.array.constructor!==e.array.constructor){const r=t.count;for(let s=0;s<r;s++)for(let r=0;r<i;r++)e.setComponent(s+n,r,t.getComponent(s,r))}else e.array.set(t.array,n*i);e.needsUpdate=!0}class EA extends Kh{get maxGeometryCount(){return this._maxGeometryCount}constructor(t,e,n=2*e,i){super(new Lh,i),this.isBatchedMesh=!0,this.perObjectFrustumCulled=!0,this.sortObjects=!0,this.boundingBox=null,this.boundingSphere=null,this.customSort=null,this._drawRanges=[],this._reservedRanges=[],this._visibility=[],this._active=[],this._bounds=[],this._maxGeometryCount=t,this._maxVertexCount=e,this._maxIndexCount=n,this._geometryInitialized=!1,this._geometryCount=0,this._multiDrawCounts=new Int32Array(t),this._multiDrawStarts=new Int32Array(t),this._multiDrawCount=0,this._multiDrawInstances=null,this._visibilityChanged=!0,this._matricesTexture=null,this._initMatricesTexture(),this._colorsTexture=null}_initMatricesTexture(){let t=Math.sqrt(4*this._maxGeometryCount);t=4*Math.ceil(t/4),t=Math.max(t,4);const e=new Float32Array(t*t*4),n=new Wf(e,t,t,Qa,ka);this._matricesTexture=n}_initColorsTexture(){let t=Math.sqrt(this._maxGeometryCount);t=Math.ceil(t);const e=new Float32Array(t*t*4).fill(1),n=new Wf(e,t,t,Qa,ka);n.colorSpace=Tc.workingColorSpace,this._colorsTexture=n}_initializeGeometry(t){const e=this.geometry,n=this._maxVertexCount,i=this._maxGeometryCount,r=this._maxIndexCount;if(!1===this._geometryInitialized){for(const i in t.attributes){const r=t.getAttribute(i),{array:s,itemSize:a,normalized:o}=r,c=new s.constructor(n*a),l=new xh(c,a,o);e.setAttribute(i,l)}if(null!==t.getIndex()){const t=n>65536?new Uint32Array(r):new Uint16Array(r);e.setIndex(new xh(t,1))}const s=i>65536?new Uint32Array(n):new Uint16Array(n);e.setAttribute(cA,new xh(s,1)),this._geometryInitialized=!0}}_validateGeometry(t){if(t.getAttribute(cA))throw new Error(`BatchedMesh: Geometry cannot use attribute "${cA}"`);const e=this.geometry;if(Boolean(t.getIndex())!==Boolean(e.getIndex()))throw new Error('BatchedMesh: All geometries must consistently have "index".');for(const n in e.attributes){if(n===cA)continue;if(!t.hasAttribute(n))throw new Error(`BatchedMesh: Added geometry missing "${n}". All geometries must have consistent attributes.`);const i=t.getAttribute(n),r=e.getAttribute(n);if(i.itemSize!==r.itemSize||i.normalized!==r.normalized)throw new Error("BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}setCustomSort(t){return this.customSort=t,this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new Yc);const t=this._geometryCount,e=this.boundingBox,n=this._active;e.makeEmpty();for(let i=0;i<t;i++)!1!==n[i]&&(this.getMatrixAt(i,lA),this.getBoundingBoxAt(i,AA).applyMatrix4(lA),e.union(AA))}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new dl);const t=this._geometryCount,e=this.boundingSphere,n=this._active;e.makeEmpty();for(let i=0;i<t;i++)!1!==n[i]&&(this.getMatrixAt(i,lA),this.getBoundingSphereAt(i,gA).applyMatrix4(lA),e.union(gA))}addGeometry(t,e=-1,n=-1){if(this._initializeGeometry(t),this._validateGeometry(t),this._geometryCount>=this._maxGeometryCount)throw new Error("BatchedMesh: Maximum geometry count reached.");const i={vertexStart:-1,vertexCount:-1,indexStart:-1,indexCount:-1};let r=null;const s=this._reservedRanges,a=this._drawRanges,o=this._bounds;0!==this._geometryCount&&(r=s[s.length-1]),i.vertexCount=-1===e?t.getAttribute("position").count:e,i.vertexStart=null===r?0:r.vertexStart+r.vertexCount;const c=t.getIndex(),l=null!==c;if(l&&(i.indexCount=-1===n?c.count:n,i.indexStart=null===r?0:r.indexStart+r.indexCount),-1!==i.indexStart&&i.indexStart+i.indexCount>this._maxIndexCount||i.vertexStart+i.vertexCount>this._maxVertexCount)throw new Error("BatchedMesh: Reserved space request exceeds the maximum buffer size.");const h=this._visibility,u=this._active,d=this._matricesTexture,p=this._matricesTexture.image.data,f=this._colorsTexture;h.push(!0),u.push(!0);const A=this._geometryCount;this._geometryCount++,uA.toArray(p,16*A),d.needsUpdate=!0,null!==f&&(dA.toArray(f.image.data,4*A),f.needsUpdate=!0),s.push(i),a.push({start:l?i.indexStart:i.vertexStart,count:-1}),o.push({boxInitialized:!1,box:new Yc,sphereInitialized:!1,sphere:new dl});const g=this.geometry.getAttribute(cA);for(let t=0;t<i.vertexCount;t++)g.setX(i.vertexStart+t,A);return g.needsUpdate=!0,this.setGeometryAt(A,t),A}setGeometryAt(t,e){if(t>=this._geometryCount)throw new Error("BatchedMesh: Maximum geometry count reached.");this._validateGeometry(e);const n=this.geometry,i=null!==n.getIndex(),r=n.getIndex(),s=e.getIndex(),a=this._reservedRanges[t];if(i&&s.count>a.indexCount||e.attributes.position.count>a.vertexCount)throw new Error("BatchedMesh: Reserved space not large enough for provided geometry.");const o=a.vertexStart,c=a.vertexCount;for(const t in n.attributes){if(t===cA)continue;const i=e.getAttribute(t),r=n.getAttribute(t);wA(i,r,o);const s=i.itemSize;for(let t=i.count,e=c;t<e;t++){const e=o+t;for(let t=0;t<s;t++)r.setComponent(e,t,0)}r.needsUpdate=!0,r.addUpdateRange(o*s,c*s)}if(i){const t=a.indexStart;for(let e=0;e<s.count;e++)r.setX(t+e,o+s.getX(e));for(let e=s.count,n=a.indexCount;e<n;e++)r.setX(t+e,o);r.needsUpdate=!0,r.addUpdateRange(t,a.indexCount)}const l=this._bounds[t];null!==e.boundingBox?(l.box.copy(e.boundingBox),l.boxInitialized=!0):l.boxInitialized=!1,null!==e.boundingSphere?(l.sphere.copy(e.boundingSphere),l.sphereInitialized=!0):l.sphereInitialized=!1;const h=this._drawRanges[t],u=e.getAttribute("position");return h.count=i?s.count:u.count,this._visibilityChanged=!0,t}deleteGeometry(t){const e=this._active;return t>=e.length||!1===e[t]||(e[t]=!1,this._visibilityChanged=!0),this}getInstanceCountAt(t){return null===this._multiDrawInstances?null:this._multiDrawInstances[t]}setInstanceCountAt(t,e){return null===this._multiDrawInstances&&(this._multiDrawInstances=new Int32Array(this._maxGeometryCount).fill(1)),this._multiDrawInstances[t]=e,t}getBoundingBoxAt(t,e){if(!1===this._active[t])return null;const n=this._bounds[t],i=n.box,r=this.geometry;if(!1===n.boxInitialized){i.makeEmpty();const e=r.index,s=r.attributes.position,a=this._drawRanges[t];for(let t=a.start,n=a.start+a.count;t<n;t++){let n=t;e&&(n=e.getX(n)),i.expandByPoint(mA.fromBufferAttribute(s,n))}n.boxInitialized=!0}return e.copy(i),e}getBoundingSphereAt(t,e){if(!1===this._active[t])return null;const n=this._bounds[t],i=n.sphere,r=this.geometry;if(!1===n.sphereInitialized){i.makeEmpty(),this.getBoundingBoxAt(t,AA),AA.getCenter(i.center);const e=r.index,s=r.attributes.position,a=this._drawRanges[t];let o=0;for(let t=a.start,n=a.start+a.count;t<n;t++){let n=t;e&&(n=e.getX(n)),mA.fromBufferAttribute(s,n),o=Math.max(o,i.center.distanceToSquared(mA))}i.radius=Math.sqrt(o),n.sphereInitialized=!0}return e.copy(i),e}setMatrixAt(t,e){const n=this._active,i=this._matricesTexture,r=this._matricesTexture.image.data;return t>=this._geometryCount||!1===n[t]||(e.toArray(r,16*t),i.needsUpdate=!0),this}getMatrixAt(t,e){const n=this._active,i=this._matricesTexture.image.data;return t>=this._geometryCount||!1===n[t]?null:e.fromArray(i,16*t)}setColorAt(t,e){null===this._colorsTexture&&this._initColorsTexture();const n=this._active,i=this._colorsTexture,r=this._colorsTexture.image.data;return t>=this._geometryCount||!1===n[t]||(e.toArray(r,4*t),i.needsUpdate=!0),this}getColorAt(t,e){const n=this._active,i=this._colorsTexture.image.data;return t>=this._geometryCount||!1===n[t]?null:e.fromArray(i,4*t)}setVisibleAt(t,e){const n=this._visibility,i=this._active;return t>=this._geometryCount||!1===i[t]||n[t]===e||(n[t]=e,this._visibilityChanged=!0),this}getVisibleAt(t){const e=this._visibility,n=this._active;return!(t>=this._geometryCount||!1===n[t])&&e[t]}raycast(t,e){const n=this._visibility,i=this._active,r=this._drawRanges,s=this._geometryCount,a=this.matrixWorld,o=this.geometry;bA.material=this.material,bA.geometry.index=o.index,bA.geometry.attributes=o.attributes,null===bA.geometry.boundingBox&&(bA.geometry.boundingBox=new Yc),null===bA.geometry.boundingSphere&&(bA.geometry.boundingSphere=new dl);for(let o=0;o<s;o++){if(!n[o]||!i[o])continue;const s=r[o];bA.geometry.setDrawRange(s.start,s.count),this.getMatrixAt(o,bA.matrixWorld).premultiply(a),this.getBoundingBoxAt(o,bA.geometry.boundingBox),this.getBoundingSphereAt(o,bA.geometry.boundingSphere),bA.raycast(t,xA);for(let t=0,n=xA.length;t<n;t++){const n=xA[t];n.object=this,n.batchId=o,e.push(n)}xA.length=0}bA.material=null,bA.geometry.index=null,bA.geometry.attributes={},bA.geometry.setDrawRange(0,1/0)}copy(t){return super.copy(t),this.geometry=t.geometry.clone(),this.perObjectFrustumCulled=t.perObjectFrustumCulled,this.sortObjects=t.sortObjects,this.boundingBox=null!==t.boundingBox?t.boundingBox.clone():null,this.boundingSphere=null!==t.boundingSphere?t.boundingSphere.clone():null,this._drawRanges=t._drawRanges.map((t=>({...t}))),this._reservedRanges=t._reservedRanges.map((t=>({...t}))),this._visibility=t._visibility.slice(),this._active=t._active.slice(),this._bounds=t._bounds.map((t=>({boxInitialized:t.boxInitialized,box:t.box.clone(),sphereInitialized:t.sphereInitialized,sphere:t.sphere.clone()}))),this._maxGeometryCount=t._maxGeometryCount,this._maxVertexCount=t._maxVertexCount,this._maxIndexCount=t._maxIndexCount,this._geometryInitialized=t._geometryInitialized,this._geometryCount=t._geometryCount,this._multiDrawCounts=t._multiDrawCounts.slice(),this._multiDrawStarts=t._multiDrawStarts.slice(),this._matricesTexture=t._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.slice(),null!==this._colorsTexture&&(this._colorsTexture=t._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.slice()),this}dispose(){return this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,null!==this._colorsTexture&&(this._colorsTexture.dispose(),this._colorsTexture=null),this}onBeforeRender(t,e,n,i,r){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const s=i.getIndex(),a=null===s?1:s.array.BYTES_PER_ELEMENT,o=this._active,c=this._visibility,l=this._multiDrawStarts,h=this._multiDrawCounts,u=this._drawRanges,d=this.perObjectFrustumCulled;d&&(pA.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse).multiply(this.matrixWorld),fA.setFromProjectionMatrix(pA,t.coordinateSystem));let p=0;if(this.sortObjects){hA.copy(this.matrixWorld).invert(),mA.setFromMatrixPosition(n.matrixWorld).applyMatrix4(hA),_A.set(0,0,-1).transformDirection(n.matrixWorld).transformDirection(hA);for(let t=0,e=c.length;t<e;t++)if(c[t]&&o[t]){this.getMatrixAt(t,lA),this.getBoundingSphereAt(t,gA).applyMatrix4(lA);let e=!1;if(d&&(e=!fA.intersectsSphere(gA)),!e){const e=vA.subVectors(gA.center,mA).dot(_A);yA.push(u[t],e)}}const t=yA.list,e=this.customSort;null===e?t.sort(r.transparent?aA:sA):e.call(this,t,n);for(let e=0,n=t.length;e<n;e++){const n=t[e];l[p]=n.start*a,h[p]=n.count,p++}yA.reset()}else for(let t=0,e=c.length;t<e;t++)if(c[t]&&o[t]){let e=!1;if(d&&(this.getMatrixAt(t,lA),this.getBoundingSphereAt(t,gA).applyMatrix4(lA),e=!fA.intersectsSphere(gA)),!e){const e=u[t];l[p]=e.start*a,h[p]=e.count,p++}}this._multiDrawCount=p,this._visibilityChanged=!1}onBeforeShadow(t,e,n,i,r,s){this.onBeforeRender(t,null,i,r,s)}}class CA extends ph{constructor(t){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new hh(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this.fog=t.fog,this}}const SA=new jc,MA=new jc,IA=new bl,TA=new yl,BA=new dl,RA=new jc,DA=new jc;class LA extends Yl{constructor(t=new Lh,e=new CA){super(),this.isLine=!0,this.type="Line",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}computeLineDistances(){const t=this.geometry;if(null===t.index){const e=t.attributes.position,n=[0];for(let t=1,i=e.count;t<i;t++)SA.fromBufferAttribute(e,t-1),MA.fromBufferAttribute(e,t),n[t]=n[t-1],n[t]+=SA.distanceTo(MA);t.setAttribute("lineDistance",new Ch(n,1))}return this}raycast(t,e){const n=this.geometry,i=this.matrixWorld,r=t.params.Line.threshold,s=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),BA.copy(n.boundingSphere),BA.applyMatrix4(i),BA.radius+=r,!1===t.ray.intersectsSphere(BA))return;IA.copy(i).invert(),TA.copy(t.ray).applyMatrix4(IA);const a=r/((this.scale.x+this.scale.y+this.scale.z)/3),o=a*a,c=this.isLineSegments?2:1,l=n.index,h=n.attributes.position;if(null!==l){const n=Math.max(0,s.start),i=Math.min(l.count,s.start+s.count);for(let r=n,s=i-1;r<s;r+=c){const n=l.getX(r),i=l.getX(r+1),s=PA(this,t,TA,o,n,i);s&&e.push(s)}if(this.isLineLoop){const r=l.getX(i-1),s=l.getX(n),a=PA(this,t,TA,o,r,s);a&&e.push(a)}}else{const n=Math.max(0,s.start),i=Math.min(h.count,s.start+s.count);for(let r=n,s=i-1;r<s;r+=c){const n=PA(this,t,TA,o,r,r+1);n&&e.push(n)}if(this.isLineLoop){const r=PA(this,t,TA,o,i-1,n);r&&e.push(r)}}}updateMorphTargets(){const t=this.geometry.morphAttributes,e=Object.keys(t);if(e.length>0){const n=t[e[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=n.length;t<e;t++){const e=n[t].name||String(t);this.morphTargetInfluences.push(0),this.morphTargetDictionary[e]=t}}}}}function PA(t,e,n,i,r,s){const a=t.geometry.attributes.position;SA.fromBufferAttribute(a,r),MA.fromBufferAttribute(a,s);if(n.distanceSqToSegment(SA,MA,RA,DA)>i)return;RA.applyMatrix4(t.matrixWorld);const o=e.ray.origin.distanceTo(RA);return o<e.near||o>e.far?void 0:{distance:o,point:DA.clone().applyMatrix4(t.matrixWorld),index:r,face:null,faceIndex:null,object:t}}const kA=new jc,OA=new jc;class UA extends LA{constructor(t,e){super(t,e),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const t=this.geometry;if(null===t.index){const e=t.attributes.position,n=[];for(let t=0,i=e.count;t<i;t+=2)kA.fromBufferAttribute(e,t),OA.fromBufferAttribute(e,t+1),n[t]=0===t?0:n[t-1],n[t+1]=n[t]+kA.distanceTo(OA);t.setAttribute("lineDistance",new Ch(n,1))}return this}}class NA extends LA{constructor(t,e){super(t,e),this.isLineLoop=!0,this.type="LineLoop"}}class FA extends ph{constructor(t){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new hh(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this.fog=t.fog,this}}const QA=new bl,zA=new yl,GA=new dl,HA=new jc;class VA extends Yl{constructor(t=new Lh,e=new FA){super(),this.isPoints=!0,this.type="Points",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}raycast(t,e){const n=this.geometry,i=this.matrixWorld,r=t.params.Points.threshold,s=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),GA.copy(n.boundingSphere),GA.applyMatrix4(i),GA.radius+=r,!1===t.ray.intersectsSphere(GA))return;QA.copy(i).invert(),zA.copy(t.ray).applyMatrix4(QA);const a=r/((this.scale.x+this.scale.y+this.scale.z)/3),o=a*a,c=n.index,l=n.attributes.position;if(null!==c){for(let n=Math.max(0,s.start),r=Math.min(c.count,s.start+s.count);n<r;n++){const r=c.getX(n);HA.fromBufferAttribute(l,r),jA(HA,r,o,i,t,e,this)}}else{for(let n=Math.max(0,s.start),r=Math.min(l.count,s.start+s.count);n<r;n++)HA.fromBufferAttribute(l,n),jA(HA,n,o,i,t,e,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,e=Object.keys(t);if(e.length>0){const n=t[e[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=n.length;t<e;t++){const e=n[t].name||String(t);this.morphTargetInfluences.push(0),this.morphTargetDictionary[e]=t}}}}}function jA(t,e,n,i,r,s,a){const o=zA.distanceSqToPoint(t);if(o<n){const n=new jc;zA.closestPointToPoint(t,n),n.applyMatrix4(i);const c=r.ray.origin.distanceTo(n);if(c<r.near||c>r.far)return;s.push({distance:c,distanceToRay:Math.sqrt(o),point:n,index:e,face:null,object:a})}}class WA extends Nc{constructor(t,e,n,i,r,s,a,o,c){super(t,e,n,i,r,s,a,o,c),this.isVideoTexture=!0,this.minFilter=void 0!==s?s:Ia,this.magFilter=void 0!==r?r:Ia,this.generateMipmaps=!1;const l=this;"requestVideoFrameCallback"in t&&t.requestVideoFrameCallback((function e(){l.needsUpdate=!0,t.requestVideoFrameCallback(e)}))}clone(){return new this.constructor(this.image).copy(this)}update(){const t=this.image;!1==="requestVideoFrameCallback"in t&&t.readyState>=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}class qA extends Nc{constructor(t,e,n,i,r,s,a,o,c,l,h,u){super(null,s,a,o,c,l,i,r,h,u),this.isCompressedTexture=!0,this.image={width:e,height:n},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}}class YA extends qA{constructor(t,e,n,i,r,s){super(t,e,n,r,s),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=wa,this.layerUpdates=new Set}addLayerUpdates(t){this.layerUpdates.add(t)}clearLayerUpdates(){this.layerUpdates.clear()}}class XA extends qA{constructor(t,e,n){super(void 0,t[0].width,t[0].height,e,n,ma),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=t}}class JA extends Nc{constructor(t,e,n,i,r,s,a,o,c){super(t,e,n,i,r,s,a,o,c),this.isCanvasTexture=!0,this.needsUpdate=!0}}class KA{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return null}getPointAt(t,e){const n=this.getUtoTmapping(t);return this.getPoint(n,e)}getPoints(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return e}getSpacedPoints(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPointAt(n/t));return e}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const e=[];let n,i=this.getPoint(0),r=0;e.push(0);for(let s=1;s<=t;s++)n=this.getPoint(s/t),r+=n.distanceTo(i),e.push(r),i=n;return this.cacheArcLengths=e,e}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(t,e){const n=this.getLengths();let i=0;const r=n.length;let s;s=e||t*n[r-1];let a,o=0,c=r-1;for(;o<=c;)if(i=Math.floor(o+(c-o)/2),a=n[i]-s,a<0)o=i+1;else{if(!(a>0)){c=i;break}c=i-1}if(i=c,n[i]===s)return i/(r-1);const l=n[i];return(i+(s-l)/(n[i+1]-l))/(r-1)}getTangent(t,e){const n=1e-4;let i=t-n,r=t+n;i<0&&(i=0),r>1&&(r=1);const s=this.getPoint(i),a=this.getPoint(r),o=e||(s.isVector2?new Ac:new jc);return o.copy(a).sub(s).normalize(),o}getTangentAt(t,e){const n=this.getUtoTmapping(t);return this.getTangent(n,e)}computeFrenetFrames(t,e){const n=new jc,i=[],r=[],s=[],a=new jc,o=new bl;for(let e=0;e<=t;e++){const n=e/t;i[e]=this.getTangentAt(n,new jc)}r[0]=new jc,s[0]=new jc;let c=Number.MAX_VALUE;const l=Math.abs(i[0].x),h=Math.abs(i[0].y),u=Math.abs(i[0].z);l<=c&&(c=l,n.set(1,0,0)),h<=c&&(c=h,n.set(0,1,0)),u<=c&&n.set(0,0,1),a.crossVectors(i[0],n).normalize(),r[0].crossVectors(i[0],a),s[0].crossVectors(i[0],r[0]);for(let e=1;e<=t;e++){if(r[e]=r[e-1].clone(),s[e]=s[e-1].clone(),a.crossVectors(i[e-1],i[e]),a.length()>Number.EPSILON){a.normalize();const t=Math.acos(lc(i[e-1].dot(i[e]),-1,1));r[e].applyMatrix4(o.makeRotationAxis(a,t))}s[e].crossVectors(i[e],r[e])}if(!0===e){let e=Math.acos(lc(r[0].dot(r[t]),-1,1));e/=t,i[0].dot(a.crossVectors(r[0],r[t]))>0&&(e=-e);for(let n=1;n<=t;n++)r[n].applyMatrix4(o.makeRotationAxis(i[n],e*n)),s[n].crossVectors(i[n],r[n])}return{tangents:i,normals:r,binormals:s}}clone(){return(new this.constructor).copy(this)}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}toJSON(){const t={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t}fromJSON(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}class ZA extends KA{constructor(t=0,e=0,n=1,i=1,r=0,s=2*Math.PI,a=!1,o=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=t,this.aY=e,this.xRadius=n,this.yRadius=i,this.aStartAngle=r,this.aEndAngle=s,this.aClockwise=a,this.aRotation=o}getPoint(t,e=new Ac){const n=e,i=2*Math.PI;let r=this.aEndAngle-this.aStartAngle;const s=Math.abs(r)<Number.EPSILON;for(;r<0;)r+=i;for(;r>i;)r-=i;r<Number.EPSILON&&(r=s?0:i),!0!==this.aClockwise||s||(r===i?r=-i:r-=i);const a=this.aStartAngle+t*r;let o=this.aX+this.xRadius*Math.cos(a),c=this.aY+this.yRadius*Math.sin(a);if(0!==this.aRotation){const t=Math.cos(this.aRotation),e=Math.sin(this.aRotation),n=o-this.aX,i=c-this.aY;o=n*t-i*e+this.aX,c=n*e+i*t+this.aY}return n.set(o,c)}copy(t){return super.copy(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}toJSON(){const t=super.toJSON();return t.aX=this.aX,t.aY=this.aY,t.xRadius=this.xRadius,t.yRadius=this.yRadius,t.aStartAngle=this.aStartAngle,t.aEndAngle=this.aEndAngle,t.aClockwise=this.aClockwise,t.aRotation=this.aRotation,t}fromJSON(t){return super.fromJSON(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}}class $A extends ZA{constructor(t,e,n,i,r,s){super(t,e,n,n,i,r,s),this.isArcCurve=!0,this.type="ArcCurve"}}function tg(){let t=0,e=0,n=0,i=0;function r(r,s,a,o){t=r,e=a,n=-3*r+3*s-2*a-o,i=2*r-2*s+a+o}return{initCatmullRom:function(t,e,n,i,s){r(e,n,s*(n-t),s*(i-e))},initNonuniformCatmullRom:function(t,e,n,i,s,a,o){let c=(e-t)/s-(n-t)/(s+a)+(n-e)/a,l=(n-e)/a-(i-e)/(a+o)+(i-n)/o;c*=a,l*=a,r(e,n,c,l)},calc:function(r){const s=r*r;return t+e*r+n*s+i*(s*r)}}}const eg=new jc,ng=new tg,ig=new tg,rg=new tg;class sg extends KA{constructor(t=[],e=!1,n="centripetal",i=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=t,this.closed=e,this.curveType=n,this.tension=i}getPoint(t,e=new jc){const n=e,i=this.points,r=i.length,s=(r-(this.closed?0:1))*t;let a,o,c=Math.floor(s),l=s-c;this.closed?c+=c>0?0:(Math.floor(Math.abs(c)/r)+1)*r:0===l&&c===r-1&&(c=r-2,l=1),this.closed||c>0?a=i[(c-1)%r]:(eg.subVectors(i[0],i[1]).add(i[0]),a=eg);const h=i[c%r],u=i[(c+1)%r];if(this.closed||c+2<r?o=i[(c+2)%r]:(eg.subVectors(i[r-1],i[r-2]).add(i[r-1]),o=eg),"centripetal"===this.curveType||"chordal"===this.curveType){const t="chordal"===this.curveType?.5:.25;let e=Math.pow(a.distanceToSquared(h),t),n=Math.pow(h.distanceToSquared(u),t),i=Math.pow(u.distanceToSquared(o),t);n<1e-4&&(n=1),e<1e-4&&(e=n),i<1e-4&&(i=n),ng.initNonuniformCatmullRom(a.x,h.x,u.x,o.x,e,n,i),ig.initNonuniformCatmullRom(a.y,h.y,u.y,o.y,e,n,i),rg.initNonuniformCatmullRom(a.z,h.z,u.z,o.z,e,n,i)}else"catmullrom"===this.curveType&&(ng.initCatmullRom(a.x,h.x,u.x,o.x,this.tension),ig.initCatmullRom(a.y,h.y,u.y,o.y,this.tension),rg.initCatmullRom(a.z,h.z,u.z,o.z,this.tension));return n.set(ng.calc(l),ig.calc(l),rg.calc(l)),n}copy(t){super.copy(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const n=t.points[e];this.points.push(n.clone())}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}toJSON(){const t=super.toJSON();t.points=[];for(let e=0,n=this.points.length;e<n;e++){const n=this.points[e];t.points.push(n.toArray())}return t.closed=this.closed,t.curveType=this.curveType,t.tension=this.tension,t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const n=t.points[e];this.points.push((new jc).fromArray(n))}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}}function ag(t,e,n,i,r){const s=.5*(i-e),a=.5*(r-n),o=t*t;return(2*n-2*i+s+a)*(t*o)+(-3*n+3*i-2*s-a)*o+s*t+n}function og(t,e,n,i){return function(t,e){const n=1-t;return n*n*e}(t,e)+function(t,e){return 2*(1-t)*t*e}(t,n)+function(t,e){return t*t*e}(t,i)}function cg(t,e,n,i,r){return function(t,e){const n=1-t;return n*n*n*e}(t,e)+function(t,e){const n=1-t;return 3*n*n*t*e}(t,n)+function(t,e){return 3*(1-t)*t*t*e}(t,i)+function(t,e){return t*t*t*e}(t,r)}class lg extends KA{constructor(t=new Ac,e=new Ac,n=new Ac,i=new Ac){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=t,this.v1=e,this.v2=n,this.v3=i}getPoint(t,e=new Ac){const n=e,i=this.v0,r=this.v1,s=this.v2,a=this.v3;return n.set(cg(t,i.x,r.x,s.x,a.x),cg(t,i.y,r.y,s.y,a.y)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}class hg extends KA{constructor(t=new jc,e=new jc,n=new jc,i=new jc){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=t,this.v1=e,this.v2=n,this.v3=i}getPoint(t,e=new jc){const n=e,i=this.v0,r=this.v1,s=this.v2,a=this.v3;return n.set(cg(t,i.x,r.x,s.x,a.x),cg(t,i.y,r.y,s.y,a.y),cg(t,i.z,r.z,s.z,a.z)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}class ug extends KA{constructor(t=new Ac,e=new Ac){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=t,this.v2=e}getPoint(t,e=new Ac){const n=e;return 1===t?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(t).add(this.v1)),n}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e=new Ac){return e.subVectors(this.v2,this.v1).normalize()}getTangentAt(t,e){return this.getTangent(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class dg extends KA{constructor(t=new jc,e=new jc){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=t,this.v2=e}getPoint(t,e=new jc){const n=e;return 1===t?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(t).add(this.v1)),n}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e=new jc){return e.subVectors(this.v2,this.v1).normalize()}getTangentAt(t,e){return this.getTangent(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class pg extends KA{constructor(t=new Ac,e=new Ac,n=new Ac){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=t,this.v1=e,this.v2=n}getPoint(t,e=new Ac){const n=e,i=this.v0,r=this.v1,s=this.v2;return n.set(og(t,i.x,r.x,s.x),og(t,i.y,r.y,s.y)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class fg extends KA{constructor(t=new jc,e=new jc,n=new jc){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=t,this.v1=e,this.v2=n}getPoint(t,e=new jc){const n=e,i=this.v0,r=this.v1,s=this.v2;return n.set(og(t,i.x,r.x,s.x),og(t,i.y,r.y,s.y),og(t,i.z,r.z,s.z)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class Ag extends KA{constructor(t=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=t}getPoint(t,e=new Ac){const n=e,i=this.points,r=(i.length-1)*t,s=Math.floor(r),a=r-s,o=i[0===s?s:s-1],c=i[s],l=i[s>i.length-2?i.length-1:s+1],h=i[s>i.length-3?i.length-1:s+2];return n.set(ag(a,o.x,c.x,l.x,h.x),ag(a,o.y,c.y,l.y,h.y)),n}copy(t){super.copy(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const n=t.points[e];this.points.push(n.clone())}return this}toJSON(){const t=super.toJSON();t.points=[];for(let e=0,n=this.points.length;e<n;e++){const n=this.points[e];t.points.push(n.toArray())}return t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const n=t.points[e];this.points.push((new Ac).fromArray(n))}return this}}var gg=Object.freeze({__proto__:null,ArcCurve:$A,CatmullRomCurve3:sg,CubicBezierCurve:lg,CubicBezierCurve3:hg,EllipseCurve:ZA,LineCurve:ug,LineCurve3:dg,QuadraticBezierCurve:pg,QuadraticBezierCurve3:fg,SplineCurve:Ag});class mg extends KA{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(t){this.curves.push(t)}closePath(){const t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);if(!t.equals(e)){const n=!0===t.isVector2?"LineCurve":"LineCurve3";this.curves.push(new gg[n](e,t))}return this}getPoint(t,e){const n=t*this.getLength(),i=this.getCurveLengths();let r=0;for(;r<i.length;){if(i[r]>=n){const t=i[r]-n,s=this.curves[r],a=s.getLength(),o=0===a?0:1-t/a;return s.getPointAt(o,e)}r++}return null}getLength(){const t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const t=[];let e=0;for(let n=0,i=this.curves.length;n<i;n++)e+=this.curves[n].getLength(),t.push(e);return this.cacheLengths=t,t}getSpacedPoints(t=40){const e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return this.autoClose&&e.push(e[0]),e}getPoints(t=12){const e=[];let n;for(let i=0,r=this.curves;i<r.length;i++){const s=r[i],a=s.isEllipseCurve?2*t:s.isLineCurve||s.isLineCurve3?1:s.isSplineCurve?t*s.points.length:t,o=s.getPoints(a);for(let t=0;t<o.length;t++){const i=o[t];n&&n.equals(i)||(e.push(i),n=i)}}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}copy(t){super.copy(t),this.curves=[];for(let e=0,n=t.curves.length;e<n;e++){const n=t.curves[e];this.curves.push(n.clone())}return this.autoClose=t.autoClose,this}toJSON(){const t=super.toJSON();t.autoClose=this.autoClose,t.curves=[];for(let e=0,n=this.curves.length;e<n;e++){const n=this.curves[e];t.curves.push(n.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.autoClose=t.autoClose,this.curves=[];for(let e=0,n=t.curves.length;e<n;e++){const n=t.curves[e];this.curves.push((new gg[n.type]).fromJSON(n))}return this}}class _g extends mg{constructor(t){super(),this.type="Path",this.currentPoint=new Ac,t&&this.setFromPoints(t)}setFromPoints(t){this.moveTo(t[0].x,t[0].y);for(let e=1,n=t.length;e<n;e++)this.lineTo(t[e].x,t[e].y);return this}moveTo(t,e){return this.currentPoint.set(t,e),this}lineTo(t,e){const n=new ug(this.currentPoint.clone(),new Ac(t,e));return this.curves.push(n),this.currentPoint.set(t,e),this}quadraticCurveTo(t,e,n,i){const r=new pg(this.currentPoint.clone(),new Ac(t,e),new Ac(n,i));return this.curves.push(r),this.currentPoint.set(n,i),this}bezierCurveTo(t,e,n,i,r,s){const a=new lg(this.currentPoint.clone(),new Ac(t,e),new Ac(n,i),new Ac(r,s));return this.curves.push(a),this.currentPoint.set(r,s),this}splineThru(t){const e=[this.currentPoint.clone()].concat(t),n=new Ag(e);return this.curves.push(n),this.currentPoint.copy(t[t.length-1]),this}arc(t,e,n,i,r,s){const a=this.currentPoint.x,o=this.currentPoint.y;return this.absarc(t+a,e+o,n,i,r,s),this}absarc(t,e,n,i,r,s){return this.absellipse(t,e,n,n,i,r,s),this}ellipse(t,e,n,i,r,s,a,o){const c=this.currentPoint.x,l=this.currentPoint.y;return this.absellipse(t+c,e+l,n,i,r,s,a,o),this}absellipse(t,e,n,i,r,s,a,o){const c=new ZA(t,e,n,i,r,s,a,o);if(this.curves.length>0){const t=c.getPoint(0);t.equals(this.currentPoint)||this.lineTo(t.x,t.y)}this.curves.push(c);const l=c.getPoint(1);return this.currentPoint.copy(l),this}copy(t){return super.copy(t),this.currentPoint.copy(t.currentPoint),this}toJSON(){const t=super.toJSON();return t.currentPoint=this.currentPoint.toArray(),t}fromJSON(t){return super.fromJSON(t),this.currentPoint.fromArray(t.currentPoint),this}}class vg extends Lh{constructor(t=[new Ac(0,-.5),new Ac(.5,0),new Ac(0,.5)],e=12,n=0,i=2*Math.PI){super(),this.type="LatheGeometry",this.parameters={points:t,segments:e,phiStart:n,phiLength:i},e=Math.floor(e),i=lc(i,0,2*Math.PI);const r=[],s=[],a=[],o=[],c=[],l=1/e,h=new jc,u=new Ac,d=new jc,p=new jc,f=new jc;let A=0,g=0;for(let e=0;e<=t.length-1;e++)switch(e){case 0:A=t[e+1].x-t[e].x,g=t[e+1].y-t[e].y,d.x=1*g,d.y=-A,d.z=0*g,f.copy(d),d.normalize(),o.push(d.x,d.y,d.z);break;case t.length-1:o.push(f.x,f.y,f.z);break;default:A=t[e+1].x-t[e].x,g=t[e+1].y-t[e].y,d.x=1*g,d.y=-A,d.z=0*g,p.copy(d),d.x+=f.x,d.y+=f.y,d.z+=f.z,d.normalize(),o.push(d.x,d.y,d.z),f.copy(p)}for(let r=0;r<=e;r++){const d=n+r*l*i,p=Math.sin(d),f=Math.cos(d);for(let n=0;n<=t.length-1;n++){h.x=t[n].x*p,h.y=t[n].y,h.z=t[n].x*f,s.push(h.x,h.y,h.z),u.x=r/e,u.y=n/(t.length-1),a.push(u.x,u.y);const i=o[3*n+0]*p,l=o[3*n+1],d=o[3*n+0]*f;c.push(i,l,d)}}for(let n=0;n<e;n++)for(let e=0;e<t.length-1;e++){const i=e+n*t.length,s=i,a=i+t.length,o=i+t.length+1,c=i+1;r.push(s,a,c),r.push(o,c,a)}this.setIndex(r),this.setAttribute("position",new Ch(s,3)),this.setAttribute("uv",new Ch(a,2)),this.setAttribute("normal",new Ch(c,3))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new vg(t.points,t.segments,t.phiStart,t.phiLength)}}class yg extends vg{constructor(t=1,e=1,n=4,i=8){const r=new _g;r.absarc(0,-e/2,t,1.5*Math.PI,0),r.absarc(0,e/2,t,0,.5*Math.PI),super(r.getPoints(n),i),this.type="CapsuleGeometry",this.parameters={radius:t,length:e,capSegments:n,radialSegments:i}}static fromJSON(t){return new yg(t.radius,t.length,t.capSegments,t.radialSegments)}}class bg extends Lh{constructor(t=1,e=32,n=0,i=2*Math.PI){super(),this.type="CircleGeometry",this.parameters={radius:t,segments:e,thetaStart:n,thetaLength:i},e=Math.max(3,e);const r=[],s=[],a=[],o=[],c=new jc,l=new Ac;s.push(0,0,0),a.push(0,0,1),o.push(.5,.5);for(let r=0,h=3;r<=e;r++,h+=3){const u=n+r/e*i;c.x=t*Math.cos(u),c.y=t*Math.sin(u),s.push(c.x,c.y,c.z),a.push(0,0,1),l.x=(s[h]/t+1)/2,l.y=(s[h+1]/t+1)/2,o.push(l.x,l.y)}for(let t=1;t<=e;t++)r.push(t,t+1,0);this.setIndex(r),this.setAttribute("position",new Ch(s,3)),this.setAttribute("normal",new Ch(a,3)),this.setAttribute("uv",new Ch(o,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new bg(t.radius,t.segments,t.thetaStart,t.thetaLength)}}class xg extends Lh{constructor(t=1,e=1,n=1,i=32,r=1,s=!1,a=0,o=2*Math.PI){super(),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:n,radialSegments:i,heightSegments:r,openEnded:s,thetaStart:a,thetaLength:o};const c=this;i=Math.floor(i),r=Math.floor(r);const l=[],h=[],u=[],d=[];let p=0;const f=[],A=n/2;let g=0;function m(n){const r=p,s=new Ac,f=new jc;let m=0;const _=!0===n?t:e,v=!0===n?1:-1;for(let t=1;t<=i;t++)h.push(0,A*v,0),u.push(0,v,0),d.push(.5,.5),p++;const y=p;for(let t=0;t<=i;t++){const e=t/i*o+a,n=Math.cos(e),r=Math.sin(e);f.x=_*r,f.y=A*v,f.z=_*n,h.push(f.x,f.y,f.z),u.push(0,v,0),s.x=.5*n+.5,s.y=.5*r*v+.5,d.push(s.x,s.y),p++}for(let t=0;t<i;t++){const e=r+t,i=y+t;!0===n?l.push(i,i+1,e):l.push(i+1,i,e),m+=3}c.addGroup(g,m,!0===n?1:2),g+=m}!function(){const s=new jc,m=new jc;let _=0;const v=(e-t)/n;for(let c=0;c<=r;c++){const l=[],g=c/r,_=g*(e-t)+t;for(let t=0;t<=i;t++){const e=t/i,r=e*o+a,c=Math.sin(r),f=Math.cos(r);m.x=_*c,m.y=-g*n+A,m.z=_*f,h.push(m.x,m.y,m.z),s.set(c,v,f).normalize(),u.push(s.x,s.y,s.z),d.push(e,1-g),l.push(p++)}f.push(l)}for(let t=0;t<i;t++)for(let e=0;e<r;e++){const n=f[e][t],i=f[e+1][t],r=f[e+1][t+1],s=f[e][t+1];l.push(n,i,s),l.push(i,r,s),_+=6}c.addGroup(g,_,0),g+=_}(),!1===s&&(t>0&&m(!0),e>0&&m(!1)),this.setIndex(l),this.setAttribute("position",new Ch(h,3)),this.setAttribute("normal",new Ch(u,3)),this.setAttribute("uv",new Ch(d,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new xg(t.radiusTop,t.radiusBottom,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class wg extends xg{constructor(t=1,e=1,n=32,i=1,r=!1,s=0,a=2*Math.PI){super(0,t,e,n,i,r,s,a),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:s,thetaLength:a}}static fromJSON(t){return new wg(t.radius,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class Eg extends Lh{constructor(t=[],e=[],n=1,i=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:n,detail:i};const r=[],s=[];function a(t,e,n,i){const r=i+1,s=[];for(let i=0;i<=r;i++){s[i]=[];const a=t.clone().lerp(n,i/r),o=e.clone().lerp(n,i/r),c=r-i;for(let t=0;t<=c;t++)s[i][t]=0===t&&i===r?a:a.clone().lerp(o,t/c)}for(let t=0;t<r;t++)for(let e=0;e<2*(r-t)-1;e++){const n=Math.floor(e/2);e%2==0?(o(s[t][n+1]),o(s[t+1][n]),o(s[t][n])):(o(s[t][n+1]),o(s[t+1][n+1]),o(s[t+1][n]))}}function o(t){r.push(t.x,t.y,t.z)}function c(e,n){const i=3*e;n.x=t[i+0],n.y=t[i+1],n.z=t[i+2]}function l(t,e,n,i){i<0&&1===t.x&&(s[e]=t.x-1),0===n.x&&0===n.z&&(s[e]=i/2/Math.PI+.5)}function h(t){return Math.atan2(t.z,-t.x)}!function(t){const n=new jc,i=new jc,r=new jc;for(let s=0;s<e.length;s+=3)c(e[s+0],n),c(e[s+1],i),c(e[s+2],r),a(n,i,r,t)}(i),function(t){const e=new jc;for(let n=0;n<r.length;n+=3)e.x=r[n+0],e.y=r[n+1],e.z=r[n+2],e.normalize().multiplyScalar(t),r[n+0]=e.x,r[n+1]=e.y,r[n+2]=e.z}(n),function(){const t=new jc;for(let n=0;n<r.length;n+=3){t.x=r[n+0],t.y=r[n+1],t.z=r[n+2];const i=h(t)/2/Math.PI+.5,a=(e=t,Math.atan2(-e.y,Math.sqrt(e.x*e.x+e.z*e.z))/Math.PI+.5);s.push(i,1-a)}var e;(function(){const t=new jc,e=new jc,n=new jc,i=new jc,a=new Ac,o=new Ac,c=new Ac;for(let u=0,d=0;u<r.length;u+=9,d+=6){t.set(r[u+0],r[u+1],r[u+2]),e.set(r[u+3],r[u+4],r[u+5]),n.set(r[u+6],r[u+7],r[u+8]),a.set(s[d+0],s[d+1]),o.set(s[d+2],s[d+3]),c.set(s[d+4],s[d+5]),i.copy(t).add(e).add(n).divideScalar(3);const p=h(i);l(a,d+0,t,p),l(o,d+2,e,p),l(c,d+4,n,p)}})(),function(){for(let t=0;t<s.length;t+=6){const e=s[t+0],n=s[t+2],i=s[t+4],r=Math.max(e,n,i),a=Math.min(e,n,i);r>.9&&a<.1&&(e<.2&&(s[t+0]+=1),n<.2&&(s[t+2]+=1),i<.2&&(s[t+4]+=1))}}()}(),this.setAttribute("position",new Ch(r,3)),this.setAttribute("normal",new Ch(r.slice(),3)),this.setAttribute("uv",new Ch(s,2)),0===i?this.computeVertexNormals():this.normalizeNormals()}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new Eg(t.vertices,t.indices,t.radius,t.details)}}class Cg extends Eg{constructor(t=1,e=0){const n=(1+Math.sqrt(5))/2,i=1/n;super([-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-i,-n,0,-i,n,0,i,-n,0,i,n,-i,-n,0,-i,n,0,i,-n,0,i,n,0,-n,0,-i,n,0,-i,-n,0,i,n,0,i],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],t,e),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new Cg(t.radius,t.detail)}}const Sg=new jc,Mg=new jc,Ig=new jc,Tg=new sh;class Bg extends Lh{constructor(t=null,e=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:t,thresholdAngle:e},null!==t){const n=4,i=Math.pow(10,n),r=Math.cos(ac*e),s=t.getIndex(),a=t.getAttribute("position"),o=s?s.count:a.count,c=[0,0,0],l=["a","b","c"],h=new Array(3),u={},d=[];for(let t=0;t<o;t+=3){s?(c[0]=s.getX(t),c[1]=s.getX(t+1),c[2]=s.getX(t+2)):(c[0]=t,c[1]=t+1,c[2]=t+2);const{a:e,b:n,c:o}=Tg;if(e.fromBufferAttribute(a,c[0]),n.fromBufferAttribute(a,c[1]),o.fromBufferAttribute(a,c[2]),Tg.getNormal(Ig),h[0]=`${Math.round(e.x*i)},${Math.round(e.y*i)},${Math.round(e.z*i)}`,h[1]=`${Math.round(n.x*i)},${Math.round(n.y*i)},${Math.round(n.z*i)}`,h[2]=`${Math.round(o.x*i)},${Math.round(o.y*i)},${Math.round(o.z*i)}`,h[0]!==h[1]&&h[1]!==h[2]&&h[2]!==h[0])for(let t=0;t<3;t++){const e=(t+1)%3,n=h[t],i=h[e],s=Tg[l[t]],a=Tg[l[e]],o=`${n}_${i}`,p=`${i}_${n}`;p in u&&u[p]?(Ig.dot(u[p].normal)<=r&&(d.push(s.x,s.y,s.z),d.push(a.x,a.y,a.z)),u[p]=null):o in u||(u[o]={index0:c[t],index1:c[e],normal:Ig.clone()})}}for(const t in u)if(u[t]){const{index0:e,index1:n}=u[t];Sg.fromBufferAttribute(a,e),Mg.fromBufferAttribute(a,n),d.push(Sg.x,Sg.y,Sg.z),d.push(Mg.x,Mg.y,Mg.z)}this.setAttribute("position",new Ch(d,3))}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}}class Rg extends _g{constructor(t){super(t),this.uuid=cc(),this.type="Shape",this.holes=[]}getPointsHoles(t){const e=[];for(let n=0,i=this.holes.length;n<i;n++)e[n]=this.holes[n].getPoints(t);return e}extractPoints(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}}copy(t){super.copy(t),this.holes=[];for(let e=0,n=t.holes.length;e<n;e++){const n=t.holes[e];this.holes.push(n.clone())}return this}toJSON(){const t=super.toJSON();t.uuid=this.uuid,t.holes=[];for(let e=0,n=this.holes.length;e<n;e++){const n=this.holes[e];t.holes.push(n.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.uuid=t.uuid,this.holes=[];for(let e=0,n=t.holes.length;e<n;e++){const n=t.holes[e];this.holes.push((new _g).fromJSON(n))}return this}}const Dg=function(t,e,n=2){const i=e&&e.length,r=i?e[0]*n:t.length;let s=Lg(t,0,r,n,!0);const a=[];if(!s||s.next===s.prev)return a;let o,c,l,h,u,d,p;if(i&&(s=function(t,e,n,i){const r=[];let s,a,o,c,l;for(s=0,a=e.length;s<a;s++)o=e[s]*i,c=s<a-1?e[s+1]*i:t.length,l=Lg(t,o,c,i,!1),l===l.next&&(l.steiner=!0),r.push(Vg(l));for(r.sort(Qg),s=0;s<r.length;s++)n=zg(r[s],n);return n}(t,e,s,n)),t.length>80*n){o=l=t[0],c=h=t[1];for(let e=n;e<r;e+=n)u=t[e],d=t[e+1],u<o&&(o=u),d<c&&(c=d),u>l&&(l=u),d>h&&(h=d);p=Math.max(l-o,h-c),p=0!==p?32767/p:0}return kg(s,a,n,o,c,p,0),a};function Lg(t,e,n,i,r){let s,a;if(r===function(t,e,n,i){let r=0;for(let s=e,a=n-i;s<n;s+=i)r+=(t[a]-t[s])*(t[s+1]+t[a+1]),a=s;return r}(t,e,n,i)>0)for(s=e;s<n;s+=i)a=tm(s,t[s],t[s+1],a);else for(s=n-i;s>=e;s-=i)a=tm(s,t[s],t[s+1],a);return a&&Yg(a,a.next)&&(em(a),a=a.next),a}function Pg(t,e){if(!t)return t;e||(e=t);let n,i=t;do{if(n=!1,i.steiner||!Yg(i,i.next)&&0!==qg(i.prev,i,i.next))i=i.next;else{if(em(i),i=e=i.prev,i===i.next)break;n=!0}}while(n||i!==e);return e}function kg(t,e,n,i,r,s,a){if(!t)return;!a&&s&&function(t,e,n,i){let r=t;do{0===r.z&&(r.z=Hg(r.x,r.y,e,n,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){let e,n,i,r,s,a,o,c,l=1;do{for(n=t,t=null,s=null,a=0;n;){for(a++,i=n,o=0,e=0;e<l&&(o++,i=i.nextZ,i);e++);for(c=l;o>0||c>0&&i;)0!==o&&(0===c||!i||n.z<=i.z)?(r=n,n=n.nextZ,o--):(r=i,i=i.nextZ,c--),s?s.nextZ=r:t=r,r.prevZ=s,s=r;n=i}s.nextZ=null,l*=2}while(a>1)}(r)}(t,i,r,s);let o,c,l=t;for(;t.prev!==t.next;)if(o=t.prev,c=t.next,s?Ug(t,i,r,s):Og(t))e.push(o.i/n|0),e.push(t.i/n|0),e.push(c.i/n|0),em(t),t=c.next,l=c.next;else if((t=c)===l){a?1===a?kg(t=Ng(Pg(t),e,n),e,n,i,r,s,2):2===a&&Fg(t,e,n,i,r,s):kg(Pg(t),e,n,i,r,s,1);break}}function Og(t){const e=t.prev,n=t,i=t.next;if(qg(e,n,i)>=0)return!1;const r=e.x,s=n.x,a=i.x,o=e.y,c=n.y,l=i.y,h=r<s?r<a?r:a:s<a?s:a,u=o<c?o<l?o:l:c<l?c:l,d=r>s?r>a?r:a:s>a?s:a,p=o>c?o>l?o:l:c>l?c:l;let f=i.next;for(;f!==e;){if(f.x>=h&&f.x<=d&&f.y>=u&&f.y<=p&&jg(r,o,s,c,a,l,f.x,f.y)&&qg(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function Ug(t,e,n,i){const r=t.prev,s=t,a=t.next;if(qg(r,s,a)>=0)return!1;const o=r.x,c=s.x,l=a.x,h=r.y,u=s.y,d=a.y,p=o<c?o<l?o:l:c<l?c:l,f=h<u?h<d?h:d:u<d?u:d,A=o>c?o>l?o:l:c>l?c:l,g=h>u?h>d?h:d:u>d?u:d,m=Hg(p,f,e,n,i),_=Hg(A,g,e,n,i);let v=t.prevZ,y=t.nextZ;for(;v&&v.z>=m&&y&&y.z<=_;){if(v.x>=p&&v.x<=A&&v.y>=f&&v.y<=g&&v!==r&&v!==a&&jg(o,h,c,u,l,d,v.x,v.y)&&qg(v.prev,v,v.next)>=0)return!1;if(v=v.prevZ,y.x>=p&&y.x<=A&&y.y>=f&&y.y<=g&&y!==r&&y!==a&&jg(o,h,c,u,l,d,y.x,y.y)&&qg(y.prev,y,y.next)>=0)return!1;y=y.nextZ}for(;v&&v.z>=m;){if(v.x>=p&&v.x<=A&&v.y>=f&&v.y<=g&&v!==r&&v!==a&&jg(o,h,c,u,l,d,v.x,v.y)&&qg(v.prev,v,v.next)>=0)return!1;v=v.prevZ}for(;y&&y.z<=_;){if(y.x>=p&&y.x<=A&&y.y>=f&&y.y<=g&&y!==r&&y!==a&&jg(o,h,c,u,l,d,y.x,y.y)&&qg(y.prev,y,y.next)>=0)return!1;y=y.nextZ}return!0}function Ng(t,e,n){let i=t;do{const r=i.prev,s=i.next.next;!Yg(r,s)&&Xg(r,i,i.next,s)&&Zg(r,s)&&Zg(s,r)&&(e.push(r.i/n|0),e.push(i.i/n|0),e.push(s.i/n|0),em(i),em(i.next),i=t=s),i=i.next}while(i!==t);return Pg(i)}function Fg(t,e,n,i,r,s){let a=t;do{let t=a.next.next;for(;t!==a.prev;){if(a.i!==t.i&&Wg(a,t)){let o=$g(a,t);return a=Pg(a,a.next),o=Pg(o,o.next),kg(a,e,n,i,r,s,0),void kg(o,e,n,i,r,s,0)}t=t.next}a=a.next}while(a!==t)}function Qg(t,e){return t.x-e.x}function zg(t,e){const n=function(t,e){let n,i=e,r=-1/0;const s=t.x,a=t.y;do{if(a<=i.y&&a>=i.next.y&&i.next.y!==i.y){const t=i.x+(a-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(t<=s&&t>r&&(r=t,n=i.x<i.next.x?i:i.next,t===s))return n}i=i.next}while(i!==e);if(!n)return null;const o=n,c=n.x,l=n.y;let h,u=1/0;i=n;do{s>=i.x&&i.x>=c&&s!==i.x&&jg(a<l?s:r,a,c,l,a<l?r:s,a,i.x,i.y)&&(h=Math.abs(a-i.y)/(s-i.x),Zg(i,t)&&(h<u||h===u&&(i.x>n.x||i.x===n.x&&Gg(n,i)))&&(n=i,u=h)),i=i.next}while(i!==o);return n}(t,e);if(!n)return e;const i=$g(n,t);return Pg(i,i.next),Pg(n,n.next)}function Gg(t,e){return qg(t.prev,t,e.prev)<0&&qg(e.next,t,t.next)<0}function Hg(t,e,n,i,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-n)*r|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-i)*r|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Vg(t){let e=t,n=t;do{(e.x<n.x||e.x===n.x&&e.y<n.y)&&(n=e),e=e.next}while(e!==t);return n}function jg(t,e,n,i,r,s,a,o){return(r-a)*(e-o)>=(t-a)*(s-o)&&(t-a)*(i-o)>=(n-a)*(e-o)&&(n-a)*(s-o)>=(r-a)*(i-o)}function Wg(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){let n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&Xg(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}(t,e)&&(Zg(t,e)&&Zg(e,t)&&function(t,e){let n=t,i=!1;const r=(t.x+e.x)/2,s=(t.y+e.y)/2;do{n.y>s!=n.next.y>s&&n.next.y!==n.y&&r<(n.next.x-n.x)*(s-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next}while(n!==t);return i}(t,e)&&(qg(t.prev,t,e.prev)||qg(t,e.prev,e))||Yg(t,e)&&qg(t.prev,t,t.next)>0&&qg(e.prev,e,e.next)>0)}function qg(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function Yg(t,e){return t.x===e.x&&t.y===e.y}function Xg(t,e,n,i){const r=Kg(qg(t,e,n)),s=Kg(qg(t,e,i)),a=Kg(qg(n,i,t)),o=Kg(qg(n,i,e));return r!==s&&a!==o||(!(0!==r||!Jg(t,n,e))||(!(0!==s||!Jg(t,i,e))||(!(0!==a||!Jg(n,t,i))||!(0!==o||!Jg(n,e,i)))))}function Jg(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function Kg(t){return t>0?1:t<0?-1:0}function Zg(t,e){return qg(t.prev,t,t.next)<0?qg(t,e,t.next)>=0&&qg(t,t.prev,e)>=0:qg(t,e,t.prev)<0||qg(t,t.next,e)<0}function $g(t,e){const n=new nm(t.i,t.x,t.y),i=new nm(e.i,e.x,e.y),r=t.next,s=e.prev;return t.next=e,e.prev=t,n.next=r,r.prev=n,i.next=n,n.prev=i,s.next=i,i.prev=s,i}function tm(t,e,n,i){const r=new nm(t,e,n);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function em(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function nm(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}class im{static area(t){const e=t.length;let n=0;for(let i=e-1,r=0;r<e;i=r++)n+=t[i].x*t[r].y-t[r].x*t[i].y;return.5*n}static isClockWise(t){return im.area(t)<0}static triangulateShape(t,e){const n=[],i=[],r=[];rm(t),sm(n,t);let s=t.length;e.forEach(rm);for(let t=0;t<e.length;t++)i.push(s),s+=e[t].length,sm(n,e[t]);const a=Dg(n,i);for(let t=0;t<a.length;t+=3)r.push(a.slice(t,t+3));return r}}function rm(t){const e=t.length;e>2&&t[e-1].equals(t[0])&&t.pop()}function sm(t,e){for(let n=0;n<e.length;n++)t.push(e[n].x),t.push(e[n].y)}class am extends Lh{constructor(t=new Rg([new Ac(.5,.5),new Ac(-.5,.5),new Ac(-.5,-.5),new Ac(.5,-.5)]),e={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:t,options:e},t=Array.isArray(t)?t:[t];const n=this,i=[],r=[];for(let e=0,n=t.length;e<n;e++){s(t[e])}function s(t){const s=[],a=void 0!==e.curveSegments?e.curveSegments:12,o=void 0!==e.steps?e.steps:1,c=void 0!==e.depth?e.depth:1;let l=void 0===e.bevelEnabled||e.bevelEnabled,h=void 0!==e.bevelThickness?e.bevelThickness:.2,u=void 0!==e.bevelSize?e.bevelSize:h-.1,d=void 0!==e.bevelOffset?e.bevelOffset:0,p=void 0!==e.bevelSegments?e.bevelSegments:3;const f=e.extrudePath,A=void 0!==e.UVGenerator?e.UVGenerator:om;let g,m,_,v,y,b=!1;f&&(g=f.getSpacedPoints(o),b=!0,l=!1,m=f.computeFrenetFrames(o,!1),_=new jc,v=new jc,y=new jc),l||(p=0,h=0,u=0,d=0);const x=t.extractPoints(a);let w=x.shape;const E=x.holes;if(!im.isClockWise(w)){w=w.reverse();for(let t=0,e=E.length;t<e;t++){const e=E[t];im.isClockWise(e)&&(E[t]=e.reverse())}}const C=im.triangulateShape(w,E),S=w;for(let t=0,e=E.length;t<e;t++){const e=E[t];w=w.concat(e)}function M(t,e,n){return t.clone().addScaledVector(e,n)}const I=w.length,T=C.length;function B(t,e,n){let i,r,s;const a=t.x-e.x,o=t.y-e.y,c=n.x-t.x,l=n.y-t.y,h=a*a+o*o,u=a*l-o*c;if(Math.abs(u)>Number.EPSILON){const u=Math.sqrt(h),d=Math.sqrt(c*c+l*l),p=e.x-o/u,f=e.y+a/u,A=((n.x-l/d-p)*l-(n.y+c/d-f)*c)/(a*l-o*c);i=p+a*A-t.x,r=f+o*A-t.y;const g=i*i+r*r;if(g<=2)return new Ac(i,r);s=Math.sqrt(g/2)}else{let t=!1;a>Number.EPSILON?c>Number.EPSILON&&(t=!0):a<-Number.EPSILON?c<-Number.EPSILON&&(t=!0):Math.sign(o)===Math.sign(l)&&(t=!0),t?(i=-o,r=a,s=Math.sqrt(h)):(i=a,r=o,s=Math.sqrt(h/2))}return new Ac(i/s,r/s)}const R=[];for(let t=0,e=S.length,n=e-1,i=t+1;t<e;t++,n++,i++)n===e&&(n=0),i===e&&(i=0),R[t]=B(S[t],S[n],S[i]);const D=[];let L,P=R.concat();for(let t=0,e=E.length;t<e;t++){const e=E[t];L=[];for(let t=0,n=e.length,i=n-1,r=t+1;t<n;t++,i++,r++)i===n&&(i=0),r===n&&(r=0),L[t]=B(e[t],e[i],e[r]);D.push(L),P=P.concat(L)}for(let t=0;t<p;t++){const e=t/p,n=h*Math.cos(e*Math.PI/2),i=u*Math.sin(e*Math.PI/2)+d;for(let t=0,e=S.length;t<e;t++){const e=M(S[t],R[t],i);U(e.x,e.y,-n)}for(let t=0,e=E.length;t<e;t++){const e=E[t];L=D[t];for(let t=0,r=e.length;t<r;t++){const r=M(e[t],L[t],i);U(r.x,r.y,-n)}}}const k=u+d;for(let t=0;t<I;t++){const e=l?M(w[t],P[t],k):w[t];b?(v.copy(m.normals[0]).multiplyScalar(e.x),_.copy(m.binormals[0]).multiplyScalar(e.y),y.copy(g[0]).add(v).add(_),U(y.x,y.y,y.z)):U(e.x,e.y,0)}for(let t=1;t<=o;t++)for(let e=0;e<I;e++){const n=l?M(w[e],P[e],k):w[e];b?(v.copy(m.normals[t]).multiplyScalar(n.x),_.copy(m.binormals[t]).multiplyScalar(n.y),y.copy(g[t]).add(v).add(_),U(y.x,y.y,y.z)):U(n.x,n.y,c/o*t)}for(let t=p-1;t>=0;t--){const e=t/p,n=h*Math.cos(e*Math.PI/2),i=u*Math.sin(e*Math.PI/2)+d;for(let t=0,e=S.length;t<e;t++){const e=M(S[t],R[t],i);U(e.x,e.y,c+n)}for(let t=0,e=E.length;t<e;t++){const e=E[t];L=D[t];for(let t=0,r=e.length;t<r;t++){const r=M(e[t],L[t],i);b?U(r.x,r.y+g[o-1].y,g[o-1].x+n):U(r.x,r.y,c+n)}}}function O(t,e){let n=t.length;for(;--n>=0;){const i=n;let r=n-1;r<0&&(r=t.length-1);for(let t=0,n=o+2*p;t<n;t++){const n=I*t,s=I*(t+1);F(e+i+n,e+r+n,e+r+s,e+i+s)}}}function U(t,e,n){s.push(t),s.push(e),s.push(n)}function N(t,e,r){Q(t),Q(e),Q(r);const s=i.length/3,a=A.generateTopUV(n,i,s-3,s-2,s-1);z(a[0]),z(a[1]),z(a[2])}function F(t,e,r,s){Q(t),Q(e),Q(s),Q(e),Q(r),Q(s);const a=i.length/3,o=A.generateSideWallUV(n,i,a-6,a-3,a-2,a-1);z(o[0]),z(o[1]),z(o[3]),z(o[1]),z(o[2]),z(o[3])}function Q(t){i.push(s[3*t+0]),i.push(s[3*t+1]),i.push(s[3*t+2])}function z(t){r.push(t.x),r.push(t.y)}!function(){const t=i.length/3;if(l){let t=0,e=I*t;for(let t=0;t<T;t++){const n=C[t];N(n[2]+e,n[1]+e,n[0]+e)}t=o+2*p,e=I*t;for(let t=0;t<T;t++){const n=C[t];N(n[0]+e,n[1]+e,n[2]+e)}}else{for(let t=0;t<T;t++){const e=C[t];N(e[2],e[1],e[0])}for(let t=0;t<T;t++){const e=C[t];N(e[0]+I*o,e[1]+I*o,e[2]+I*o)}}n.addGroup(t,i.length/3-t,0)}(),function(){const t=i.length/3;let e=0;O(S,e),e+=S.length;for(let t=0,n=E.length;t<n;t++){const n=E[t];O(n,e),e+=n.length}n.addGroup(t,i.length/3-t,1)}()}this.setAttribute("position",new Ch(i,3)),this.setAttribute("uv",new Ch(r,2)),this.computeVertexNormals()}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}toJSON(){const t=super.toJSON();return function(t,e,n){if(n.shapes=[],Array.isArray(t))for(let e=0,i=t.length;e<i;e++){const i=t[e];n.shapes.push(i.uuid)}else n.shapes.push(t.uuid);n.options=Object.assign({},e),void 0!==e.extrudePath&&(n.options.extrudePath=e.extrudePath.toJSON());return n}(this.parameters.shapes,this.parameters.options,t)}static fromJSON(t,e){const n=[];for(let i=0,r=t.shapes.length;i<r;i++){const r=e[t.shapes[i]];n.push(r)}const i=t.options.extrudePath;return void 0!==i&&(t.options.extrudePath=(new gg[i.type]).fromJSON(i)),new am(n,t.options)}}const om={generateTopUV:function(t,e,n,i,r){const s=e[3*n],a=e[3*n+1],o=e[3*i],c=e[3*i+1],l=e[3*r],h=e[3*r+1];return[new Ac(s,a),new Ac(o,c),new Ac(l,h)]},generateSideWallUV:function(t,e,n,i,r,s){const a=e[3*n],o=e[3*n+1],c=e[3*n+2],l=e[3*i],h=e[3*i+1],u=e[3*i+2],d=e[3*r],p=e[3*r+1],f=e[3*r+2],A=e[3*s],g=e[3*s+1],m=e[3*s+2];return Math.abs(o-h)<Math.abs(a-l)?[new Ac(a,1-c),new Ac(l,1-u),new Ac(d,1-f),new Ac(A,1-m)]:[new Ac(o,1-c),new Ac(h,1-u),new Ac(p,1-f),new Ac(g,1-m)]}};class cm extends Eg{constructor(t=1,e=0){const n=(1+Math.sqrt(5))/2;super([-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1],[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],t,e),this.type="IcosahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new cm(t.radius,t.detail)}}class lm extends Eg{constructor(t=1,e=0){super([1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],t,e),this.type="OctahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new lm(t.radius,t.detail)}}class hm extends Lh{constructor(t=.5,e=1,n=32,i=1,r=0,s=2*Math.PI){super(),this.type="RingGeometry",this.parameters={innerRadius:t,outerRadius:e,thetaSegments:n,phiSegments:i,thetaStart:r,thetaLength:s},n=Math.max(3,n);const a=[],o=[],c=[],l=[];let h=t;const u=(e-t)/(i=Math.max(1,i)),d=new jc,p=new Ac;for(let t=0;t<=i;t++){for(let t=0;t<=n;t++){const i=r+t/n*s;d.x=h*Math.cos(i),d.y=h*Math.sin(i),o.push(d.x,d.y,d.z),c.push(0,0,1),p.x=(d.x/e+1)/2,p.y=(d.y/e+1)/2,l.push(p.x,p.y)}h+=u}for(let t=0;t<i;t++){const e=t*(n+1);for(let t=0;t<n;t++){const i=t+e,r=i,s=i+n+1,o=i+n+2,c=i+1;a.push(r,s,c),a.push(s,o,c)}}this.setIndex(a),this.setAttribute("position",new Ch(o,3)),this.setAttribute("normal",new Ch(c,3)),this.setAttribute("uv",new Ch(l,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new hm(t.innerRadius,t.outerRadius,t.thetaSegments,t.phiSegments,t.thetaStart,t.thetaLength)}}class um extends Lh{constructor(t=new Rg([new Ac(0,.5),new Ac(-.5,-.5),new Ac(.5,-.5)]),e=12){super(),this.type="ShapeGeometry",this.parameters={shapes:t,curveSegments:e};const n=[],i=[],r=[],s=[];let a=0,o=0;if(!1===Array.isArray(t))c(t);else for(let e=0;e<t.length;e++)c(t[e]),this.addGroup(a,o,e),a+=o,o=0;function c(t){const a=i.length/3,c=t.extractPoints(e);let l=c.shape;const h=c.holes;!1===im.isClockWise(l)&&(l=l.reverse());for(let t=0,e=h.length;t<e;t++){const e=h[t];!0===im.isClockWise(e)&&(h[t]=e.reverse())}const u=im.triangulateShape(l,h);for(let t=0,e=h.length;t<e;t++){const e=h[t];l=l.concat(e)}for(let t=0,e=l.length;t<e;t++){const e=l[t];i.push(e.x,e.y,0),r.push(0,0,1),s.push(e.x,e.y)}for(let t=0,e=u.length;t<e;t++){const e=u[t],i=e[0]+a,r=e[1]+a,s=e[2]+a;n.push(i,r,s),o+=3}}this.setIndex(n),this.setAttribute("position",new Ch(i,3)),this.setAttribute("normal",new Ch(r,3)),this.setAttribute("uv",new Ch(s,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}toJSON(){const t=super.toJSON();return function(t,e){if(e.shapes=[],Array.isArray(t))for(let n=0,i=t.length;n<i;n++){const i=t[n];e.shapes.push(i.uuid)}else e.shapes.push(t.uuid);return e}(this.parameters.shapes,t)}static fromJSON(t,e){const n=[];for(let i=0,r=t.shapes.length;i<r;i++){const r=e[t.shapes[i]];n.push(r)}return new um(n,t.curveSegments)}}class dm extends Lh{constructor(t=1,e=32,n=16,i=0,r=2*Math.PI,s=0,a=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:n,phiStart:i,phiLength:r,thetaStart:s,thetaLength:a},e=Math.max(3,Math.floor(e)),n=Math.max(2,Math.floor(n));const o=Math.min(s+a,Math.PI);let c=0;const l=[],h=new jc,u=new jc,d=[],p=[],f=[],A=[];for(let d=0;d<=n;d++){const g=[],m=d/n;let _=0;0===d&&0===s?_=.5/e:d===n&&o===Math.PI&&(_=-.5/e);for(let n=0;n<=e;n++){const o=n/e;h.x=-t*Math.cos(i+o*r)*Math.sin(s+m*a),h.y=t*Math.cos(s+m*a),h.z=t*Math.sin(i+o*r)*Math.sin(s+m*a),p.push(h.x,h.y,h.z),u.copy(h).normalize(),f.push(u.x,u.y,u.z),A.push(o+_,1-m),g.push(c++)}l.push(g)}for(let t=0;t<n;t++)for(let i=0;i<e;i++){const e=l[t][i+1],r=l[t][i],a=l[t+1][i],c=l[t+1][i+1];(0!==t||s>0)&&d.push(e,r,c),(t!==n-1||o<Math.PI)&&d.push(r,a,c)}this.setIndex(d),this.setAttribute("position",new Ch(p,3)),this.setAttribute("normal",new Ch(f,3)),this.setAttribute("uv",new Ch(A,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new dm(t.radius,t.widthSegments,t.heightSegments,t.phiStart,t.phiLength,t.thetaStart,t.thetaLength)}}class pm extends Eg{constructor(t=1,e=0){super([1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],t,e),this.type="TetrahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new pm(t.radius,t.detail)}}class fm extends Lh{constructor(t=1,e=.4,n=12,i=48,r=2*Math.PI){super(),this.type="TorusGeometry",this.parameters={radius:t,tube:e,radialSegments:n,tubularSegments:i,arc:r},n=Math.floor(n),i=Math.floor(i);const s=[],a=[],o=[],c=[],l=new jc,h=new jc,u=new jc;for(let s=0;s<=n;s++)for(let d=0;d<=i;d++){const p=d/i*r,f=s/n*Math.PI*2;h.x=(t+e*Math.cos(f))*Math.cos(p),h.y=(t+e*Math.cos(f))*Math.sin(p),h.z=e*Math.sin(f),a.push(h.x,h.y,h.z),l.x=t*Math.cos(p),l.y=t*Math.sin(p),u.subVectors(h,l).normalize(),o.push(u.x,u.y,u.z),c.push(d/i),c.push(s/n)}for(let t=1;t<=n;t++)for(let e=1;e<=i;e++){const n=(i+1)*t+e-1,r=(i+1)*(t-1)+e-1,a=(i+1)*(t-1)+e,o=(i+1)*t+e;s.push(n,r,o),s.push(r,a,o)}this.setIndex(s),this.setAttribute("position",new Ch(a,3)),this.setAttribute("normal",new Ch(o,3)),this.setAttribute("uv",new Ch(c,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new fm(t.radius,t.tube,t.radialSegments,t.tubularSegments,t.arc)}}class Am extends Lh{constructor(t=1,e=.4,n=64,i=8,r=2,s=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:t,tube:e,tubularSegments:n,radialSegments:i,p:r,q:s},n=Math.floor(n),i=Math.floor(i);const a=[],o=[],c=[],l=[],h=new jc,u=new jc,d=new jc,p=new jc,f=new jc,A=new jc,g=new jc;for(let a=0;a<=n;++a){const _=a/n*r*Math.PI*2;m(_,r,s,t,d),m(_+.01,r,s,t,p),A.subVectors(p,d),g.addVectors(p,d),f.crossVectors(A,g),g.crossVectors(f,A),f.normalize(),g.normalize();for(let t=0;t<=i;++t){const r=t/i*Math.PI*2,s=-e*Math.cos(r),p=e*Math.sin(r);h.x=d.x+(s*g.x+p*f.x),h.y=d.y+(s*g.y+p*f.y),h.z=d.z+(s*g.z+p*f.z),o.push(h.x,h.y,h.z),u.subVectors(h,d).normalize(),c.push(u.x,u.y,u.z),l.push(a/n),l.push(t/i)}}for(let t=1;t<=n;t++)for(let e=1;e<=i;e++){const n=(i+1)*(t-1)+(e-1),r=(i+1)*t+(e-1),s=(i+1)*t+e,o=(i+1)*(t-1)+e;a.push(n,r,o),a.push(r,s,o)}function m(t,e,n,i,r){const s=Math.cos(t),a=Math.sin(t),o=n/e*t,c=Math.cos(o);r.x=i*(2+c)*.5*s,r.y=i*(2+c)*a*.5,r.z=i*Math.sin(o)*.5}this.setIndex(a),this.setAttribute("position",new Ch(o,3)),this.setAttribute("normal",new Ch(c,3)),this.setAttribute("uv",new Ch(l,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new Am(t.radius,t.tube,t.tubularSegments,t.radialSegments,t.p,t.q)}}class gm extends Lh{constructor(t=new fg(new jc(-1,-1,0),new jc(-1,1,0),new jc(1,1,0)),e=64,n=1,i=8,r=!1){super(),this.type="TubeGeometry",this.parameters={path:t,tubularSegments:e,radius:n,radialSegments:i,closed:r};const s=t.computeFrenetFrames(e,r);this.tangents=s.tangents,this.normals=s.normals,this.binormals=s.binormals;const a=new jc,o=new jc,c=new Ac;let l=new jc;const h=[],u=[],d=[],p=[];function f(r){l=t.getPointAt(r/e,l);const c=s.normals[r],d=s.binormals[r];for(let t=0;t<=i;t++){const e=t/i*Math.PI*2,r=Math.sin(e),s=-Math.cos(e);o.x=s*c.x+r*d.x,o.y=s*c.y+r*d.y,o.z=s*c.z+r*d.z,o.normalize(),u.push(o.x,o.y,o.z),a.x=l.x+n*o.x,a.y=l.y+n*o.y,a.z=l.z+n*o.z,h.push(a.x,a.y,a.z)}}!function(){for(let t=0;t<e;t++)f(t);f(!1===r?e:0),function(){for(let t=0;t<=e;t++)for(let n=0;n<=i;n++)c.x=t/e,c.y=n/i,d.push(c.x,c.y)}(),function(){for(let t=1;t<=e;t++)for(let e=1;e<=i;e++){const n=(i+1)*(t-1)+(e-1),r=(i+1)*t+(e-1),s=(i+1)*t+e,a=(i+1)*(t-1)+e;p.push(n,r,a),p.push(r,s,a)}}()}(),this.setIndex(p),this.setAttribute("position",new Ch(h,3)),this.setAttribute("normal",new Ch(u,3)),this.setAttribute("uv",new Ch(d,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}toJSON(){const t=super.toJSON();return t.path=this.parameters.path.toJSON(),t}static fromJSON(t){return new gm((new gg[t.path.type]).fromJSON(t.path),t.tubularSegments,t.radius,t.radialSegments,t.closed)}}class mm extends Lh{constructor(t=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:t},null!==t){const e=[],n=new Set,i=new jc,r=new jc;if(null!==t.index){const s=t.attributes.position,a=t.index;let o=t.groups;0===o.length&&(o=[{start:0,count:a.count,materialIndex:0}]);for(let t=0,c=o.length;t<c;++t){const c=o[t],l=c.start;for(let t=l,o=l+c.count;t<o;t+=3)for(let o=0;o<3;o++){const c=a.getX(t+o),l=a.getX(t+(o+1)%3);i.fromBufferAttribute(s,c),r.fromBufferAttribute(s,l),!0===_m(i,r,n)&&(e.push(i.x,i.y,i.z),e.push(r.x,r.y,r.z))}}}else{const s=t.attributes.position;for(let t=0,a=s.count/3;t<a;t++)for(let a=0;a<3;a++){const o=3*t+a,c=3*t+(a+1)%3;i.fromBufferAttribute(s,o),r.fromBufferAttribute(s,c),!0===_m(i,r,n)&&(e.push(i.x,i.y,i.z),e.push(r.x,r.y,r.z))}}this.setAttribute("position",new Ch(e,3))}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}}function _m(t,e,n){const i=`${t.x},${t.y},${t.z}-${e.x},${e.y},${e.z}`,r=`${e.x},${e.y},${e.z}-${t.x},${t.y},${t.z}`;return!0!==n.has(i)&&!0!==n.has(r)&&(n.add(i),n.add(r),!0)}var vm=Object.freeze({__proto__:null,BoxGeometry:$h,CapsuleGeometry:yg,CircleGeometry:bg,ConeGeometry:wg,CylinderGeometry:xg,DodecahedronGeometry:Cg,EdgesGeometry:Bg,ExtrudeGeometry:am,IcosahedronGeometry:cm,LatheGeometry:vg,OctahedronGeometry:lm,PlaneGeometry:wu,PolyhedronGeometry:Eg,RingGeometry:hm,ShapeGeometry:um,SphereGeometry:dm,TetrahedronGeometry:pm,TorusGeometry:fm,TorusKnotGeometry:Am,TubeGeometry:gm,WireframeGeometry:mm});class ym extends ph{constructor(t){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new hh(0),this.transparent=!0,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.fog=t.fog,this}}class bm extends ru{constructor(t){super(t),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class xm extends ph{constructor(t){super(),this.isMeshStandardMaterial=!0,this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new hh(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new hh(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Ac(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Rl,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.defines={STANDARD:""},this.color.copy(t.color),this.roughness=t.roughness,this.metalness=t.metalness,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.roughnessMap=t.roughnessMap,this.metalnessMap=t.metalnessMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.envMapIntensity=t.envMapIntensity,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}class wm extends xm{constructor(t){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new Ac(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return lc(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new hh(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new hh(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new hh(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(t)}get anisotropy(){return this._anisotropy}set anisotropy(t){this._anisotropy>0!=t>0&&this.version++,this._anisotropy=t}get clearcoat(){return this._clearcoat}set clearcoat(t){this._clearcoat>0!=t>0&&this.version++,this._clearcoat=t}get iridescence(){return this._iridescence}set iridescence(t){this._iridescence>0!=t>0&&this.version++,this._iridescence=t}get dispersion(){return this._dispersion}set dispersion(t){this._dispersion>0!=t>0&&this.version++,this._dispersion=t}get sheen(){return this._sheen}set sheen(t){this._sheen>0!=t>0&&this.version++,this._sheen=t}get transmission(){return this._transmission}set transmission(t){this._transmission>0!=t>0&&this.version++,this._transmission=t}copy(t){return super.copy(t),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=t.anisotropy,this.anisotropyRotation=t.anisotropyRotation,this.anisotropyMap=t.anisotropyMap,this.clearcoat=t.clearcoat,this.clearcoatMap=t.clearcoatMap,this.clearcoatRoughness=t.clearcoatRoughness,this.clearcoatRoughnessMap=t.clearcoatRoughnessMap,this.clearcoatNormalMap=t.clearcoatNormalMap,this.clearcoatNormalScale.copy(t.clearcoatNormalScale),this.dispersion=t.dispersion,this.ior=t.ior,this.iridescence=t.iridescence,this.iridescenceMap=t.iridescenceMap,this.iridescenceIOR=t.iridescenceIOR,this.iridescenceThicknessRange=[...t.iridescenceThicknessRange],this.iridescenceThicknessMap=t.iridescenceThicknessMap,this.sheen=t.sheen,this.sheenColor.copy(t.sheenColor),this.sheenColorMap=t.sheenColorMap,this.sheenRoughness=t.sheenRoughness,this.sheenRoughnessMap=t.sheenRoughnessMap,this.transmission=t.transmission,this.transmissionMap=t.transmissionMap,this.thickness=t.thickness,this.thicknessMap=t.thicknessMap,this.attenuationDistance=t.attenuationDistance,this.attenuationColor.copy(t.attenuationColor),this.specularIntensity=t.specularIntensity,this.specularIntensityMap=t.specularIntensityMap,this.specularColor.copy(t.specularColor),this.specularColorMap=t.specularColorMap,this}}class Em extends ph{constructor(t){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new hh(16777215),this.specular=new hh(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new hh(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Ac(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Rl,this.combine=ia,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}class Cm extends ph{constructor(t){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new hh(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new hh(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Ac(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.gradientMap=t.gradientMap,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}}class Sm extends ph{constructor(t){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Ac(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.flatShading=t.flatShading,this}}class Mm extends ph{constructor(t){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new hh(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new hh(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Ac(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Rl,this.combine=ia,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}class Im extends ph{constructor(t){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new hh(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Ac(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.defines={MATCAP:""},this.color.copy(t.color),this.matcap=t.matcap,this.map=t.map,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.flatShading=t.flatShading,this.fog=t.fog,this}}class Tm extends CA{constructor(t){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(t)}copy(t){return super.copy(t),this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this}}function Bm(t,e,n){return!t||!n&&t.constructor===e?t:"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t)}function Rm(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function Dm(t){const e=t.length,n=new Array(e);for(let t=0;t!==e;++t)n[t]=t;return n.sort((function(e,n){return t[e]-t[n]})),n}function Lm(t,e,n){const i=t.length,r=new t.constructor(i);for(let s=0,a=0;a!==i;++s){const i=n[s]*e;for(let n=0;n!==e;++n)r[a++]=t[i+n]}return r}function Pm(t,e,n,i){let r=1,s=t[0];for(;void 0!==s&&void 0===s[i];)s=t[r++];if(void 0===s)return;let a=s[i];if(void 0!==a)if(Array.isArray(a))do{a=s[i],void 0!==a&&(e.push(s.time),n.push.apply(n,a)),s=t[r++]}while(void 0!==s);else if(void 0!==a.toArray)do{a=s[i],void 0!==a&&(e.push(s.time),a.toArray(n,n.length)),s=t[r++]}while(void 0!==s);else do{a=s[i],void 0!==a&&(e.push(s.time),n.push(a)),s=t[r++]}while(void 0!==s)}const km={convertArray:Bm,isTypedArray:Rm,getKeyframeOrder:Dm,sortedArray:Lm,flattenJSON:Pm,subclip:function(t,e,n,i,r=30){const s=t.clone();s.name=e;const a=[];for(let t=0;t<s.tracks.length;++t){const e=s.tracks[t],o=e.getValueSize(),c=[],l=[];for(let t=0;t<e.times.length;++t){const s=e.times[t]*r;if(!(s<n||s>=i)){c.push(e.times[t]);for(let n=0;n<o;++n)l.push(e.values[t*o+n])}}0!==c.length&&(e.times=Bm(c,e.times.constructor),e.values=Bm(l,e.values.constructor),a.push(e))}s.tracks=a;let o=1/0;for(let t=0;t<s.tracks.length;++t)o>s.tracks[t].times[0]&&(o=s.tracks[t].times[0]);for(let t=0;t<s.tracks.length;++t)s.tracks[t].shift(-1*o);return s.resetDuration(),s},makeClipAdditive:function(t,e=0,n=t,i=30){i<=0&&(i=30);const r=n.tracks.length,s=e/i;for(let e=0;e<r;++e){const i=n.tracks[e],r=i.ValueTypeName;if("bool"===r||"string"===r)continue;const a=t.tracks.find((function(t){return t.name===i.name&&t.ValueTypeName===r}));if(void 0===a)continue;let o=0;const c=i.getValueSize();i.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(o=c/3);let l=0;const h=a.getValueSize();a.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(l=h/3);const u=i.times.length-1;let d;if(s<=i.times[0]){const t=o,e=c-o;d=i.values.slice(t,e)}else if(s>=i.times[u]){const t=u*c+o,e=t+c-o;d=i.values.slice(t,e)}else{const t=i.createInterpolant(),e=o,n=c-o;t.evaluate(s),d=t.resultBuffer.slice(e,n)}if("quaternion"===r){(new Vc).fromArray(d).normalize().conjugate().toArray(d)}const p=a.times.length;for(let t=0;t<p;++t){const e=t*h+l;if("quaternion"===r)Vc.multiplyQuaternionsFlat(a.values,e,d,0,a.values,e);else{const t=h-2*l;for(let n=0;n<t;++n)a.values[e+n]-=d[n]}}}return t.blendMode=Po,t}};class Om{constructor(t,e,n,i){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==i?i:new e.constructor(n),this.sampleValues=e,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(t){const e=this.parameterPositions;let n=this._cachedIndex,i=e[n],r=e[n-1];t:{e:{let s;n:{i:if(!(t<i)){for(let s=n+2;;){if(void 0===i){if(t<r)break i;return n=e.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===s)break;if(r=i,i=e[++n],t<i)break e}s=e.length;break n}if(t>=r)break t;{const a=e[1];t<a&&(n=2,r=a);for(let s=n-2;;){if(void 0===r)return this._cachedIndex=0,this.copySampleValue_(0);if(n===s)break;if(i=r,r=e[--n-1],t>=r)break e}s=n,n=0}}for(;n<s;){const i=n+s>>>1;t<e[i]?s=i:n=i+1}if(i=e[n],r=e[n-1],void 0===r)return this._cachedIndex=0,this.copySampleValue_(0);if(void 0===i)return n=e.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,r,i)}return this.interpolate_(n,r,t,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(t){const e=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=t*i;for(let t=0;t!==i;++t)e[t]=n[r+t];return e}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class Um extends Om{constructor(t,e,n,i){super(t,e,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Bo,endingEnd:Bo}}intervalChanged_(t,e,n){const i=this.parameterPositions;let r=t-2,s=t+1,a=i[r],o=i[s];if(void 0===a)switch(this.getSettings_().endingStart){case Ro:r=t,a=2*e-n;break;case Do:r=i.length-2,a=e+i[r]-i[r+1];break;default:r=t,a=n}if(void 0===o)switch(this.getSettings_().endingEnd){case Ro:s=t,o=2*n-e;break;case Do:s=1,o=n+i[1]-i[0];break;default:s=t-1,o=e}const c=.5*(n-e),l=this.valueSize;this._weightPrev=c/(e-a),this._weightNext=c/(o-n),this._offsetPrev=r*l,this._offsetNext=s*l}interpolate_(t,e,n,i){const r=this.resultBuffer,s=this.sampleValues,a=this.valueSize,o=t*a,c=o-a,l=this._offsetPrev,h=this._offsetNext,u=this._weightPrev,d=this._weightNext,p=(n-e)/(i-e),f=p*p,A=f*p,g=-u*A+2*u*f-u*p,m=(1+u)*A+(-1.5-2*u)*f+(-.5+u)*p+1,_=(-1-d)*A+(1.5+d)*f+.5*p,v=d*A-d*f;for(let t=0;t!==a;++t)r[t]=g*s[l+t]+m*s[c+t]+_*s[o+t]+v*s[h+t];return r}}class Nm extends Om{constructor(t,e,n,i){super(t,e,n,i)}interpolate_(t,e,n,i){const r=this.resultBuffer,s=this.sampleValues,a=this.valueSize,o=t*a,c=o-a,l=(n-e)/(i-e),h=1-l;for(let t=0;t!==a;++t)r[t]=s[c+t]*h+s[o+t]*l;return r}}class Fm extends Om{constructor(t,e,n,i){super(t,e,n,i)}interpolate_(t){return this.copySampleValue_(t-1)}}class Qm{constructor(t,e,n,i){if(void 0===t)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===e||0===e.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=Bm(e,this.TimeBufferType),this.values=Bm(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(t){const e=t.constructor;let n;if(e.toJSON!==this.toJSON)n=e.toJSON(t);else{n={name:t.name,times:Bm(t.times,Array),values:Bm(t.values,Array)};const e=t.getInterpolation();e!==t.DefaultInterpolation&&(n.interpolation=e)}return n.type=t.ValueTypeName,n}InterpolantFactoryMethodDiscrete(t){return new Fm(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new Nm(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new Um(this.times,this.values,this.getValueSize(),t)}setInterpolation(t){let e;switch(t){case Mo:e=this.InterpolantFactoryMethodDiscrete;break;case Io:e=this.InterpolantFactoryMethodLinear;break;case To:e=this.InterpolantFactoryMethodSmooth}if(void 0===e){const e="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(t===this.DefaultInterpolation)throw new Error(e);this.setInterpolation(this.DefaultInterpolation)}return this}return this.createInterpolant=e,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Mo;case this.InterpolantFactoryMethodLinear:return Io;case this.InterpolantFactoryMethodSmooth:return To}}getValueSize(){return this.values.length/this.times.length}shift(t){if(0!==t){const e=this.times;for(let n=0,i=e.length;n!==i;++n)e[n]+=t}return this}scale(t){if(1!==t){const e=this.times;for(let n=0,i=e.length;n!==i;++n)e[n]*=t}return this}trim(t,e){const n=this.times,i=n.length;let r=0,s=i-1;for(;r!==i&&n[r]<t;)++r;for(;-1!==s&&n[s]>e;)--s;if(++s,0!==r||s!==i){r>=s&&(s=Math.max(s,1),r=s-1);const t=this.getValueSize();this.times=n.slice(r,s),this.values=this.values.slice(r*t,s*t)}return this}validate(){let t=!0;const e=this.getValueSize();e-Math.floor(e)!=0&&(t=!1);const n=this.times,i=this.values,r=n.length;0===r&&(t=!1);let s=null;for(let e=0;e!==r;e++){const i=n[e];if("number"==typeof i&&isNaN(i)){t=!1;break}if(null!==s&&s>i){t=!1;break}s=i}if(void 0!==i&&Rm(i))for(let e=0,n=i.length;e!==n;++e){const n=i[e];if(isNaN(n)){t=!1;break}}return t}optimize(){const t=this.times.slice(),e=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===To,r=t.length-1;let s=1;for(let a=1;a<r;++a){let r=!1;const o=t[a];if(o!==t[a+1]&&(1!==a||o!==t[0]))if(i)r=!0;else{const t=a*n,i=t-n,s=t+n;for(let a=0;a!==n;++a){const n=e[t+a];if(n!==e[i+a]||n!==e[s+a]){r=!0;break}}}if(r){if(a!==s){t[s]=t[a];const i=a*n,r=s*n;for(let t=0;t!==n;++t)e[r+t]=e[i+t]}++s}}if(r>0){t[s]=t[r];for(let t=r*n,i=s*n,a=0;a!==n;++a)e[i+a]=e[t+a];++s}return s!==t.length?(this.times=t.slice(0,s),this.values=e.slice(0,s*n)):(this.times=t,this.values=e),this}clone(){const t=this.times.slice(),e=this.values.slice(),n=new(0,this.constructor)(this.name,t,e);return n.createInterpolant=this.createInterpolant,n}}Qm.prototype.TimeBufferType=Float32Array,Qm.prototype.ValueBufferType=Float32Array,Qm.prototype.DefaultInterpolation=Io;class zm extends Qm{constructor(t,e,n){super(t,e,n)}}zm.prototype.ValueTypeName="bool",zm.prototype.ValueBufferType=Array,zm.prototype.DefaultInterpolation=Mo,zm.prototype.InterpolantFactoryMethodLinear=void 0,zm.prototype.InterpolantFactoryMethodSmooth=void 0;class Gm extends Qm{}Gm.prototype.ValueTypeName="color";class Hm extends Qm{}Hm.prototype.ValueTypeName="number";class Vm extends Om{constructor(t,e,n,i){super(t,e,n,i)}interpolate_(t,e,n,i){const r=this.resultBuffer,s=this.sampleValues,a=this.valueSize,o=(n-e)/(i-e);let c=t*a;for(let t=c+a;c!==t;c+=4)Vc.slerpFlat(r,0,s,c-a,s,c,o);return r}}class jm extends Qm{InterpolantFactoryMethodLinear(t){return new Vm(this.times,this.values,this.getValueSize(),t)}}jm.prototype.ValueTypeName="quaternion",jm.prototype.InterpolantFactoryMethodSmooth=void 0;class Wm extends Qm{constructor(t,e,n){super(t,e,n)}}Wm.prototype.ValueTypeName="string",Wm.prototype.ValueBufferType=Array,Wm.prototype.DefaultInterpolation=Mo,Wm.prototype.InterpolantFactoryMethodLinear=void 0,Wm.prototype.InterpolantFactoryMethodSmooth=void 0;class qm extends Qm{}qm.prototype.ValueTypeName="vector";class Ym{constructor(t="",e=-1,n=[],i=2500){this.name=t,this.tracks=n,this.duration=e,this.blendMode=i,this.uuid=cc(),this.duration<0&&this.resetDuration()}static parse(t){const e=[],n=t.tracks,i=1/(t.fps||1);for(let t=0,r=n.length;t!==r;++t)e.push(Xm(n[t]).scale(i));const r=new this(t.name,t.duration,e,t.blendMode);return r.uuid=t.uuid,r}static toJSON(t){const e=[],n=t.tracks,i={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid,blendMode:t.blendMode};for(let t=0,i=n.length;t!==i;++t)e.push(Qm.toJSON(n[t]));return i}static CreateFromMorphTargetSequence(t,e,n,i){const r=e.length,s=[];for(let t=0;t<r;t++){let a=[],o=[];a.push((t+r-1)%r,t,(t+1)%r),o.push(0,1,0);const c=Dm(a);a=Lm(a,1,c),o=Lm(o,1,c),i||0!==a[0]||(a.push(r),o.push(o[0])),s.push(new Hm(".morphTargetInfluences["+e[t].name+"]",a,o).scale(1/n))}return new this(t,-1,s)}static findByName(t,e){let n=t;if(!Array.isArray(t)){const e=t;n=e.geometry&&e.geometry.animations||e.animations}for(let t=0;t<n.length;t++)if(n[t].name===e)return n[t];return null}static CreateClipsFromMorphTargetSequences(t,e,n){const i={},r=/^([\w-]*?)([\d]+)$/;for(let e=0,n=t.length;e<n;e++){const n=t[e],s=n.name.match(r);if(s&&s.length>1){const t=s[1];let e=i[t];e||(i[t]=e=[]),e.push(n)}}const s=[];for(const t in i)s.push(this.CreateFromMorphTargetSequence(t,i[t],e,n));return s}static parseAnimation(t,e){if(!t)return null;const n=function(t,e,n,i,r){if(0!==n.length){const s=[],a=[];Pm(n,s,a,i),0!==s.length&&r.push(new t(e,s,a))}},i=[],r=t.name||"default",s=t.fps||30,a=t.blendMode;let o=t.length||-1;const c=t.hierarchy||[];for(let t=0;t<c.length;t++){const r=c[t].keys;if(r&&0!==r.length)if(r[0].morphTargets){const t={};let e;for(e=0;e<r.length;e++)if(r[e].morphTargets)for(let n=0;n<r[e].morphTargets.length;n++)t[r[e].morphTargets[n]]=-1;for(const n in t){const t=[],s=[];for(let i=0;i!==r[e].morphTargets.length;++i){const i=r[e];t.push(i.time),s.push(i.morphTarget===n?1:0)}i.push(new Hm(".morphTargetInfluence["+n+"]",t,s))}o=t.length*s}else{const s=".bones["+e[t].name+"]";n(qm,s+".position",r,"pos",i),n(jm,s+".quaternion",r,"rot",i),n(qm,s+".scale",r,"scl",i)}}if(0===i.length)return null;return new this(r,o,i,a)}resetDuration(){let t=0;for(let e=0,n=this.tracks.length;e!==n;++e){const n=this.tracks[e];t=Math.max(t,n.times[n.times.length-1])}return this.duration=t,this}trim(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].trim(0,this.duration);return this}validate(){let t=!0;for(let e=0;e<this.tracks.length;e++)t=t&&this.tracks[e].validate();return t}optimize(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].optimize();return this}clone(){const t=[];for(let e=0;e<this.tracks.length;e++)t.push(this.tracks[e].clone());return new this.constructor(this.name,this.duration,t,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function Xm(t){if(void 0===t.type)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=function(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Hm;case"vector":case"vector2":case"vector3":case"vector4":return qm;case"color":return Gm;case"quaternion":return jm;case"bool":case"boolean":return zm;case"string":return Wm}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+t)}(t.type);if(void 0===t.times){const e=[],n=[];Pm(t.keys,e,n,"value"),t.times=e,t.values=n}return void 0!==e.parse?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)}const Jm={enabled:!1,files:{},add:function(t,e){!1!==this.enabled&&(this.files[t]=e)},get:function(t){if(!1!==this.enabled)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}};class Km{constructor(t,e,n){const i=this;let r,s=!1,a=0,o=0;const c=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=n,this.itemStart=function(t){o++,!1===s&&void 0!==i.onStart&&i.onStart(t,a,o),s=!0},this.itemEnd=function(t){a++,void 0!==i.onProgress&&i.onProgress(t,a,o),a===o&&(s=!1,void 0!==i.onLoad&&i.onLoad())},this.itemError=function(t){void 0!==i.onError&&i.onError(t)},this.resolveURL=function(t){return r?r(t):t},this.setURLModifier=function(t){return r=t,this},this.addHandler=function(t,e){return c.push(t,e),this},this.removeHandler=function(t){const e=c.indexOf(t);return-1!==e&&c.splice(e,2),this},this.getHandler=function(t){for(let e=0,n=c.length;e<n;e+=2){const n=c[e],i=c[e+1];if(n.global&&(n.lastIndex=0),n.test(t))return i}return null}}}const Zm=new Km;class $m{constructor(t){this.manager=void 0!==t?t:Zm,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(t,e){const n=this;return new Promise((function(i,r){n.load(t,i,e,r)}))}parse(){}setCrossOrigin(t){return this.crossOrigin=t,this}setWithCredentials(t){return this.withCredentials=t,this}setPath(t){return this.path=t,this}setResourcePath(t){return this.resourcePath=t,this}setRequestHeader(t){return this.requestHeader=t,this}}$m.DEFAULT_MATERIAL_NAME="__DEFAULT";const t_={};class e_ extends Error{constructor(t,e){super(t),this.response=e}}class n_ extends $m{constructor(t){super(t)}load(t,e,n,i){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const r=Jm.get(t);if(void 0!==r)return this.manager.itemStart(t),setTimeout((()=>{e&&e(r),this.manager.itemEnd(t)}),0),r;if(void 0!==t_[t])return void t_[t].push({onLoad:e,onProgress:n,onError:i});t_[t]=[],t_[t].push({onLoad:e,onProgress:n,onError:i});const s=new Request(t,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,o=this.responseType;fetch(s).then((e=>{if(200===e.status||0===e.status){if(e.status,"undefined"==typeof ReadableStream||void 0===e.body||void 0===e.body.getReader)return e;const n=t_[t],i=e.body.getReader(),r=e.headers.get("X-File-Size")||e.headers.get("Content-Length"),s=r?parseInt(r):0,a=0!==s;let o=0;const c=new ReadableStream({start(t){!function e(){i.read().then((({done:i,value:r})=>{if(i)t.close();else{o+=r.byteLength;const i=new ProgressEvent("progress",{lengthComputable:a,loaded:o,total:s});for(let t=0,e=n.length;t<e;t++){const e=n[t];e.onProgress&&e.onProgress(i)}t.enqueue(r),e()}}),(e=>{t.error(e)}))}()}});return new Response(c)}throw new e_(`fetch for "${e.url}" responded with ${e.status}: ${e.statusText}`,e)})).then((t=>{switch(o){case"arraybuffer":return t.arrayBuffer();case"blob":return t.blob();case"document":return t.text().then((t=>(new DOMParser).parseFromString(t,a)));case"json":return t.json();default:if(void 0===a)return t.text();{const e=/charset="?([^;"\s]*)"?/i.exec(a),n=e&&e[1]?e[1].toLowerCase():void 0,i=new TextDecoder(n);return t.arrayBuffer().then((t=>i.decode(t)))}}})).then((e=>{Jm.add(t,e);const n=t_[t];delete t_[t];for(let t=0,i=n.length;t<i;t++){const i=n[t];i.onLoad&&i.onLoad(e)}})).catch((e=>{const n=t_[t];if(void 0===n)throw this.manager.itemError(t),e;delete t_[t];for(let t=0,i=n.length;t<i;t++){const i=n[t];i.onError&&i.onError(e)}this.manager.itemError(t)})).finally((()=>{this.manager.itemEnd(t)})),this.manager.itemStart(t)}setResponseType(t){return this.responseType=t,this}setMimeType(t){return this.mimeType=t,this}}class i_ extends $m{constructor(t){super(t)}load(t,e,n,i){void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const r=this,s=Jm.get(t);if(void 0!==s)return r.manager.itemStart(t),setTimeout((function(){e&&e(s),r.manager.itemEnd(t)}),0),s;const a=bc("img");function o(){l(),Jm.add(t,this),e&&e(this),r.manager.itemEnd(t)}function c(e){l(),i&&i(e),r.manager.itemError(t),r.manager.itemEnd(t)}function l(){a.removeEventListener("load",o,!1),a.removeEventListener("error",c,!1)}return a.addEventListener("load",o,!1),a.addEventListener("error",c,!1),"data:"!==t.slice(0,5)&&void 0!==this.crossOrigin&&(a.crossOrigin=this.crossOrigin),r.manager.itemStart(t),a.src=t,a}}class r_ extends $m{constructor(t){super(t)}load(t,e,n,i){const r=new du;r.colorSpace=Oo;const s=new i_(this.manager);s.setCrossOrigin(this.crossOrigin),s.setPath(this.path);let a=0;function o(n){s.load(t[n],(function(t){r.images[n]=t,a++,6===a&&(r.needsUpdate=!0,e&&e(r))}),void 0,i)}for(let e=0;e<t.length;++e)o(e);return r}}class s_ extends $m{constructor(t){super(t)}load(t,e,n,i){const r=this,s=new Wf,a=new n_(this.manager);return a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setPath(this.path),a.setWithCredentials(r.withCredentials),a.load(t,(function(t){let n;try{n=r.parse(t)}catch(t){if(void 0===i)return;i(t)}void 0!==n.image?s.image=n.image:void 0!==n.data&&(s.image.width=n.width,s.image.height=n.height,s.image.data=n.data),s.wrapS=void 0!==n.wrapS?n.wrapS:wa,s.wrapT=void 0!==n.wrapT?n.wrapT:wa,s.magFilter=void 0!==n.magFilter?n.magFilter:Ia,s.minFilter=void 0!==n.minFilter?n.minFilter:Ia,s.anisotropy=void 0!==n.anisotropy?n.anisotropy:1,void 0!==n.colorSpace&&(s.colorSpace=n.colorSpace),void 0!==n.flipY&&(s.flipY=n.flipY),void 0!==n.format&&(s.format=n.format),void 0!==n.type&&(s.type=n.type),void 0!==n.mipmaps&&(s.mipmaps=n.mipmaps,s.minFilter=Ba),1===n.mipmapCount&&(s.minFilter=Ia),void 0!==n.generateMipmaps&&(s.generateMipmaps=n.generateMipmaps),s.needsUpdate=!0,e&&e(s,n)}),n,i),s}}class a_ extends $m{constructor(t){super(t)}load(t,e,n,i){const r=new Nc,s=new i_(this.manager);return s.setCrossOrigin(this.crossOrigin),s.setPath(this.path),s.load(t,(function(t){r.image=t,r.needsUpdate=!0,void 0!==e&&e(r)}),n,i),r}}class o_ extends Yl{constructor(t,e=1){super(),this.isLight=!0,this.type="Light",this.color=new hh(t),this.intensity=e}dispose(){}copy(t,e){return super.copy(t,e),this.color.copy(t.color),this.intensity=t.intensity,this}toJSON(t){const e=super.toJSON(t);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,void 0!==this.groundColor&&(e.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(e.object.distance=this.distance),void 0!==this.angle&&(e.object.angle=this.angle),void 0!==this.decay&&(e.object.decay=this.decay),void 0!==this.penumbra&&(e.object.penumbra=this.penumbra),void 0!==this.shadow&&(e.object.shadow=this.shadow.toJSON()),e}}class c_ extends o_{constructor(t,e,n){super(t,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(Yl.DEFAULT_UP),this.updateMatrix(),this.groundColor=new hh(e)}copy(t,e){return super.copy(t,e),this.groundColor.copy(t.groundColor),this}}const l_=new bl,h_=new jc,u_=new jc;class d_{constructor(t){this.camera=t,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Ac(512,512),this.map=null,this.mapPass=null,this.matrix=new bl,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new yu,this._frameExtents=new Ac(1,1),this._viewportCount=1,this._viewports=[new Fc(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(t){const e=this.camera,n=this.matrix;h_.setFromMatrixPosition(t.matrixWorld),e.position.copy(h_),u_.setFromMatrixPosition(t.target.matrixWorld),e.lookAt(u_),e.updateMatrixWorld(),l_.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),this._frustum.setFromProjectionMatrix(l_),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(l_)}getViewport(t){return this._viewports[t]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(t){return this.camera=t.camera.clone(),this.bias=t.bias,this.radius=t.radius,this.mapSize.copy(t.mapSize),this}clone(){return(new this.constructor).copy(this)}toJSON(){const t={};return 0!==this.bias&&(t.bias=this.bias),0!==this.normalBias&&(t.normalBias=this.normalBias),1!==this.radius&&(t.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}}class p_ extends d_{constructor(){super(new lu(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(t){const e=this.camera,n=2*oc*t.angle*this.focus,i=this.mapSize.width/this.mapSize.height,r=t.distance||e.far;n===e.fov&&i===e.aspect&&r===e.far||(e.fov=n,e.aspect=i,e.far=r,e.updateProjectionMatrix()),super.updateMatrices(t)}copy(t){return super.copy(t),this.focus=t.focus,this}}class f_ extends o_{constructor(t,e,n=0,i=Math.PI/3,r=0,s=2){super(t,e),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(Yl.DEFAULT_UP),this.updateMatrix(),this.target=new Yl,this.distance=n,this.angle=i,this.penumbra=r,this.decay=s,this.map=null,this.shadow=new p_}get power(){return this.intensity*Math.PI}set power(t){this.intensity=t/Math.PI}dispose(){this.shadow.dispose()}copy(t,e){return super.copy(t,e),this.distance=t.distance,this.angle=t.angle,this.penumbra=t.penumbra,this.decay=t.decay,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}const A_=new bl,g_=new jc,m_=new jc;class __ extends d_{constructor(){super(new lu(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new Ac(4,2),this._viewportCount=6,this._viewports=[new Fc(2,1,1,1),new Fc(0,1,1,1),new Fc(3,1,1,1),new Fc(1,1,1,1),new Fc(3,0,1,1),new Fc(1,0,1,1)],this._cubeDirections=[new jc(1,0,0),new jc(-1,0,0),new jc(0,0,1),new jc(0,0,-1),new jc(0,1,0),new jc(0,-1,0)],this._cubeUps=[new jc(0,1,0),new jc(0,1,0),new jc(0,1,0),new jc(0,1,0),new jc(0,0,1),new jc(0,0,-1)]}updateMatrices(t,e=0){const n=this.camera,i=this.matrix,r=t.distance||n.far;r!==n.far&&(n.far=r,n.updateProjectionMatrix()),g_.setFromMatrixPosition(t.matrixWorld),n.position.copy(g_),m_.copy(n.position),m_.add(this._cubeDirections[e]),n.up.copy(this._cubeUps[e]),n.lookAt(m_),n.updateMatrixWorld(),i.makeTranslation(-g_.x,-g_.y,-g_.z),A_.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(A_)}}class v_ extends o_{constructor(t,e,n=0,i=2){super(t,e),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new __}get power(){return 4*this.intensity*Math.PI}set power(t){this.intensity=t/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(t,e){return super.copy(t,e),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}}class y_ extends d_{constructor(){super(new Ou(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class b_ extends o_{constructor(t,e){super(t,e),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Yl.DEFAULT_UP),this.updateMatrix(),this.target=new Yl,this.shadow=new y_}dispose(){this.shadow.dispose()}copy(t){return super.copy(t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}class x_ extends o_{constructor(t,e){super(t,e),this.isAmbientLight=!0,this.type="AmbientLight"}}class w_ extends o_{constructor(t,e,n=10,i=10){super(t,e),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=n,this.height=i}get power(){return this.intensity*this.width*this.height*Math.PI}set power(t){this.intensity=t/(this.width*this.height*Math.PI)}copy(t){return super.copy(t),this.width=t.width,this.height=t.height,this}toJSON(t){const e=super.toJSON(t);return e.object.width=this.width,e.object.height=this.height,e}}class E_{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let t=0;t<9;t++)this.coefficients.push(new jc)}set(t){for(let e=0;e<9;e++)this.coefficients[e].copy(t[e]);return this}zero(){for(let t=0;t<9;t++)this.coefficients[t].set(0,0,0);return this}getAt(t,e){const n=t.x,i=t.y,r=t.z,s=this.coefficients;return e.copy(s[0]).multiplyScalar(.282095),e.addScaledVector(s[1],.488603*i),e.addScaledVector(s[2],.488603*r),e.addScaledVector(s[3],.488603*n),e.addScaledVector(s[4],n*i*1.092548),e.addScaledVector(s[5],i*r*1.092548),e.addScaledVector(s[6],.315392*(3*r*r-1)),e.addScaledVector(s[7],n*r*1.092548),e.addScaledVector(s[8],.546274*(n*n-i*i)),e}getIrradianceAt(t,e){const n=t.x,i=t.y,r=t.z,s=this.coefficients;return e.copy(s[0]).multiplyScalar(.886227),e.addScaledVector(s[1],1.023328*i),e.addScaledVector(s[2],1.023328*r),e.addScaledVector(s[3],1.023328*n),e.addScaledVector(s[4],.858086*n*i),e.addScaledVector(s[5],.858086*i*r),e.addScaledVector(s[6],.743125*r*r-.247708),e.addScaledVector(s[7],.858086*n*r),e.addScaledVector(s[8],.429043*(n*n-i*i)),e}add(t){for(let e=0;e<9;e++)this.coefficients[e].add(t.coefficients[e]);return this}addScaledSH(t,e){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(t.coefficients[n],e);return this}scale(t){for(let e=0;e<9;e++)this.coefficients[e].multiplyScalar(t);return this}lerp(t,e){for(let n=0;n<9;n++)this.coefficients[n].lerp(t.coefficients[n],e);return this}equals(t){for(let e=0;e<9;e++)if(!this.coefficients[e].equals(t.coefficients[e]))return!1;return!0}copy(t){return this.set(t.coefficients)}clone(){return(new this.constructor).copy(this)}fromArray(t,e=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].fromArray(t,e+3*i);return this}toArray(t=[],e=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].toArray(t,e+3*i);return t}static getBasisAt(t,e){const n=t.x,i=t.y,r=t.z;e[0]=.282095,e[1]=.488603*i,e[2]=.488603*r,e[3]=.488603*n,e[4]=1.092548*n*i,e[5]=1.092548*i*r,e[6]=.315392*(3*r*r-1),e[7]=1.092548*n*r,e[8]=.546274*(n*n-i*i)}}class C_ extends o_{constructor(t=new E_,e=1){super(void 0,e),this.isLightProbe=!0,this.sh=t}copy(t){return super.copy(t),this.sh.copy(t.sh),this}fromJSON(t){return this.intensity=t.intensity,this.sh.fromArray(t.sh),this}toJSON(t){const e=super.toJSON(t);return e.object.sh=this.sh.toArray(),e}}class S_ extends $m{constructor(t){super(t),this.textures={}}load(t,e,n,i){const r=this,s=new n_(r.manager);s.setPath(r.path),s.setRequestHeader(r.requestHeader),s.setWithCredentials(r.withCredentials),s.load(t,(function(n){try{e(r.parse(JSON.parse(n)))}catch(e){i&&i(e),r.manager.itemError(t)}}),n,i)}parse(t){const e=this.textures;function n(t){return e[t],e[t]}const i=S_.createMaterialFromType(t.type);if(void 0!==t.uuid&&(i.uuid=t.uuid),void 0!==t.name&&(i.name=t.name),void 0!==t.color&&void 0!==i.color&&i.color.setHex(t.color),void 0!==t.roughness&&(i.roughness=t.roughness),void 0!==t.metalness&&(i.metalness=t.metalness),void 0!==t.sheen&&(i.sheen=t.sheen),void 0!==t.sheenColor&&(i.sheenColor=(new hh).setHex(t.sheenColor)),void 0!==t.sheenRoughness&&(i.sheenRoughness=t.sheenRoughness),void 0!==t.emissive&&void 0!==i.emissive&&i.emissive.setHex(t.emissive),void 0!==t.specular&&void 0!==i.specular&&i.specular.setHex(t.specular),void 0!==t.specularIntensity&&(i.specularIntensity=t.specularIntensity),void 0!==t.specularColor&&void 0!==i.specularColor&&i.specularColor.setHex(t.specularColor),void 0!==t.shininess&&(i.shininess=t.shininess),void 0!==t.clearcoat&&(i.clearcoat=t.clearcoat),void 0!==t.clearcoatRoughness&&(i.clearcoatRoughness=t.clearcoatRoughness),void 0!==t.dispersion&&(i.dispersion=t.dispersion),void 0!==t.iridescence&&(i.iridescence=t.iridescence),void 0!==t.iridescenceIOR&&(i.iridescenceIOR=t.iridescenceIOR),void 0!==t.iridescenceThicknessRange&&(i.iridescenceThicknessRange=t.iridescenceThicknessRange),void 0!==t.transmission&&(i.transmission=t.transmission),void 0!==t.thickness&&(i.thickness=t.thickness),void 0!==t.attenuationDistance&&(i.attenuationDistance=t.attenuationDistance),void 0!==t.attenuationColor&&void 0!==i.attenuationColor&&i.attenuationColor.setHex(t.attenuationColor),void 0!==t.anisotropy&&(i.anisotropy=t.anisotropy),void 0!==t.anisotropyRotation&&(i.anisotropyRotation=t.anisotropyRotation),void 0!==t.fog&&(i.fog=t.fog),void 0!==t.flatShading&&(i.flatShading=t.flatShading),void 0!==t.blending&&(i.blending=t.blending),void 0!==t.combine&&(i.combine=t.combine),void 0!==t.side&&(i.side=t.side),void 0!==t.shadowSide&&(i.shadowSide=t.shadowSide),void 0!==t.opacity&&(i.opacity=t.opacity),void 0!==t.transparent&&(i.transparent=t.transparent),void 0!==t.alphaTest&&(i.alphaTest=t.alphaTest),void 0!==t.alphaHash&&(i.alphaHash=t.alphaHash),void 0!==t.depthFunc&&(i.depthFunc=t.depthFunc),void 0!==t.depthTest&&(i.depthTest=t.depthTest),void 0!==t.depthWrite&&(i.depthWrite=t.depthWrite),void 0!==t.colorWrite&&(i.colorWrite=t.colorWrite),void 0!==t.blendSrc&&(i.blendSrc=t.blendSrc),void 0!==t.blendDst&&(i.blendDst=t.blendDst),void 0!==t.blendEquation&&(i.blendEquation=t.blendEquation),void 0!==t.blendSrcAlpha&&(i.blendSrcAlpha=t.blendSrcAlpha),void 0!==t.blendDstAlpha&&(i.blendDstAlpha=t.blendDstAlpha),void 0!==t.blendEquationAlpha&&(i.blendEquationAlpha=t.blendEquationAlpha),void 0!==t.blendColor&&void 0!==i.blendColor&&i.blendColor.setHex(t.blendColor),void 0!==t.blendAlpha&&(i.blendAlpha=t.blendAlpha),void 0!==t.stencilWriteMask&&(i.stencilWriteMask=t.stencilWriteMask),void 0!==t.stencilFunc&&(i.stencilFunc=t.stencilFunc),void 0!==t.stencilRef&&(i.stencilRef=t.stencilRef),void 0!==t.stencilFuncMask&&(i.stencilFuncMask=t.stencilFuncMask),void 0!==t.stencilFail&&(i.stencilFail=t.stencilFail),void 0!==t.stencilZFail&&(i.stencilZFail=t.stencilZFail),void 0!==t.stencilZPass&&(i.stencilZPass=t.stencilZPass),void 0!==t.stencilWrite&&(i.stencilWrite=t.stencilWrite),void 0!==t.wireframe&&(i.wireframe=t.wireframe),void 0!==t.wireframeLinewidth&&(i.wireframeLinewidth=t.wireframeLinewidth),void 0!==t.wireframeLinecap&&(i.wireframeLinecap=t.wireframeLinecap),void 0!==t.wireframeLinejoin&&(i.wireframeLinejoin=t.wireframeLinejoin),void 0!==t.rotation&&(i.rotation=t.rotation),void 0!==t.linewidth&&(i.linewidth=t.linewidth),void 0!==t.dashSize&&(i.dashSize=t.dashSize),void 0!==t.gapSize&&(i.gapSize=t.gapSize),void 0!==t.scale&&(i.scale=t.scale),void 0!==t.polygonOffset&&(i.polygonOffset=t.polygonOffset),void 0!==t.polygonOffsetFactor&&(i.polygonOffsetFactor=t.polygonOffsetFactor),void 0!==t.polygonOffsetUnits&&(i.polygonOffsetUnits=t.polygonOffsetUnits),void 0!==t.dithering&&(i.dithering=t.dithering),void 0!==t.alphaToCoverage&&(i.alphaToCoverage=t.alphaToCoverage),void 0!==t.premultipliedAlpha&&(i.premultipliedAlpha=t.premultipliedAlpha),void 0!==t.forceSinglePass&&(i.forceSinglePass=t.forceSinglePass),void 0!==t.visible&&(i.visible=t.visible),void 0!==t.toneMapped&&(i.toneMapped=t.toneMapped),void 0!==t.userData&&(i.userData=t.userData),void 0!==t.vertexColors&&("number"==typeof t.vertexColors?i.vertexColors=t.vertexColors>0:i.vertexColors=t.vertexColors),void 0!==t.uniforms)for(const e in t.uniforms){const r=t.uniforms[e];switch(i.uniforms[e]={},r.type){case"t":i.uniforms[e].value=n(r.value);break;case"c":i.uniforms[e].value=(new hh).setHex(r.value);break;case"v2":i.uniforms[e].value=(new Ac).fromArray(r.value);break;case"v3":i.uniforms[e].value=(new jc).fromArray(r.value);break;case"v4":i.uniforms[e].value=(new Fc).fromArray(r.value);break;case"m3":i.uniforms[e].value=(new gc).fromArray(r.value);break;case"m4":i.uniforms[e].value=(new bl).fromArray(r.value);break;default:i.uniforms[e].value=r.value}}if(void 0!==t.defines&&(i.defines=t.defines),void 0!==t.vertexShader&&(i.vertexShader=t.vertexShader),void 0!==t.fragmentShader&&(i.fragmentShader=t.fragmentShader),void 0!==t.glslVersion&&(i.glslVersion=t.glslVersion),void 0!==t.extensions)for(const e in t.extensions)i.extensions[e]=t.extensions[e];if(void 0!==t.lights&&(i.lights=t.lights),void 0!==t.clipping&&(i.clipping=t.clipping),void 0!==t.size&&(i.size=t.size),void 0!==t.sizeAttenuation&&(i.sizeAttenuation=t.sizeAttenuation),void 0!==t.map&&(i.map=n(t.map)),void 0!==t.matcap&&(i.matcap=n(t.matcap)),void 0!==t.alphaMap&&(i.alphaMap=n(t.alphaMap)),void 0!==t.bumpMap&&(i.bumpMap=n(t.bumpMap)),void 0!==t.bumpScale&&(i.bumpScale=t.bumpScale),void 0!==t.normalMap&&(i.normalMap=n(t.normalMap)),void 0!==t.normalMapType&&(i.normalMapType=t.normalMapType),void 0!==t.normalScale){let e=t.normalScale;!1===Array.isArray(e)&&(e=[e,e]),i.normalScale=(new Ac).fromArray(e)}return void 0!==t.displacementMap&&(i.displacementMap=n(t.displacementMap)),void 0!==t.displacementScale&&(i.displacementScale=t.displacementScale),void 0!==t.displacementBias&&(i.displacementBias=t.displacementBias),void 0!==t.roughnessMap&&(i.roughnessMap=n(t.roughnessMap)),void 0!==t.metalnessMap&&(i.metalnessMap=n(t.metalnessMap)),void 0!==t.emissiveMap&&(i.emissiveMap=n(t.emissiveMap)),void 0!==t.emissiveIntensity&&(i.emissiveIntensity=t.emissiveIntensity),void 0!==t.specularMap&&(i.specularMap=n(t.specularMap)),void 0!==t.specularIntensityMap&&(i.specularIntensityMap=n(t.specularIntensityMap)),void 0!==t.specularColorMap&&(i.specularColorMap=n(t.specularColorMap)),void 0!==t.envMap&&(i.envMap=n(t.envMap)),void 0!==t.envMapRotation&&i.envMapRotation.fromArray(t.envMapRotation),void 0!==t.envMapIntensity&&(i.envMapIntensity=t.envMapIntensity),void 0!==t.reflectivity&&(i.reflectivity=t.reflectivity),void 0!==t.refractionRatio&&(i.refractionRatio=t.refractionRatio),void 0!==t.lightMap&&(i.lightMap=n(t.lightMap)),void 0!==t.lightMapIntensity&&(i.lightMapIntensity=t.lightMapIntensity),void 0!==t.aoMap&&(i.aoMap=n(t.aoMap)),void 0!==t.aoMapIntensity&&(i.aoMapIntensity=t.aoMapIntensity),void 0!==t.gradientMap&&(i.gradientMap=n(t.gradientMap)),void 0!==t.clearcoatMap&&(i.clearcoatMap=n(t.clearcoatMap)),void 0!==t.clearcoatRoughnessMap&&(i.clearcoatRoughnessMap=n(t.clearcoatRoughnessMap)),void 0!==t.clearcoatNormalMap&&(i.clearcoatNormalMap=n(t.clearcoatNormalMap)),void 0!==t.clearcoatNormalScale&&(i.clearcoatNormalScale=(new Ac).fromArray(t.clearcoatNormalScale)),void 0!==t.iridescenceMap&&(i.iridescenceMap=n(t.iridescenceMap)),void 0!==t.iridescenceThicknessMap&&(i.iridescenceThicknessMap=n(t.iridescenceThicknessMap)),void 0!==t.transmissionMap&&(i.transmissionMap=n(t.transmissionMap)),void 0!==t.thicknessMap&&(i.thicknessMap=n(t.thicknessMap)),void 0!==t.anisotropyMap&&(i.anisotropyMap=n(t.anisotropyMap)),void 0!==t.sheenColorMap&&(i.sheenColorMap=n(t.sheenColorMap)),void 0!==t.sheenRoughnessMap&&(i.sheenRoughnessMap=n(t.sheenRoughnessMap)),i}setTextures(t){return this.textures=t,this}static createMaterialFromType(t){return new{ShadowMaterial:ym,SpriteMaterial:gf,RawShaderMaterial:bm,ShaderMaterial:ru,PointsMaterial:FA,MeshPhysicalMaterial:wm,MeshStandardMaterial:xm,MeshPhongMaterial:Em,MeshToonMaterial:Cm,MeshNormalMaterial:Sm,MeshLambertMaterial:Mm,MeshDepthMaterial:Wp,MeshDistanceMaterial:qp,MeshBasicMaterial:fh,MeshMatcapMaterial:Im,LineDashedMaterial:Tm,LineBasicMaterial:CA,Material:ph}[t]}}class M_{static decodeText(t){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(t);let e="";for(let n=0,i=t.length;n<i;n++)e+=String.fromCharCode(t[n]);try{return decodeURIComponent(escape(e))}catch(t){return e}}static extractUrlBase(t){const e=t.lastIndexOf("/");return-1===e?"./":t.slice(0,e+1)}static resolveURL(t,e){return"string"!=typeof t||""===t?"":(/^https?:\/\//i.test(e)&&/^\//.test(t)&&(e=e.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(t)||/^data:.*,.*$/i.test(t)||/^blob:.*$/i.test(t)?t:e+t)}}class I_ extends Lh{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(t){return super.copy(t),this.instanceCount=t.instanceCount,this}toJSON(){const t=super.toJSON();return t.instanceCount=this.instanceCount,t.isInstancedBufferGeometry=!0,t}}class T_ extends $m{constructor(t){super(t)}load(t,e,n,i){const r=this,s=new n_(r.manager);s.setPath(r.path),s.setRequestHeader(r.requestHeader),s.setWithCredentials(r.withCredentials),s.load(t,(function(n){try{e(r.parse(JSON.parse(n)))}catch(e){i&&i(e),r.manager.itemError(t)}}),n,i)}parse(t){const e={},n={};function i(t,i){if(void 0!==e[i])return e[i];const r=t.interleavedBuffers[i],s=function(t,e){if(void 0!==n[e])return n[e];const i=t.arrayBuffers,r=i[e],s=new Uint32Array(r).buffer;return n[e]=s,s}(t,r.buffer),a=yc(r.type,s),o=new pf(a,r.stride);return o.uuid=r.uuid,e[i]=o,o}const r=t.isInstancedBufferGeometry?new I_:new Lh,s=t.data.index;if(void 0!==s){const t=yc(s.type,s.array);r.setIndex(new xh(t,1))}const a=t.data.attributes;for(const e in a){const n=a[e];let s;if(n.isInterleavedBufferAttribute){const e=i(t.data,n.data);s=new Af(e,n.itemSize,n.offset,n.normalized)}else{const t=yc(n.type,n.array);s=new(n.isInstancedBufferAttribute?Jf:xh)(t,n.itemSize,n.normalized)}void 0!==n.name&&(s.name=n.name),void 0!==n.usage&&s.setUsage(n.usage),r.setAttribute(e,s)}const o=t.data.morphAttributes;if(o)for(const e in o){const n=o[e],s=[];for(let e=0,r=n.length;e<r;e++){const r=n[e];let a;if(r.isInterleavedBufferAttribute){const e=i(t.data,r.data);a=new Af(e,r.itemSize,r.offset,r.normalized)}else{const t=yc(r.type,r.array);a=new xh(t,r.itemSize,r.normalized)}void 0!==r.name&&(a.name=r.name),s.push(a)}r.morphAttributes[e]=s}t.data.morphTargetsRelative&&(r.morphTargetsRelative=!0);const c=t.data.groups||t.data.drawcalls||t.data.offsets;if(void 0!==c)for(let t=0,e=c.length;t!==e;++t){const e=c[t];r.addGroup(e.start,e.count,e.materialIndex)}const l=t.data.boundingSphere;if(void 0!==l){const t=new jc;void 0!==l.center&&t.fromArray(l.center),r.boundingSphere=new dl(t,l.radius)}return t.name&&(r.name=t.name),t.userData&&(r.userData=t.userData),r}}class B_ extends $m{constructor(t){super(t)}load(t,e,n,i){const r=this,s=""===this.path?M_.extractUrlBase(t):this.path;this.resourcePath=this.resourcePath||s;const a=new n_(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(t,(function(n){let s=null;try{s=JSON.parse(n)}catch(t){return void(void 0!==i&&i(t))}const a=s.metadata;void 0!==a&&void 0!==a.type&&"geometry"!==a.type.toLowerCase()?r.parse(s,e):void 0!==i&&i(new Error("THREE.ObjectLoader: Can't load "+t))}),n,i)}async loadAsync(t,e){const n=""===this.path?M_.extractUrlBase(t):this.path;this.resourcePath=this.resourcePath||n;const i=new n_(this.manager);i.setPath(this.path),i.setRequestHeader(this.requestHeader),i.setWithCredentials(this.withCredentials);const r=await i.loadAsync(t,e),s=JSON.parse(r),a=s.metadata;if(void 0===a||void 0===a.type||"geometry"===a.type.toLowerCase())throw new Error("THREE.ObjectLoader: Can't load "+t);return await this.parseAsync(s)}parse(t,e){const n=this.parseAnimations(t.animations),i=this.parseShapes(t.shapes),r=this.parseGeometries(t.geometries,i),s=this.parseImages(t.images,(function(){void 0!==e&&e(c)})),a=this.parseTextures(t.textures,s),o=this.parseMaterials(t.materials,a),c=this.parseObject(t.object,r,o,a,n),l=this.parseSkeletons(t.skeletons,c);if(this.bindSkeletons(c,l),void 0!==e){let t=!1;for(const e in s)if(s[e].data instanceof HTMLImageElement){t=!0;break}!1===t&&e(c)}return c}async parseAsync(t){const e=this.parseAnimations(t.animations),n=this.parseShapes(t.shapes),i=this.parseGeometries(t.geometries,n),r=await this.parseImagesAsync(t.images),s=this.parseTextures(t.textures,r),a=this.parseMaterials(t.materials,s),o=this.parseObject(t.object,i,a,s,e),c=this.parseSkeletons(t.skeletons,o);return this.bindSkeletons(o,c),o}parseShapes(t){const e={};if(void 0!==t)for(let n=0,i=t.length;n<i;n++){const i=(new Rg).fromJSON(t[n]);e[i.uuid]=i}return e}parseSkeletons(t,e){const n={},i={};if(e.traverse((function(t){t.isBone&&(i[t.uuid]=t)})),void 0!==t)for(let e=0,r=t.length;e<r;e++){const r=(new Xf).fromJSON(t[e],i);n[r.uuid]=r}return n}parseGeometries(t,e){const n={};if(void 0!==t){const i=new T_;for(let r=0,s=t.length;r<s;r++){let s;const a=t[r];switch(a.type){case"BufferGeometry":case"InstancedBufferGeometry":s=i.parse(a);break;default:a.type in vm&&(s=vm[a.type].fromJSON(a,e))}s.uuid=a.uuid,void 0!==a.name&&(s.name=a.name),void 0!==a.userData&&(s.userData=a.userData),n[a.uuid]=s}}return n}parseMaterials(t,e){const n={},i={};if(void 0!==t){const r=new S_;r.setTextures(e);for(let e=0,s=t.length;e<s;e++){const s=t[e];void 0===n[s.uuid]&&(n[s.uuid]=r.parse(s)),i[s.uuid]=n[s.uuid]}}return i}parseAnimations(t){const e={};if(void 0!==t)for(let n=0;n<t.length;n++){const i=t[n],r=Ym.parse(i);e[r.uuid]=r}return e}parseImages(t,e){const n=this,i={};let r;function s(t){if("string"==typeof t){const e=t;return function(t){return n.manager.itemStart(t),r.load(t,(function(){n.manager.itemEnd(t)}),void 0,(function(){n.manager.itemError(t),n.manager.itemEnd(t)}))}(/^(\/\/)|([a-z]+:(\/\/)?)/i.test(e)?e:n.resourcePath+e)}return t.data?{data:yc(t.type,t.data),width:t.width,height:t.height}:null}if(void 0!==t&&t.length>0){const n=new Km(e);r=new i_(n),r.setCrossOrigin(this.crossOrigin);for(let e=0,n=t.length;e<n;e++){const n=t[e],r=n.url;if(Array.isArray(r)){const t=[];for(let e=0,n=r.length;e<n;e++){const n=s(r[e]);null!==n&&(n instanceof HTMLImageElement?t.push(n):t.push(new Wf(n.data,n.width,n.height)))}i[n.uuid]=new kc(t)}else{const t=s(n.url);i[n.uuid]=new kc(t)}}}return i}async parseImagesAsync(t){const e=this,n={};let i;async function r(t){if("string"==typeof t){const n=t,r=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(n)?n:e.resourcePath+n;return await i.loadAsync(r)}return t.data?{data:yc(t.type,t.data),width:t.width,height:t.height}:null}if(void 0!==t&&t.length>0){i=new i_(this.manager),i.setCrossOrigin(this.crossOrigin);for(let e=0,i=t.length;e<i;e++){const i=t[e],s=i.url;if(Array.isArray(s)){const t=[];for(let e=0,n=s.length;e<n;e++){const n=s[e],i=await r(n);null!==i&&(i instanceof HTMLImageElement?t.push(i):t.push(new Wf(i.data,i.width,i.height)))}n[i.uuid]=new kc(t)}else{const t=await r(i.url);n[i.uuid]=new kc(t)}}}return n}parseTextures(t,e){function n(t,e){return"number"==typeof t?t:e[t]}const i={};if(void 0!==t)for(let r=0,s=t.length;r<s;r++){const s=t[r];s.image,e[s.image];const a=e[s.image],o=a.data;let c;Array.isArray(o)?(c=new du,6===o.length&&(c.needsUpdate=!0)):(c=o&&o.data?new Wf:new Nc,o&&(c.needsUpdate=!0)),c.source=a,c.uuid=s.uuid,void 0!==s.name&&(c.name=s.name),void 0!==s.mapping&&(c.mapping=n(s.mapping,R_)),void 0!==s.channel&&(c.channel=s.channel),void 0!==s.offset&&c.offset.fromArray(s.offset),void 0!==s.repeat&&c.repeat.fromArray(s.repeat),void 0!==s.center&&c.center.fromArray(s.center),void 0!==s.rotation&&(c.rotation=s.rotation),void 0!==s.wrap&&(c.wrapS=n(s.wrap[0],D_),c.wrapT=n(s.wrap[1],D_)),void 0!==s.format&&(c.format=s.format),void 0!==s.internalFormat&&(c.internalFormat=s.internalFormat),void 0!==s.type&&(c.type=s.type),void 0!==s.colorSpace&&(c.colorSpace=s.colorSpace),void 0!==s.minFilter&&(c.minFilter=n(s.minFilter,L_)),void 0!==s.magFilter&&(c.magFilter=n(s.magFilter,L_)),void 0!==s.anisotropy&&(c.anisotropy=s.anisotropy),void 0!==s.flipY&&(c.flipY=s.flipY),void 0!==s.generateMipmaps&&(c.generateMipmaps=s.generateMipmaps),void 0!==s.premultiplyAlpha&&(c.premultiplyAlpha=s.premultiplyAlpha),void 0!==s.unpackAlignment&&(c.unpackAlignment=s.unpackAlignment),void 0!==s.compareFunction&&(c.compareFunction=s.compareFunction),void 0!==s.userData&&(c.userData=s.userData),i[s.uuid]=c}return i}parseObject(t,e,n,i,r){let s,a,o;function c(t){return e[t],e[t]}function l(t){if(void 0!==t){if(Array.isArray(t)){const e=[];for(let i=0,r=t.length;i<r;i++){const r=t[i];n[r],e.push(n[r])}return e}return n[t],n[t]}}function h(t){return i[t],i[t]}switch(t.type){case"Scene":s=new df,void 0!==t.background&&(Number.isInteger(t.background)?s.background=new hh(t.background):s.background=h(t.background)),void 0!==t.environment&&(s.environment=h(t.environment)),void 0!==t.fog&&("Fog"===t.fog.type?s.fog=new uf(t.fog.color,t.fog.near,t.fog.far):"FogExp2"===t.fog.type&&(s.fog=new hf(t.fog.color,t.fog.density)),""!==t.fog.name&&(s.fog.name=t.fog.name)),void 0!==t.backgroundBlurriness&&(s.backgroundBlurriness=t.backgroundBlurriness),void 0!==t.backgroundIntensity&&(s.backgroundIntensity=t.backgroundIntensity),void 0!==t.backgroundRotation&&s.backgroundRotation.fromArray(t.backgroundRotation),void 0!==t.environmentIntensity&&(s.environmentIntensity=t.environmentIntensity),void 0!==t.environmentRotation&&s.environmentRotation.fromArray(t.environmentRotation);break;case"PerspectiveCamera":s=new lu(t.fov,t.aspect,t.near,t.far),void 0!==t.focus&&(s.focus=t.focus),void 0!==t.zoom&&(s.zoom=t.zoom),void 0!==t.filmGauge&&(s.filmGauge=t.filmGauge),void 0!==t.filmOffset&&(s.filmOffset=t.filmOffset),void 0!==t.view&&(s.view=Object.assign({},t.view));break;case"OrthographicCamera":s=new Ou(t.left,t.right,t.top,t.bottom,t.near,t.far),void 0!==t.zoom&&(s.zoom=t.zoom),void 0!==t.view&&(s.view=Object.assign({},t.view));break;case"AmbientLight":s=new x_(t.color,t.intensity);break;case"DirectionalLight":s=new b_(t.color,t.intensity);break;case"PointLight":s=new v_(t.color,t.intensity,t.distance,t.decay);break;case"RectAreaLight":s=new w_(t.color,t.intensity,t.width,t.height);break;case"SpotLight":s=new f_(t.color,t.intensity,t.distance,t.angle,t.penumbra,t.decay);break;case"HemisphereLight":s=new c_(t.color,t.groundColor,t.intensity);break;case"LightProbe":s=(new C_).fromJSON(t);break;case"SkinnedMesh":a=c(t.geometry),o=l(t.material),s=new Vf(a,o),void 0!==t.bindMode&&(s.bindMode=t.bindMode),void 0!==t.bindMatrix&&s.bindMatrix.fromArray(t.bindMatrix),void 0!==t.skeleton&&(s.skeleton=t.skeleton);break;case"Mesh":a=c(t.geometry),o=l(t.material),s=new Kh(a,o);break;case"InstancedMesh":a=c(t.geometry),o=l(t.material);const e=t.count,n=t.instanceMatrix,i=t.instanceColor;s=new rA(a,o,e),s.instanceMatrix=new Jf(new Float32Array(n.array),16),void 0!==i&&(s.instanceColor=new Jf(new Float32Array(i.array),i.itemSize));break;case"BatchedMesh":a=c(t.geometry),o=l(t.material),s=new EA(t.maxGeometryCount,t.maxVertexCount,t.maxIndexCount,o),s.geometry=a,s.perObjectFrustumCulled=t.perObjectFrustumCulled,s.sortObjects=t.sortObjects,s._drawRanges=t.drawRanges,s._reservedRanges=t.reservedRanges,s._visibility=t.visibility,s._active=t.active,s._bounds=t.bounds.map((t=>{const e=new Yc;e.min.fromArray(t.boxMin),e.max.fromArray(t.boxMax);const n=new dl;return n.radius=t.sphereRadius,n.center.fromArray(t.sphereCenter),{boxInitialized:t.boxInitialized,box:e,sphereInitialized:t.sphereInitialized,sphere:n}})),s._maxGeometryCount=t.maxGeometryCount,s._maxVertexCount=t.maxVertexCount,s._maxIndexCount=t.maxIndexCount,s._geometryInitialized=t.geometryInitialized,s._geometryCount=t.geometryCount,s._matricesTexture=h(t.matricesTexture.uuid),void 0!==t.colorsTexture&&(s._colorsTexture=h(t.colorsTexture.uuid));break;case"LOD":s=new Pf;break;case"Line":s=new LA(c(t.geometry),l(t.material));break;case"LineLoop":s=new NA(c(t.geometry),l(t.material));break;case"LineSegments":s=new UA(c(t.geometry),l(t.material));break;case"PointCloud":case"Points":s=new VA(c(t.geometry),l(t.material));break;case"Sprite":s=new Bf(l(t.material));break;case"Group":s=new $p;break;case"Bone":s=new jf;break;default:s=new Yl}if(s.uuid=t.uuid,void 0!==t.name&&(s.name=t.name),void 0!==t.matrix?(s.matrix.fromArray(t.matrix),void 0!==t.matrixAutoUpdate&&(s.matrixAutoUpdate=t.matrixAutoUpdate),s.matrixAutoUpdate&&s.matrix.decompose(s.position,s.quaternion,s.scale)):(void 0!==t.position&&s.position.fromArray(t.position),void 0!==t.rotation&&s.rotation.fromArray(t.rotation),void 0!==t.quaternion&&s.quaternion.fromArray(t.quaternion),void 0!==t.scale&&s.scale.fromArray(t.scale)),void 0!==t.up&&s.up.fromArray(t.up),void 0!==t.castShadow&&(s.castShadow=t.castShadow),void 0!==t.receiveShadow&&(s.receiveShadow=t.receiveShadow),t.shadow&&(void 0!==t.shadow.bias&&(s.shadow.bias=t.shadow.bias),void 0!==t.shadow.normalBias&&(s.shadow.normalBias=t.shadow.normalBias),void 0!==t.shadow.radius&&(s.shadow.radius=t.shadow.radius),void 0!==t.shadow.mapSize&&s.shadow.mapSize.fromArray(t.shadow.mapSize),void 0!==t.shadow.camera&&(s.shadow.camera=this.parseObject(t.shadow.camera))),void 0!==t.visible&&(s.visible=t.visible),void 0!==t.frustumCulled&&(s.frustumCulled=t.frustumCulled),void 0!==t.renderOrder&&(s.renderOrder=t.renderOrder),void 0!==t.userData&&(s.userData=t.userData),void 0!==t.layers&&(s.layers.mask=t.layers),void 0!==t.children){const a=t.children;for(let t=0;t<a.length;t++)s.add(this.parseObject(a[t],e,n,i,r))}if(void 0!==t.animations){const e=t.animations;for(let t=0;t<e.length;t++){const n=e[t];s.animations.push(r[n])}}if("LOD"===t.type){void 0!==t.autoUpdate&&(s.autoUpdate=t.autoUpdate);const e=t.levels;for(let t=0;t<e.length;t++){const n=e[t],i=s.getObjectByProperty("uuid",n.object);void 0!==i&&s.addLevel(i,n.distance,n.hysteresis)}}return s}bindSkeletons(t,e){0!==Object.keys(e).length&&t.traverse((function(t){if(!0===t.isSkinnedMesh&&void 0!==t.skeleton){const n=e[t.skeleton];void 0===n||t.bind(n,t.bindMatrix)}}))}}const R_={UVMapping:ga,CubeReflectionMapping:ma,CubeRefractionMapping:_a,EquirectangularReflectionMapping:va,EquirectangularRefractionMapping:ya,CubeUVReflectionMapping:ba},D_={RepeatWrapping:xa,ClampToEdgeWrapping:wa,MirroredRepeatWrapping:Ea},L_={NearestFilter:Ca,NearestMipmapNearestFilter:Sa,NearestMipmapLinearFilter:Ma,LinearFilter:Ia,LinearMipmapNearestFilter:Ta,LinearMipmapLinearFilter:Ba};class P_ extends $m{constructor(t){super(t),this.isImageBitmapLoader=!0,this.options={premultiplyAlpha:"none"}}setOptions(t){return this.options=t,this}load(t,e,n,i){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const r=this,s=Jm.get(t);if(void 0!==s)return r.manager.itemStart(t),s.then?void s.then((n=>{e&&e(n),r.manager.itemEnd(t)})).catch((t=>{i&&i(t)})):(setTimeout((function(){e&&e(s),r.manager.itemEnd(t)}),0),s);const a={};a.credentials="anonymous"===this.crossOrigin?"same-origin":"include",a.headers=this.requestHeader;const o=fetch(t,a).then((function(t){return t.blob()})).then((function(t){return createImageBitmap(t,Object.assign(r.options,{colorSpaceConversion:"none"}))})).then((function(n){return Jm.add(t,n),e&&e(n),r.manager.itemEnd(t),n})).catch((function(e){i&&i(e),Jm.remove(t),r.manager.itemError(t),r.manager.itemEnd(t)}));Jm.add(t,o),r.manager.itemStart(t)}}let k_,O_=class{static getContext(){return void 0===k_&&(k_=new(window.AudioContext||window.webkitAudioContext)),k_}static setContext(t){k_=t}};const U_=new bl,N_=new bl,F_=new bl;class Q_{constructor(t=!0){this.autoStart=t,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=z_(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let t=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const e=z_();t=(e-this.oldTime)/1e3,this.oldTime=e,this.elapsedTime+=t}return t}}function z_(){return("undefined"==typeof performance?Date:performance).now()}const G_=new jc,H_=new Vc,V_=new jc,j_=new jc;let W_=class extends Yl{constructor(t){super(),this.type="Audio",this.listener=t,this.context=t.context,this.gain=this.context.createGain(),this.gain.connect(t.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(t){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=t,this.connect(),this}setMediaElementSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(t),this.connect(),this}setMediaStreamSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(t),this.connect(),this}setBuffer(t){return this.buffer=t,this.sourceType="buffer",this.autoplay&&this.play(),this}play(t=0){if(!0===this.isPlaying)return;if(!1===this.hasPlaybackControl)return;this._startedAt=this.context.currentTime+t;const e=this.context.createBufferSource();return e.buffer=this.buffer,e.loop=this.loop,e.loopStart=this.loopStart,e.loopEnd=this.loopEnd,e.onended=this.onEnded.bind(this),e.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=e,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(!1!==this.hasPlaybackControl)return!0===this.isPlaying&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,!0===this.loop&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(){if(!1!==this.hasPlaybackControl)return this._progress=0,null!==this.source&&(this.source.stop(),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let t=1,e=this.filters.length;t<e;t++)this.filters[t-1].connect(this.filters[t]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(!1!==this._connected){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let t=1,e=this.filters.length;t<e;t++)this.filters[t-1].disconnect(this.filters[t]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}}getFilters(){return this.filters}setFilters(t){return t||(t=[]),!0===this._connected?(this.disconnect(),this.filters=t.slice(),this.connect()):this.filters=t.slice(),this}setDetune(t){return this.detune=t,!0===this.isPlaying&&void 0!==this.source.detune&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(t){return this.setFilters(t?[t]:[])}setPlaybackRate(t){if(!1!==this.hasPlaybackControl)return this.playbackRate=t,!0===this.isPlaying&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1}getLoop(){return!1!==this.hasPlaybackControl&&this.loop}setLoop(t){if(!1!==this.hasPlaybackControl)return this.loop=t,!0===this.isPlaying&&(this.source.loop=this.loop),this}setLoopStart(t){return this.loopStart=t,this}setLoopEnd(t){return this.loopEnd=t,this}getVolume(){return this.gain.gain.value}setVolume(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this}};const q_=new jc,Y_=new Vc,X_=new jc,J_=new jc;class K_{constructor(t,e,n){let i,r,s;switch(this.binding=t,this.valueSize=n,e){case"quaternion":i=this._slerp,r=this._slerpAdditive,s=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(6*n),this._workIndex=5;break;case"string":case"bool":i=this._select,r=this._select,s=this._setAdditiveIdentityOther,this.buffer=new Array(5*n);break;default:i=this._lerp,r=this._lerpAdditive,s=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(5*n)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=r,this._setIdentity=s,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(t,e){const n=this.buffer,i=this.valueSize,r=t*i+i;let s=this.cumulativeWeight;if(0===s){for(let t=0;t!==i;++t)n[r+t]=n[t];s=e}else{s+=e;const t=e/s;this._mixBufferRegion(n,r,0,t,i)}this.cumulativeWeight=s}accumulateAdditive(t){const e=this.buffer,n=this.valueSize,i=n*this._addIndex;0===this.cumulativeWeightAdditive&&this._setIdentity(),this._mixBufferRegionAdditive(e,i,0,t,n),this.cumulativeWeightAdditive+=t}apply(t){const e=this.valueSize,n=this.buffer,i=t*e+e,r=this.cumulativeWeight,s=this.cumulativeWeightAdditive,a=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,r<1){const t=e*this._origIndex;this._mixBufferRegion(n,i,t,1-r,e)}s>0&&this._mixBufferRegionAdditive(n,i,this._addIndex*e,1,e);for(let t=e,r=e+e;t!==r;++t)if(n[t]!==n[t+e]){a.setValue(n,i);break}}saveOriginalState(){const t=this.binding,e=this.buffer,n=this.valueSize,i=n*this._origIndex;t.getValue(e,i);for(let t=n,r=i;t!==r;++t)e[t]=e[i+t%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const t=3*this.valueSize;this.binding.setValue(this.buffer,t)}_setAdditiveIdentityNumeric(){const t=this._addIndex*this.valueSize,e=t+this.valueSize;for(let n=t;n<e;n++)this.buffer[n]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const t=this._origIndex*this.valueSize,e=this._addIndex*this.valueSize;for(let n=0;n<this.valueSize;n++)this.buffer[e+n]=this.buffer[t+n]}_select(t,e,n,i,r){if(i>=.5)for(let i=0;i!==r;++i)t[e+i]=t[n+i]}_slerp(t,e,n,i){Vc.slerpFlat(t,e,t,e,t,n,i)}_slerpAdditive(t,e,n,i,r){const s=this._workIndex*r;Vc.multiplyQuaternionsFlat(t,s,t,e,t,n),Vc.slerpFlat(t,e,t,e,t,s,i)}_lerp(t,e,n,i,r){const s=1-i;for(let a=0;a!==r;++a){const r=e+a;t[r]=t[r]*s+t[n+a]*i}}_lerpAdditive(t,e,n,i,r){for(let s=0;s!==r;++s){const r=e+s;t[r]=t[r]+t[n+s]*i}}}const Z_="\\[\\]\\.:\\/",$_=new RegExp("["+Z_+"]","g"),tv="[^"+Z_+"]",ev="[^"+Z_.replace("\\.","")+"]",nv=new RegExp("^"+/((?:WC+[\/:])*)/.source.replace("WC",tv)+/(WCOD+)?/.source.replace("WCOD",ev)+/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",tv)+/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",tv)+"$"),iv=["material","materials","bones","map"];class rv{constructor(t,e,n){this.path=e,this.parsedPath=n||rv.parseTrackName(e),this.node=rv.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,n){return t&&t.isAnimationObjectGroup?new rv.Composite(t,e,n):new rv(t,e,n)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace($_,"")}static parseTrackName(t){const e=nv.exec(t);if(null===e)throw new Error("PropertyBinding: Cannot parse trackName: "+t);const n={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==i&&-1!==i){const t=n.nodeName.substring(i+1);-1!==iv.indexOf(t)&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=t)}if(null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return n}static findNode(t,e){if(void 0===e||""===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){const n=t.skeleton.getBoneByName(e);if(void 0!==n)return n}if(t.children){const n=function(t){for(let i=0;i<t.length;i++){const r=t[i];if(r.name===e||r.uuid===e)return r;const s=n(r.children);if(s)return s}return null},i=n(t.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(t,e){t[e]=this.targetObject[this.propertyName]}_getValue_array(t,e){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)t[e++]=n[i]}_getValue_arrayElement(t,e){t[e]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(t,e){this.resolvedProperty.toArray(t,e)}_setValue_direct(t,e){this.targetObject[this.propertyName]=t[e]}_setValue_direct_setNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(t,e){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=t[e++]}_setValue_array_setNeedsUpdate(t,e){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=t[e++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(t,e){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(t,e){this.resolvedProperty[this.propertyIndex]=t[e]}_setValue_arrayElement_setNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(t,e){this.resolvedProperty.fromArray(t,e)}_setValue_fromArray_setNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(t,e){this.bind(),this.getValue(t,e)}_setValue_unbound(t,e){this.bind(),this.setValue(t,e)}bind(){let t=this.node;const e=this.parsedPath,n=e.objectName,i=e.propertyName;let r=e.propertyIndex;if(t||(t=rv.findNode(this.rootNode,e.nodeName),this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t)return;if(n){let i=e.objectIndex;switch(n){case"materials":if(!t.material)return;if(!t.material.materials)return;t=t.material.materials;break;case"bones":if(!t.skeleton)return;t=t.skeleton.bones;for(let e=0;e<t.length;e++)if(t[e].name===i){i=e;break}break;case"map":if("map"in t){t=t.map;break}if(!t.material)return;if(!t.material.map)return;t=t.material.map;break;default:if(void 0===t[n])return;t=t[n]}if(void 0!==i){if(void 0===t[i])return;t=t[i]}}const s=t[i];if(void 0===s){e.nodeName;return}let a=this.Versioning.None;this.targetObject=t,void 0!==t.needsUpdate?a=this.Versioning.NeedsUpdate:void 0!==t.matrixWorldNeedsUpdate&&(a=this.Versioning.MatrixWorldNeedsUpdate);let o=this.BindingType.Direct;if(void 0!==r){if("morphTargetInfluences"===i){if(!t.geometry)return;if(!t.geometry.morphAttributes)return;void 0!==t.morphTargetDictionary[r]&&(r=t.morphTargetDictionary[r])}o=this.BindingType.ArrayElement,this.resolvedProperty=s,this.propertyIndex=r}else void 0!==s.fromArray&&void 0!==s.toArray?(o=this.BindingType.HasFromToArray,this.resolvedProperty=s):Array.isArray(s)?(o=this.BindingType.EntireArray,this.resolvedProperty=s):this.propertyName=i;this.getValue=this.GetterByBindingType[o],this.setValue=this.SetterByBindingTypeAndVersioning[o][a]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}rv.Composite=class{constructor(t,e,n){const i=n||rv.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,i)}getValue(t,e){this.bind();const n=this._targetGroup.nCachedObjects_,i=this._bindings[n];void 0!==i&&i.getValue(t,e)}setValue(t,e){const n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,r=n.length;i!==r;++i)n[i].setValue(t,e)}bind(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].bind()}unbind(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].unbind()}},rv.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},rv.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},rv.prototype.GetterByBindingType=[rv.prototype._getValue_direct,rv.prototype._getValue_array,rv.prototype._getValue_arrayElement,rv.prototype._getValue_toArray],rv.prototype.SetterByBindingTypeAndVersioning=[[rv.prototype._setValue_direct,rv.prototype._setValue_direct_setNeedsUpdate,rv.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[rv.prototype._setValue_array,rv.prototype._setValue_array_setNeedsUpdate,rv.prototype._setValue_array_setMatrixWorldNeedsUpdate],[rv.prototype._setValue_arrayElement,rv.prototype._setValue_arrayElement_setNeedsUpdate,rv.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[rv.prototype._setValue_fromArray,rv.prototype._setValue_fromArray_setNeedsUpdate,rv.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class sv{constructor(){this.isAnimationObjectGroup=!0,this.uuid=cc(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const t={};this._indicesByUUID=t;for(let e=0,n=arguments.length;e!==n;++e)t[arguments[e].uuid]=e;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const e=this;this.stats={objects:{get total(){return e._objects.length},get inUse(){return this.total-e.nCachedObjects_}},get bindingsPerObject(){return e._bindings.length}}}add(){const t=this._objects,e=this._indicesByUUID,n=this._paths,i=this._parsedPaths,r=this._bindings,s=r.length;let a,o=t.length,c=this.nCachedObjects_;for(let l=0,h=arguments.length;l!==h;++l){const h=arguments[l],u=h.uuid;let d=e[u];if(void 0===d){d=o++,e[u]=d,t.push(h);for(let t=0,e=s;t!==e;++t)r[t].push(new rv(h,n[t],i[t]))}else if(d<c){a=t[d];const o=--c,l=t[o];e[l.uuid]=d,t[d]=l,e[u]=o,t[o]=h;for(let t=0,e=s;t!==e;++t){const e=r[t],s=e[o];let a=e[d];e[d]=s,void 0===a&&(a=new rv(h,n[t],i[t])),e[o]=a}}else t[d]}this.nCachedObjects_=c}remove(){const t=this._objects,e=this._indicesByUUID,n=this._bindings,i=n.length;let r=this.nCachedObjects_;for(let s=0,a=arguments.length;s!==a;++s){const a=arguments[s],o=a.uuid,c=e[o];if(void 0!==c&&c>=r){const s=r++,l=t[s];e[l.uuid]=c,t[c]=l,e[o]=s,t[s]=a;for(let t=0,e=i;t!==e;++t){const e=n[t],i=e[s],r=e[c];e[c]=i,e[s]=r}}}this.nCachedObjects_=r}uncache(){const t=this._objects,e=this._indicesByUUID,n=this._bindings,i=n.length;let r=this.nCachedObjects_,s=t.length;for(let a=0,o=arguments.length;a!==o;++a){const o=arguments[a].uuid,c=e[o];if(void 0!==c)if(delete e[o],c<r){const a=--r,o=t[a],l=--s,h=t[l];e[o.uuid]=c,t[c]=o,e[h.uuid]=a,t[a]=h,t.pop();for(let t=0,e=i;t!==e;++t){const e=n[t],i=e[a],r=e[l];e[c]=i,e[a]=r,e.pop()}}else{const r=--s,a=t[r];r>0&&(e[a.uuid]=c),t[c]=a,t.pop();for(let t=0,e=i;t!==e;++t){const e=n[t];e[c]=e[r],e.pop()}}}this.nCachedObjects_=r}subscribe_(t,e){const n=this._bindingsIndicesByPath;let i=n[t];const r=this._bindings;if(void 0!==i)return r[i];const s=this._paths,a=this._parsedPaths,o=this._objects,c=o.length,l=this.nCachedObjects_,h=new Array(c);i=r.length,n[t]=i,s.push(t),a.push(e),r.push(h);for(let n=l,i=o.length;n!==i;++n){const i=o[n];h[n]=new rv(i,t,e)}return h}unsubscribe_(t){const e=this._bindingsIndicesByPath,n=e[t];if(void 0!==n){const i=this._paths,r=this._parsedPaths,s=this._bindings,a=s.length-1,o=s[a];e[t[a]]=n,s[n]=o,s.pop(),r[n]=r[a],r.pop(),i[n]=i[a],i.pop()}}}class av{constructor(t,e,n=null,i=e.blendMode){this._mixer=t,this._clip=e,this._localRoot=n,this.blendMode=i;const r=e.tracks,s=r.length,a=new Array(s),o={endingStart:Bo,endingEnd:Bo};for(let t=0;t!==s;++t){const e=r[t].createInterpolant(null);a[t]=e,e.settings=o}this._interpolantSettings=o,this._interpolants=a,this._propertyBindings=new Array(s),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=So,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(t){return this._startTime=t,this}setLoop(t,e){return this.loop=t,this.repetitions=e,this}setEffectiveWeight(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(t){return this._scheduleFading(t,0,1)}fadeOut(t){return this._scheduleFading(t,1,0)}crossFadeFrom(t,e,n){if(t.fadeOut(e),this.fadeIn(e),n){const n=this._clip.duration,i=t._clip.duration,r=i/n,s=n/i;t.warp(1,r,e),this.warp(s,1,e)}return this}crossFadeTo(t,e,n){return t.crossFadeFrom(this,e,n)}stopFading(){const t=this._weightInterpolant;return null!==t&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}setEffectiveTimeScale(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(t){return this.timeScale=this._clip.duration/t,this.stopWarping()}syncWith(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()}halt(t){return this.warp(this._effectiveTimeScale,0,t)}warp(t,e,n){const i=this._mixer,r=i.time,s=this.timeScale;let a=this._timeScaleInterpolant;null===a&&(a=i._lendControlInterpolant(),this._timeScaleInterpolant=a);const o=a.parameterPositions,c=a.sampleValues;return o[0]=r,o[1]=r+n,c[0]=t/s,c[1]=e/s,this}stopWarping(){const t=this._timeScaleInterpolant;return null!==t&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(t,e,n,i){if(!this.enabled)return void this._updateWeight(t);const r=this._startTime;if(null!==r){const i=(t-r)*n;i<0||0===n?e=0:(this._startTime=null,e=n*i)}e*=this._updateTimeScale(t);const s=this._updateTime(e),a=this._updateWeight(t);if(a>0){const t=this._interpolants,e=this._propertyBindings;if(this.blendMode===Po)for(let n=0,i=t.length;n!==i;++n)t[n].evaluate(s),e[n].accumulateAdditive(a);else for(let n=0,r=t.length;n!==r;++n)t[n].evaluate(s),e[n].accumulate(i,a)}}_updateWeight(t){let e=0;if(this.enabled){e=this.weight;const n=this._weightInterpolant;if(null!==n){const i=n.evaluate(t)[0];e*=i,t>n.parameterPositions[1]&&(this.stopFading(),0===i&&(this.enabled=!1))}}return this._effectiveWeight=e,e}_updateTimeScale(t){let e=0;if(!this.paused){e=this.timeScale;const n=this._timeScaleInterpolant;if(null!==n){e*=n.evaluate(t)[0],t>n.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e)}}return this._effectiveTimeScale=e,e}_updateTime(t){const e=this._clip.duration,n=this.loop;let i=this.time+t,r=this._loopCount;const s=2202===n;if(0===t)return-1===r||!s||1&~r?i:e-i;if(2200===n){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(i>=e)i=e;else{if(!(i<0)){this.time=i;break t}i=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{if(-1===r&&(t>=0?(r=0,this._setEndings(!0,0===this.repetitions,s)):this._setEndings(0===this.repetitions,!0,s)),i>=e||i<0){const n=Math.floor(i/e);i-=e*n,r+=Math.abs(n);const a=this.repetitions-r;if(a<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=t>0?e:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(1===a){const e=t<0;this._setEndings(e,!e,s)}else this._setEndings(!1,!1,s);this._loopCount=r,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:n})}}else this.time=i;if(s&&!(1&~r))return e-i}return i}_setEndings(t,e,n){const i=this._interpolantSettings;n?(i.endingStart=Ro,i.endingEnd=Ro):(i.endingStart=t?this.zeroSlopeAtStart?Ro:Bo:Do,i.endingEnd=e?this.zeroSlopeAtEnd?Ro:Bo:Do)}_scheduleFading(t,e,n){const i=this._mixer,r=i.time;let s=this._weightInterpolant;null===s&&(s=i._lendControlInterpolant(),this._weightInterpolant=s);const a=s.parameterPositions,o=s.sampleValues;return a[0]=r,o[0]=e,a[1]=r+t,o[1]=n,this}}const ov=new Float32Array(1);class cv extends ic{constructor(t){super(),this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(t,e){const n=t._localRoot||this._root,i=t._clip.tracks,r=i.length,s=t._propertyBindings,a=t._interpolants,o=n.uuid,c=this._bindingsByRootAndName;let l=c[o];void 0===l&&(l={},c[o]=l);for(let t=0;t!==r;++t){const r=i[t],c=r.name;let h=l[c];if(void 0!==h)++h.referenceCount,s[t]=h;else{if(h=s[t],void 0!==h){null===h._cacheIndex&&(++h.referenceCount,this._addInactiveBinding(h,o,c));continue}const i=e&&e._propertyBindings[t].binding.parsedPath;h=new K_(rv.create(n,c,i),r.ValueTypeName,r.getValueSize()),++h.referenceCount,this._addInactiveBinding(h,o,c),s[t]=h}a[t].resultBuffer=h.buffer}}_activateAction(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){const e=(t._localRoot||this._root).uuid,n=t._clip.uuid,i=this._actionsByClip[n];this._bindAction(t,i&&i.knownActions[0]),this._addInactiveAction(t,n,e)}const e=t._propertyBindings;for(let t=0,n=e.length;t!==n;++t){const n=e[t];0==n.useCount++&&(this._lendBinding(n),n.saveOriginalState())}this._lendAction(t)}}_deactivateAction(t){if(this._isActiveAction(t)){const e=t._propertyBindings;for(let t=0,n=e.length;t!==n;++t){const n=e[t];0==--n.useCount&&(n.restoreOriginalState(),this._takeBackBinding(n))}this._takeBackAction(t)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}}_isActiveAction(t){const e=t._cacheIndex;return null!==e&&e<this._nActiveActions}_addInactiveAction(t,e,n){const i=this._actions,r=this._actionsByClip;let s=r[e];if(void 0===s)s={knownActions:[t],actionByRoot:{}},t._byClipCacheIndex=0,r[e]=s;else{const e=s.knownActions;t._byClipCacheIndex=e.length,e.push(t)}t._cacheIndex=i.length,i.push(t),s.actionByRoot[n]=t}_removeInactiveAction(t){const e=this._actions,n=e[e.length-1],i=t._cacheIndex;n._cacheIndex=i,e[i]=n,e.pop(),t._cacheIndex=null;const r=t._clip.uuid,s=this._actionsByClip,a=s[r],o=a.knownActions,c=o[o.length-1],l=t._byClipCacheIndex;c._byClipCacheIndex=l,o[l]=c,o.pop(),t._byClipCacheIndex=null;delete a.actionByRoot[(t._localRoot||this._root).uuid],0===o.length&&delete s[r],this._removeInactiveBindingsForAction(t)}_removeInactiveBindingsForAction(t){const e=t._propertyBindings;for(let t=0,n=e.length;t!==n;++t){const n=e[t];0==--n.referenceCount&&this._removeInactiveBinding(n)}}_lendAction(t){const e=this._actions,n=t._cacheIndex,i=this._nActiveActions++,r=e[i];t._cacheIndex=i,e[i]=t,r._cacheIndex=n,e[n]=r}_takeBackAction(t){const e=this._actions,n=t._cacheIndex,i=--this._nActiveActions,r=e[i];t._cacheIndex=i,e[i]=t,r._cacheIndex=n,e[n]=r}_addInactiveBinding(t,e,n){const i=this._bindingsByRootAndName,r=this._bindings;let s=i[e];void 0===s&&(s={},i[e]=s),s[n]=t,t._cacheIndex=r.length,r.push(t)}_removeInactiveBinding(t){const e=this._bindings,n=t.binding,i=n.rootNode.uuid,r=n.path,s=this._bindingsByRootAndName,a=s[i],o=e[e.length-1],c=t._cacheIndex;o._cacheIndex=c,e[c]=o,e.pop(),delete a[r],0===Object.keys(a).length&&delete s[i]}_lendBinding(t){const e=this._bindings,n=t._cacheIndex,i=this._nActiveBindings++,r=e[i];t._cacheIndex=i,e[i]=t,r._cacheIndex=n,e[n]=r}_takeBackBinding(t){const e=this._bindings,n=t._cacheIndex,i=--this._nActiveBindings,r=e[i];t._cacheIndex=i,e[i]=t,r._cacheIndex=n,e[n]=r}_lendControlInterpolant(){const t=this._controlInterpolants,e=this._nActiveControlInterpolants++;let n=t[e];return void 0===n&&(n=new Nm(new Float32Array(2),new Float32Array(2),1,ov),n.__cacheIndex=e,t[e]=n),n}_takeBackControlInterpolant(t){const e=this._controlInterpolants,n=t.__cacheIndex,i=--this._nActiveControlInterpolants,r=e[i];t.__cacheIndex=i,e[i]=t,r.__cacheIndex=n,e[n]=r}clipAction(t,e,n){const i=e||this._root,r=i.uuid;let s="string"==typeof t?Ym.findByName(i,t):t;const a=null!==s?s.uuid:t,o=this._actionsByClip[a];let c=null;if(void 0===n&&(n=null!==s?s.blendMode:Lo),void 0!==o){const t=o.actionByRoot[r];if(void 0!==t&&t.blendMode===n)return t;c=o.knownActions[0],null===s&&(s=c._clip)}if(null===s)return null;const l=new av(this,s,e,n);return this._bindAction(l,c),this._addInactiveAction(l,a,r),l}existingAction(t,e){const n=e||this._root,i=n.uuid,r="string"==typeof t?Ym.findByName(n,t):t,s=r?r.uuid:t,a=this._actionsByClip[s];return void 0!==a&&a.actionByRoot[i]||null}stopAllAction(){const t=this._actions;for(let e=this._nActiveActions-1;e>=0;--e)t[e].stop();return this}update(t){t*=this.timeScale;const e=this._actions,n=this._nActiveActions,i=this.time+=t,r=Math.sign(t),s=this._accuIndex^=1;for(let a=0;a!==n;++a){e[a]._update(i,t,r,s)}const a=this._bindings,o=this._nActiveBindings;for(let t=0;t!==o;++t)a[t].apply(s);return this}setTime(t){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(t)}getRoot(){return this._root}uncacheClip(t){const e=this._actions,n=t.uuid,i=this._actionsByClip,r=i[n];if(void 0!==r){const t=r.knownActions;for(let n=0,i=t.length;n!==i;++n){const i=t[n];this._deactivateAction(i);const r=i._cacheIndex,s=e[e.length-1];i._cacheIndex=null,i._byClipCacheIndex=null,s._cacheIndex=r,e[r]=s,e.pop(),this._removeInactiveBindingsForAction(i)}delete i[n]}}uncacheRoot(t){const e=t.uuid,n=this._actionsByClip;for(const t in n){const i=n[t].actionByRoot[e];void 0!==i&&(this._deactivateAction(i),this._removeInactiveAction(i))}const i=this._bindingsByRootAndName[e];if(void 0!==i)for(const t in i){const e=i[t];e.restoreOriginalState(),this._removeInactiveBinding(e)}}uncacheAction(t,e){const n=this.existingAction(t,e);null!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}}class lv{constructor(t){this.value=t}clone(){return new lv(void 0===this.value.clone?this.value:this.value.clone())}}let hv=0;const uv=new bl;function dv(t,e){return t.distance-e.distance}function pv(t,e,n,i){let r=!0;if(t.layers.test(e.layers)){!1===t.raycast(e,n)&&(r=!1)}if(!0===r&&!0===i){const i=t.children;for(let t=0,r=i.length;t<r;t++)pv(i[t],e,n,!0)}}class fv{constructor(t=1,e=0,n=0){return this.radius=t,this.phi=e,this.theta=n,this}set(t,e,n){return this.radius=t,this.phi=e,this.theta=n,this}copy(t){return this.radius=t.radius,this.phi=t.phi,this.theta=t.theta,this}makeSafe(){const t=1e-6;return this.phi=Math.max(t,Math.min(Math.PI-t,this.phi)),this}setFromVector3(t){return this.setFromCartesianCoords(t.x,t.y,t.z)}setFromCartesianCoords(t,e,n){return this.radius=Math.sqrt(t*t+e*e+n*n),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(t,n),this.phi=Math.acos(lc(e/this.radius,-1,1))),this}clone(){return(new this.constructor).copy(this)}}const Av=new Ac;const gv=new jc,mv=new jc;const _v=new jc;class vv extends Yl{constructor(t,e){super(),this.light=t,this.matrixAutoUpdate=!1,this.color=e,this.type="SpotLightHelper";const n=new Lh,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let t=0,e=1,n=32;t<n;t++,e++){const r=t/n*Math.PI*2,s=e/n*Math.PI*2;i.push(Math.cos(r),Math.sin(r),1,Math.cos(s),Math.sin(s),1)}n.setAttribute("position",new Ch(i,3));const r=new CA({fog:!1,toneMapped:!1});this.cone=new UA(n,r),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),this.parent?(this.parent.updateWorldMatrix(!0),this.matrix.copy(this.parent.matrixWorld).invert().multiply(this.light.matrixWorld)):this.matrix.copy(this.light.matrixWorld),this.matrixWorld.copy(this.light.matrixWorld);const t=this.light.distance?this.light.distance:1e3,e=t*Math.tan(this.light.angle);this.cone.scale.set(e,e,t),_v.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(_v),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const yv=new jc,bv=new bl,xv=new bl;class wv extends UA{constructor(t){const e=Ev(t),n=new Lh,i=[],r=[],s=new hh(0,0,1),a=new hh(0,1,0);for(let t=0;t<e.length;t++){const n=e[t];n.parent&&n.parent.isBone&&(i.push(0,0,0),i.push(0,0,0),r.push(s.r,s.g,s.b),r.push(a.r,a.g,a.b))}n.setAttribute("position",new Ch(i,3)),n.setAttribute("color",new Ch(r,3));super(n,new CA({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0})),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=t,this.bones=e,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(t){const e=this.bones,n=this.geometry,i=n.getAttribute("position");xv.copy(this.root.matrixWorld).invert();for(let t=0,n=0;t<e.length;t++){const r=e[t];r.parent&&r.parent.isBone&&(bv.multiplyMatrices(xv,r.matrixWorld),yv.setFromMatrixPosition(bv),i.setXYZ(n,yv.x,yv.y,yv.z),bv.multiplyMatrices(xv,r.parent.matrixWorld),yv.setFromMatrixPosition(bv),i.setXYZ(n+1,yv.x,yv.y,yv.z),n+=2)}n.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(t)}dispose(){this.geometry.dispose(),this.material.dispose()}}function Ev(t){const e=[];!0===t.isBone&&e.push(t);for(let n=0;n<t.children.length;n++)e.push.apply(e,Ev(t.children[n]));return e}class Cv extends Kh{constructor(t,e,n){super(new dm(e,4,2),new fh({wireframe:!0,fog:!1,toneMapped:!1})),this.light=t,this.color=n,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),void 0!==this.color?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}const Sv=new jc,Mv=new hh,Iv=new hh;class Tv extends Yl{constructor(t,e,n){super(),this.light=t,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="HemisphereLightHelper";const i=new lm(e);i.rotateY(.5*Math.PI),this.material=new fh({wireframe:!0,fog:!1,toneMapped:!1}),void 0===this.color&&(this.material.vertexColors=!0);const r=i.getAttribute("position"),s=new Float32Array(3*r.count);i.setAttribute("color",new xh(s,3)),this.add(new Kh(i,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const t=this.children[0];if(void 0!==this.color)this.material.color.set(this.color);else{const e=t.geometry.getAttribute("color");Mv.copy(this.light.color),Iv.copy(this.light.groundColor);for(let t=0,n=e.count;t<n;t++){const i=t<n/2?Mv:Iv;e.setXYZ(t,i.r,i.g,i.b)}e.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),t.lookAt(Sv.setFromMatrixPosition(this.light.matrixWorld).negate())}}class Bv extends UA{constructor(t=10,e=10,n=4473924,i=8947848){n=new hh(n),i=new hh(i);const r=e/2,s=t/e,a=t/2,o=[],c=[];for(let t=0,l=0,h=-a;t<=e;t++,h+=s){o.push(-a,0,h,a,0,h),o.push(h,0,-a,h,0,a);const e=t===r?n:i;e.toArray(c,l),l+=3,e.toArray(c,l),l+=3,e.toArray(c,l),l+=3,e.toArray(c,l),l+=3}const l=new Lh;l.setAttribute("position",new Ch(o,3)),l.setAttribute("color",new Ch(c,3));super(l,new CA({vertexColors:!0,toneMapped:!1})),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}const Rv=new jc,Dv=new jc,Lv=new jc;class Pv extends Yl{constructor(t,e,n){super(),this.light=t,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="DirectionalLightHelper",void 0===e&&(e=1);let i=new Lh;i.setAttribute("position",new Ch([-e,e,0,e,e,0,e,-e,0,-e,-e,0,-e,e,0],3));const r=new CA({fog:!1,toneMapped:!1});this.lightPlane=new LA(i,r),this.add(this.lightPlane),i=new Lh,i.setAttribute("position",new Ch([0,0,0,0,0,1],3)),this.targetLine=new LA(i,r),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),Rv.setFromMatrixPosition(this.light.matrixWorld),Dv.setFromMatrixPosition(this.light.target.matrixWorld),Lv.subVectors(Dv,Rv),this.lightPlane.lookAt(Dv),void 0!==this.color?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(Dv),this.targetLine.scale.z=Lv.length()}}const kv=new jc,Ov=new su;class Uv extends UA{constructor(t){const e=new Lh,n=new CA({color:16777215,vertexColors:!0,toneMapped:!1}),i=[],r=[],s={};function a(t,e){o(t),o(e)}function o(t){i.push(0,0,0),r.push(0,0,0),void 0===s[t]&&(s[t]=[]),s[t].push(i.length/3-1)}a("n1","n2"),a("n2","n4"),a("n4","n3"),a("n3","n1"),a("f1","f2"),a("f2","f4"),a("f4","f3"),a("f3","f1"),a("n1","f1"),a("n2","f2"),a("n3","f3"),a("n4","f4"),a("p","n1"),a("p","n2"),a("p","n3"),a("p","n4"),a("u1","u2"),a("u2","u3"),a("u3","u1"),a("c","t"),a("p","c"),a("cn1","cn2"),a("cn3","cn4"),a("cf1","cf2"),a("cf3","cf4"),e.setAttribute("position",new Ch(i,3)),e.setAttribute("color",new Ch(r,3)),super(e,n),this.type="CameraHelper",this.camera=t,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=s,this.update();const c=new hh(16755200),l=new hh(16711680),h=new hh(43775),u=new hh(16777215),d=new hh(3355443);this.setColors(c,l,h,u,d)}setColors(t,e,n,i,r){const s=this.geometry.getAttribute("color");s.setXYZ(0,t.r,t.g,t.b),s.setXYZ(1,t.r,t.g,t.b),s.setXYZ(2,t.r,t.g,t.b),s.setXYZ(3,t.r,t.g,t.b),s.setXYZ(4,t.r,t.g,t.b),s.setXYZ(5,t.r,t.g,t.b),s.setXYZ(6,t.r,t.g,t.b),s.setXYZ(7,t.r,t.g,t.b),s.setXYZ(8,t.r,t.g,t.b),s.setXYZ(9,t.r,t.g,t.b),s.setXYZ(10,t.r,t.g,t.b),s.setXYZ(11,t.r,t.g,t.b),s.setXYZ(12,t.r,t.g,t.b),s.setXYZ(13,t.r,t.g,t.b),s.setXYZ(14,t.r,t.g,t.b),s.setXYZ(15,t.r,t.g,t.b),s.setXYZ(16,t.r,t.g,t.b),s.setXYZ(17,t.r,t.g,t.b),s.setXYZ(18,t.r,t.g,t.b),s.setXYZ(19,t.r,t.g,t.b),s.setXYZ(20,t.r,t.g,t.b),s.setXYZ(21,t.r,t.g,t.b),s.setXYZ(22,t.r,t.g,t.b),s.setXYZ(23,t.r,t.g,t.b),s.setXYZ(24,e.r,e.g,e.b),s.setXYZ(25,e.r,e.g,e.b),s.setXYZ(26,e.r,e.g,e.b),s.setXYZ(27,e.r,e.g,e.b),s.setXYZ(28,e.r,e.g,e.b),s.setXYZ(29,e.r,e.g,e.b),s.setXYZ(30,e.r,e.g,e.b),s.setXYZ(31,e.r,e.g,e.b),s.setXYZ(32,n.r,n.g,n.b),s.setXYZ(33,n.r,n.g,n.b),s.setXYZ(34,n.r,n.g,n.b),s.setXYZ(35,n.r,n.g,n.b),s.setXYZ(36,n.r,n.g,n.b),s.setXYZ(37,n.r,n.g,n.b),s.setXYZ(38,i.r,i.g,i.b),s.setXYZ(39,i.r,i.g,i.b),s.setXYZ(40,r.r,r.g,r.b),s.setXYZ(41,r.r,r.g,r.b),s.setXYZ(42,r.r,r.g,r.b),s.setXYZ(43,r.r,r.g,r.b),s.setXYZ(44,r.r,r.g,r.b),s.setXYZ(45,r.r,r.g,r.b),s.setXYZ(46,r.r,r.g,r.b),s.setXYZ(47,r.r,r.g,r.b),s.setXYZ(48,r.r,r.g,r.b),s.setXYZ(49,r.r,r.g,r.b),s.needsUpdate=!0}update(){const t=this.geometry,e=this.pointMap;Ov.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),Nv("c",e,t,Ov,0,0,-1),Nv("t",e,t,Ov,0,0,1),Nv("n1",e,t,Ov,-1,-1,-1),Nv("n2",e,t,Ov,1,-1,-1),Nv("n3",e,t,Ov,-1,1,-1),Nv("n4",e,t,Ov,1,1,-1),Nv("f1",e,t,Ov,-1,-1,1),Nv("f2",e,t,Ov,1,-1,1),Nv("f3",e,t,Ov,-1,1,1),Nv("f4",e,t,Ov,1,1,1),Nv("u1",e,t,Ov,.7,1.1,-1),Nv("u2",e,t,Ov,-.7,1.1,-1),Nv("u3",e,t,Ov,0,2,-1),Nv("cf1",e,t,Ov,-1,0,1),Nv("cf2",e,t,Ov,1,0,1),Nv("cf3",e,t,Ov,0,-1,1),Nv("cf4",e,t,Ov,0,1,1),Nv("cn1",e,t,Ov,-1,0,-1),Nv("cn2",e,t,Ov,1,0,-1),Nv("cn3",e,t,Ov,0,-1,-1),Nv("cn4",e,t,Ov,0,1,-1),t.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function Nv(t,e,n,i,r,s,a){kv.set(r,s,a).unproject(i);const o=e[t];if(void 0!==o){const t=n.getAttribute("position");for(let e=0,n=o.length;e<n;e++)t.setXYZ(o[e],kv.x,kv.y,kv.z)}}const Fv=new Yc;class Qv extends UA{constructor(t,e=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new Float32Array(24),r=new Lh;r.setIndex(new xh(n,1)),r.setAttribute("position",new xh(i,3)),super(r,new CA({color:e,toneMapped:!1})),this.object=t,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(t){if(void 0!==this.object&&Fv.setFromObject(this.object),Fv.isEmpty())return;const e=Fv.min,n=Fv.max,i=this.geometry.attributes.position,r=i.array;r[0]=n.x,r[1]=n.y,r[2]=n.z,r[3]=e.x,r[4]=n.y,r[5]=n.z,r[6]=e.x,r[7]=e.y,r[8]=n.z,r[9]=n.x,r[10]=e.y,r[11]=n.z,r[12]=n.x,r[13]=n.y,r[14]=e.z,r[15]=e.x,r[16]=n.y,r[17]=e.z,r[18]=e.x,r[19]=e.y,r[20]=e.z,r[21]=n.x,r[22]=e.y,r[23]=e.z,i.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(t){return this.object=t,this.update(),this}copy(t,e){return super.copy(t,e),this.object=t.object,this}dispose(){this.geometry.dispose(),this.material.dispose()}}const zv=new jc;let Gv,Hv;"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Bs}})),"undefined"!=typeof window&&(window.__THREE__||(window.__THREE__=Bs));var Vv=Object.freeze({__proto__:null,ACESFilmicToneMapping:ha,AddEquation:Fs,AddOperation:sa,AdditiveAnimationBlendMode:Po,AdditiveBlending:2,AgXToneMapping:da,AlphaFormat:1021,AlwaysCompare:519,AlwaysDepth:1,AlwaysStencilFunc:519,AmbientLight:x_,AnimationAction:av,AnimationClip:Ym,AnimationLoader:class extends $m{constructor(t){super(t)}load(t,e,n,i){const r=this,s=new n_(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(t,(function(n){try{e(r.parse(JSON.parse(n)))}catch(e){i&&i(e),r.manager.itemError(t)}}),n,i)}parse(t){const e=[];for(let n=0;n<t.length;n++){const i=Ym.parse(t[n]);e.push(i)}return e}},AnimationMixer:cv,AnimationObjectGroup:sv,AnimationUtils:km,ArcCurve:$A,ArrayCamera:Zp,ArrowHelper:class extends Yl{constructor(t=new jc(0,0,1),e=new jc(0,0,0),n=1,i=16776960,r=.2*n,s=.2*r){super(),this.type="ArrowHelper",void 0===Gv&&(Gv=new Lh,Gv.setAttribute("position",new Ch([0,0,0,0,1,0],3)),Hv=new xg(0,.5,1,5,1),Hv.translate(0,-.5,0)),this.position.copy(e),this.line=new LA(Gv,new CA({color:i,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new Kh(Hv,new fh({color:i,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(t),this.setLength(n,r,s)}setDirection(t){if(t.y>.99999)this.quaternion.set(0,0,0,1);else if(t.y<-.99999)this.quaternion.set(1,0,0,0);else{zv.set(t.z,0,-t.x).normalize();const e=Math.acos(t.y);this.quaternion.setFromAxisAngle(zv,e)}}setLength(t,e=.2*t,n=.2*e){this.line.scale.set(1,Math.max(1e-4,t-e),1),this.line.updateMatrix(),this.cone.scale.set(n,e,n),this.cone.position.y=t,this.cone.updateMatrix()}setColor(t){this.line.material.color.set(t),this.cone.material.color.set(t)}copy(t){return super.copy(t,!1),this.line.copy(t.line),this.cone.copy(t.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}},AttachedBindMode:fa,Audio:W_,AudioAnalyser:class{constructor(t,e=2048){this.analyser=t.context.createAnalyser(),this.analyser.fftSize=e,this.data=new Uint8Array(this.analyser.frequencyBinCount),t.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let t=0;const e=this.getFrequencyData();for(let n=0;n<e.length;n++)t+=e[n];return t/e.length}},AudioContext:O_,AudioListener:class extends Yl{constructor(){super(),this.type="AudioListener",this.context=O_.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new Q_}getInput(){return this.gain}removeFilter(){return null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(t){return null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=t,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this}updateMatrixWorld(t){super.updateMatrixWorld(t);const e=this.context.listener,n=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(G_,H_,V_),j_.set(0,0,-1).applyQuaternion(H_),e.positionX){const t=this.context.currentTime+this.timeDelta;e.positionX.linearRampToValueAtTime(G_.x,t),e.positionY.linearRampToValueAtTime(G_.y,t),e.positionZ.linearRampToValueAtTime(G_.z,t),e.forwardX.linearRampToValueAtTime(j_.x,t),e.forwardY.linearRampToValueAtTime(j_.y,t),e.forwardZ.linearRampToValueAtTime(j_.z,t),e.upX.linearRampToValueAtTime(n.x,t),e.upY.linearRampToValueAtTime(n.y,t),e.upZ.linearRampToValueAtTime(n.z,t)}else e.setPosition(G_.x,G_.y,G_.z),e.setOrientation(j_.x,j_.y,j_.z,n.x,n.y,n.z)}},AudioLoader:class extends $m{constructor(t){super(t)}load(t,e,n,i){const r=this,s=new n_(this.manager);function a(e){i&&i(e),r.manager.itemError(t)}s.setResponseType("arraybuffer"),s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(t,(function(t){try{const n=t.slice(0);O_.getContext().decodeAudioData(n,(function(t){e(t)})).catch(a)}catch(t){a(t)}}),n,i)}},AxesHelper:class extends UA{constructor(t=1){const e=[0,0,0,t,0,0,0,0,0,0,t,0,0,0,0,0,0,t],n=new Lh;n.setAttribute("position",new Ch(e,3)),n.setAttribute("color",new Ch([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3));super(n,new CA({vertexColors:!0,toneMapped:!1})),this.type="AxesHelper"}setColors(t,e,n){const i=new hh,r=this.geometry.attributes.color.array;return i.set(t),i.toArray(r,0),i.toArray(r,3),i.set(e),i.toArray(r,6),i.toArray(r,9),i.set(n),i.toArray(r,12),i.toArray(r,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}},BackSide:Us,BasicDepthPacking:3200,BasicShadowMap:0,BatchedMesh:EA,Bone:jf,BooleanKeyframeTrack:zm,Box2:class{constructor(t=new Ac(1/0,1/0),e=new Ac(-1/0,-1/0)){this.isBox2=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromPoints(t){this.makeEmpty();for(let e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const n=Av.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(t){return this.isEmpty()?t.set(0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}containsPoint(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y)}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,Av).distanceTo(t)}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}},Box3:Yc,Box3Helper:class extends UA{constructor(t,e=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new Lh;i.setIndex(new xh(n,1)),i.setAttribute("position",new Ch([1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],3)),super(i,new CA({color:e,toneMapped:!1})),this.box=t,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(t){const e=this.box;e.isEmpty()||(e.getCenter(this.position),e.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(t))}dispose(){this.geometry.dispose(),this.material.dispose()}},BoxGeometry:$h,BoxHelper:Qv,BufferAttribute:xh,BufferGeometry:Lh,BufferGeometryLoader:T_,ByteType:1010,Cache:Jm,Camera:su,CameraHelper:Uv,CanvasTexture:JA,CapsuleGeometry:yg,CatmullRomCurve3:sg,CineonToneMapping:la,CircleGeometry:bg,ClampToEdgeWrapping:wa,Clock:Q_,Color:hh,ColorKeyframeTrack:Gm,ColorManagement:Tc,CompressedArrayTexture:YA,CompressedCubeTexture:XA,CompressedTexture:qA,CompressedTextureLoader:class extends $m{constructor(t){super(t)}load(t,e,n,i){const r=this,s=[],a=new qA,o=new n_(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(r.withCredentials);let c=0;function l(l){o.load(t[l],(function(t){const n=r.parse(t,!0);s[l]={width:n.width,height:n.height,format:n.format,mipmaps:n.mipmaps},c+=1,6===c&&(1===n.mipmapCount&&(a.minFilter=Ia),a.image=s,a.format=n.format,a.needsUpdate=!0,e&&e(a))}),n,i)}if(Array.isArray(t))for(let e=0,n=t.length;e<n;++e)l(e);else o.load(t,(function(t){const n=r.parse(t,!0);if(n.isCubemap){const t=n.mipmaps.length/n.mipmapCount;for(let e=0;e<t;e++){s[e]={mipmaps:[]};for(let t=0;t<n.mipmapCount;t++)s[e].mipmaps.push(n.mipmaps[e*n.mipmapCount+t]),s[e].format=n.format,s[e].width=n.width,s[e].height=n.height}a.image=s}else a.image.width=n.width,a.image.height=n.height,a.mipmaps=n.mipmaps;1===n.mipmapCount&&(a.minFilter=Ia),a.format=n.format,a.needsUpdate=!0,e&&e(a)}),n,i);return a}},ConeGeometry:wg,ConstantAlphaFactor:213,ConstantColorFactor:211,CubeCamera:uu,CubeReflectionMapping:ma,CubeRefractionMapping:_a,CubeTexture:du,CubeTextureLoader:r_,CubeUVReflectionMapping:ba,CubicBezierCurve:lg,CubicBezierCurve3:hg,CubicInterpolant:Um,CullFaceBack:1,CullFaceFront:2,CullFaceFrontBack:3,CullFaceNone:0,Curve:KA,CurvePath:mg,CustomBlending:5,CustomToneMapping:ua,CylinderGeometry:xg,Cylindrical:class{constructor(t=1,e=0,n=0){return this.radius=t,this.theta=e,this.y=n,this}set(t,e,n){return this.radius=t,this.theta=e,this.y=n,this}copy(t){return this.radius=t.radius,this.theta=t.theta,this.y=t.y,this}setFromVector3(t){return this.setFromCartesianCoords(t.x,t.y,t.z)}setFromCartesianCoords(t,e,n){return this.radius=Math.sqrt(t*t+n*n),this.theta=Math.atan2(t,n),this.y=e,this}clone(){return(new this.constructor).copy(this)}},Data3DTexture:Hc,DataArrayTexture:Gc,DataTexture:Wf,DataTextureLoader:s_,DataUtils:vh,DecrementStencilOp:7683,DecrementWrapStencilOp:34056,DefaultLoadingManager:Zm,DepthFormat:za,DepthStencilFormat:Ga,DepthTexture:od,DetachedBindMode:Aa,DirectionalLight:b_,DirectionalLightHelper:Pv,DiscreteInterpolant:Fm,DisplayP3ColorSpace:No,DodecahedronGeometry:Cg,DoubleSide:2,DstAlphaFactor:206,DstColorFactor:208,DynamicCopyUsage:35050,DynamicDrawUsage:35048,DynamicReadUsage:35049,EdgesGeometry:Bg,EllipseCurve:ZA,EqualCompare:514,EqualDepth:4,EqualStencilFunc:514,EquirectangularReflectionMapping:va,EquirectangularRefractionMapping:ya,Euler:Rl,EventDispatcher:ic,ExtrudeGeometry:am,FileLoader:n_,Float16BufferAttribute:class extends xh{constructor(t,e,n){super(new Uint16Array(t),e,n),this.isFloat16BufferAttribute=!0}getX(t){let e=_h(this.array[t*this.itemSize]);return this.normalized&&(e=dc(e,this.array)),e}setX(t,e){return this.normalized&&(e=pc(e,this.array)),this.array[t*this.itemSize]=mh(e),this}getY(t){let e=_h(this.array[t*this.itemSize+1]);return this.normalized&&(e=dc(e,this.array)),e}setY(t,e){return this.normalized&&(e=pc(e,this.array)),this.array[t*this.itemSize+1]=mh(e),this}getZ(t){let e=_h(this.array[t*this.itemSize+2]);return this.normalized&&(e=dc(e,this.array)),e}setZ(t,e){return this.normalized&&(e=pc(e,this.array)),this.array[t*this.itemSize+2]=mh(e),this}getW(t){let e=_h(this.array[t*this.itemSize+3]);return this.normalized&&(e=dc(e,this.array)),e}setW(t,e){return this.normalized&&(e=pc(e,this.array)),this.array[t*this.itemSize+3]=mh(e),this}setXY(t,e,n){return t*=this.itemSize,this.normalized&&(e=pc(e,this.array),n=pc(n,this.array)),this.array[t+0]=mh(e),this.array[t+1]=mh(n),this}setXYZ(t,e,n,i){return t*=this.itemSize,this.normalized&&(e=pc(e,this.array),n=pc(n,this.array),i=pc(i,this.array)),this.array[t+0]=mh(e),this.array[t+1]=mh(n),this.array[t+2]=mh(i),this}setXYZW(t,e,n,i,r){return t*=this.itemSize,this.normalized&&(e=pc(e,this.array),n=pc(n,this.array),i=pc(i,this.array),r=pc(r,this.array)),this.array[t+0]=mh(e),this.array[t+1]=mh(n),this.array[t+2]=mh(i),this.array[t+3]=mh(r),this}},Float32BufferAttribute:Ch,FloatType:ka,Fog:uf,FogExp2:hf,FramebufferTexture:class extends Nc{constructor(t,e){super({width:t,height:e}),this.isFramebufferTexture=!0,this.magFilter=Ca,this.minFilter=Ca,this.generateMipmaps=!1,this.needsUpdate=!0}},FrontSide:Os,Frustum:yu,GLBufferAttribute:class{constructor(t,e,n,i,r){this.isGLBufferAttribute=!0,this.name="",this.buffer=t,this.type=e,this.itemSize=n,this.elementSize=i,this.count=r,this.version=0}set needsUpdate(t){!0===t&&this.version++}setBuffer(t){return this.buffer=t,this}setType(t,e){return this.type=t,this.elementSize=e,this}setItemSize(t){return this.itemSize=t,this}setCount(t){return this.count=t,this}},GLSL1:"100",GLSL3:tc,GreaterCompare:516,GreaterDepth:6,GreaterEqualCompare:518,GreaterEqualDepth:5,GreaterEqualStencilFunc:518,GreaterStencilFunc:516,GridHelper:Bv,Group:$p,HalfFloatType:Oa,HemisphereLight:c_,HemisphereLightHelper:Tv,IcosahedronGeometry:cm,ImageBitmapLoader:P_,ImageLoader:i_,ImageUtils:Lc,IncrementStencilOp:7682,IncrementWrapStencilOp:34055,InstancedBufferAttribute:Jf,InstancedBufferGeometry:I_,InstancedInterleavedBuffer:class extends pf{constructor(t,e,n=1){super(t,e),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=n}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}clone(t){const e=super.clone(t);return e.meshPerAttribute=this.meshPerAttribute,e}toJSON(t){const e=super.toJSON(t);return e.isInstancedInterleavedBuffer=!0,e.meshPerAttribute=this.meshPerAttribute,e}},InstancedMesh:rA,Int16BufferAttribute:class extends xh{constructor(t,e,n){super(new Int16Array(t),e,n)}},Int32BufferAttribute:class extends xh{constructor(t,e,n){super(new Int32Array(t),e,n)}},Int8BufferAttribute:class extends xh{constructor(t,e,n){super(new Int8Array(t),e,n)}},IntType:La,InterleavedBuffer:pf,InterleavedBufferAttribute:Af,Interpolant:Om,InterpolateDiscrete:Mo,InterpolateLinear:Io,InterpolateSmooth:To,InvertStencilOp:5386,KeepStencilOp:Vo,KeyframeTrack:Qm,LOD:Pf,LatheGeometry:vg,Layers:Dl,LessCompare:513,LessDepth:2,LessEqualCompare:515,LessEqualDepth:3,LessEqualStencilFunc:515,LessStencilFunc:513,Light:o_,LightProbe:C_,Line:LA,Line3:class{constructor(t=new jc,e=new jc){this.start=t,this.end=e}set(t,e){return this.start.copy(t),this.end.copy(e),this}copy(t){return this.start.copy(t.start),this.end.copy(t.end),this}getCenter(t){return t.addVectors(this.start,this.end).multiplyScalar(.5)}delta(t){return t.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(t,e){return this.delta(e).multiplyScalar(t).add(this.start)}closestPointToPointParameter(t,e){gv.subVectors(t,this.start),mv.subVectors(this.end,this.start);const n=mv.dot(mv);let i=mv.dot(gv)/n;return e&&(i=lc(i,0,1)),i}closestPointToPoint(t,e,n){const i=this.closestPointToPointParameter(t,e);return this.delta(n).multiplyScalar(i).add(this.start)}applyMatrix4(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this}equals(t){return t.start.equals(this.start)&&t.end.equals(this.end)}clone(){return(new this.constructor).copy(this)}},LineBasicMaterial:CA,LineCurve:ug,LineCurve3:dg,LineDashedMaterial:Tm,LineLoop:NA,LineSegments:UA,LinearDisplayP3ColorSpace:Fo,LinearFilter:Ia,LinearInterpolant:Nm,LinearMipMapLinearFilter:1008,LinearMipMapNearestFilter:1007,LinearMipmapLinearFilter:Ba,LinearMipmapNearestFilter:Ta,LinearSRGBColorSpace:Uo,LinearToneMapping:oa,LinearTransfer:Qo,Loader:$m,LoaderUtils:M_,LoadingManager:Km,LoopOnce:2200,LoopPingPong:2202,LoopRepeat:So,LuminanceAlphaFormat:1025,LuminanceFormat:1024,MOUSE:Rs,Material:ph,MaterialLoader:S_,MathUtils:fc,Matrix3:gc,Matrix4:bl,MaxEquation:104,Mesh:Kh,MeshBasicMaterial:fh,MeshDepthMaterial:Wp,MeshDistanceMaterial:qp,MeshLambertMaterial:Mm,MeshMatcapMaterial:Im,MeshNormalMaterial:Sm,MeshPhongMaterial:Em,MeshPhysicalMaterial:wm,MeshStandardMaterial:xm,MeshToonMaterial:Cm,MinEquation:103,MirroredRepeatWrapping:Ea,MixOperation:ra,MultiplyBlending:4,MultiplyOperation:ia,NearestFilter:Ca,NearestMipMapLinearFilter:1005,NearestMipMapNearestFilter:1004,NearestMipmapLinearFilter:Ma,NearestMipmapNearestFilter:Sa,NeutralToneMapping:pa,NeverCompare:512,NeverDepth:0,NeverStencilFunc:512,NoBlending:0,NoColorSpace:ko,NoToneMapping:aa,NormalAnimationBlendMode:Lo,NormalBlending:1,NotEqualCompare:517,NotEqualDepth:7,NotEqualStencilFunc:517,NumberKeyframeTrack:Hm,Object3D:Yl,ObjectLoader:B_,ObjectSpaceNormalMap:1,OctahedronGeometry:lm,OneFactor:201,OneMinusConstantAlphaFactor:214,OneMinusConstantColorFactor:212,OneMinusDstAlphaFactor:207,OneMinusDstColorFactor:209,OneMinusSrcAlphaFactor:qs,OneMinusSrcColorFactor:203,OrthographicCamera:Ou,P3Primaries:Ho,PCFShadowMap:Ls,PCFSoftShadowMap:Ps,PMREMGenerator:Yu,Path:_g,PerspectiveCamera:lu,Plane:mu,PlaneGeometry:wu,PlaneHelper:class extends LA{constructor(t,e=1,n=16776960){const i=n,r=new Lh;r.setAttribute("position",new Ch([1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],3)),r.computeBoundingSphere(),super(r,new CA({color:i,toneMapped:!1})),this.type="PlaneHelper",this.plane=t,this.size=e;const s=new Lh;s.setAttribute("position",new Ch([1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],3)),s.computeBoundingSphere(),this.add(new Kh(s,new fh({color:i,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(t){this.position.set(0,0,0),this.scale.set(.5*this.size,.5*this.size,1),this.lookAt(this.plane.normal),this.translateZ(-this.plane.constant),super.updateMatrixWorld(t)}dispose(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}},PointLight:v_,PointLightHelper:Cv,Points:VA,PointsMaterial:FA,PolarGridHelper:class extends UA{constructor(t=10,e=16,n=8,i=64,r=4473924,s=8947848){r=new hh(r),s=new hh(s);const a=[],o=[];if(e>1)for(let n=0;n<e;n++){const i=n/e*(2*Math.PI),c=Math.sin(i)*t,l=Math.cos(i)*t;a.push(0,0,0),a.push(c,0,l);const h=1&n?r:s;o.push(h.r,h.g,h.b),o.push(h.r,h.g,h.b)}for(let e=0;e<n;e++){const c=1&e?r:s,l=t-t/n*e;for(let t=0;t<i;t++){let e=t/i*(2*Math.PI),n=Math.sin(e)*l,r=Math.cos(e)*l;a.push(n,0,r),o.push(c.r,c.g,c.b),e=(t+1)/i*(2*Math.PI),n=Math.sin(e)*l,r=Math.cos(e)*l,a.push(n,0,r),o.push(c.r,c.g,c.b)}}const c=new Lh;c.setAttribute("position",new Ch(a,3)),c.setAttribute("color",new Ch(o,3));super(c,new CA({vertexColors:!0,toneMapped:!1})),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}},PolyhedronGeometry:Eg,PositionalAudio:class extends W_{constructor(t){super(t),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}connect(){super.connect(),this.panner.connect(this.gain)}disconnect(){super.disconnect(),this.panner.disconnect(this.gain)}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(t){return this.panner.refDistance=t,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(t){return this.panner.rolloffFactor=t,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(t){return this.panner.distanceModel=t,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(t){return this.panner.maxDistance=t,this}setDirectionalCone(t,e,n){return this.panner.coneInnerAngle=t,this.panner.coneOuterAngle=e,this.panner.coneOuterGain=n,this}updateMatrixWorld(t){if(super.updateMatrixWorld(t),!0===this.hasPlaybackControl&&!1===this.isPlaying)return;this.matrixWorld.decompose(q_,Y_,X_),J_.set(0,0,1).applyQuaternion(Y_);const e=this.panner;if(e.positionX){const t=this.context.currentTime+this.listener.timeDelta;e.positionX.linearRampToValueAtTime(q_.x,t),e.positionY.linearRampToValueAtTime(q_.y,t),e.positionZ.linearRampToValueAtTime(q_.z,t),e.orientationX.linearRampToValueAtTime(J_.x,t),e.orientationY.linearRampToValueAtTime(J_.y,t),e.orientationZ.linearRampToValueAtTime(J_.z,t)}else e.setPosition(q_.x,q_.y,q_.z),e.setOrientation(J_.x,J_.y,J_.z)}},PropertyBinding:rv,PropertyMixer:K_,QuadraticBezierCurve:pg,QuadraticBezierCurve3:fg,Quaternion:Vc,QuaternionKeyframeTrack:jm,QuaternionLinearInterpolant:Vm,RED_GREEN_RGTC2_Format:Eo,RED_RGTC1_Format:36283,REVISION:Bs,RGBADepthPacking:3201,RGBAFormat:Qa,RGBAIntegerFormat:qa,RGBA_ASTC_10x10_Format:mo,RGBA_ASTC_10x5_Format:fo,RGBA_ASTC_10x6_Format:Ao,RGBA_ASTC_10x8_Format:go,RGBA_ASTC_12x10_Format:_o,RGBA_ASTC_12x12_Format:vo,RGBA_ASTC_4x4_Format:so,RGBA_ASTC_5x4_Format:ao,RGBA_ASTC_5x5_Format:oo,RGBA_ASTC_6x5_Format:co,RGBA_ASTC_6x6_Format:lo,RGBA_ASTC_8x5_Format:ho,RGBA_ASTC_8x6_Format:uo,RGBA_ASTC_8x8_Format:po,RGBA_BPTC_Format:yo,RGBA_ETC2_EAC_Format:ro,RGBA_PVRTC_2BPPV1_Format:eo,RGBA_PVRTC_4BPPV1_Format:to,RGBA_S3TC_DXT1_Format:Xa,RGBA_S3TC_DXT3_Format:Ja,RGBA_S3TC_DXT5_Format:Ka,RGBFormat:1022,RGB_BPTC_SIGNED_Format:bo,RGB_BPTC_UNSIGNED_Format:xo,RGB_ETC1_Format:no,RGB_ETC2_Format:io,RGB_PVRTC_2BPPV1_Format:$a,RGB_PVRTC_4BPPV1_Format:Za,RGB_S3TC_DXT1_Format:Ya,RGFormat:ja,RGIntegerFormat:Wa,RawShaderMaterial:bm,Ray:yl,Raycaster:class{constructor(t,e,n=0,i=1/0){this.ray=new yl(t,e),this.near=n,this.far=i,this.camera=null,this.layers=new Dl,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(t,e){this.ray.set(t,e)}setFromCamera(t,e){e.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(t.x,t.y,.5).unproject(e).sub(this.ray.origin).normalize(),this.camera=e):e.isOrthographicCamera&&(this.ray.origin.set(t.x,t.y,(e.near+e.far)/(e.near-e.far)).unproject(e),this.ray.direction.set(0,0,-1).transformDirection(e.matrixWorld),this.camera=e)}setFromXRController(t){return uv.identity().extractRotation(t.matrixWorld),this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(uv),this}intersectObject(t,e=!0,n=[]){return pv(t,this,n,e),n.sort(dv),n}intersectObjects(t,e=!0,n=[]){for(let i=0,r=t.length;i<r;i++)pv(t[i],this,n,e);return n.sort(dv),n}},Rec709Primaries:Go,RectAreaLight:w_,RedFormat:Ha,RedIntegerFormat:Va,ReinhardToneMapping:ca,RenderTarget:Qc,RepeatWrapping:xa,ReplaceStencilOp:7681,ReverseSubtractEquation:102,RingGeometry:hm,SIGNED_RED_GREEN_RGTC2_Format:Co,SIGNED_RED_RGTC1_Format:wo,SRGBColorSpace:Oo,SRGBTransfer:zo,Scene:df,ShaderChunk:Eu,ShaderLib:Su,ShaderMaterial:ru,ShadowMaterial:ym,Shape:Rg,ShapeGeometry:um,ShapePath:class{constructor(){this.type="ShapePath",this.color=new hh,this.subPaths=[],this.currentPath=null}moveTo(t,e){return this.currentPath=new _g,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e),this}lineTo(t,e){return this.currentPath.lineTo(t,e),this}quadraticCurveTo(t,e,n,i){return this.currentPath.quadraticCurveTo(t,e,n,i),this}bezierCurveTo(t,e,n,i,r,s){return this.currentPath.bezierCurveTo(t,e,n,i,r,s),this}splineThru(t){return this.currentPath.splineThru(t),this}toShapes(t){function e(t,e){const n=e.length;let i=!1;for(let r=n-1,s=0;s<n;r=s++){let n=e[r],a=e[s],o=a.x-n.x,c=a.y-n.y;if(Math.abs(c)>Number.EPSILON){if(c<0&&(n=e[s],o=-o,a=e[r],c=-c),t.y<n.y||t.y>a.y)continue;if(t.y===n.y){if(t.x===n.x)return!0}else{const e=c*(t.x-n.x)-o*(t.y-n.y);if(0===e)return!0;if(e<0)continue;i=!i}}else{if(t.y!==n.y)continue;if(a.x<=t.x&&t.x<=n.x||n.x<=t.x&&t.x<=a.x)return!0}}return i}const n=im.isClockWise,i=this.subPaths;if(0===i.length)return[];let r,s,a;const o=[];if(1===i.length)return s=i[0],a=new Rg,a.curves=s.curves,o.push(a),o;let c=!n(i[0].getPoints());c=t?!c:c;const l=[],h=[];let u,d,p=[],f=0;h[f]=void 0,p[f]=[];for(let e=0,a=i.length;e<a;e++)s=i[e],u=s.getPoints(),r=n(u),r=t?!r:r,r?(!c&&h[f]&&f++,h[f]={s:new Rg,p:u},h[f].s.curves=s.curves,c&&f++,p[f]=[]):p[f].push({h:s,p:u[0]});if(!h[0])return function(t){const e=[];for(let n=0,i=t.length;n<i;n++){const i=t[n],r=new Rg;r.curves=i.curves,e.push(r)}return e}(i);if(h.length>1){let t=!1,n=0;for(let t=0,e=h.length;t<e;t++)l[t]=[];for(let i=0,r=h.length;i<r;i++){const r=p[i];for(let s=0;s<r.length;s++){const a=r[s];let o=!0;for(let r=0;r<h.length;r++)e(a.p,h[r].p)&&(i!==r&&n++,o?(o=!1,l[r].push(a)):t=!0);o&&l[i].push(a)}}n>0&&!1===t&&(p=l)}for(let t=0,e=h.length;t<e;t++){a=h[t].s,o.push(a),d=p[t];for(let t=0,e=d.length;t<e;t++)a.holes.push(d[t].h)}return o}},ShapeUtils:im,ShortType:1011,Skeleton:Xf,SkeletonHelper:wv,SkinnedMesh:Vf,Source:kc,Sphere:dl,SphereGeometry:dm,Spherical:fv,SphericalHarmonics3:E_,SplineCurve:Ag,SpotLight:f_,SpotLightHelper:vv,Sprite:Bf,SpriteMaterial:gf,SrcAlphaFactor:Ws,SrcAlphaSaturateFactor:210,SrcColorFactor:202,StaticCopyUsage:35046,StaticDrawUsage:$o,StaticReadUsage:35045,StereoCamera:class{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new lu,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new lu,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(t){const e=this._cache;if(e.focus!==t.focus||e.fov!==t.fov||e.aspect!==t.aspect*this.aspect||e.near!==t.near||e.far!==t.far||e.zoom!==t.zoom||e.eyeSep!==this.eyeSep){e.focus=t.focus,e.fov=t.fov,e.aspect=t.aspect*this.aspect,e.near=t.near,e.far=t.far,e.zoom=t.zoom,e.eyeSep=this.eyeSep,F_.copy(t.projectionMatrix);const n=e.eyeSep/2,i=n*e.near/e.focus,r=e.near*Math.tan(ac*e.fov*.5)/e.zoom;let s,a;N_.elements[12]=-n,U_.elements[12]=n,s=-r*e.aspect+i,a=r*e.aspect+i,F_.elements[0]=2*e.near/(a-s),F_.elements[8]=(a+s)/(a-s),this.cameraL.projectionMatrix.copy(F_),s=-r*e.aspect-i,a=r*e.aspect-i,F_.elements[0]=2*e.near/(a-s),F_.elements[8]=(a+s)/(a-s),this.cameraR.projectionMatrix.copy(F_)}this.cameraL.matrixWorld.copy(t.matrixWorld).multiply(N_),this.cameraR.matrixWorld.copy(t.matrixWorld).multiply(U_)}},StreamCopyUsage:35042,StreamDrawUsage:35040,StreamReadUsage:35041,StringKeyframeTrack:Wm,SubtractEquation:101,SubtractiveBlending:3,TOUCH:Ds,TangentSpaceNormalMap:0,TetrahedronGeometry:pm,Texture:Nc,TextureLoader:a_,TorusGeometry:fm,TorusKnotGeometry:Am,Triangle:sh,TriangleFanDrawMode:2,TriangleStripDrawMode:1,TrianglesDrawMode:0,TubeGeometry:gm,UVMapping:ga,Uint16BufferAttribute:wh,Uint32BufferAttribute:Eh,Uint8BufferAttribute:class extends xh{constructor(t,e,n){super(new Uint8Array(t),e,n)}},Uint8ClampedBufferAttribute:class extends xh{constructor(t,e,n){super(new Uint8ClampedArray(t),e,n)}},Uniform:lv,UniformsGroup:class extends ic{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:hv++}),this.name="",this.usage=$o,this.uniforms=[]}add(t){return this.uniforms.push(t),this}remove(t){const e=this.uniforms.indexOf(t);return-1!==e&&this.uniforms.splice(e,1),this}setName(t){return this.name=t,this}setUsage(t){return this.usage=t,this}dispose(){return this.dispatchEvent({type:"dispose"}),this}copy(t){this.name=t.name,this.usage=t.usage;const e=t.uniforms;this.uniforms.length=0;for(let t=0,n=e.length;t<n;t++){const n=Array.isArray(e[t])?e[t]:[e[t]];for(let t=0;t<n.length;t++)this.uniforms.push(n[t].clone())}return this}clone(){return(new this.constructor).copy(this)}},UniformsLib:Cu,UniformsUtils:iu,UnsignedByteType:Ra,UnsignedInt248Type:Fa,UnsignedInt5999Type:35902,UnsignedIntType:Pa,UnsignedShort4444Type:Ua,UnsignedShort5551Type:Na,UnsignedShortType:Da,VSMShadowMap:ks,Vector2:Ac,Vector3:jc,Vector4:Fc,VectorKeyframeTrack:qm,VideoTexture:WA,WebGL3DRenderTarget:class extends zc{constructor(t=1,e=1,n=1,i={}){super(t,e,i),this.isWebGL3DRenderTarget=!0,this.depth=n,this.texture=new Hc(null,t,e,n),this.texture.isRenderTargetTexture=!0}},WebGLArrayRenderTarget:class extends zc{constructor(t=1,e=1,n=1,i={}){super(t,e,i),this.isWebGLArrayRenderTarget=!0,this.depth=n,this.texture=new Gc(null,t,e,n),this.texture.isRenderTargetTexture=!0}},WebGLCoordinateSystem:ec,WebGLCubeRenderTarget:pu,WebGLMultipleRenderTargets:class extends zc{constructor(t=1,e=1,n=1,i={}){super(t,e,{...i,count:n}),this.isWebGLMultipleRenderTargets=!0}get texture(){return this.textures}},WebGLRenderTarget:zc,WebGLRenderer:lf,WebGLUtils:Kp,WebGPUCoordinateSystem:nc,WireframeGeometry:mm,WrapAroundEnding:Do,ZeroCurvatureEnding:Bo,ZeroFactor:200,ZeroSlopeEnding:Ro,ZeroStencilOp:0,createCanvasElement:xc});const jv={type:"change"},Wv={type:"start"},qv={type:"end"},Yv=new yl,Xv=new mu,Jv=Math.cos(70*fc.DEG2RAD);class Kv extends ic{constructor(t,e){super(),this.object=t,this.domElement=e,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new jc,this.cursor=new jc,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:Rs.ROTATE,MIDDLE:Rs.DOLLY,RIGHT:Rs.PAN},this.touches={ONE:Ds.ROTATE,TWO:Ds.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this.getPolarAngle=function(){return a.phi},this.getAzimuthalAngle=function(){return a.theta},this.getDistance=function(){return this.object.position.distanceTo(this.target)},this.listenToKeyEvents=function(t){t.addEventListener("keydown",X),this._domElementKeyEvents=t},this.stopListenToKeyEvents=function(){this._domElementKeyEvents.removeEventListener("keydown",X),this._domElementKeyEvents=null},this.saveState=function(){n.target0.copy(n.target),n.position0.copy(n.object.position),n.zoom0=n.object.zoom},this.reset=function(){n.target.copy(n.target0),n.object.position.copy(n.position0),n.object.zoom=n.zoom0,n.object.updateProjectionMatrix(),n.dispatchEvent(jv),n.update(),r=i.NONE},this.update=function(){const e=new jc,h=(new Vc).setFromUnitVectors(t.up,new jc(0,1,0)),u=h.clone().invert(),d=new jc,p=new Vc,f=new jc,A=2*Math.PI;return function(g=null){const m=n.object.position;e.copy(m).sub(n.target),e.applyQuaternion(h),a.setFromVector3(e),n.autoRotate&&r===i.NONE&&S(function(t){return null!==t?2*Math.PI/60*n.autoRotateSpeed*t:2*Math.PI/60/60*n.autoRotateSpeed}(g)),n.enableDamping?(a.theta+=o.theta*n.dampingFactor,a.phi+=o.phi*n.dampingFactor):(a.theta+=o.theta,a.phi+=o.phi);let _=n.minAzimuthAngle,x=n.maxAzimuthAngle;isFinite(_)&&isFinite(x)&&(_<-Math.PI?_+=A:_>Math.PI&&(_-=A),x<-Math.PI?x+=A:x>Math.PI&&(x-=A),a.theta=_<=x?Math.max(_,Math.min(x,a.theta)):a.theta>(_+x)/2?Math.max(_,a.theta):Math.min(x,a.theta)),a.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,a.phi)),a.makeSafe(),!0===n.enableDamping?n.target.addScaledVector(l,n.dampingFactor):n.target.add(l),n.target.sub(n.cursor),n.target.clampLength(n.minTargetRadius,n.maxTargetRadius),n.target.add(n.cursor);let w=!1;if(n.zoomToCursor&&b||n.object.isOrthographicCamera)a.radius=P(a.radius);else{const t=a.radius;a.radius=P(a.radius*c),w=t!=a.radius}if(e.setFromSpherical(a),e.applyQuaternion(u),m.copy(n.target).add(e),n.object.lookAt(n.target),!0===n.enableDamping?(o.theta*=1-n.dampingFactor,o.phi*=1-n.dampingFactor,l.multiplyScalar(1-n.dampingFactor)):(o.set(0,0,0),l.set(0,0,0)),n.zoomToCursor&&b){let i=null;if(n.object.isPerspectiveCamera){const t=e.length();i=P(t*c);const r=t-i;n.object.position.addScaledVector(v,r),n.object.updateMatrixWorld(),w=!!r}else if(n.object.isOrthographicCamera){const t=new jc(y.x,y.y,0);t.unproject(n.object);const r=n.object.zoom;n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/c)),n.object.updateProjectionMatrix(),w=r!==n.object.zoom;const s=new jc(y.x,y.y,0);s.unproject(n.object),n.object.position.sub(s).add(t),n.object.updateMatrixWorld(),i=e.length()}else n.zoomToCursor=!1;null!==i&&(this.screenSpacePanning?n.target.set(0,0,-1).transformDirection(n.object.matrix).multiplyScalar(i).add(n.object.position):(Yv.origin.copy(n.object.position),Yv.direction.set(0,0,-1).transformDirection(n.object.matrix),Math.abs(n.object.up.dot(Yv.direction))<Jv?t.lookAt(n.target):(Xv.setFromNormalAndCoplanarPoint(n.object.up,n.target),Yv.intersectPlane(Xv,n.target))))}else if(n.object.isOrthographicCamera){const t=n.object.zoom;n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/c)),t!==n.object.zoom&&(n.object.updateProjectionMatrix(),w=!0)}return c=1,b=!1,!!(w||d.distanceToSquared(n.object.position)>s||8*(1-p.dot(n.object.quaternion))>s||f.distanceToSquared(n.target)>s)&&(n.dispatchEvent(jv),d.copy(n.object.position),p.copy(n.object.quaternion),f.copy(n.target),!0)}}(),this.dispose=function(){n.domElement.removeEventListener("contextmenu",K),n.domElement.removeEventListener("pointerdown",H),n.domElement.removeEventListener("pointercancel",j),n.domElement.removeEventListener("wheel",W),n.domElement.removeEventListener("pointermove",V),n.domElement.removeEventListener("pointerup",j);n.domElement.getRootNode().removeEventListener("keydown",q,{capture:!0}),null!==n._domElementKeyEvents&&(n._domElementKeyEvents.removeEventListener("keydown",X),n._domElementKeyEvents=null)};const n=this,i={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let r=i.NONE;const s=1e-6,a=new fv,o=new fv;let c=1;const l=new jc,h=new Ac,u=new Ac,d=new Ac,p=new Ac,f=new Ac,A=new Ac,g=new Ac,m=new Ac,_=new Ac,v=new jc,y=new Ac;let b=!1;const x=[],w={};let E=!1;function C(t){const e=Math.abs(.01*t);return Math.pow(.95,n.zoomSpeed*e)}function S(t){o.theta-=t}function M(t){o.phi-=t}const I=function(){const t=new jc;return function(e,n){t.setFromMatrixColumn(n,0),t.multiplyScalar(-e),l.add(t)}}(),T=function(){const t=new jc;return function(e,i){!0===n.screenSpacePanning?t.setFromMatrixColumn(i,1):(t.setFromMatrixColumn(i,0),t.crossVectors(n.object.up,t)),t.multiplyScalar(e),l.add(t)}}(),B=function(){const t=new jc;return function(e,i){const r=n.domElement;if(n.object.isPerspectiveCamera){const s=n.object.position;t.copy(s).sub(n.target);let a=t.length();a*=Math.tan(n.object.fov/2*Math.PI/180),I(2*e*a/r.clientHeight,n.object.matrix),T(2*i*a/r.clientHeight,n.object.matrix)}else n.object.isOrthographicCamera?(I(e*(n.object.right-n.object.left)/n.object.zoom/r.clientWidth,n.object.matrix),T(i*(n.object.top-n.object.bottom)/n.object.zoom/r.clientHeight,n.object.matrix)):n.enablePan=!1}}();function R(t){n.object.isPerspectiveCamera||n.object.isOrthographicCamera?c/=t:n.enableZoom=!1}function D(t){n.object.isPerspectiveCamera||n.object.isOrthographicCamera?c*=t:n.enableZoom=!1}function L(t,e){if(!n.zoomToCursor)return;b=!0;const i=n.domElement.getBoundingClientRect(),r=t-i.left,s=e-i.top,a=i.width,o=i.height;y.x=r/a*2-1,y.y=-s/o*2+1,v.set(y.x,y.y,1).unproject(n.object).sub(n.object.position).normalize()}function P(t){return Math.max(n.minDistance,Math.min(n.maxDistance,t))}function k(t){h.set(t.clientX,t.clientY)}function O(t){p.set(t.clientX,t.clientY)}function U(t){if(1===x.length)h.set(t.pageX,t.pageY);else{const e=$(t),n=.5*(t.pageX+e.x),i=.5*(t.pageY+e.y);h.set(n,i)}}function N(t){if(1===x.length)p.set(t.pageX,t.pageY);else{const e=$(t),n=.5*(t.pageX+e.x),i=.5*(t.pageY+e.y);p.set(n,i)}}function F(t){const e=$(t),n=t.pageX-e.x,i=t.pageY-e.y,r=Math.sqrt(n*n+i*i);g.set(0,r)}function Q(t){if(1==x.length)u.set(t.pageX,t.pageY);else{const e=$(t),n=.5*(t.pageX+e.x),i=.5*(t.pageY+e.y);u.set(n,i)}d.subVectors(u,h).multiplyScalar(n.rotateSpeed);const e=n.domElement;S(2*Math.PI*d.x/e.clientHeight),M(2*Math.PI*d.y/e.clientHeight),h.copy(u)}function z(t){if(1===x.length)f.set(t.pageX,t.pageY);else{const e=$(t),n=.5*(t.pageX+e.x),i=.5*(t.pageY+e.y);f.set(n,i)}A.subVectors(f,p).multiplyScalar(n.panSpeed),B(A.x,A.y),p.copy(f)}function G(t){const e=$(t),i=t.pageX-e.x,r=t.pageY-e.y,s=Math.sqrt(i*i+r*r);m.set(0,s),_.set(0,Math.pow(m.y/g.y,n.zoomSpeed)),R(_.y),g.copy(m);L(.5*(t.pageX+e.x),.5*(t.pageY+e.y))}function H(t){!1!==n.enabled&&(0===x.length&&(n.domElement.setPointerCapture(t.pointerId),n.domElement.addEventListener("pointermove",V),n.domElement.addEventListener("pointerup",j)),function(t){for(let e=0;e<x.length;e++)if(x[e]==t.pointerId)return!0;return!1}(t)||(function(t){x.push(t.pointerId)}(t),"touch"===t.pointerType?J(t):function(t){let e;switch(t.button){case 0:e=n.mouseButtons.LEFT;break;case 1:e=n.mouseButtons.MIDDLE;break;case 2:e=n.mouseButtons.RIGHT;break;default:e=-1}switch(e){case Rs.DOLLY:if(!1===n.enableZoom)return;!function(t){L(t.clientX,t.clientX),g.set(t.clientX,t.clientY)}(t),r=i.DOLLY;break;case Rs.ROTATE:if(t.ctrlKey||t.metaKey||t.shiftKey){if(!1===n.enablePan)return;O(t),r=i.PAN}else{if(!1===n.enableRotate)return;k(t),r=i.ROTATE}break;case Rs.PAN:if(t.ctrlKey||t.metaKey||t.shiftKey){if(!1===n.enableRotate)return;k(t),r=i.ROTATE}else{if(!1===n.enablePan)return;O(t),r=i.PAN}break;default:r=i.NONE}r!==i.NONE&&n.dispatchEvent(Wv)}(t)))}function V(t){!1!==n.enabled&&("touch"===t.pointerType?function(t){switch(Z(t),r){case i.TOUCH_ROTATE:if(!1===n.enableRotate)return;Q(t),n.update();break;case i.TOUCH_PAN:if(!1===n.enablePan)return;z(t),n.update();break;case i.TOUCH_DOLLY_PAN:if(!1===n.enableZoom&&!1===n.enablePan)return;!function(t){n.enableZoom&&G(t),n.enablePan&&z(t)}(t),n.update();break;case i.TOUCH_DOLLY_ROTATE:if(!1===n.enableZoom&&!1===n.enableRotate)return;!function(t){n.enableZoom&&G(t),n.enableRotate&&Q(t)}(t),n.update();break;default:r=i.NONE}}(t):function(t){switch(r){case i.ROTATE:if(!1===n.enableRotate)return;!function(t){u.set(t.clientX,t.clientY),d.subVectors(u,h).multiplyScalar(n.rotateSpeed);const e=n.domElement;S(2*Math.PI*d.x/e.clientHeight),M(2*Math.PI*d.y/e.clientHeight),h.copy(u),n.update()}(t);break;case i.DOLLY:if(!1===n.enableZoom)return;!function(t){m.set(t.clientX,t.clientY),_.subVectors(m,g),_.y>0?R(C(_.y)):_.y<0&&D(C(_.y)),g.copy(m),n.update()}(t);break;case i.PAN:if(!1===n.enablePan)return;!function(t){f.set(t.clientX,t.clientY),A.subVectors(f,p).multiplyScalar(n.panSpeed),B(A.x,A.y),p.copy(f),n.update()}(t)}}(t))}function j(t){switch(function(t){delete w[t.pointerId];for(let e=0;e<x.length;e++)if(x[e]==t.pointerId)return void x.splice(e,1)}(t),x.length){case 0:n.domElement.releasePointerCapture(t.pointerId),n.domElement.removeEventListener("pointermove",V),n.domElement.removeEventListener("pointerup",j),n.dispatchEvent(qv),r=i.NONE;break;case 1:const e=x[0],s=w[e];J({pointerId:e,pageX:s.x,pageY:s.y})}}function W(t){!1!==n.enabled&&!1!==n.enableZoom&&r===i.NONE&&(t.preventDefault(),n.dispatchEvent(Wv),function(t){L(t.clientX,t.clientY),t.deltaY<0?D(C(t.deltaY)):t.deltaY>0&&R(C(t.deltaY)),n.update()}(function(t){const e=t.deltaMode,n={clientX:t.clientX,clientY:t.clientY,deltaY:t.deltaY};switch(e){case 1:n.deltaY*=16;break;case 2:n.deltaY*=100}t.ctrlKey&&!E&&(n.deltaY*=10);return n}(t)),n.dispatchEvent(qv))}function q(t){if("Control"===t.key){E=!0;n.domElement.getRootNode().addEventListener("keyup",Y,{passive:!0,capture:!0})}}function Y(t){if("Control"===t.key){E=!1;n.domElement.getRootNode().removeEventListener("keyup",Y,{passive:!0,capture:!0})}}function X(t){!1!==n.enabled&&!1!==n.enablePan&&function(t){let e=!1;switch(t.code){case n.keys.UP:t.ctrlKey||t.metaKey||t.shiftKey?M(2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):B(0,n.keyPanSpeed),e=!0;break;case n.keys.BOTTOM:t.ctrlKey||t.metaKey||t.shiftKey?M(-2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):B(0,-n.keyPanSpeed),e=!0;break;case n.keys.LEFT:t.ctrlKey||t.metaKey||t.shiftKey?S(2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):B(n.keyPanSpeed,0),e=!0;break;case n.keys.RIGHT:t.ctrlKey||t.metaKey||t.shiftKey?S(-2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):B(-n.keyPanSpeed,0),e=!0}e&&(t.preventDefault(),n.update())}(t)}function J(t){switch(Z(t),x.length){case 1:switch(n.touches.ONE){case Ds.ROTATE:if(!1===n.enableRotate)return;U(t),r=i.TOUCH_ROTATE;break;case Ds.PAN:if(!1===n.enablePan)return;N(t),r=i.TOUCH_PAN;break;default:r=i.NONE}break;case 2:switch(n.touches.TWO){case Ds.DOLLY_PAN:if(!1===n.enableZoom&&!1===n.enablePan)return;!function(t){n.enableZoom&&F(t),n.enablePan&&N(t)}(t),r=i.TOUCH_DOLLY_PAN;break;case Ds.DOLLY_ROTATE:if(!1===n.enableZoom&&!1===n.enableRotate)return;!function(t){n.enableZoom&&F(t),n.enableRotate&&U(t)}(t),r=i.TOUCH_DOLLY_ROTATE;break;default:r=i.NONE}break;default:r=i.NONE}r!==i.NONE&&n.dispatchEvent(Wv)}function K(t){!1!==n.enabled&&t.preventDefault()}function Z(t){let e=w[t.pointerId];void 0===e&&(e=new Ac,w[t.pointerId]=e),e.set(t.pageX,t.pageY)}function $(t){const e=t.pointerId===x[0]?x[1]:x[0];return w[e]}n.domElement.addEventListener("contextmenu",K),n.domElement.addEventListener("pointerdown",H),n.domElement.addEventListener("pointercancel",j),n.domElement.addEventListener("wheel",W,{passive:!1});n.domElement.getRootNode().addEventListener("keydown",q,{passive:!0,capture:!0}),this.update()}}function Zv(t,e){if(0===e)return t;if(2===e||1===e){let n=t.getIndex();if(null===n){const e=[],i=t.getAttribute("position");if(void 0===i)return t;for(let t=0;t<i.count;t++)e.push(t);t.setIndex(e),n=t.getIndex()}const i=n.count-2,r=[];if(2===e)for(let t=1;t<=i;t++)r.push(n.getX(0)),r.push(n.getX(t)),r.push(n.getX(t+1));else for(let t=0;t<i;t++)t%2==0?(r.push(n.getX(t)),r.push(n.getX(t+1)),r.push(n.getX(t+2))):(r.push(n.getX(t+2)),r.push(n.getX(t+1)),r.push(n.getX(t)));r.length;const s=t.clone();return s.setIndex(r),s.clearGroups(),s}return t}class $v extends $m{constructor(t){super(t),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register((function(t){return new sy(t)})),this.register((function(t){return new ay(t)})),this.register((function(t){return new Ay(t)})),this.register((function(t){return new gy(t)})),this.register((function(t){return new my(t)})),this.register((function(t){return new cy(t)})),this.register((function(t){return new ly(t)})),this.register((function(t){return new hy(t)})),this.register((function(t){return new uy(t)})),this.register((function(t){return new ry(t)})),this.register((function(t){return new dy(t)})),this.register((function(t){return new oy(t)})),this.register((function(t){return new fy(t)})),this.register((function(t){return new py(t)})),this.register((function(t){return new ny(t)})),this.register((function(t){return new _y(t)})),this.register((function(t){return new vy(t)}))}load(t,e,n,i){const r=this;let s;if(""!==this.resourcePath)s=this.resourcePath;else if(""!==this.path){const e=M_.extractUrlBase(t);s=M_.resolveURL(e,this.path)}else s=M_.extractUrlBase(t);this.manager.itemStart(t);const a=function(e){i&&i(e),r.manager.itemError(t),r.manager.itemEnd(t)},o=new n_(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(t,(function(n){try{r.parse(n,s,(function(n){e(n),r.manager.itemEnd(t)}),a)}catch(t){a(t)}}),n,a)}setDRACOLoader(t){return this.dracoLoader=t,this}setDDSLoader(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}setKTX2Loader(t){return this.ktx2Loader=t,this}setMeshoptDecoder(t){return this.meshoptDecoder=t,this}register(t){return-1===this.pluginCallbacks.indexOf(t)&&this.pluginCallbacks.push(t),this}unregister(t){return-1!==this.pluginCallbacks.indexOf(t)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(t),1),this}parse(t,e,n,i){let r;const s={},a={},o=new TextDecoder;if("string"==typeof t)r=JSON.parse(t);else if(t instanceof ArrayBuffer){if(o.decode(new Uint8Array(t,0,4))===yy){try{s[ey.KHR_BINARY_GLTF]=new wy(t)}catch(t){return void(i&&i(t))}r=JSON.parse(s[ey.KHR_BINARY_GLTF].content)}else r=JSON.parse(o.decode(t))}else r=t;if(void 0===r.asset||r.asset.version[0]<2)return void(i&&i(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported.")));const c=new Yy(r,{path:e||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let t=0;t<this.pluginCallbacks.length;t++){const e=this.pluginCallbacks[t](c);e.name,a[e.name]=e,s[e.name]=!0}if(r.extensionsUsed)for(let t=0;t<r.extensionsUsed.length;++t){const e=r.extensionsUsed[t],n=r.extensionsRequired||[];switch(e){case ey.KHR_MATERIALS_UNLIT:s[e]=new iy;break;case ey.KHR_DRACO_MESH_COMPRESSION:s[e]=new Ey(r,this.dracoLoader);break;case ey.KHR_TEXTURE_TRANSFORM:s[e]=new Cy;break;case ey.KHR_MESH_QUANTIZATION:s[e]=new Sy;break;default:n.indexOf(e)>=0&&a[e]}}c.setExtensions(s),c.setPlugins(a),c.parse(n,i)}parseAsync(t,e){const n=this;return new Promise((function(i,r){n.parse(t,e,i,r)}))}}function ty(){let t={};return{get:function(e){return t[e]},add:function(e,n){t[e]=n},remove:function(e){delete t[e]},removeAll:function(){t={}}}}const ey={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_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class ny{constructor(t){this.parser=t,this.name=ey.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const t=this.parser,e=this.parser.json.nodes||[];for(let n=0,i=e.length;n<i;n++){const i=e[n];i.extensions&&i.extensions[this.name]&&void 0!==i.extensions[this.name].light&&t._addNodeRef(this.cache,i.extensions[this.name].light)}}_loadLight(t){const e=this.parser,n="light:"+t;let i=e.cache.get(n);if(i)return i;const r=e.json,s=((r.extensions&&r.extensions[this.name]||{}).lights||[])[t];let a;const o=new hh(16777215);void 0!==s.color&&o.setRGB(s.color[0],s.color[1],s.color[2],Uo);const c=void 0!==s.range?s.range:0;switch(s.type){case"directional":a=new b_(o),a.target.position.set(0,0,-1),a.add(a.target);break;case"point":a=new v_(o),a.distance=c;break;case"spot":a=new f_(o),a.distance=c,s.spot=s.spot||{},s.spot.innerConeAngle=void 0!==s.spot.innerConeAngle?s.spot.innerConeAngle:0,s.spot.outerConeAngle=void 0!==s.spot.outerConeAngle?s.spot.outerConeAngle:Math.PI/4,a.angle=s.spot.outerConeAngle,a.penumbra=1-s.spot.innerConeAngle/s.spot.outerConeAngle,a.target.position.set(0,0,-1),a.add(a.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+s.type)}return a.position.set(0,0,0),a.decay=2,Gy(a,s),void 0!==s.intensity&&(a.intensity=s.intensity),a.name=e.createUniqueName(s.name||"light_"+t),i=Promise.resolve(a),e.cache.add(n,i),i}getDependency(t,e){if("light"===t)return this._loadLight(e)}createNodeAttachment(t){const e=this,n=this.parser,i=n.json.nodes[t],r=(i.extensions&&i.extensions[this.name]||{}).light;return void 0===r?null:this._loadLight(r).then((function(t){return n._getNodeRef(e.cache,r,t)}))}}class iy{constructor(){this.name=ey.KHR_MATERIALS_UNLIT}getMaterialType(){return fh}extendParams(t,e,n){const i=[];t.color=new hh(1,1,1),t.opacity=1;const r=e.pbrMetallicRoughness;if(r){if(Array.isArray(r.baseColorFactor)){const e=r.baseColorFactor;t.color.setRGB(e[0],e[1],e[2],Uo),t.opacity=e[3]}void 0!==r.baseColorTexture&&i.push(n.assignTexture(t,"map",r.baseColorTexture,Oo))}return Promise.all(i)}}class ry{constructor(t){this.parser=t,this.name=ey.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(t,e){const n=this.parser.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=n.extensions[this.name].emissiveStrength;return void 0!==i&&(e.emissiveIntensity=i),Promise.resolve()}}class sy{constructor(t){this.parser=t,this.name=ey.KHR_MATERIALS_CLEARCOAT}getMaterialType(t){const e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?wm:null}extendMaterialParams(t,e){const n=this.parser,i=n.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],s=i.extensions[this.name];if(void 0!==s.clearcoatFactor&&(e.clearcoat=s.clearcoatFactor),void 0!==s.clearcoatTexture&&r.push(n.assignTexture(e,"clearcoatMap",s.clearcoatTexture)),void 0!==s.clearcoatRoughnessFactor&&(e.clearcoatRoughness=s.clearcoatRoughnessFactor),void 0!==s.clearcoatRoughnessTexture&&r.push(n.assignTexture(e,"clearcoatRoughnessMap",s.clearcoatRoughnessTexture)),void 0!==s.clearcoatNormalTexture&&(r.push(n.assignTexture(e,"clearcoatNormalMap",s.clearcoatNormalTexture)),void 0!==s.clearcoatNormalTexture.scale)){const t=s.clearcoatNormalTexture.scale;e.clearcoatNormalScale=new Ac(t,t)}return Promise.all(r)}}class ay{constructor(t){this.parser=t,this.name=ey.KHR_MATERIALS_DISPERSION}getMaterialType(t){const e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?wm:null}extendMaterialParams(t,e){const n=this.parser.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=n.extensions[this.name];return e.dispersion=void 0!==i.dispersion?i.dispersion:0,Promise.resolve()}}class oy{constructor(t){this.parser=t,this.name=ey.KHR_MATERIALS_IRIDESCENCE}getMaterialType(t){const e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?wm:null}extendMaterialParams(t,e){const n=this.parser,i=n.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],s=i.extensions[this.name];return void 0!==s.iridescenceFactor&&(e.iridescence=s.iridescenceFactor),void 0!==s.iridescenceTexture&&r.push(n.assignTexture(e,"iridescenceMap",s.iridescenceTexture)),void 0!==s.iridescenceIor&&(e.iridescenceIOR=s.iridescenceIor),void 0===e.iridescenceThicknessRange&&(e.iridescenceThicknessRange=[100,400]),void 0!==s.iridescenceThicknessMinimum&&(e.iridescenceThicknessRange[0]=s.iridescenceThicknessMinimum),void 0!==s.iridescenceThicknessMaximum&&(e.iridescenceThicknessRange[1]=s.iridescenceThicknessMaximum),void 0!==s.iridescenceThicknessTexture&&r.push(n.assignTexture(e,"iridescenceThicknessMap",s.iridescenceThicknessTexture)),Promise.all(r)}}class cy{constructor(t){this.parser=t,this.name=ey.KHR_MATERIALS_SHEEN}getMaterialType(t){const e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?wm:null}extendMaterialParams(t,e){const n=this.parser,i=n.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[];e.sheenColor=new hh(0,0,0),e.sheenRoughness=0,e.sheen=1;const s=i.extensions[this.name];if(void 0!==s.sheenColorFactor){const t=s.sheenColorFactor;e.sheenColor.setRGB(t[0],t[1],t[2],Uo)}return void 0!==s.sheenRoughnessFactor&&(e.sheenRoughness=s.sheenRoughnessFactor),void 0!==s.sheenColorTexture&&r.push(n.assignTexture(e,"sheenColorMap",s.sheenColorTexture,Oo)),void 0!==s.sheenRoughnessTexture&&r.push(n.assignTexture(e,"sheenRoughnessMap",s.sheenRoughnessTexture)),Promise.all(r)}}class ly{constructor(t){this.parser=t,this.name=ey.KHR_MATERIALS_TRANSMISSION}getMaterialType(t){const e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?wm:null}extendMaterialParams(t,e){const n=this.parser,i=n.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],s=i.extensions[this.name];return void 0!==s.transmissionFactor&&(e.transmission=s.transmissionFactor),void 0!==s.transmissionTexture&&r.push(n.assignTexture(e,"transmissionMap",s.transmissionTexture)),Promise.all(r)}}class hy{constructor(t){this.parser=t,this.name=ey.KHR_MATERIALS_VOLUME}getMaterialType(t){const e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?wm:null}extendMaterialParams(t,e){const n=this.parser,i=n.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],s=i.extensions[this.name];e.thickness=void 0!==s.thicknessFactor?s.thicknessFactor:0,void 0!==s.thicknessTexture&&r.push(n.assignTexture(e,"thicknessMap",s.thicknessTexture)),e.attenuationDistance=s.attenuationDistance||1/0;const a=s.attenuationColor||[1,1,1];return e.attenuationColor=(new hh).setRGB(a[0],a[1],a[2],Uo),Promise.all(r)}}class uy{constructor(t){this.parser=t,this.name=ey.KHR_MATERIALS_IOR}getMaterialType(t){const e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?wm:null}extendMaterialParams(t,e){const n=this.parser.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=n.extensions[this.name];return e.ior=void 0!==i.ior?i.ior:1.5,Promise.resolve()}}class dy{constructor(t){this.parser=t,this.name=ey.KHR_MATERIALS_SPECULAR}getMaterialType(t){const e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?wm:null}extendMaterialParams(t,e){const n=this.parser,i=n.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],s=i.extensions[this.name];e.specularIntensity=void 0!==s.specularFactor?s.specularFactor:1,void 0!==s.specularTexture&&r.push(n.assignTexture(e,"specularIntensityMap",s.specularTexture));const a=s.specularColorFactor||[1,1,1];return e.specularColor=(new hh).setRGB(a[0],a[1],a[2],Uo),void 0!==s.specularColorTexture&&r.push(n.assignTexture(e,"specularColorMap",s.specularColorTexture,Oo)),Promise.all(r)}}class py{constructor(t){this.parser=t,this.name=ey.EXT_MATERIALS_BUMP}getMaterialType(t){const e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?wm:null}extendMaterialParams(t,e){const n=this.parser,i=n.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],s=i.extensions[this.name];return e.bumpScale=void 0!==s.bumpFactor?s.bumpFactor:1,void 0!==s.bumpTexture&&r.push(n.assignTexture(e,"bumpMap",s.bumpTexture)),Promise.all(r)}}class fy{constructor(t){this.parser=t,this.name=ey.KHR_MATERIALS_ANISOTROPY}getMaterialType(t){const e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?wm:null}extendMaterialParams(t,e){const n=this.parser,i=n.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],s=i.extensions[this.name];return void 0!==s.anisotropyStrength&&(e.anisotropy=s.anisotropyStrength),void 0!==s.anisotropyRotation&&(e.anisotropyRotation=s.anisotropyRotation),void 0!==s.anisotropyTexture&&r.push(n.assignTexture(e,"anisotropyMap",s.anisotropyTexture)),Promise.all(r)}}class Ay{constructor(t){this.parser=t,this.name=ey.KHR_TEXTURE_BASISU}loadTexture(t){const e=this.parser,n=e.json,i=n.textures[t];if(!i.extensions||!i.extensions[this.name])return null;const r=i.extensions[this.name],s=e.options.ktx2Loader;if(!s){if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return e.loadTextureImage(t,r.source,s)}}class gy{constructor(t){this.parser=t,this.name=ey.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(t){const e=this.name,n=this.parser,i=n.json,r=i.textures[t];if(!r.extensions||!r.extensions[e])return null;const s=r.extensions[e],a=i.images[s.source];let o=n.textureLoader;if(a.uri){const t=n.options.manager.getHandler(a.uri);null!==t&&(o=t)}return this.detectSupport().then((function(r){if(r)return n.loadTextureImage(t,s.source,o);if(i.extensionsRequired&&i.extensionsRequired.indexOf(e)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return n.loadTexture(t)}))}detectSupport(){return this.isSupported||(this.isSupported=new Promise((function(t){const e=new Image;e.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",e.onload=e.onerror=function(){t(1===e.height)}}))),this.isSupported}}class my{constructor(t){this.parser=t,this.name=ey.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(t){const e=this.name,n=this.parser,i=n.json,r=i.textures[t];if(!r.extensions||!r.extensions[e])return null;const s=r.extensions[e],a=i.images[s.source];let o=n.textureLoader;if(a.uri){const t=n.options.manager.getHandler(a.uri);null!==t&&(o=t)}return this.detectSupport().then((function(r){if(r)return n.loadTextureImage(t,s.source,o);if(i.extensionsRequired&&i.extensionsRequired.indexOf(e)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return n.loadTexture(t)}))}detectSupport(){return this.isSupported||(this.isSupported=new Promise((function(t){const e=new Image;e.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",e.onload=e.onerror=function(){t(1===e.height)}}))),this.isSupported}}class _y{constructor(t){this.name=ey.EXT_MESHOPT_COMPRESSION,this.parser=t}loadBufferView(t){const e=this.parser.json,n=e.bufferViews[t];if(n.extensions&&n.extensions[this.name]){const t=n.extensions[this.name],i=this.parser.getDependency("buffer",t.buffer),r=this.parser.options.meshoptDecoder;if(!r||!r.supported){if(e.extensionsRequired&&e.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return i.then((function(e){const n=t.byteOffset||0,i=t.byteLength||0,s=t.count,a=t.byteStride,o=new Uint8Array(e,n,i);return r.decodeGltfBufferAsync?r.decodeGltfBufferAsync(s,a,o,t.mode,t.filter).then((function(t){return t.buffer})):r.ready.then((function(){const e=new ArrayBuffer(s*a);return r.decodeGltfBuffer(new Uint8Array(e),s,a,o,t.mode,t.filter),e}))}))}return null}}class vy{constructor(t){this.name=ey.EXT_MESH_GPU_INSTANCING,this.parser=t}createNodeMesh(t){const e=this.parser.json,n=e.nodes[t];if(!n.extensions||!n.extensions[this.name]||void 0===n.mesh)return null;const i=e.meshes[n.mesh];for(const t of i.primitives)if(t.mode!==By.TRIANGLES&&t.mode!==By.TRIANGLE_STRIP&&t.mode!==By.TRIANGLE_FAN&&void 0!==t.mode)return null;const r=n.extensions[this.name].attributes,s=[],a={};for(const t in r)s.push(this.parser.getDependency("accessor",r[t]).then((e=>(a[t]=e,a[t]))));return s.length<1?null:(s.push(this.parser.createNodeMesh(t)),Promise.all(s).then((t=>{const e=t.pop(),n=e.isGroup?e.children:[e],i=t[0].count,r=[];for(const t of n){const e=new bl,n=new jc,s=new Vc,o=new jc(1,1,1),c=new rA(t.geometry,t.material,i);for(let t=0;t<i;t++)a.TRANSLATION&&n.fromBufferAttribute(a.TRANSLATION,t),a.ROTATION&&s.fromBufferAttribute(a.ROTATION,t),a.SCALE&&o.fromBufferAttribute(a.SCALE,t),c.setMatrixAt(t,e.compose(n,s,o));for(const e in a)if("_COLOR_0"===e){const t=a[e];c.instanceColor=new Jf(t.array,t.itemSize,t.normalized)}else"TRANSLATION"!==e&&"ROTATION"!==e&&"SCALE"!==e&&t.geometry.setAttribute(e,a[e]);Yl.prototype.copy.call(c,t),this.parser.assignFinalMaterial(c),r.push(c)}return e.isGroup?(e.clear(),e.add(...r),e):r[0]})))}}const yy="glTF",by=1313821514,xy=5130562;class wy{constructor(t){this.name=ey.KHR_BINARY_GLTF,this.content=null,this.body=null;const e=new DataView(t,0,12),n=new TextDecoder;if(this.header={magic:n.decode(new Uint8Array(t.slice(0,4))),version:e.getUint32(4,!0),length:e.getUint32(8,!0)},this.header.magic!==yy)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const i=this.header.length-12,r=new DataView(t,12);let s=0;for(;s<i;){const e=r.getUint32(s,!0);s+=4;const i=r.getUint32(s,!0);if(s+=4,i===by){const i=new Uint8Array(t,12+s,e);this.content=n.decode(i)}else if(i===xy){const n=12+s;this.body=t.slice(n,n+e)}s+=e}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class Ey{constructor(t,e){if(!e)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=ey.KHR_DRACO_MESH_COMPRESSION,this.json=t,this.dracoLoader=e,this.dracoLoader.preload()}decodePrimitive(t,e){const n=this.json,i=this.dracoLoader,r=t.extensions[this.name].bufferView,s=t.extensions[this.name].attributes,a={},o={},c={};for(const t in s){const e=ky[t]||t.toLowerCase();a[e]=s[t]}for(const e in t.attributes){const i=ky[e]||e.toLowerCase();if(void 0!==s[e]){const r=n.accessors[t.attributes[e]],s=Ry[r.componentType];c[i]=s.name,o[i]=!0===r.normalized}}return e.getDependency("bufferView",r).then((function(t){return new Promise((function(e,n){i.decodeDracoFile(t,(function(t){for(const e in t.attributes){const n=t.attributes[e],i=o[e];void 0!==i&&(n.normalized=i)}e(t)}),a,c,Uo,n)}))}))}}class Cy{constructor(){this.name=ey.KHR_TEXTURE_TRANSFORM}extendTexture(t,e){return void 0!==e.texCoord&&e.texCoord!==t.channel||void 0!==e.offset||void 0!==e.rotation||void 0!==e.scale?(t=t.clone(),void 0!==e.texCoord&&(t.channel=e.texCoord),void 0!==e.offset&&t.offset.fromArray(e.offset),void 0!==e.rotation&&(t.rotation=e.rotation),void 0!==e.scale&&t.repeat.fromArray(e.scale),t.needsUpdate=!0,t):t}}class Sy{constructor(){this.name=ey.KHR_MESH_QUANTIZATION}}class My extends Om{constructor(t,e,n,i){super(t,e,n,i)}copySampleValue_(t){const e=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=t*i*3+i;for(let t=0;t!==i;t++)e[t]=n[r+t];return e}interpolate_(t,e,n,i){const r=this.resultBuffer,s=this.sampleValues,a=this.valueSize,o=2*a,c=3*a,l=i-e,h=(n-e)/l,u=h*h,d=u*h,p=t*c,f=p-c,A=-2*d+3*u,g=d-u,m=1-A,_=g-u+h;for(let t=0;t!==a;t++){const e=s[f+t+a],n=s[f+t+o]*l,i=s[p+t+a],c=s[p+t]*l;r[t]=m*e+_*n+A*i+g*c}return r}}const Iy=new Vc;class Ty extends My{interpolate_(t,e,n,i){const r=super.interpolate_(t,e,n,i);return Iy.fromArray(r).normalize().toArray(r),r}}const By={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},Ry={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Dy={9728:Ca,9729:Ia,9984:Sa,9985:Ta,9986:Ma,9987:Ba},Ly={33071:wa,33648:Ea,10497:xa},Py={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},ky={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},Oy={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},Uy={CUBICSPLINE:void 0,LINEAR:Io,STEP:Mo},Ny="OPAQUE",Fy="MASK",Qy="BLEND";function zy(t,e,n){for(const i in n.extensions)void 0===t[i]&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[i]=n.extensions[i])}function Gy(t,e){void 0!==e.extras&&"object"==typeof e.extras&&Object.assign(t.userData,e.extras)}function Hy(t,e){if(t.updateMorphTargets(),void 0!==e.weights)for(let n=0,i=e.weights.length;n<i;n++)t.morphTargetInfluences[n]=e.weights[n];if(e.extras&&Array.isArray(e.extras.targetNames)){const n=e.extras.targetNames;if(t.morphTargetInfluences.length===n.length){t.morphTargetDictionary={};for(let e=0,i=n.length;e<i;e++)t.morphTargetDictionary[n[e]]=e}}}function Vy(t){let e;const n=t.extensions&&t.extensions[ey.KHR_DRACO_MESH_COMPRESSION];if(e=n?"draco:"+n.bufferView+":"+n.indices+":"+jy(n.attributes):t.indices+":"+jy(t.attributes)+":"+t.mode,void 0!==t.targets)for(let n=0,i=t.targets.length;n<i;n++)e+=":"+jy(t.targets[n]);return e}function jy(t){let e="";const n=Object.keys(t).sort();for(let i=0,r=n.length;i<r;i++)e+=n[i]+":"+t[n[i]]+";";return e}function Wy(t){switch(t){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.")}}const qy=new bl;class Yy{constructor(t={},e={}){this.json=t,this.extensions={},this.plugins={},this.options=e,this.cache=new ty,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let n=!1,i=!1,r=-1;"undefined"!=typeof navigator&&(n=!0===/^((?!chrome|android).)*safari/i.test(navigator.userAgent),i=navigator.userAgent.indexOf("Firefox")>-1,r=i?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),"undefined"==typeof createImageBitmap||n||i&&r<98?this.textureLoader=new a_(this.options.manager):this.textureLoader=new P_(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new n_(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}setExtensions(t){this.extensions=t}setPlugins(t){this.plugins=t}parse(t,e){const n=this,i=this.json,r=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll((function(t){return t._markDefs&&t._markDefs()})),Promise.all(this._invokeAll((function(t){return t.beforeRoot&&t.beforeRoot()}))).then((function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])})).then((function(e){const s={scene:e[0][i.scene||0],scenes:e[0],animations:e[1],cameras:e[2],asset:i.asset,parser:n,userData:{}};return zy(r,s,i),Gy(s,i),Promise.all(n._invokeAll((function(t){return t.afterRoot&&t.afterRoot(s)}))).then((function(){for(const t of s.scenes)t.updateMatrixWorld();t(s)}))})).catch(e)}_markDefs(){const t=this.json.nodes||[],e=this.json.skins||[],n=this.json.meshes||[];for(let n=0,i=e.length;n<i;n++){const i=e[n].joints;for(let e=0,n=i.length;e<n;e++)t[i[e]].isBone=!0}for(let e=0,i=t.length;e<i;e++){const i=t[e];void 0!==i.mesh&&(this._addNodeRef(this.meshCache,i.mesh),void 0!==i.skin&&(n[i.mesh].isSkinnedMesh=!0)),void 0!==i.camera&&this._addNodeRef(this.cameraCache,i.camera)}}_addNodeRef(t,e){void 0!==e&&(void 0===t.refs[e]&&(t.refs[e]=t.uses[e]=0),t.refs[e]++)}_getNodeRef(t,e,n){if(t.refs[e]<=1)return n;const i=n.clone(),r=(t,e)=>{const n=this.associations.get(t);null!=n&&this.associations.set(e,n);for(const[n,i]of t.children.entries())r(i,e.children[n])};return r(n,i),i.name+="_instance_"+t.uses[e]++,i}_invokeOne(t){const e=Object.values(this.plugins);e.push(this);for(let n=0;n<e.length;n++){const i=t(e[n]);if(i)return i}return null}_invokeAll(t){const e=Object.values(this.plugins);e.unshift(this);const n=[];for(let i=0;i<e.length;i++){const r=t(e[i]);r&&n.push(r)}return n}getDependency(t,e){const n=t+":"+e;let i=this.cache.get(n);if(!i){switch(t){case"scene":i=this.loadScene(e);break;case"node":i=this._invokeOne((function(t){return t.loadNode&&t.loadNode(e)}));break;case"mesh":i=this._invokeOne((function(t){return t.loadMesh&&t.loadMesh(e)}));break;case"accessor":i=this.loadAccessor(e);break;case"bufferView":i=this._invokeOne((function(t){return t.loadBufferView&&t.loadBufferView(e)}));break;case"buffer":i=this.loadBuffer(e);break;case"material":i=this._invokeOne((function(t){return t.loadMaterial&&t.loadMaterial(e)}));break;case"texture":i=this._invokeOne((function(t){return t.loadTexture&&t.loadTexture(e)}));break;case"skin":i=this.loadSkin(e);break;case"animation":i=this._invokeOne((function(t){return t.loadAnimation&&t.loadAnimation(e)}));break;case"camera":i=this.loadCamera(e);break;default:if(i=this._invokeOne((function(n){return n!=this&&n.getDependency&&n.getDependency(t,e)})),!i)throw new Error("Unknown type: "+t)}this.cache.add(n,i)}return i}getDependencies(t){let e=this.cache.get(t);if(!e){const n=this,i=this.json[t+("mesh"===t?"es":"s")]||[];e=Promise.all(i.map((function(e,i){return n.getDependency(t,i)}))),this.cache.add(t,e)}return e}loadBuffer(t){const e=this.json.buffers[t],n=this.fileLoader;if(e.type&&"arraybuffer"!==e.type)throw new Error("THREE.GLTFLoader: "+e.type+" buffer type is not supported.");if(void 0===e.uri&&0===t)return Promise.resolve(this.extensions[ey.KHR_BINARY_GLTF].body);const i=this.options;return new Promise((function(t,r){n.load(M_.resolveURL(e.uri,i.path),t,void 0,(function(){r(new Error('THREE.GLTFLoader: Failed to load buffer "'+e.uri+'".'))}))}))}loadBufferView(t){const e=this.json.bufferViews[t];return this.getDependency("buffer",e.buffer).then((function(t){const n=e.byteLength||0,i=e.byteOffset||0;return t.slice(i,i+n)}))}loadAccessor(t){const e=this,n=this.json,i=this.json.accessors[t];if(void 0===i.bufferView&&void 0===i.sparse){const t=Py[i.type],e=Ry[i.componentType],n=!0===i.normalized,r=new e(i.count*t);return Promise.resolve(new xh(r,t,n))}const r=[];return void 0!==i.bufferView?r.push(this.getDependency("bufferView",i.bufferView)):r.push(null),void 0!==i.sparse&&(r.push(this.getDependency("bufferView",i.sparse.indices.bufferView)),r.push(this.getDependency("bufferView",i.sparse.values.bufferView))),Promise.all(r).then((function(t){const r=t[0],s=Py[i.type],a=Ry[i.componentType],o=a.BYTES_PER_ELEMENT,c=o*s,l=i.byteOffset||0,h=void 0!==i.bufferView?n.bufferViews[i.bufferView].byteStride:void 0,u=!0===i.normalized;let d,p;if(h&&h!==c){const t=Math.floor(l/h),n="InterleavedBuffer:"+i.bufferView+":"+i.componentType+":"+t+":"+i.count;let c=e.cache.get(n);c||(d=new a(r,t*h,i.count*h/o),c=new pf(d,h/o),e.cache.add(n,c)),p=new Af(c,s,l%h/o,u)}else d=null===r?new a(i.count*s):new a(r,l,i.count*s),p=new xh(d,s,u);if(void 0!==i.sparse){const e=Py.SCALAR,n=Ry[i.sparse.indices.componentType],o=i.sparse.indices.byteOffset||0,c=i.sparse.values.byteOffset||0,l=new n(t[1],o,i.sparse.count*e),h=new a(t[2],c,i.sparse.count*s);null!==r&&(p=new xh(p.array.slice(),p.itemSize,p.normalized));for(let t=0,e=l.length;t<e;t++){const e=l[t];if(p.setX(e,h[t*s]),s>=2&&p.setY(e,h[t*s+1]),s>=3&&p.setZ(e,h[t*s+2]),s>=4&&p.setW(e,h[t*s+3]),s>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return p}))}loadTexture(t){const e=this.json,n=this.options,i=e.textures[t].source,r=e.images[i];let s=this.textureLoader;if(r.uri){const t=n.manager.getHandler(r.uri);null!==t&&(s=t)}return this.loadTextureImage(t,i,s)}loadTextureImage(t,e,n){const i=this,r=this.json,s=r.textures[t],a=r.images[e],o=(a.uri||a.bufferView)+":"+s.sampler;if(this.textureCache[o])return this.textureCache[o];const c=this.loadImageSource(e,n).then((function(e){e.flipY=!1,e.name=s.name||a.name||"",""===e.name&&"string"==typeof a.uri&&!1===a.uri.startsWith("data:image/")&&(e.name=a.uri);const n=(r.samplers||{})[s.sampler]||{};return e.magFilter=Dy[n.magFilter]||Ia,e.minFilter=Dy[n.minFilter]||Ba,e.wrapS=Ly[n.wrapS]||xa,e.wrapT=Ly[n.wrapT]||xa,i.associations.set(e,{textures:t}),e})).catch((function(){return null}));return this.textureCache[o]=c,c}loadImageSource(t,e){const n=this,i=this.json,r=this.options;if(void 0!==this.sourceCache[t])return this.sourceCache[t].then((t=>t.clone()));const s=i.images[t],a=self.URL||self.webkitURL;let o=s.uri||"",c=!1;if(void 0!==s.bufferView)o=n.getDependency("bufferView",s.bufferView).then((function(t){c=!0;const e=new Blob([t],{type:s.mimeType});return o=a.createObjectURL(e),o}));else if(void 0===s.uri)throw new Error("THREE.GLTFLoader: Image "+t+" is missing URI and bufferView");const l=Promise.resolve(o).then((function(t){return new Promise((function(n,i){let s=n;!0===e.isImageBitmapLoader&&(s=function(t){const e=new Nc(t);e.needsUpdate=!0,n(e)}),e.load(M_.resolveURL(t,r.path),s,void 0,i)}))})).then((function(t){var e;return!0===c&&a.revokeObjectURL(o),Gy(t,s),t.userData.mimeType=s.mimeType||((e=s.uri).search(/\.jpe?g($|\?)/i)>0||0===e.search(/^data\:image\/jpeg/)?"image/jpeg":e.search(/\.webp($|\?)/i)>0||0===e.search(/^data\:image\/webp/)?"image/webp":"image/png"),t})).catch((function(t){throw t}));return this.sourceCache[t]=l,l}assignTexture(t,e,n,i){const r=this;return this.getDependency("texture",n.index).then((function(s){if(!s)return null;if(void 0!==n.texCoord&&n.texCoord>0&&((s=s.clone()).channel=n.texCoord),r.extensions[ey.KHR_TEXTURE_TRANSFORM]){const t=void 0!==n.extensions?n.extensions[ey.KHR_TEXTURE_TRANSFORM]:void 0;if(t){const e=r.associations.get(s);s=r.extensions[ey.KHR_TEXTURE_TRANSFORM].extendTexture(s,t),r.associations.set(s,e)}}return void 0!==i&&(s.colorSpace=i),t[e]=s,s}))}assignFinalMaterial(t){const e=t.geometry;let n=t.material;const i=void 0===e.attributes.tangent,r=void 0!==e.attributes.color,s=void 0===e.attributes.normal;if(t.isPoints){const t="PointsMaterial:"+n.uuid;let e=this.cache.get(t);e||(e=new FA,ph.prototype.copy.call(e,n),e.color.copy(n.color),e.map=n.map,e.sizeAttenuation=!1,this.cache.add(t,e)),n=e}else if(t.isLine){const t="LineBasicMaterial:"+n.uuid;let e=this.cache.get(t);e||(e=new CA,ph.prototype.copy.call(e,n),e.color.copy(n.color),e.map=n.map,this.cache.add(t,e)),n=e}if(i||r||s){let t="ClonedMaterial:"+n.uuid+":";i&&(t+="derivative-tangents:"),r&&(t+="vertex-colors:"),s&&(t+="flat-shading:");let e=this.cache.get(t);e||(e=n.clone(),r&&(e.vertexColors=!0),s&&(e.flatShading=!0),i&&(e.normalScale&&(e.normalScale.y*=-1),e.clearcoatNormalScale&&(e.clearcoatNormalScale.y*=-1)),this.cache.add(t,e),this.associations.set(e,this.associations.get(n))),n=e}t.material=n}getMaterialType(){return xm}loadMaterial(t){const e=this,n=this.json,i=this.extensions,r=n.materials[t];let s;const a={},o=[];if((r.extensions||{})[ey.KHR_MATERIALS_UNLIT]){const t=i[ey.KHR_MATERIALS_UNLIT];s=t.getMaterialType(),o.push(t.extendParams(a,r,e))}else{const n=r.pbrMetallicRoughness||{};if(a.color=new hh(1,1,1),a.opacity=1,Array.isArray(n.baseColorFactor)){const t=n.baseColorFactor;a.color.setRGB(t[0],t[1],t[2],Uo),a.opacity=t[3]}void 0!==n.baseColorTexture&&o.push(e.assignTexture(a,"map",n.baseColorTexture,Oo)),a.metalness=void 0!==n.metallicFactor?n.metallicFactor:1,a.roughness=void 0!==n.roughnessFactor?n.roughnessFactor:1,void 0!==n.metallicRoughnessTexture&&(o.push(e.assignTexture(a,"metalnessMap",n.metallicRoughnessTexture)),o.push(e.assignTexture(a,"roughnessMap",n.metallicRoughnessTexture))),s=this._invokeOne((function(e){return e.getMaterialType&&e.getMaterialType(t)})),o.push(Promise.all(this._invokeAll((function(e){return e.extendMaterialParams&&e.extendMaterialParams(t,a)}))))}!0===r.doubleSided&&(a.side=2);const c=r.alphaMode||Ny;if(c===Qy?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,c===Fy&&(a.alphaTest=void 0!==r.alphaCutoff?r.alphaCutoff:.5)),void 0!==r.normalTexture&&s!==fh&&(o.push(e.assignTexture(a,"normalMap",r.normalTexture)),a.normalScale=new Ac(1,1),void 0!==r.normalTexture.scale)){const t=r.normalTexture.scale;a.normalScale.set(t,t)}if(void 0!==r.occlusionTexture&&s!==fh&&(o.push(e.assignTexture(a,"aoMap",r.occlusionTexture)),void 0!==r.occlusionTexture.strength&&(a.aoMapIntensity=r.occlusionTexture.strength)),void 0!==r.emissiveFactor&&s!==fh){const t=r.emissiveFactor;a.emissive=(new hh).setRGB(t[0],t[1],t[2],Uo)}return void 0!==r.emissiveTexture&&s!==fh&&o.push(e.assignTexture(a,"emissiveMap",r.emissiveTexture,Oo)),Promise.all(o).then((function(){const n=new s(a);return r.name&&(n.name=r.name),Gy(n,r),e.associations.set(n,{materials:t}),r.extensions&&zy(i,n,r),n}))}createUniqueName(t){const e=rv.sanitizeNodeName(t||"");return e in this.nodeNamesUsed?e+"_"+ ++this.nodeNamesUsed[e]:(this.nodeNamesUsed[e]=0,e)}loadGeometries(t){const e=this,n=this.extensions,i=this.primitiveCache;function r(t){return n[ey.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(t,e).then((function(n){return Xy(n,t,e)}))}const s=[];for(let n=0,a=t.length;n<a;n++){const a=t[n],o=Vy(a),c=i[o];if(c)s.push(c.promise);else{let t;t=a.extensions&&a.extensions[ey.KHR_DRACO_MESH_COMPRESSION]?r(a):Xy(new Lh,a,e),i[o]={primitive:a,promise:t},s.push(t)}}return Promise.all(s)}loadMesh(t){const e=this,n=this.json,i=this.extensions,r=n.meshes[t],s=r.primitives,a=[];for(let t=0,e=s.length;t<e;t++){const e=void 0===s[t].material?(void 0===(o=this.cache).DefaultMaterial&&(o.DefaultMaterial=new xm({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:Os})),o.DefaultMaterial):this.getDependency("material",s[t].material);a.push(e)}var o;return a.push(e.loadGeometries(s)),Promise.all(a).then((function(n){const a=n.slice(0,n.length-1),o=n[n.length-1],c=[];for(let n=0,l=o.length;n<l;n++){const l=o[n],h=s[n];let u;const d=a[n];if(h.mode===By.TRIANGLES||h.mode===By.TRIANGLE_STRIP||h.mode===By.TRIANGLE_FAN||void 0===h.mode)u=!0===r.isSkinnedMesh?new Vf(l,d):new Kh(l,d),!0===u.isSkinnedMesh&&u.normalizeSkinWeights(),h.mode===By.TRIANGLE_STRIP?u.geometry=Zv(u.geometry,1):h.mode===By.TRIANGLE_FAN&&(u.geometry=Zv(u.geometry,2));else if(h.mode===By.LINES)u=new UA(l,d);else if(h.mode===By.LINE_STRIP)u=new LA(l,d);else if(h.mode===By.LINE_LOOP)u=new NA(l,d);else{if(h.mode!==By.POINTS)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+h.mode);u=new VA(l,d)}Object.keys(u.geometry.morphAttributes).length>0&&Hy(u,r),u.name=e.createUniqueName(r.name||"mesh_"+t),Gy(u,r),h.extensions&&zy(i,u,h),e.assignFinalMaterial(u),c.push(u)}for(let n=0,i=c.length;n<i;n++)e.associations.set(c[n],{meshes:t,primitives:n});if(1===c.length)return r.extensions&&zy(i,c[0],r),c[0];const l=new $p;r.extensions&&zy(i,l,r),e.associations.set(l,{meshes:t});for(let t=0,e=c.length;t<e;t++)l.add(c[t]);return l}))}loadCamera(t){let e;const n=this.json.cameras[t],i=n[n.type];if(i)return"perspective"===n.type?e=new lu(fc.radToDeg(i.yfov),i.aspectRatio||1,i.znear||1,i.zfar||2e6):"orthographic"===n.type&&(e=new Ou(-i.xmag,i.xmag,i.ymag,-i.ymag,i.znear,i.zfar)),n.name&&(e.name=this.createUniqueName(n.name)),Gy(e,n),Promise.resolve(e)}loadSkin(t){const e=this.json.skins[t],n=[];for(let t=0,i=e.joints.length;t<i;t++)n.push(this._loadNodeShallow(e.joints[t]));return void 0!==e.inverseBindMatrices?n.push(this.getDependency("accessor",e.inverseBindMatrices)):n.push(null),Promise.all(n).then((function(t){const e=t.pop(),n=t,i=[],r=[];for(let t=0,s=n.length;t<s;t++){const s=n[t];if(s){i.push(s);const n=new bl;null!==e&&n.fromArray(e.array,16*t),r.push(n)}}return new Xf(i,r)}))}loadAnimation(t){const e=this.json,n=this,i=e.animations[t],r=i.name?i.name:"animation_"+t,s=[],a=[],o=[],c=[],l=[];for(let t=0,e=i.channels.length;t<e;t++){const e=i.channels[t],n=i.samplers[e.sampler],r=e.target,h=r.node,u=void 0!==i.parameters?i.parameters[n.input]:n.input,d=void 0!==i.parameters?i.parameters[n.output]:n.output;void 0!==r.node&&(s.push(this.getDependency("node",h)),a.push(this.getDependency("accessor",u)),o.push(this.getDependency("accessor",d)),c.push(n),l.push(r))}return Promise.all([Promise.all(s),Promise.all(a),Promise.all(o),Promise.all(c),Promise.all(l)]).then((function(t){const e=t[0],i=t[1],s=t[2],a=t[3],o=t[4],c=[];for(let t=0,r=e.length;t<r;t++){const r=e[t],l=i[t],h=s[t],u=a[t],d=o[t];if(void 0===r)continue;r.updateMatrix&&r.updateMatrix();const p=n._createAnimationTracks(r,l,h,u,d);if(p)for(let t=0;t<p.length;t++)c.push(p[t])}return new Ym(r,void 0,c)}))}createNodeMesh(t){const e=this.json,n=this,i=e.nodes[t];return void 0===i.mesh?null:n.getDependency("mesh",i.mesh).then((function(t){const e=n._getNodeRef(n.meshCache,i.mesh,t);return void 0!==i.weights&&e.traverse((function(t){if(t.isMesh)for(let e=0,n=i.weights.length;e<n;e++)t.morphTargetInfluences[e]=i.weights[e]})),e}))}loadNode(t){const e=this,n=this.json.nodes[t],i=e._loadNodeShallow(t),r=[],s=n.children||[];for(let t=0,n=s.length;t<n;t++)r.push(e.getDependency("node",s[t]));const a=void 0===n.skin?Promise.resolve(null):e.getDependency("skin",n.skin);return Promise.all([i,Promise.all(r),a]).then((function(t){const e=t[0],n=t[1],i=t[2];null!==i&&e.traverse((function(t){t.isSkinnedMesh&&t.bind(i,qy)}));for(let t=0,i=n.length;t<i;t++)e.add(n[t]);return e}))}_loadNodeShallow(t){const e=this.json,n=this.extensions,i=this;if(void 0!==this.nodeCache[t])return this.nodeCache[t];const r=e.nodes[t],s=r.name?i.createUniqueName(r.name):"",a=[],o=i._invokeOne((function(e){return e.createNodeMesh&&e.createNodeMesh(t)}));return o&&a.push(o),void 0!==r.camera&&a.push(i.getDependency("camera",r.camera).then((function(t){return i._getNodeRef(i.cameraCache,r.camera,t)}))),i._invokeAll((function(e){return e.createNodeAttachment&&e.createNodeAttachment(t)})).forEach((function(t){a.push(t)})),this.nodeCache[t]=Promise.all(a).then((function(e){let a;if(a=!0===r.isBone?new jf:e.length>1?new $p:1===e.length?e[0]:new Yl,a!==e[0])for(let t=0,n=e.length;t<n;t++)a.add(e[t]);if(r.name&&(a.userData.name=r.name,a.name=s),Gy(a,r),r.extensions&&zy(n,a,r),void 0!==r.matrix){const t=new bl;t.fromArray(r.matrix),a.applyMatrix4(t)}else void 0!==r.translation&&a.position.fromArray(r.translation),void 0!==r.rotation&&a.quaternion.fromArray(r.rotation),void 0!==r.scale&&a.scale.fromArray(r.scale);return i.associations.has(a)||i.associations.set(a,{}),i.associations.get(a).nodes=t,a})),this.nodeCache[t]}loadScene(t){const e=this.extensions,n=this.json.scenes[t],i=this,r=new $p;n.name&&(r.name=i.createUniqueName(n.name)),Gy(r,n),n.extensions&&zy(e,r,n);const s=n.nodes||[],a=[];for(let t=0,e=s.length;t<e;t++)a.push(i.getDependency("node",s[t]));return Promise.all(a).then((function(t){for(let e=0,n=t.length;e<n;e++)r.add(t[e]);return i.associations=(t=>{const e=new Map;for(const[t,n]of i.associations)(t instanceof ph||t instanceof Nc)&&e.set(t,n);return t.traverse((t=>{const n=i.associations.get(t);null!=n&&e.set(t,n)})),e})(r),r}))}_createAnimationTracks(t,e,n,i,r){const s=[],a=t.name?t.name:t.uuid,o=[];let c;switch(Oy[r.path]===Oy.weights?t.traverse((function(t){t.morphTargetInfluences&&o.push(t.name?t.name:t.uuid)})):o.push(a),Oy[r.path]){case Oy.weights:c=Hm;break;case Oy.rotation:c=jm;break;case Oy.position:case Oy.scale:c=qm;break;default:if(1===n.itemSize)c=Hm;else c=qm}const l=void 0!==i.interpolation?Uy[i.interpolation]:Io,h=this._getArrayFromAccessor(n);for(let t=0,n=o.length;t<n;t++){const n=new c(o[t]+"."+Oy[r.path],e.array,h,l);"CUBICSPLINE"===i.interpolation&&this._createCubicSplineTrackInterpolant(n),s.push(n)}return s}_getArrayFromAccessor(t){let e=t.array;if(t.normalized){const t=Wy(e.constructor),n=new Float32Array(e.length);for(let i=0,r=e.length;i<r;i++)n[i]=e[i]*t;e=n}return e}_createCubicSplineTrackInterpolant(t){t.createInterpolant=function(t){return new(this instanceof jm?Ty:My)(this.times,this.values,this.getValueSize()/3,t)},t.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function Xy(t,e,n){const i=e.attributes,r=[];function s(e,i){return n.getDependency("accessor",e).then((function(e){t.setAttribute(i,e)}))}for(const e in i){const n=ky[e]||e.toLowerCase();n in t.attributes||r.push(s(i[e],n))}if(void 0!==e.indices&&!t.index){const i=n.getDependency("accessor",e.indices).then((function(e){t.setIndex(e)}));r.push(i)}return Tc.workingColorSpace,Gy(t,e),function(t,e,n){const i=e.attributes,r=new Yc;if(void 0===i.POSITION)return;{const t=n.json.accessors[i.POSITION],e=t.min,s=t.max;if(void 0===e||void 0===s)return;if(r.set(new jc(e[0],e[1],e[2]),new jc(s[0],s[1],s[2])),t.normalized){const e=Wy(Ry[t.componentType]);r.min.multiplyScalar(e),r.max.multiplyScalar(e)}}const s=e.targets;if(void 0!==s){const t=new jc,e=new jc;for(let i=0,r=s.length;i<r;i++){const r=s[i];if(void 0!==r.POSITION){const i=n.json.accessors[r.POSITION],s=i.min,a=i.max;if(void 0!==s&&void 0!==a){if(e.setX(Math.max(Math.abs(s[0]),Math.abs(a[0]))),e.setY(Math.max(Math.abs(s[1]),Math.abs(a[1]))),e.setZ(Math.max(Math.abs(s[2]),Math.abs(a[2]))),i.normalized){const t=Wy(Ry[i.componentType]);e.multiplyScalar(t)}t.max(e)}}}r.expandByVector(t)}t.boundingBox=r;const a=new dl;r.getCenter(a.center),a.radius=r.min.distanceTo(r.max)/2,t.boundingSphere=a}(t,e,n),Promise.all(r).then((function(){return void 0!==e.targets?function(t,e,n){let i=!1,r=!1,s=!1;for(let t=0,n=e.length;t<n;t++){const n=e[t];if(void 0!==n.POSITION&&(i=!0),void 0!==n.NORMAL&&(r=!0),void 0!==n.COLOR_0&&(s=!0),i&&r&&s)break}if(!i&&!r&&!s)return Promise.resolve(t);const a=[],o=[],c=[];for(let l=0,h=e.length;l<h;l++){const h=e[l];if(i){const e=void 0!==h.POSITION?n.getDependency("accessor",h.POSITION):t.attributes.position;a.push(e)}if(r){const e=void 0!==h.NORMAL?n.getDependency("accessor",h.NORMAL):t.attributes.normal;o.push(e)}if(s){const e=void 0!==h.COLOR_0?n.getDependency("accessor",h.COLOR_0):t.attributes.color;c.push(e)}}return Promise.all([Promise.all(a),Promise.all(o),Promise.all(c)]).then((function(e){const n=e[0],a=e[1],o=e[2];return i&&(t.morphAttributes.position=n),r&&(t.morphAttributes.normal=a),s&&(t.morphAttributes.color=o),t.morphTargetsRelative=!0,t}))}(t,e.targets,n):t}))}class Jy{constructor(t=4){this.pool=t,this.queue=[],this.workers=[],this.workersResolve=[],this.workerStatus=0}_initWorker(t){if(!this.workers[t]){const e=this.workerCreator();e.addEventListener("message",this._onMessage.bind(this,t)),this.workers[t]=e}}_getIdleWorker(){for(let t=0;t<this.pool;t++)if(!(this.workerStatus&1<<t))return t;return-1}_onMessage(t,e){const n=this.workersResolve[t];if(n&&n(e),this.queue.length){const{resolve:e,msg:n,transfer:i}=this.queue.shift();this.workersResolve[t]=e,this.workers[t].postMessage(n,i)}else this.workerStatus^=1<<t}setWorkerCreator(t){this.workerCreator=t}setWorkerLimit(t){this.pool=t}postMessage(t,e){return new Promise((n=>{const i=this._getIdleWorker();-1!==i?(this._initWorker(i),this.workerStatus|=1<<i,this.workersResolve[i]=n,this.workers[i].postMessage(t,e)):this.queue.push({resolve:n,msg:t,transfer:e})}))}dispose(){this.workers.forEach((t=>t.terminate())),this.workersResolve.length=0,this.workers.length=0,this.queue.length=0,this.workerStatus=0}}const Ky=2,Zy=1,$y=10,tb=9,eb=15,nb=16,ib=22,rb=37,sb=43,ab=76,ob=83,cb=97,lb=100,hb=103,ub=109,db=165,pb=166;class fb{constructor(){this.vkFormat=0,this.typeSize=1,this.pixelWidth=0,this.pixelHeight=0,this.pixelDepth=0,this.layerCount=0,this.faceCount=1,this.supercompressionScheme=0,this.levels=[],this.dataFormatDescriptor=[{vendorId:0,descriptorType:0,descriptorBlockSize:0,versionNumber:2,colorModel:0,colorPrimaries:1,transferFunction:2,flags:0,texelBlockDimension:[0,0,0,0],bytesPlane:[0,0,0,0,0,0,0,0],samples:[]}],this.keyValue={},this.globalData=null}}class Ab{constructor(t,e,n,i){this._dataView=new DataView(t.buffer,t.byteOffset+e,n),this._littleEndian=i,this._offset=0}_nextUint8(){const t=this._dataView.getUint8(this._offset);return this._offset+=1,t}_nextUint16(){const t=this._dataView.getUint16(this._offset,this._littleEndian);return this._offset+=2,t}_nextUint32(){const t=this._dataView.getUint32(this._offset,this._littleEndian);return this._offset+=4,t}_nextUint64(){const t=this._dataView.getUint32(this._offset,this._littleEndian)+2**32*this._dataView.getUint32(this._offset+4,this._littleEndian);return this._offset+=8,t}_nextInt32(){const t=this._dataView.getInt32(this._offset,this._littleEndian);return this._offset+=4,t}_skip(t){return this._offset+=t,this}_scan(t,e=0){const n=this._offset;let i=0;for(;this._dataView.getUint8(this._offset)!==e&&i<t;)i++,this._offset++;return i<t&&this._offset++,new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+n,i)}}const gb=[171,75,84,88,32,50,48,187,13,10,26,10];function mb(t){return"undefined"!=typeof TextDecoder?(new TextDecoder).decode(t):Hr.from(t).toString("utf8")}let _b,vb,yb;const bb={env:{emscripten_notify_memory_growth:function(t){yb=new Uint8Array(vb.exports.memory.buffer)}}};class xb{init(){return _b||(_b="undefined"!=typeof fetch?fetch("data:application/wasm;base64,"+wb).then((t=>t.arrayBuffer())).then((t=>WebAssembly.instantiate(t,bb))).then(this._init):WebAssembly.instantiate(Hr.from(wb,"base64"),bb).then(this._init),_b)}_init(t){vb=t.instance,bb.env.emscripten_notify_memory_growth(0)}decode(t,e=0){if(!vb)throw new Error("ZSTDDecoder: Await .init() before decoding.");const n=t.byteLength,i=vb.exports.malloc(n);yb.set(t,i),e=e||Number(vb.exports.ZSTD_findDecompressedSize(i,n));const r=vb.exports.malloc(e),s=vb.exports.ZSTD_decompress(r,e,i,n),a=yb.slice(r,r+s);return vb.exports.free(i),vb.exports.free(r),a}}const wb="AGFzbQEAAAABpQEVYAF/AX9gAn9/AGADf39/AX9gBX9/f39/AX9gAX8AYAJ/fwF/YAR/f39/AX9gA39/fwBgBn9/f39/fwF/YAd/f39/f39/AX9gAn9/AX5gAn5+AX5gAABgBX9/f39/AGAGf39/f39/AGAIf39/f39/f38AYAl/f39/f39/f38AYAABf2AIf39/f39/f38Bf2ANf39/f39/f39/f39/fwF/YAF/AX4CJwEDZW52H2Vtc2NyaXB0ZW5fbm90aWZ5X21lbW9yeV9ncm93dGgABANpaAEFAAAFAgEFCwACAQABAgIFBQcAAwABDgsBAQcAEhMHAAUBDAQEAAANBwQCAgYCBAgDAwMDBgEACQkHBgICAAYGAgQUBwYGAwIGAAMCAQgBBwUGCgoEEQAEBAEIAwgDBQgDEA8IAAcABAUBcAECAgUEAQCAAgYJAX8BQaCgwAILB2AHBm1lbW9yeQIABm1hbGxvYwAoBGZyZWUAJgxaU1REX2lzRXJyb3IAaBlaU1REX2ZpbmREZWNvbXByZXNzZWRTaXplAFQPWlNURF9kZWNvbXByZXNzAEoGX3N0YXJ0ACQJBwEAQQELASQKussBaA8AIAAgACgCBCABajYCBAsZACAAKAIAIAAoAgRBH3F0QQAgAWtBH3F2CwgAIABBiH9LC34BBH9BAyEBIAAoAgQiA0EgTQRAIAAoAggiASAAKAIQTwRAIAAQDQ8LIAAoAgwiAiABRgRAQQFBAiADQSBJGw8LIAAgASABIAJrIANBA3YiBCABIARrIAJJIgEbIgJrIgQ2AgggACADIAJBA3RrNgIEIAAgBCgAADYCAAsgAQsUAQF/IAAgARACIQIgACABEAEgAgv3AQECfyACRQRAIABCADcCACAAQQA2AhAgAEIANwIIQbh/DwsgACABNgIMIAAgAUEEajYCECACQQRPBEAgACABIAJqIgFBfGoiAzYCCCAAIAMoAAA2AgAgAUF/ai0AACIBBEAgAEEIIAEQFGs2AgQgAg8LIABBADYCBEF/DwsgACABNgIIIAAgAS0AACIDNgIAIAJBfmoiBEEBTQRAIARBAWtFBEAgACABLQACQRB0IANyIgM2AgALIAAgAS0AAUEIdCADajYCAAsgASACakF/ai0AACIBRQRAIABBADYCBEFsDwsgAEEoIAEQFCACQQN0ams2AgQgAgsWACAAIAEpAAA3AAAgACABKQAINwAICy8BAX8gAUECdEGgHWooAgAgACgCAEEgIAEgACgCBGprQR9xdnEhAiAAIAEQASACCyEAIAFCz9bTvtLHq9lCfiAAfEIfiUKHla+vmLbem55/fgsdAQF/IAAoAgggACgCDEYEfyAAKAIEQSBGBUEACwuCBAEDfyACQYDAAE8EQCAAIAEgAhBnIAAPCyAAIAJqIQMCQCAAIAFzQQNxRQRAAkAgAkEBSARAIAAhAgwBCyAAQQNxRQRAIAAhAgwBCyAAIQIDQCACIAEtAAA6AAAgAUEBaiEBIAJBAWoiAiADTw0BIAJBA3ENAAsLAkAgA0F8cSIEQcAASQ0AIAIgBEFAaiIFSw0AA0AgAiABKAIANgIAIAIgASgCBDYCBCACIAEoAgg2AgggAiABKAIMNgIMIAIgASgCEDYCECACIAEoAhQ2AhQgAiABKAIYNgIYIAIgASgCHDYCHCACIAEoAiA2AiAgAiABKAIkNgIkIAIgASgCKDYCKCACIAEoAiw2AiwgAiABKAIwNgIwIAIgASgCNDYCNCACIAEoAjg2AjggAiABKAI8NgI8IAFBQGshASACQUBrIgIgBU0NAAsLIAIgBE8NAQNAIAIgASgCADYCACABQQRqIQEgAkEEaiICIARJDQALDAELIANBBEkEQCAAIQIMAQsgA0F8aiIEIABJBEAgACECDAELIAAhAgNAIAIgAS0AADoAACACIAEtAAE6AAEgAiABLQACOgACIAIgAS0AAzoAAyABQQRqIQEgAkEEaiICIARNDQALCyACIANJBEADQCACIAEtAAA6AAAgAUEBaiEBIAJBAWoiAiADRw0ACwsgAAsMACAAIAEpAAA3AAALQQECfyAAKAIIIgEgACgCEEkEQEEDDwsgACAAKAIEIgJBB3E2AgQgACABIAJBA3ZrIgE2AgggACABKAAANgIAQQALDAAgACABKAIANgAAC/cCAQJ/AkAgACABRg0AAkAgASACaiAASwRAIAAgAmoiBCABSw0BCyAAIAEgAhALDwsgACABc0EDcSEDAkACQCAAIAFJBEAgAwRAIAAhAwwDCyAAQQNxRQRAIAAhAwwCCyAAIQMDQCACRQ0EIAMgAS0AADoAACABQQFqIQEgAkF/aiECIANBAWoiA0EDcQ0ACwwBCwJAIAMNACAEQQNxBEADQCACRQ0FIAAgAkF/aiICaiIDIAEgAmotAAA6AAAgA0EDcQ0ACwsgAkEDTQ0AA0AgACACQXxqIgJqIAEgAmooAgA2AgAgAkEDSw0ACwsgAkUNAgNAIAAgAkF/aiICaiABIAJqLQAAOgAAIAINAAsMAgsgAkEDTQ0AIAIhBANAIAMgASgCADYCACABQQRqIQEgA0EEaiEDIARBfGoiBEEDSw0ACyACQQNxIQILIAJFDQADQCADIAEtAAA6AAAgA0EBaiEDIAFBAWohASACQX9qIgINAAsLIAAL8wICAn8BfgJAIAJFDQAgACACaiIDQX9qIAE6AAAgACABOgAAIAJBA0kNACADQX5qIAE6AAAgACABOgABIANBfWogAToAACAAIAE6AAIgAkEHSQ0AIANBfGogAToAACAAIAE6AAMgAkEJSQ0AIABBACAAa0EDcSIEaiIDIAFB/wFxQYGChAhsIgE2AgAgAyACIARrQXxxIgRqIgJBfGogATYCACAEQQlJDQAgAyABNgIIIAMgATYCBCACQXhqIAE2AgAgAkF0aiABNgIAIARBGUkNACADIAE2AhggAyABNgIUIAMgATYCECADIAE2AgwgAkFwaiABNgIAIAJBbGogATYCACACQWhqIAE2AgAgAkFkaiABNgIAIAQgA0EEcUEYciIEayICQSBJDQAgAa0iBUIghiAFhCEFIAMgBGohAQNAIAEgBTcDGCABIAU3AxAgASAFNwMIIAEgBTcDACABQSBqIQEgAkFgaiICQR9LDQALCyAACy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAIajYCACADCy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAFajYCACADCx8AIAAgASACKAIEEAg2AgAgARAEGiAAIAJBCGo2AgQLCAAgAGdBH3MLugUBDX8jAEEQayIKJAACfyAEQQNNBEAgCkEANgIMIApBDGogAyAEEAsaIAAgASACIApBDGpBBBAVIgBBbCAAEAMbIAAgACAESxsMAQsgAEEAIAEoAgBBAXRBAmoQECENQVQgAygAACIGQQ9xIgBBCksNABogAiAAQQVqNgIAIAMgBGoiAkF8aiEMIAJBeWohDiACQXtqIRAgAEEGaiELQQQhBSAGQQR2IQRBICAAdCIAQQFyIQkgASgCACEPQQAhAiADIQYCQANAIAlBAkggAiAPS3JFBEAgAiEHAkAgCARAA0AgBEH//wNxQf//A0YEQCAHQRhqIQcgBiAQSQR/IAZBAmoiBigAACAFdgUgBUEQaiEFIARBEHYLIQQMAQsLA0AgBEEDcSIIQQNGBEAgBUECaiEFIARBAnYhBCAHQQNqIQcMAQsLIAcgCGoiByAPSw0EIAVBAmohBQNAIAIgB0kEQCANIAJBAXRqQQA7AQAgAkEBaiECDAELCyAGIA5LQQAgBiAFQQN1aiIHIAxLG0UEQCAHKAAAIAVBB3EiBXYhBAwCCyAEQQJ2IQQLIAYhBwsCfyALQX9qIAQgAEF/anEiBiAAQQF0QX9qIgggCWsiEUkNABogBCAIcSIEQQAgESAEIABIG2shBiALCyEIIA0gAkEBdGogBkF/aiIEOwEAIAlBASAGayAEIAZBAUgbayEJA0AgCSAASARAIABBAXUhACALQX9qIQsMAQsLAn8gByAOS0EAIAcgBSAIaiIFQQN1aiIGIAxLG0UEQCAFQQdxDAELIAUgDCIGIAdrQQN0awshBSACQQFqIQIgBEUhCCAGKAAAIAVBH3F2IQQMAQsLQWwgCUEBRyAFQSBKcg0BGiABIAJBf2o2AgAgBiAFQQdqQQN1aiADawwBC0FQCyEAIApBEGokACAACwkAQQFBBSAAGwsMACAAIAEoAAA2AAALqgMBCn8jAEHwAGsiCiQAIAJBAWohDiAAQQhqIQtBgIAEIAVBf2p0QRB1IQxBACECQQEhBkEBIAV0IglBf2oiDyEIA0AgAiAORkUEQAJAIAEgAkEBdCINai8BACIHQf//A0YEQCALIAhBA3RqIAI2AgQgCEF/aiEIQQEhBwwBCyAGQQAgDCAHQRB0QRB1ShshBgsgCiANaiAHOwEAIAJBAWohAgwBCwsgACAFNgIEIAAgBjYCACAJQQN2IAlBAXZqQQNqIQxBACEAQQAhBkEAIQIDQCAGIA5GBEADQAJAIAAgCUYNACAKIAsgAEEDdGoiASgCBCIGQQF0aiICIAIvAQAiAkEBajsBACABIAUgAhAUayIIOgADIAEgAiAIQf8BcXQgCWs7AQAgASAEIAZBAnQiAmooAgA6AAIgASACIANqKAIANgIEIABBAWohAAwBCwsFIAEgBkEBdGouAQAhDUEAIQcDQCAHIA1ORQRAIAsgAkEDdGogBjYCBANAIAIgDGogD3EiAiAISw0ACyAHQQFqIQcMAQsLIAZBAWohBgwBCwsgCkHwAGokAAsjAEIAIAEQCSAAhUKHla+vmLbem55/fkLj3MqV/M7y9YV/fAsQACAAQn43AwggACABNgIACyQBAX8gAARAIAEoAgQiAgRAIAEoAgggACACEQEADwsgABAmCwsfACAAIAEgAi8BABAINgIAIAEQBBogACACQQRqNgIEC0oBAX9BoCAoAgAiASAAaiIAQX9MBEBBiCBBMDYCAEF/DwsCQCAAPwBBEHRNDQAgABBmDQBBiCBBMDYCAEF/DwtBoCAgADYCACABC9cBAQh/Qbp/IQoCQCACKAIEIgggAigCACIJaiIOIAEgAGtLDQBBbCEKIAkgBCADKAIAIgtrSw0AIAAgCWoiBCACKAIIIgxrIQ0gACABQWBqIg8gCyAJQQAQKSADIAkgC2o2AgACQAJAIAwgBCAFa00EQCANIQUMAQsgDCAEIAZrSw0CIAcgDSAFayIAaiIBIAhqIAdNBEAgBCABIAgQDxoMAgsgBCABQQAgAGsQDyEBIAIgACAIaiIINgIEIAEgAGshBAsgBCAPIAUgCEEBECkLIA4hCgsgCgubAgEBfyMAQYABayINJAAgDSADNgJ8AkAgAkEDSwRAQX8hCQwBCwJAAkACQAJAIAJBAWsOAwADAgELIAZFBEBBuH8hCQwEC0FsIQkgBS0AACICIANLDQMgACAHIAJBAnQiAmooAgAgAiAIaigCABA7IAEgADYCAEEBIQkMAwsgASAJNgIAQQAhCQwCCyAKRQRAQWwhCQwCC0EAIQkgC0UgDEEZSHINAUEIIAR0QQhqIQBBACECA0AgAiAATw0CIAJBQGshAgwAAAsAC0FsIQkgDSANQfwAaiANQfgAaiAFIAYQFSICEAMNACANKAJ4IgMgBEsNACAAIA0gDSgCfCAHIAggAxAYIAEgADYCACACIQkLIA1BgAFqJAAgCQsLACAAIAEgAhALGgsQACAALwAAIAAtAAJBEHRyCy8AAn9BuH8gAUEISQ0AGkFyIAAoAAQiAEF3Sw0AGkG4fyAAQQhqIgAgACABSxsLCwkAIAAgATsAAAsDAAELigYBBX8gACAAKAIAIgVBfnE2AgBBACAAIAVBAXZqQYQgKAIAIgQgAEYbIQECQAJAIAAoAgQiAkUNACACKAIAIgNBAXENACACQQhqIgUgA0EBdkF4aiIDQQggA0EISxtnQR9zQQJ0QYAfaiIDKAIARgRAIAMgAigCDDYCAAsgAigCCCIDBEAgAyACKAIMNgIECyACKAIMIgMEQCADIAIoAgg2AgALIAIgAigCACAAKAIAQX5xajYCAEGEICEAAkACQCABRQ0AIAEgAjYCBCABKAIAIgNBAXENASADQQF2QXhqIgNBCCADQQhLG2dBH3NBAnRBgB9qIgMoAgAgAUEIakYEQCADIAEoAgw2AgALIAEoAggiAwRAIAMgASgCDDYCBAsgASgCDCIDBEAgAyABKAIINgIAQYQgKAIAIQQLIAIgAigCACABKAIAQX5xajYCACABIARGDQAgASABKAIAQQF2akEEaiEACyAAIAI2AgALIAIoAgBBAXZBeGoiAEEIIABBCEsbZ0Efc0ECdEGAH2oiASgCACEAIAEgBTYCACACIAA2AgwgAkEANgIIIABFDQEgACAFNgIADwsCQCABRQ0AIAEoAgAiAkEBcQ0AIAJBAXZBeGoiAkEIIAJBCEsbZ0Efc0ECdEGAH2oiAigCACABQQhqRgRAIAIgASgCDDYCAAsgASgCCCICBEAgAiABKAIMNgIECyABKAIMIgIEQCACIAEoAgg2AgBBhCAoAgAhBAsgACAAKAIAIAEoAgBBfnFqIgI2AgACQCABIARHBEAgASABKAIAQQF2aiAANgIEIAAoAgAhAgwBC0GEICAANgIACyACQQF2QXhqIgFBCCABQQhLG2dBH3NBAnRBgB9qIgIoAgAhASACIABBCGoiAjYCACAAIAE2AgwgAEEANgIIIAFFDQEgASACNgIADwsgBUEBdkF4aiIBQQggAUEISxtnQR9zQQJ0QYAfaiICKAIAIQEgAiAAQQhqIgI2AgAgACABNgIMIABBADYCCCABRQ0AIAEgAjYCAAsLDgAgAARAIABBeGoQJQsLgAIBA38CQCAAQQ9qQXhxQYQgKAIAKAIAQQF2ayICEB1Bf0YNAAJAQYQgKAIAIgAoAgAiAUEBcQ0AIAFBAXZBeGoiAUEIIAFBCEsbZ0Efc0ECdEGAH2oiASgCACAAQQhqRgRAIAEgACgCDDYCAAsgACgCCCIBBEAgASAAKAIMNgIECyAAKAIMIgFFDQAgASAAKAIINgIAC0EBIQEgACAAKAIAIAJBAXRqIgI2AgAgAkEBcQ0AIAJBAXZBeGoiAkEIIAJBCEsbZ0Efc0ECdEGAH2oiAygCACECIAMgAEEIaiIDNgIAIAAgAjYCDCAAQQA2AgggAkUNACACIAM2AgALIAELtwIBA38CQAJAIABBASAAGyICEDgiAA0AAkACQEGEICgCACIARQ0AIAAoAgAiA0EBcQ0AIAAgA0EBcjYCACADQQF2QXhqIgFBCCABQQhLG2dBH3NBAnRBgB9qIgEoAgAgAEEIakYEQCABIAAoAgw2AgALIAAoAggiAQRAIAEgACgCDDYCBAsgACgCDCIBBEAgASAAKAIINgIACyACECchAkEAIQFBhCAoAgAhACACDQEgACAAKAIAQX5xNgIAQQAPCyACQQ9qQXhxIgMQHSICQX9GDQIgAkEHakF4cSIAIAJHBEAgACACaxAdQX9GDQMLAkBBhCAoAgAiAUUEQEGAICAANgIADAELIAAgATYCBAtBhCAgADYCACAAIANBAXRBAXI2AgAMAQsgAEUNAQsgAEEIaiEBCyABC7kDAQJ/IAAgA2ohBQJAIANBB0wEQANAIAAgBU8NAiAAIAItAAA6AAAgAEEBaiEAIAJBAWohAgwAAAsACyAEQQFGBEACQCAAIAJrIgZBB00EQCAAIAItAAA6AAAgACACLQABOgABIAAgAi0AAjoAAiAAIAItAAM6AAMgAEEEaiACIAZBAnQiBkHAHmooAgBqIgIQFyACIAZB4B5qKAIAayECDAELIAAgAhAMCyACQQhqIQIgAEEIaiEACwJAAkACQAJAIAUgAU0EQCAAIANqIQEgBEEBRyAAIAJrQQ9Kcg0BA0AgACACEAwgAkEIaiECIABBCGoiACABSQ0ACwwFCyAAIAFLBEAgACEBDAQLIARBAUcgACACa0EPSnINASAAIQMgAiEEA0AgAyAEEAwgBEEIaiEEIANBCGoiAyABSQ0ACwwCCwNAIAAgAhAHIAJBEGohAiAAQRBqIgAgAUkNAAsMAwsgACEDIAIhBANAIAMgBBAHIARBEGohBCADQRBqIgMgAUkNAAsLIAIgASAAa2ohAgsDQCABIAVPDQEgASACLQAAOgAAIAFBAWohASACQQFqIQIMAAALAAsLQQECfyAAIAAoArjgASIDNgLE4AEgACgCvOABIQQgACABNgK84AEgACABIAJqNgK44AEgACABIAQgA2tqNgLA4AELpgEBAX8gACAAKALs4QEQFjYCyOABIABCADcD+OABIABCADcDuOABIABBwOABakIANwMAIABBqNAAaiIBQYyAgOAANgIAIABBADYCmOIBIABCADcDiOEBIABCAzcDgOEBIABBrNABakHgEikCADcCACAAQbTQAWpB6BIoAgA2AgAgACABNgIMIAAgAEGYIGo2AgggACAAQaAwajYCBCAAIABBEGo2AgALYQEBf0G4fyEDAkAgAUEDSQ0AIAIgABAhIgFBA3YiADYCCCACIAFBAXE2AgQgAiABQQF2QQNxIgM2AgACQCADQX9qIgFBAksNAAJAIAFBAWsOAgEAAgtBbA8LIAAhAwsgAwsMACAAIAEgAkEAEC4LiAQCA38CfiADEBYhBCAAQQBBKBAQIQAgBCACSwRAIAQPCyABRQRAQX8PCwJAAkAgA0EBRg0AIAEoAAAiBkGo6r5pRg0AQXYhAyAGQXBxQdDUtMIBRw0BQQghAyACQQhJDQEgAEEAQSgQECEAIAEoAAQhASAAQQE2AhQgACABrTcDAEEADwsgASACIAMQLyIDIAJLDQAgACADNgIYQXIhAyABIARqIgVBf2otAAAiAkEIcQ0AIAJBIHEiBkUEQEFwIQMgBS0AACIFQacBSw0BIAVBB3GtQgEgBUEDdkEKaq2GIgdCA4h+IAd8IQggBEEBaiEECyACQQZ2IQMgAkECdiEFAkAgAkEDcUF/aiICQQJLBEBBACECDAELAkACQAJAIAJBAWsOAgECAAsgASAEai0AACECIARBAWohBAwCCyABIARqLwAAIQIgBEECaiEEDAELIAEgBGooAAAhAiAEQQRqIQQLIAVBAXEhBQJ+AkACQAJAIANBf2oiA0ECTQRAIANBAWsOAgIDAQtCfyAGRQ0DGiABIARqMQAADAMLIAEgBGovAACtQoACfAwCCyABIARqKAAArQwBCyABIARqKQAACyEHIAAgBTYCICAAIAI2AhwgACAHNwMAQQAhAyAAQQA2AhQgACAHIAggBhsiBzcDCCAAIAdCgIAIIAdCgIAIVBs+AhALIAMLWwEBf0G4fyEDIAIQFiICIAFNBH8gACACakF/ai0AACIAQQNxQQJ0QaAeaigCACACaiAAQQZ2IgFBAnRBsB5qKAIAaiAAQSBxIgBFaiABRSAAQQV2cWoFQbh/CwsdACAAKAKQ4gEQWiAAQQA2AqDiASAAQgA3A5DiAQu1AwEFfyMAQZACayIKJABBuH8hBgJAIAVFDQAgBCwAACIIQf8BcSEHAkAgCEF/TARAIAdBgn9qQQF2IgggBU8NAkFsIQYgB0GBf2oiBUGAAk8NAiAEQQFqIQdBACEGA0AgBiAFTwRAIAUhBiAIIQcMAwUgACAGaiAHIAZBAXZqIgQtAABBBHY6AAAgACAGQQFyaiAELQAAQQ9xOgAAIAZBAmohBgwBCwAACwALIAcgBU8NASAAIARBAWogByAKEFMiBhADDQELIAYhBEEAIQYgAUEAQTQQECEJQQAhBQNAIAQgBkcEQCAAIAZqIggtAAAiAUELSwRAQWwhBgwDBSAJIAFBAnRqIgEgASgCAEEBajYCACAGQQFqIQZBASAILQAAdEEBdSAFaiEFDAILAAsLQWwhBiAFRQ0AIAUQFEEBaiIBQQxLDQAgAyABNgIAQQFBASABdCAFayIDEBQiAXQgA0cNACAAIARqIAFBAWoiADoAACAJIABBAnRqIgAgACgCAEEBajYCACAJKAIEIgBBAkkgAEEBcXINACACIARBAWo2AgAgB0EBaiEGCyAKQZACaiQAIAYLxhEBDH8jAEHwAGsiBSQAQWwhCwJAIANBCkkNACACLwAAIQogAi8AAiEJIAIvAAQhByAFQQhqIAQQDgJAIAMgByAJIApqakEGaiIMSQ0AIAUtAAohCCAFQdgAaiACQQZqIgIgChAGIgsQAw0BIAVBQGsgAiAKaiICIAkQBiILEAMNASAFQShqIAIgCWoiAiAHEAYiCxADDQEgBUEQaiACIAdqIAMgDGsQBiILEAMNASAAIAFqIg9BfWohECAEQQRqIQZBASELIAAgAUEDakECdiIDaiIMIANqIgIgA2oiDiEDIAIhBCAMIQcDQCALIAMgEElxBEAgACAGIAVB2ABqIAgQAkECdGoiCS8BADsAACAFQdgAaiAJLQACEAEgCS0AAyELIAcgBiAFQUBrIAgQAkECdGoiCS8BADsAACAFQUBrIAktAAIQASAJLQADIQogBCAGIAVBKGogCBACQQJ0aiIJLwEAOwAAIAVBKGogCS0AAhABIAktAAMhCSADIAYgBUEQaiAIEAJBAnRqIg0vAQA7AAAgBUEQaiANLQACEAEgDS0AAyENIAAgC2oiCyAGIAVB2ABqIAgQAkECdGoiAC8BADsAACAFQdgAaiAALQACEAEgAC0AAyEAIAcgCmoiCiAGIAVBQGsgCBACQQJ0aiIHLwEAOwAAIAVBQGsgBy0AAhABIActAAMhByAEIAlqIgkgBiAFQShqIAgQAkECdGoiBC8BADsAACAFQShqIAQtAAIQASAELQADIQQgAyANaiIDIAYgBUEQaiAIEAJBAnRqIg0vAQA7AAAgBUEQaiANLQACEAEgACALaiEAIAcgCmohByAEIAlqIQQgAyANLQADaiEDIAVB2ABqEA0gBUFAaxANciAFQShqEA1yIAVBEGoQDXJFIQsMAQsLIAQgDksgByACS3INAEFsIQsgACAMSw0BIAxBfWohCQNAQQAgACAJSSAFQdgAahAEGwRAIAAgBiAFQdgAaiAIEAJBAnRqIgovAQA7AAAgBUHYAGogCi0AAhABIAAgCi0AA2oiACAGIAVB2ABqIAgQAkECdGoiCi8BADsAACAFQdgAaiAKLQACEAEgACAKLQADaiEADAEFIAxBfmohCgNAIAVB2ABqEAQgACAKS3JFBEAgACAGIAVB2ABqIAgQAkECdGoiCS8BADsAACAFQdgAaiAJLQACEAEgACAJLQADaiEADAELCwNAIAAgCk0EQCAAIAYgBUHYAGogCBACQQJ0aiIJLwEAOwAAIAVB2ABqIAktAAIQASAAIAktAANqIQAMAQsLAkAgACAMTw0AIAAgBiAFQdgAaiAIEAIiAEECdGoiDC0AADoAACAMLQADQQFGBEAgBUHYAGogDC0AAhABDAELIAUoAlxBH0sNACAFQdgAaiAGIABBAnRqLQACEAEgBSgCXEEhSQ0AIAVBIDYCXAsgAkF9aiEMA0BBACAHIAxJIAVBQGsQBBsEQCAHIAYgBUFAayAIEAJBAnRqIgAvAQA7AAAgBUFAayAALQACEAEgByAALQADaiIAIAYgBUFAayAIEAJBAnRqIgcvAQA7AAAgBUFAayAHLQACEAEgACAHLQADaiEHDAEFIAJBfmohDANAIAVBQGsQBCAHIAxLckUEQCAHIAYgBUFAayAIEAJBAnRqIgAvAQA7AAAgBUFAayAALQACEAEgByAALQADaiEHDAELCwNAIAcgDE0EQCAHIAYgBUFAayAIEAJBAnRqIgAvAQA7AAAgBUFAayAALQACEAEgByAALQADaiEHDAELCwJAIAcgAk8NACAHIAYgBUFAayAIEAIiAEECdGoiAi0AADoAACACLQADQQFGBEAgBUFAayACLQACEAEMAQsgBSgCREEfSw0AIAVBQGsgBiAAQQJ0ai0AAhABIAUoAkRBIUkNACAFQSA2AkQLIA5BfWohAgNAQQAgBCACSSAFQShqEAQbBEAgBCAGIAVBKGogCBACQQJ0aiIALwEAOwAAIAVBKGogAC0AAhABIAQgAC0AA2oiACAGIAVBKGogCBACQQJ0aiIELwEAOwAAIAVBKGogBC0AAhABIAAgBC0AA2ohBAwBBSAOQX5qIQIDQCAFQShqEAQgBCACS3JFBEAgBCAGIAVBKGogCBACQQJ0aiIALwEAOwAAIAVBKGogAC0AAhABIAQgAC0AA2ohBAwBCwsDQCAEIAJNBEAgBCAGIAVBKGogCBACQQJ0aiIALwEAOwAAIAVBKGogAC0AAhABIAQgAC0AA2ohBAwBCwsCQCAEIA5PDQAgBCAGIAVBKGogCBACIgBBAnRqIgItAAA6AAAgAi0AA0EBRgRAIAVBKGogAi0AAhABDAELIAUoAixBH0sNACAFQShqIAYgAEECdGotAAIQASAFKAIsQSFJDQAgBUEgNgIsCwNAQQAgAyAQSSAFQRBqEAQbBEAgAyAGIAVBEGogCBACQQJ0aiIALwEAOwAAIAVBEGogAC0AAhABIAMgAC0AA2oiACAGIAVBEGogCBACQQJ0aiICLwEAOwAAIAVBEGogAi0AAhABIAAgAi0AA2ohAwwBBSAPQX5qIQIDQCAFQRBqEAQgAyACS3JFBEAgAyAGIAVBEGogCBACQQJ0aiIALwEAOwAAIAVBEGogAC0AAhABIAMgAC0AA2ohAwwBCwsDQCADIAJNBEAgAyAGIAVBEGogCBACQQJ0aiIALwEAOwAAIAVBEGogAC0AAhABIAMgAC0AA2ohAwwBCwsCQCADIA9PDQAgAyAGIAVBEGogCBACIgBBAnRqIgItAAA6AAAgAi0AA0EBRgRAIAVBEGogAi0AAhABDAELIAUoAhRBH0sNACAFQRBqIAYgAEECdGotAAIQASAFKAIUQSFJDQAgBUEgNgIUCyABQWwgBUHYAGoQCiAFQUBrEApxIAVBKGoQCnEgBUEQahAKcRshCwwJCwAACwALAAALAAsAAAsACwAACwALQWwhCwsgBUHwAGokACALC7UEAQ5/IwBBEGsiBiQAIAZBBGogABAOQVQhBQJAIARB3AtJDQAgBi0ABCEHIANB8ARqQQBB7AAQECEIIAdBDEsNACADQdwJaiIJIAggBkEIaiAGQQxqIAEgAhAxIhAQA0UEQCAGKAIMIgQgB0sNASADQdwFaiEPIANBpAVqIREgAEEEaiESIANBqAVqIQEgBCEFA0AgBSICQX9qIQUgCCACQQJ0aigCAEUNAAsgAkEBaiEOQQEhBQNAIAUgDk9FBEAgCCAFQQJ0IgtqKAIAIQwgASALaiAKNgIAIAVBAWohBSAKIAxqIQoMAQsLIAEgCjYCAEEAIQUgBigCCCELA0AgBSALRkUEQCABIAUgCWotAAAiDEECdGoiDSANKAIAIg1BAWo2AgAgDyANQQF0aiINIAw6AAEgDSAFOgAAIAVBAWohBQwBCwtBACEBIANBADYCqAUgBEF/cyAHaiEJQQEhBQNAIAUgDk9FBEAgCCAFQQJ0IgtqKAIAIQwgAyALaiABNgIAIAwgBSAJanQgAWohASAFQQFqIQUMAQsLIAcgBEEBaiIBIAJrIgRrQQFqIQgDQEEBIQUgBCAIT0UEQANAIAUgDk9FBEAgBUECdCIJIAMgBEE0bGpqIAMgCWooAgAgBHY2AgAgBUEBaiEFDAELCyAEQQFqIQQMAQsLIBIgByAPIAogESADIAIgARBkIAZBAToABSAGIAc6AAYgACAGKAIENgIACyAQIQULIAZBEGokACAFC8ENAQt/IwBB8ABrIgUkAEFsIQkCQCADQQpJDQAgAi8AACEKIAIvAAIhDCACLwAEIQYgBUEIaiAEEA4CQCADIAYgCiAMampBBmoiDUkNACAFLQAKIQcgBUHYAGogAkEGaiICIAoQBiIJEAMNASAFQUBrIAIgCmoiAiAMEAYiCRADDQEgBUEoaiACIAxqIgIgBhAGIgkQAw0BIAVBEGogAiAGaiADIA1rEAYiCRADDQEgACABaiIOQX1qIQ8gBEEEaiEGQQEhCSAAIAFBA2pBAnYiAmoiCiACaiIMIAJqIg0hAyAMIQQgCiECA0AgCSADIA9JcQRAIAYgBUHYAGogBxACQQF0aiIILQAAIQsgBUHYAGogCC0AARABIAAgCzoAACAGIAVBQGsgBxACQQF0aiIILQAAIQsgBUFAayAILQABEAEgAiALOgAAIAYgBUEoaiAHEAJBAXRqIggtAAAhCyAFQShqIAgtAAEQASAEIAs6AAAgBiAFQRBqIAcQAkEBdGoiCC0AACELIAVBEGogCC0AARABIAMgCzoAACAGIAVB2ABqIAcQAkEBdGoiCC0AACELIAVB2ABqIAgtAAEQASAAIAs6AAEgBiAFQUBrIAcQAkEBdGoiCC0AACELIAVBQGsgCC0AARABIAIgCzoAASAGIAVBKGogBxACQQF0aiIILQAAIQsgBUEoaiAILQABEAEgBCALOgABIAYgBUEQaiAHEAJBAXRqIggtAAAhCyAFQRBqIAgtAAEQASADIAs6AAEgA0ECaiEDIARBAmohBCACQQJqIQIgAEECaiEAIAkgBUHYAGoQDUVxIAVBQGsQDUVxIAVBKGoQDUVxIAVBEGoQDUVxIQkMAQsLIAQgDUsgAiAMS3INAEFsIQkgACAKSw0BIApBfWohCQNAIAVB2ABqEAQgACAJT3JFBEAgBiAFQdgAaiAHEAJBAXRqIggtAAAhCyAFQdgAaiAILQABEAEgACALOgAAIAYgBUHYAGogBxACQQF0aiIILQAAIQsgBUHYAGogCC0AARABIAAgCzoAASAAQQJqIQAMAQsLA0AgBUHYAGoQBCAAIApPckUEQCAGIAVB2ABqIAcQAkEBdGoiCS0AACEIIAVB2ABqIAktAAEQASAAIAg6AAAgAEEBaiEADAELCwNAIAAgCkkEQCAGIAVB2ABqIAcQAkEBdGoiCS0AACEIIAVB2ABqIAktAAEQASAAIAg6AAAgAEEBaiEADAELCyAMQX1qIQADQCAFQUBrEAQgAiAAT3JFBEAgBiAFQUBrIAcQAkEBdGoiCi0AACEJIAVBQGsgCi0AARABIAIgCToAACAGIAVBQGsgBxACQQF0aiIKLQAAIQkgBUFAayAKLQABEAEgAiAJOgABIAJBAmohAgwBCwsDQCAFQUBrEAQgAiAMT3JFBEAgBiAFQUBrIAcQAkEBdGoiAC0AACEKIAVBQGsgAC0AARABIAIgCjoAACACQQFqIQIMAQsLA0AgAiAMSQRAIAYgBUFAayAHEAJBAXRqIgAtAAAhCiAFQUBrIAAtAAEQASACIAo6AAAgAkEBaiECDAELCyANQX1qIQADQCAFQShqEAQgBCAAT3JFBEAgBiAFQShqIAcQAkEBdGoiAi0AACEKIAVBKGogAi0AARABIAQgCjoAACAGIAVBKGogBxACQQF0aiICLQAAIQogBUEoaiACLQABEAEgBCAKOgABIARBAmohBAwBCwsDQCAFQShqEAQgBCANT3JFBEAgBiAFQShqIAcQAkEBdGoiAC0AACECIAVBKGogAC0AARABIAQgAjoAACAEQQFqIQQMAQsLA0AgBCANSQRAIAYgBUEoaiAHEAJBAXRqIgAtAAAhAiAFQShqIAAtAAEQASAEIAI6AAAgBEEBaiEEDAELCwNAIAVBEGoQBCADIA9PckUEQCAGIAVBEGogBxACQQF0aiIALQAAIQIgBUEQaiAALQABEAEgAyACOgAAIAYgBUEQaiAHEAJBAXRqIgAtAAAhAiAFQRBqIAAtAAEQASADIAI6AAEgA0ECaiEDDAELCwNAIAVBEGoQBCADIA5PckUEQCAGIAVBEGogBxACQQF0aiIALQAAIQIgBUEQaiAALQABEAEgAyACOgAAIANBAWohAwwBCwsDQCADIA5JBEAgBiAFQRBqIAcQAkEBdGoiAC0AACECIAVBEGogAC0AARABIAMgAjoAACADQQFqIQMMAQsLIAFBbCAFQdgAahAKIAVBQGsQCnEgBUEoahAKcSAFQRBqEApxGyEJDAELQWwhCQsgBUHwAGokACAJC8oCAQR/IwBBIGsiBSQAIAUgBBAOIAUtAAIhByAFQQhqIAIgAxAGIgIQA0UEQCAEQQRqIQIgACABaiIDQX1qIQQDQCAFQQhqEAQgACAET3JFBEAgAiAFQQhqIAcQAkEBdGoiBi0AACEIIAVBCGogBi0AARABIAAgCDoAACACIAVBCGogBxACQQF0aiIGLQAAIQggBUEIaiAGLQABEAEgACAIOgABIABBAmohAAwBCwsDQCAFQQhqEAQgACADT3JFBEAgAiAFQQhqIAcQAkEBdGoiBC0AACEGIAVBCGogBC0AARABIAAgBjoAACAAQQFqIQAMAQsLA0AgACADT0UEQCACIAVBCGogBxACQQF0aiIELQAAIQYgBUEIaiAELQABEAEgACAGOgAAIABBAWohAAwBCwsgAUFsIAVBCGoQChshAgsgBUEgaiQAIAILtgMBCX8jAEEQayIGJAAgBkEANgIMIAZBADYCCEFUIQQCQAJAIANBQGsiDCADIAZBCGogBkEMaiABIAIQMSICEAMNACAGQQRqIAAQDiAGKAIMIgcgBi0ABEEBaksNASAAQQRqIQogBkEAOgAFIAYgBzoABiAAIAYoAgQ2AgAgB0EBaiEJQQEhBANAIAQgCUkEQCADIARBAnRqIgEoAgAhACABIAU2AgAgACAEQX9qdCAFaiEFIARBAWohBAwBCwsgB0EBaiEHQQAhBSAGKAIIIQkDQCAFIAlGDQEgAyAFIAxqLQAAIgRBAnRqIgBBASAEdEEBdSILIAAoAgAiAWoiADYCACAHIARrIQhBACEEAkAgC0EDTQRAA0AgBCALRg0CIAogASAEakEBdGoiACAIOgABIAAgBToAACAEQQFqIQQMAAALAAsDQCABIABPDQEgCiABQQF0aiIEIAg6AAEgBCAFOgAAIAQgCDoAAyAEIAU6AAIgBCAIOgAFIAQgBToABCAEIAg6AAcgBCAFOgAGIAFBBGohAQwAAAsACyAFQQFqIQUMAAALAAsgAiEECyAGQRBqJAAgBAutAQECfwJAQYQgKAIAIABHIAAoAgBBAXYiAyABa0F4aiICQXhxQQhHcgR/IAIFIAMQJ0UNASACQQhqC0EQSQ0AIAAgACgCACICQQFxIAAgAWpBD2pBeHEiASAAa0EBdHI2AgAgASAANgIEIAEgASgCAEEBcSAAIAJBAXZqIAFrIgJBAXRyNgIAQYQgIAEgAkH/////B3FqQQRqQYQgKAIAIABGGyABNgIAIAEQJQsLygIBBX8CQAJAAkAgAEEIIABBCEsbZ0EfcyAAaUEBR2oiAUEESSAAIAF2cg0AIAFBAnRB/B5qKAIAIgJFDQADQCACQXhqIgMoAgBBAXZBeGoiBSAATwRAIAIgBUEIIAVBCEsbZ0Efc0ECdEGAH2oiASgCAEYEQCABIAIoAgQ2AgALDAMLIARBHksNASAEQQFqIQQgAigCBCICDQALC0EAIQMgAUEgTw0BA0AgAUECdEGAH2ooAgAiAkUEQCABQR5LIQIgAUEBaiEBIAJFDQEMAwsLIAIgAkF4aiIDKAIAQQF2QXhqIgFBCCABQQhLG2dBH3NBAnRBgB9qIgEoAgBGBEAgASACKAIENgIACwsgAigCACIBBEAgASACKAIENgIECyACKAIEIgEEQCABIAIoAgA2AgALIAMgAygCAEEBcjYCACADIAAQNwsgAwvhCwINfwV+IwBB8ABrIgckACAHIAAoAvDhASIINgJcIAEgAmohDSAIIAAoAoDiAWohDwJAAkAgBUUEQCABIQQMAQsgACgCxOABIRAgACgCwOABIREgACgCvOABIQ4gAEEBNgKM4QFBACEIA0AgCEEDRwRAIAcgCEECdCICaiAAIAJqQazQAWooAgA2AkQgCEEBaiEIDAELC0FsIQwgB0EYaiADIAQQBhADDQEgB0EsaiAHQRhqIAAoAgAQEyAHQTRqIAdBGGogACgCCBATIAdBPGogB0EYaiAAKAIEEBMgDUFgaiESIAEhBEEAIQwDQCAHKAIwIAcoAixBA3RqKQIAIhRCEIinQf8BcSEIIAcoAkAgBygCPEEDdGopAgAiFUIQiKdB/wFxIQsgBygCOCAHKAI0QQN0aikCACIWQiCIpyEJIBVCIIghFyAUQiCIpyECAkAgFkIQiKdB/wFxIgNBAk8EQAJAIAZFIANBGUlyRQRAIAkgB0EYaiADQSAgBygCHGsiCiAKIANLGyIKEAUgAyAKayIDdGohCSAHQRhqEAQaIANFDQEgB0EYaiADEAUgCWohCQwBCyAHQRhqIAMQBSAJaiEJIAdBGGoQBBoLIAcpAkQhGCAHIAk2AkQgByAYNwNIDAELAkAgA0UEQCACBEAgBygCRCEJDAMLIAcoAkghCQwBCwJAAkAgB0EYakEBEAUgCSACRWpqIgNBA0YEQCAHKAJEQX9qIgMgA0VqIQkMAQsgA0ECdCAHaigCRCIJIAlFaiEJIANBAUYNAQsgByAHKAJINgJMCwsgByAHKAJENgJIIAcgCTYCRAsgF6chAyALBEAgB0EYaiALEAUgA2ohAwsgCCALakEUTwRAIAdBGGoQBBoLIAgEQCAHQRhqIAgQBSACaiECCyAHQRhqEAQaIAcgB0EYaiAUQhiIp0H/AXEQCCAUp0H//wNxajYCLCAHIAdBGGogFUIYiKdB/wFxEAggFadB//8DcWo2AjwgB0EYahAEGiAHIAdBGGogFkIYiKdB/wFxEAggFqdB//8DcWo2AjQgByACNgJgIAcoAlwhCiAHIAk2AmggByADNgJkAkACQAJAIAQgAiADaiILaiASSw0AIAIgCmoiEyAPSw0AIA0gBGsgC0Egak8NAQsgByAHKQNoNwMQIAcgBykDYDcDCCAEIA0gB0EIaiAHQdwAaiAPIA4gESAQEB4hCwwBCyACIARqIQggBCAKEAcgAkERTwRAIARBEGohAgNAIAIgCkEQaiIKEAcgAkEQaiICIAhJDQALCyAIIAlrIQIgByATNgJcIAkgCCAOa0sEQCAJIAggEWtLBEBBbCELDAILIBAgAiAOayICaiIKIANqIBBNBEAgCCAKIAMQDxoMAgsgCCAKQQAgAmsQDyEIIAcgAiADaiIDNgJkIAggAmshCCAOIQILIAlBEE8EQCADIAhqIQMDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALDAELAkAgCUEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgCUECdCIDQcAeaigCAGoiAhAXIAIgA0HgHmooAgBrIQIgBygCZCEDDAELIAggAhAMCyADQQlJDQAgAyAIaiEDIAhBCGoiCCACQQhqIgJrQQ9MBEADQCAIIAIQDCACQQhqIQIgCEEIaiIIIANJDQAMAgALAAsDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALCyAHQRhqEAQaIAsgDCALEAMiAhshDCAEIAQgC2ogAhshBCAFQX9qIgUNAAsgDBADDQFBbCEMIAdBGGoQBEECSQ0BQQAhCANAIAhBA0cEQCAAIAhBAnQiAmpBrNABaiACIAdqKAJENgIAIAhBAWohCAwBCwsgBygCXCEIC0G6fyEMIA8gCGsiACANIARrSw0AIAQEfyAEIAggABALIABqBUEACyABayEMCyAHQfAAaiQAIAwLkRcCFn8FfiMAQdABayIHJAAgByAAKALw4QEiCDYCvAEgASACaiESIAggACgCgOIBaiETAkACQCAFRQRAIAEhAwwBCyAAKALE4AEhESAAKALA4AEhFSAAKAK84AEhDyAAQQE2AozhAUEAIQgDQCAIQQNHBEAgByAIQQJ0IgJqIAAgAmpBrNABaigCADYCVCAIQQFqIQgMAQsLIAcgETYCZCAHIA82AmAgByABIA9rNgJoQWwhECAHQShqIAMgBBAGEAMNASAFQQQgBUEESBshFyAHQTxqIAdBKGogACgCABATIAdBxABqIAdBKGogACgCCBATIAdBzABqIAdBKGogACgCBBATQQAhBCAHQeAAaiEMIAdB5ABqIQoDQCAHQShqEARBAksgBCAXTnJFBEAgBygCQCAHKAI8QQN0aikCACIdQhCIp0H/AXEhCyAHKAJQIAcoAkxBA3RqKQIAIh5CEIinQf8BcSEJIAcoAkggBygCREEDdGopAgAiH0IgiKchCCAeQiCIISAgHUIgiKchAgJAIB9CEIinQf8BcSIDQQJPBEACQCAGRSADQRlJckUEQCAIIAdBKGogA0EgIAcoAixrIg0gDSADSxsiDRAFIAMgDWsiA3RqIQggB0EoahAEGiADRQ0BIAdBKGogAxAFIAhqIQgMAQsgB0EoaiADEAUgCGohCCAHQShqEAQaCyAHKQJUISEgByAINgJUIAcgITcDWAwBCwJAIANFBEAgAgRAIAcoAlQhCAwDCyAHKAJYIQgMAQsCQAJAIAdBKGpBARAFIAggAkVqaiIDQQNGBEAgBygCVEF/aiIDIANFaiEIDAELIANBAnQgB2ooAlQiCCAIRWohCCADQQFGDQELIAcgBygCWDYCXAsLIAcgBygCVDYCWCAHIAg2AlQLICCnIQMgCQRAIAdBKGogCRAFIANqIQMLIAkgC2pBFE8EQCAHQShqEAQaCyALBEAgB0EoaiALEAUgAmohAgsgB0EoahAEGiAHIAcoAmggAmoiCSADajYCaCAKIAwgCCAJSxsoAgAhDSAHIAdBKGogHUIYiKdB/wFxEAggHadB//8DcWo2AjwgByAHQShqIB5CGIinQf8BcRAIIB6nQf//A3FqNgJMIAdBKGoQBBogB0EoaiAfQhiIp0H/AXEQCCEOIAdB8ABqIARBBHRqIgsgCSANaiAIazYCDCALIAg2AgggCyADNgIEIAsgAjYCACAHIA4gH6dB//8DcWo2AkQgBEEBaiEEDAELCyAEIBdIDQEgEkFgaiEYIAdB4ABqIRogB0HkAGohGyABIQMDQCAHQShqEARBAksgBCAFTnJFBEAgBygCQCAHKAI8QQN0aikCACIdQhCIp0H/AXEhCyAHKAJQIAcoAkxBA3RqKQIAIh5CEIinQf8BcSEIIAcoAkggBygCREEDdGopAgAiH0IgiKchCSAeQiCIISAgHUIgiKchDAJAIB9CEIinQf8BcSICQQJPBEACQCAGRSACQRlJckUEQCAJIAdBKGogAkEgIAcoAixrIgogCiACSxsiChAFIAIgCmsiAnRqIQkgB0EoahAEGiACRQ0BIAdBKGogAhAFIAlqIQkMAQsgB0EoaiACEAUgCWohCSAHQShqEAQaCyAHKQJUISEgByAJNgJUIAcgITcDWAwBCwJAIAJFBEAgDARAIAcoAlQhCQwDCyAHKAJYIQkMAQsCQAJAIAdBKGpBARAFIAkgDEVqaiICQQNGBEAgBygCVEF/aiICIAJFaiEJDAELIAJBAnQgB2ooAlQiCSAJRWohCSACQQFGDQELIAcgBygCWDYCXAsLIAcgBygCVDYCWCAHIAk2AlQLICCnIRQgCARAIAdBKGogCBAFIBRqIRQLIAggC2pBFE8EQCAHQShqEAQaCyALBEAgB0EoaiALEAUgDGohDAsgB0EoahAEGiAHIAcoAmggDGoiGSAUajYCaCAbIBogCSAZSxsoAgAhHCAHIAdBKGogHUIYiKdB/wFxEAggHadB//8DcWo2AjwgByAHQShqIB5CGIinQf8BcRAIIB6nQf//A3FqNgJMIAdBKGoQBBogByAHQShqIB9CGIinQf8BcRAIIB+nQf//A3FqNgJEIAcgB0HwAGogBEEDcUEEdGoiDSkDCCIdNwPIASAHIA0pAwAiHjcDwAECQAJAAkAgBygCvAEiDiAepyICaiIWIBNLDQAgAyAHKALEASIKIAJqIgtqIBhLDQAgEiADayALQSBqTw0BCyAHIAcpA8gBNwMQIAcgBykDwAE3AwggAyASIAdBCGogB0G8AWogEyAPIBUgERAeIQsMAQsgAiADaiEIIAMgDhAHIAJBEU8EQCADQRBqIQIDQCACIA5BEGoiDhAHIAJBEGoiAiAISQ0ACwsgCCAdpyIOayECIAcgFjYCvAEgDiAIIA9rSwRAIA4gCCAVa0sEQEFsIQsMAgsgESACIA9rIgJqIhYgCmogEU0EQCAIIBYgChAPGgwCCyAIIBZBACACaxAPIQggByACIApqIgo2AsQBIAggAmshCCAPIQILIA5BEE8EQCAIIApqIQoDQCAIIAIQByACQRBqIQIgCEEQaiIIIApJDQALDAELAkAgDkEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgDkECdCIKQcAeaigCAGoiAhAXIAIgCkHgHmooAgBrIQIgBygCxAEhCgwBCyAIIAIQDAsgCkEJSQ0AIAggCmohCiAIQQhqIgggAkEIaiICa0EPTARAA0AgCCACEAwgAkEIaiECIAhBCGoiCCAKSQ0ADAIACwALA0AgCCACEAcgAkEQaiECIAhBEGoiCCAKSQ0ACwsgCxADBEAgCyEQDAQFIA0gDDYCACANIBkgHGogCWs2AgwgDSAJNgIIIA0gFDYCBCAEQQFqIQQgAyALaiEDDAILAAsLIAQgBUgNASAEIBdrIQtBACEEA0AgCyAFSARAIAcgB0HwAGogC0EDcUEEdGoiAikDCCIdNwPIASAHIAIpAwAiHjcDwAECQAJAAkAgBygCvAEiDCAepyICaiIKIBNLDQAgAyAHKALEASIJIAJqIhBqIBhLDQAgEiADayAQQSBqTw0BCyAHIAcpA8gBNwMgIAcgBykDwAE3AxggAyASIAdBGGogB0G8AWogEyAPIBUgERAeIRAMAQsgAiADaiEIIAMgDBAHIAJBEU8EQCADQRBqIQIDQCACIAxBEGoiDBAHIAJBEGoiAiAISQ0ACwsgCCAdpyIGayECIAcgCjYCvAEgBiAIIA9rSwRAIAYgCCAVa0sEQEFsIRAMAgsgESACIA9rIgJqIgwgCWogEU0EQCAIIAwgCRAPGgwCCyAIIAxBACACaxAPIQggByACIAlqIgk2AsQBIAggAmshCCAPIQILIAZBEE8EQCAIIAlqIQYDQCAIIAIQByACQRBqIQIgCEEQaiIIIAZJDQALDAELAkAgBkEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgBkECdCIGQcAeaigCAGoiAhAXIAIgBkHgHmooAgBrIQIgBygCxAEhCQwBCyAIIAIQDAsgCUEJSQ0AIAggCWohBiAIQQhqIgggAkEIaiICa0EPTARAA0AgCCACEAwgAkEIaiECIAhBCGoiCCAGSQ0ADAIACwALA0AgCCACEAcgAkEQaiECIAhBEGoiCCAGSQ0ACwsgEBADDQMgC0EBaiELIAMgEGohAwwBCwsDQCAEQQNHBEAgACAEQQJ0IgJqQazQAWogAiAHaigCVDYCACAEQQFqIQQMAQsLIAcoArwBIQgLQbp/IRAgEyAIayIAIBIgA2tLDQAgAwR/IAMgCCAAEAsgAGoFQQALIAFrIRALIAdB0AFqJAAgEAslACAAQgA3AgAgAEEAOwEIIABBADoACyAAIAE2AgwgACACOgAKC7QFAQN/IwBBMGsiBCQAIABB/wFqIgVBfWohBgJAIAMvAQIEQCAEQRhqIAEgAhAGIgIQAw0BIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahASOgAAIAMgBEEIaiAEQRhqEBI6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0FIAEgBEEQaiAEQRhqEBI6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBSABIARBCGogBEEYahASOgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEjoAACABIAJqIABrIQIMAwsgAyAEQRBqIARBGGoQEjoAAiADIARBCGogBEEYahASOgADIANBBGohAwwAAAsACyAEQRhqIAEgAhAGIgIQAw0AIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahAROgAAIAMgBEEIaiAEQRhqEBE6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0EIAEgBEEQaiAEQRhqEBE6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBCABIARBCGogBEEYahAROgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEToAACABIAJqIABrIQIMAgsgAyAEQRBqIARBGGoQEToAAiADIARBCGogBEEYahAROgADIANBBGohAwwAAAsACyAEQTBqJAAgAgtpAQF/An8CQAJAIAJBB00NACABKAAAQbfIwuF+Rw0AIAAgASgABDYCmOIBQWIgAEEQaiABIAIQPiIDEAMNAhogAEKBgICAEDcDiOEBIAAgASADaiACIANrECoMAQsgACABIAIQKgtBAAsLrQMBBn8jAEGAAWsiAyQAQWIhCAJAIAJBCUkNACAAQZjQAGogAUEIaiIEIAJBeGogAEGY0AAQMyIFEAMiBg0AIANBHzYCfCADIANB/ABqIANB+ABqIAQgBCAFaiAGGyIEIAEgAmoiAiAEaxAVIgUQAw0AIAMoAnwiBkEfSw0AIAMoAngiB0EJTw0AIABBiCBqIAMgBkGAC0GADCAHEBggA0E0NgJ8IAMgA0H8AGogA0H4AGogBCAFaiIEIAIgBGsQFSIFEAMNACADKAJ8IgZBNEsNACADKAJ4IgdBCk8NACAAQZAwaiADIAZBgA1B4A4gBxAYIANBIzYCfCADIANB/ABqIANB+ABqIAQgBWoiBCACIARrEBUiBRADDQAgAygCfCIGQSNLDQAgAygCeCIHQQpPDQAgACADIAZBwBBB0BEgBxAYIAQgBWoiBEEMaiIFIAJLDQAgAiAFayEFQQAhAgNAIAJBA0cEQCAEKAAAIgZBf2ogBU8NAiAAIAJBAnRqQZzQAWogBjYCACACQQFqIQIgBEEEaiEEDAELCyAEIAFrIQgLIANBgAFqJAAgCAtGAQN/IABBCGohAyAAKAIEIQJBACEAA0AgACACdkUEQCABIAMgAEEDdGotAAJBFktqIQEgAEEBaiEADAELCyABQQggAmt0C4YDAQV/Qbh/IQcCQCADRQ0AIAItAAAiBEUEQCABQQA2AgBBAUG4fyADQQFGGw8LAn8gAkEBaiIFIARBGHRBGHUiBkF/Sg0AGiAGQX9GBEAgA0EDSA0CIAUvAABBgP4BaiEEIAJBA2oMAQsgA0ECSA0BIAItAAEgBEEIdHJBgIB+aiEEIAJBAmoLIQUgASAENgIAIAVBAWoiASACIANqIgNLDQBBbCEHIABBEGogACAFLQAAIgVBBnZBI0EJIAEgAyABa0HAEEHQEUHwEiAAKAKM4QEgACgCnOIBIAQQHyIGEAMiCA0AIABBmCBqIABBCGogBUEEdkEDcUEfQQggASABIAZqIAgbIgEgAyABa0GAC0GADEGAFyAAKAKM4QEgACgCnOIBIAQQHyIGEAMiCA0AIABBoDBqIABBBGogBUECdkEDcUE0QQkgASABIAZqIAgbIgEgAyABa0GADUHgDkGQGSAAKAKM4QEgACgCnOIBIAQQHyIAEAMNACAAIAFqIAJrIQcLIAcLrQMBCn8jAEGABGsiCCQAAn9BUiACQf8BSw0AGkFUIANBDEsNABogAkEBaiELIABBBGohCUGAgAQgA0F/anRBEHUhCkEAIQJBASEEQQEgA3QiB0F/aiIMIQUDQCACIAtGRQRAAkAgASACQQF0Ig1qLwEAIgZB//8DRgRAIAkgBUECdGogAjoAAiAFQX9qIQVBASEGDAELIARBACAKIAZBEHRBEHVKGyEECyAIIA1qIAY7AQAgAkEBaiECDAELCyAAIAQ7AQIgACADOwEAIAdBA3YgB0EBdmpBA2ohBkEAIQRBACECA0AgBCALRkUEQCABIARBAXRqLgEAIQpBACEAA0AgACAKTkUEQCAJIAJBAnRqIAQ6AAIDQCACIAZqIAxxIgIgBUsNAAsgAEEBaiEADAELCyAEQQFqIQQMAQsLQX8gAg0AGkEAIQIDfyACIAdGBH9BAAUgCCAJIAJBAnRqIgAtAAJBAXRqIgEgAS8BACIBQQFqOwEAIAAgAyABEBRrIgU6AAMgACABIAVB/wFxdCAHazsBACACQQFqIQIMAQsLCyEFIAhBgARqJAAgBQvjBgEIf0FsIQcCQCACQQNJDQACQAJAAkACQCABLQAAIgNBA3EiCUEBaw4DAwEAAgsgACgCiOEBDQBBYg8LIAJBBUkNAkEDIQYgASgAACEFAn8CQAJAIANBAnZBA3EiCEF+aiIEQQFNBEAgBEEBaw0BDAILIAVBDnZB/wdxIQQgBUEEdkH/B3EhAyAIRQwCCyAFQRJ2IQRBBCEGIAVBBHZB//8AcSEDQQAMAQsgBUEEdkH//w9xIgNBgIAISw0DIAEtAARBCnQgBUEWdnIhBEEFIQZBAAshBSAEIAZqIgogAksNAgJAIANBgQZJDQAgACgCnOIBRQ0AQQAhAgNAIAJBg4ABSw0BIAJBQGshAgwAAAsACwJ/IAlBA0YEQCABIAZqIQEgAEHw4gFqIQIgACgCDCEGIAUEQCACIAMgASAEIAYQXwwCCyACIAMgASAEIAYQXQwBCyAAQbjQAWohAiABIAZqIQEgAEHw4gFqIQYgAEGo0ABqIQggBQRAIAggBiADIAEgBCACEF4MAQsgCCAGIAMgASAEIAIQXAsQAw0CIAAgAzYCgOIBIABBATYCiOEBIAAgAEHw4gFqNgLw4QEgCUECRgRAIAAgAEGo0ABqNgIMCyAAIANqIgBBiOMBakIANwAAIABBgOMBakIANwAAIABB+OIBakIANwAAIABB8OIBakIANwAAIAoPCwJ/AkACQAJAIANBAnZBA3FBf2oiBEECSw0AIARBAWsOAgACAQtBASEEIANBA3YMAgtBAiEEIAEvAABBBHYMAQtBAyEEIAEQIUEEdgsiAyAEaiIFQSBqIAJLBEAgBSACSw0CIABB8OIBaiABIARqIAMQCyEBIAAgAzYCgOIBIAAgATYC8OEBIAEgA2oiAEIANwAYIABCADcAECAAQgA3AAggAEIANwAAIAUPCyAAIAM2AoDiASAAIAEgBGo2AvDhASAFDwsCfwJAAkACQCADQQJ2QQNxQX9qIgRBAksNACAEQQFrDgIAAgELQQEhByADQQN2DAILQQIhByABLwAAQQR2DAELIAJBBEkgARAhIgJBj4CAAUtyDQFBAyEHIAJBBHYLIQIgAEHw4gFqIAEgB2otAAAgAkEgahAQIQEgACACNgKA4gEgACABNgLw4QEgB0EBaiEHCyAHC0sAIABC+erQ0OfJoeThADcDICAAQgA3AxggAELP1tO+0ser2UI3AxAgAELW64Lu6v2J9eAANwMIIABCADcDACAAQShqQQBBKBAQGgviAgICfwV+IABBKGoiASAAKAJIaiECAn4gACkDACIDQiBaBEAgACkDECIEQgeJIAApAwgiBUIBiXwgACkDGCIGQgyJfCAAKQMgIgdCEol8IAUQGSAEEBkgBhAZIAcQGQwBCyAAKQMYQsXP2bLx5brqJ3wLIAN8IQMDQCABQQhqIgAgAk0EQEIAIAEpAAAQCSADhUIbiUKHla+vmLbem55/fkLj3MqV/M7y9YV/fCEDIAAhAQwBCwsCQCABQQRqIgAgAksEQCABIQAMAQsgASgAAK1Ch5Wvr5i23puef34gA4VCF4lCz9bTvtLHq9lCfkL5893xmfaZqxZ8IQMLA0AgACACSQRAIAAxAABCxc/ZsvHluuonfiADhUILiUKHla+vmLbem55/fiEDIABBAWohAAwBCwsgA0IhiCADhULP1tO+0ser2UJ+IgNCHYggA4VC+fPd8Zn2masWfiIDQiCIIAOFC+8CAgJ/BH4gACAAKQMAIAKtfDcDAAJAAkAgACgCSCIDIAJqIgRBH00EQCABRQ0BIAAgA2pBKGogASACECAgACgCSCACaiEEDAELIAEgAmohAgJ/IAMEQCAAQShqIgQgA2ogAUEgIANrECAgACAAKQMIIAQpAAAQCTcDCCAAIAApAxAgACkAMBAJNwMQIAAgACkDGCAAKQA4EAk3AxggACAAKQMgIABBQGspAAAQCTcDICAAKAJIIQMgAEEANgJIIAEgA2tBIGohAQsgAUEgaiACTQsEQCACQWBqIQMgACkDICEFIAApAxghBiAAKQMQIQcgACkDCCEIA0AgCCABKQAAEAkhCCAHIAEpAAgQCSEHIAYgASkAEBAJIQYgBSABKQAYEAkhBSABQSBqIgEgA00NAAsgACAFNwMgIAAgBjcDGCAAIAc3AxAgACAINwMICyABIAJPDQEgAEEoaiABIAIgAWsiBBAgCyAAIAQ2AkgLCy8BAX8gAEUEQEG2f0EAIAMbDwtBun8hBCADIAFNBH8gACACIAMQEBogAwVBun8LCy8BAX8gAEUEQEG2f0EAIAMbDwtBun8hBCADIAFNBH8gACACIAMQCxogAwVBun8LC6gCAQZ/IwBBEGsiByQAIABB2OABaikDAEKAgIAQViEIQbh/IQUCQCAEQf//B0sNACAAIAMgBBBCIgUQAyIGDQAgACgCnOIBIQkgACAHQQxqIAMgAyAFaiAGGyIKIARBACAFIAYbayIGEEAiAxADBEAgAyEFDAELIAcoAgwhBCABRQRAQbp/IQUgBEEASg0BCyAGIANrIQUgAyAKaiEDAkAgCQRAIABBADYCnOIBDAELAkACQAJAIARBBUgNACAAQdjgAWopAwBCgICACFgNAAwBCyAAQQA2ApziAQwBCyAAKAIIED8hBiAAQQA2ApziASAGQRRPDQELIAAgASACIAMgBSAEIAgQOSEFDAELIAAgASACIAMgBSAEIAgQOiEFCyAHQRBqJAAgBQtnACAAQdDgAWogASACIAAoAuzhARAuIgEQAwRAIAEPC0G4fyECAkAgAQ0AIABB7OABaigCACIBBEBBYCECIAAoApjiASABRw0BC0EAIQIgAEHw4AFqKAIARQ0AIABBkOEBahBDCyACCycBAX8QVyIERQRAQUAPCyAEIAAgASACIAMgBBBLEE8hACAEEFYgAAs/AQF/AkACQAJAIAAoAqDiAUEBaiIBQQJLDQAgAUEBaw4CAAECCyAAEDBBAA8LIABBADYCoOIBCyAAKAKU4gELvAMCB38BfiMAQRBrIgkkAEG4fyEGAkAgBCgCACIIQQVBCSAAKALs4QEiBRtJDQAgAygCACIHQQFBBSAFGyAFEC8iBRADBEAgBSEGDAELIAggBUEDakkNACAAIAcgBRBJIgYQAw0AIAEgAmohCiAAQZDhAWohCyAIIAVrIQIgBSAHaiEHIAEhBQNAIAcgAiAJECwiBhADDQEgAkF9aiICIAZJBEBBuH8hBgwCCyAJKAIAIghBAksEQEFsIQYMAgsgB0EDaiEHAn8CQAJAAkAgCEEBaw4CAgABCyAAIAUgCiAFayAHIAYQSAwCCyAFIAogBWsgByAGEEcMAQsgBSAKIAVrIActAAAgCSgCCBBGCyIIEAMEQCAIIQYMAgsgACgC8OABBEAgCyAFIAgQRQsgAiAGayECIAYgB2ohByAFIAhqIQUgCSgCBEUNAAsgACkD0OABIgxCf1IEQEFsIQYgDCAFIAFrrFINAQsgACgC8OABBEBBaiEGIAJBBEkNASALEEQhDCAHKAAAIAynRw0BIAdBBGohByACQXxqIQILIAMgBzYCACAEIAI2AgAgBSABayEGCyAJQRBqJAAgBgsuACAAECsCf0EAQQAQAw0AGiABRSACRXJFBEBBYiAAIAEgAhA9EAMNARoLQQALCzcAIAEEQCAAIAAoAsTgASABKAIEIAEoAghqRzYCnOIBCyAAECtBABADIAFFckUEQCAAIAEQWwsL0QIBB38jAEEQayIGJAAgBiAENgIIIAYgAzYCDCAFBEAgBSgCBCEKIAUoAgghCQsgASEIAkACQANAIAAoAuzhARAWIQsCQANAIAQgC0kNASADKAAAQXBxQdDUtMIBRgRAIAMgBBAiIgcQAw0EIAQgB2shBCADIAdqIQMMAQsLIAYgAzYCDCAGIAQ2AggCQCAFBEAgACAFEE5BACEHQQAQA0UNAQwFCyAAIAogCRBNIgcQAw0ECyAAIAgQUCAMQQFHQQAgACAIIAIgBkEMaiAGQQhqEEwiByIDa0EAIAMQAxtBCkdyRQRAQbh/IQcMBAsgBxADDQMgAiAHayECIAcgCGohCEEBIQwgBigCDCEDIAYoAgghBAwBCwsgBiADNgIMIAYgBDYCCEG4fyEHIAQNASAIIAFrIQcMAQsgBiADNgIMIAYgBDYCCAsgBkEQaiQAIAcLRgECfyABIAAoArjgASICRwRAIAAgAjYCxOABIAAgATYCuOABIAAoArzgASEDIAAgATYCvOABIAAgASADIAJrajYCwOABCwutAgIEfwF+IwBBQGoiBCQAAkACQCACQQhJDQAgASgAAEFwcUHQ1LTCAUcNACABIAIQIiEBIABCADcDCCAAQQA2AgQgACABNgIADAELIARBGGogASACEC0iAxADBEAgACADEBoMAQsgAwRAIABBuH8QGgwBCyACIAQoAjAiA2shAiABIANqIQMDQAJAIAAgAyACIARBCGoQLCIFEAMEfyAFBSACIAVBA2oiBU8NAUG4fwsQGgwCCyAGQQFqIQYgAiAFayECIAMgBWohAyAEKAIMRQ0ACyAEKAI4BEAgAkEDTQRAIABBuH8QGgwCCyADQQRqIQMLIAQoAighAiAEKQMYIQcgAEEANgIEIAAgAyABazYCACAAIAIgBmytIAcgB0J/URs3AwgLIARBQGskAAslAQF/IwBBEGsiAiQAIAIgACABEFEgAigCACEAIAJBEGokACAAC30BBH8jAEGQBGsiBCQAIARB/wE2AggCQCAEQRBqIARBCGogBEEMaiABIAIQFSIGEAMEQCAGIQUMAQtBVCEFIAQoAgwiB0EGSw0AIAMgBEEQaiAEKAIIIAcQQSIFEAMNACAAIAEgBmogAiAGayADEDwhBQsgBEGQBGokACAFC4cBAgJ/An5BABAWIQMCQANAIAEgA08EQAJAIAAoAABBcHFB0NS0wgFGBEAgACABECIiAhADRQ0BQn4PCyAAIAEQVSIEQn1WDQMgBCAFfCIFIARUIQJCfiEEIAINAyAAIAEQUiICEAMNAwsgASACayEBIAAgAmohAAwBCwtCfiAFIAEbIQQLIAQLPwIBfwF+IwBBMGsiAiQAAn5CfiACQQhqIAAgARAtDQAaQgAgAigCHEEBRg0AGiACKQMICyEDIAJBMGokACADC40BAQJ/IwBBMGsiASQAAkAgAEUNACAAKAKI4gENACABIABB/OEBaigCADYCKCABIAApAvThATcDICAAEDAgACgCqOIBIQIgASABKAIoNgIYIAEgASkDIDcDECACIAFBEGoQGyAAQQA2AqjiASABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALKgECfyMAQRBrIgAkACAAQQA2AgggAEIANwMAIAAQWCEBIABBEGokACABC4cBAQN/IwBBEGsiAiQAAkAgACgCAEUgACgCBEVzDQAgAiAAKAIINgIIIAIgACkCADcDAAJ/IAIoAgAiAQRAIAIoAghBqOMJIAERBQAMAQtBqOMJECgLIgFFDQAgASAAKQIANwL04QEgAUH84QFqIAAoAgg2AgAgARBZIAEhAwsgAkEQaiQAIAMLywEBAn8jAEEgayIBJAAgAEGBgIDAADYCtOIBIABBADYCiOIBIABBADYC7OEBIABCADcDkOIBIABBADYCpOMJIABBADYC3OIBIABCADcCzOIBIABBADYCvOIBIABBADYCxOABIABCADcCnOIBIABBpOIBakIANwIAIABBrOIBakEANgIAIAFCADcCECABQgA3AhggASABKQMYNwMIIAEgASkDEDcDACABKAIIQQh2QQFxIQIgAEEANgLg4gEgACACNgKM4gEgAUEgaiQAC3YBA38jAEEwayIBJAAgAARAIAEgAEHE0AFqIgIoAgA2AiggASAAKQK80AE3AyAgACgCACEDIAEgAigCADYCGCABIAApArzQATcDECADIAFBEGoQGyABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALzAEBAX8gACABKAK00AE2ApjiASAAIAEoAgQiAjYCwOABIAAgAjYCvOABIAAgAiABKAIIaiICNgK44AEgACACNgLE4AEgASgCuNABBEAgAEKBgICAEDcDiOEBIAAgAUGk0ABqNgIMIAAgAUGUIGo2AgggACABQZwwajYCBCAAIAFBDGo2AgAgAEGs0AFqIAFBqNABaigCADYCACAAQbDQAWogAUGs0AFqKAIANgIAIABBtNABaiABQbDQAWooAgA2AgAPCyAAQgA3A4jhAQs7ACACRQRAQbp/DwsgBEUEQEFsDwsgAiAEEGAEQCAAIAEgAiADIAQgBRBhDwsgACABIAIgAyAEIAUQZQtGAQF/IwBBEGsiBSQAIAVBCGogBBAOAn8gBS0ACQRAIAAgASACIAMgBBAyDAELIAAgASACIAMgBBA0CyEAIAVBEGokACAACzQAIAAgAyAEIAUQNiIFEAMEQCAFDwsgBSAESQR/IAEgAiADIAVqIAQgBWsgABA1BUG4fwsLRgEBfyMAQRBrIgUkACAFQQhqIAQQDgJ/IAUtAAkEQCAAIAEgAiADIAQQYgwBCyAAIAEgAiADIAQQNQshACAFQRBqJAAgAAtZAQF/QQ8hAiABIABJBEAgAUEEdCAAbiECCyAAQQh2IgEgAkEYbCIAQYwIaigCAGwgAEGICGooAgBqIgJBA3YgAmogAEGACGooAgAgAEGECGooAgAgAWxqSQs3ACAAIAMgBCAFQYAQEDMiBRADBEAgBQ8LIAUgBEkEfyABIAIgAyAFaiAEIAVrIAAQMgVBuH8LC78DAQN/IwBBIGsiBSQAIAVBCGogAiADEAYiAhADRQRAIAAgAWoiB0F9aiEGIAUgBBAOIARBBGohAiAFLQACIQMDQEEAIAAgBkkgBUEIahAEGwRAIAAgAiAFQQhqIAMQAkECdGoiBC8BADsAACAFQQhqIAQtAAIQASAAIAQtAANqIgQgAiAFQQhqIAMQAkECdGoiAC8BADsAACAFQQhqIAAtAAIQASAEIAAtAANqIQAMAQUgB0F+aiEEA0AgBUEIahAEIAAgBEtyRQRAIAAgAiAFQQhqIAMQAkECdGoiBi8BADsAACAFQQhqIAYtAAIQASAAIAYtAANqIQAMAQsLA0AgACAES0UEQCAAIAIgBUEIaiADEAJBAnRqIgYvAQA7AAAgBUEIaiAGLQACEAEgACAGLQADaiEADAELCwJAIAAgB08NACAAIAIgBUEIaiADEAIiA0ECdGoiAC0AADoAACAALQADQQFGBEAgBUEIaiAALQACEAEMAQsgBSgCDEEfSw0AIAVBCGogAiADQQJ0ai0AAhABIAUoAgxBIUkNACAFQSA2AgwLIAFBbCAFQQhqEAobIQILCwsgBUEgaiQAIAILkgIBBH8jAEFAaiIJJAAgCSADQTQQCyEDAkAgBEECSA0AIAMgBEECdGooAgAhCSADQTxqIAgQIyADQQE6AD8gAyACOgA+QQAhBCADKAI8IQoDQCAEIAlGDQEgACAEQQJ0aiAKNgEAIARBAWohBAwAAAsAC0EAIQkDQCAGIAlGRQRAIAMgBSAJQQF0aiIKLQABIgtBAnRqIgwoAgAhBCADQTxqIAotAABBCHQgCGpB//8DcRAjIANBAjoAPyADIAcgC2siCiACajoAPiAEQQEgASAKa3RqIQogAygCPCELA0AgACAEQQJ0aiALNgEAIARBAWoiBCAKSQ0ACyAMIAo2AgAgCUEBaiEJDAELCyADQUBrJAALowIBCX8jAEHQAGsiCSQAIAlBEGogBUE0EAsaIAcgBmshDyAHIAFrIRADQAJAIAMgCkcEQEEBIAEgByACIApBAXRqIgYtAAEiDGsiCGsiC3QhDSAGLQAAIQ4gCUEQaiAMQQJ0aiIMKAIAIQYgCyAPTwRAIAAgBkECdGogCyAIIAUgCEE0bGogCCAQaiIIQQEgCEEBShsiCCACIAQgCEECdGooAgAiCEEBdGogAyAIayAHIA4QYyAGIA1qIQgMAgsgCUEMaiAOECMgCUEBOgAPIAkgCDoADiAGIA1qIQggCSgCDCELA0AgBiAITw0CIAAgBkECdGogCzYBACAGQQFqIQYMAAALAAsgCUHQAGokAA8LIAwgCDYCACAKQQFqIQoMAAALAAs0ACAAIAMgBCAFEDYiBRADBEAgBQ8LIAUgBEkEfyABIAIgAyAFaiAEIAVrIAAQNAVBuH8LCyMAIAA/AEEQdGtB//8DakEQdkAAQX9GBEBBAA8LQQAQAEEBCzsBAX8gAgRAA0AgACABIAJBgCAgAkGAIEkbIgMQCyEAIAFBgCBqIQEgAEGAIGohACACIANrIgINAAsLCwYAIAAQAwsLqBUJAEGICAsNAQAAAAEAAAACAAAAAgBBoAgLswYBAAAAAQAAAAIAAAACAAAAJgAAAIIAAAAhBQAASgAAAGcIAAAmAAAAwAEAAIAAAABJBQAASgAAAL4IAAApAAAALAIAAIAAAABJBQAASgAAAL4IAAAvAAAAygIAAIAAAACKBQAASgAAAIQJAAA1AAAAcwMAAIAAAACdBQAASgAAAKAJAAA9AAAAgQMAAIAAAADrBQAASwAAAD4KAABEAAAAngMAAIAAAABNBgAASwAAAKoKAABLAAAAswMAAIAAAADBBgAATQAAAB8NAABNAAAAUwQAAIAAAAAjCAAAUQAAAKYPAABUAAAAmQQAAIAAAABLCQAAVwAAALESAABYAAAA2gQAAIAAAABvCQAAXQAAACMUAABUAAAARQUAAIAAAABUCgAAagAAAIwUAABqAAAArwUAAIAAAAB2CQAAfAAAAE4QAAB8AAAA0gIAAIAAAABjBwAAkQAAAJAHAACSAAAAAAAAAAEAAAABAAAABQAAAA0AAAAdAAAAPQAAAH0AAAD9AAAA/QEAAP0DAAD9BwAA/Q8AAP0fAAD9PwAA/X8AAP3/AAD9/wEA/f8DAP3/BwD9/w8A/f8fAP3/PwD9/38A/f//AP3//wH9//8D/f//B/3//w/9//8f/f//P/3//38AAAAAAQAAAAIAAAADAAAABAAAAAUAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAABEAAAASAAAAEwAAABQAAAAVAAAAFgAAABcAAAAYAAAAGQAAABoAAAAbAAAAHAAAAB0AAAAeAAAAHwAAAAMAAAAEAAAABQAAAAYAAAAHAAAACAAAAAkAAAAKAAAACwAAAAwAAAANAAAADgAAAA8AAAAQAAAAEQAAABIAAAATAAAAFAAAABUAAAAWAAAAFwAAABgAAAAZAAAAGgAAABsAAAAcAAAAHQAAAB4AAAAfAAAAIAAAACEAAAAiAAAAIwAAACUAAAAnAAAAKQAAACsAAAAvAAAAMwAAADsAAABDAAAAUwAAAGMAAACDAAAAAwEAAAMCAAADBAAAAwgAAAMQAAADIAAAA0AAAAOAAAADAAEAQeAPC1EBAAAAAQAAAAEAAAABAAAAAgAAAAIAAAADAAAAAwAAAAQAAAAEAAAABQAAAAcAAAAIAAAACQAAAAoAAAALAAAADAAAAA0AAAAOAAAADwAAABAAQcQQC4sBAQAAAAIAAAADAAAABAAAAAUAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAABIAAAAUAAAAFgAAABgAAAAcAAAAIAAAACgAAAAwAAAAQAAAAIAAAAAAAQAAAAIAAAAEAAAACAAAABAAAAAgAAAAQAAAAIAAAAAAAQBBkBIL5gQBAAAAAQAAAAEAAAABAAAAAgAAAAIAAAADAAAAAwAAAAQAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAAAEAAAAEAAAACAAAAAAAAAABAAEBBgAAAAAAAAQAAAAAEAAABAAAAAAgAAAFAQAAAAAAAAUDAAAAAAAABQQAAAAAAAAFBgAAAAAAAAUHAAAAAAAABQkAAAAAAAAFCgAAAAAAAAUMAAAAAAAABg4AAAAAAAEFEAAAAAAAAQUUAAAAAAABBRYAAAAAAAIFHAAAAAAAAwUgAAAAAAAEBTAAAAAgAAYFQAAAAAAABwWAAAAAAAAIBgABAAAAAAoGAAQAAAAADAYAEAAAIAAABAAAAAAAAAAEAQAAAAAAAAUCAAAAIAAABQQAAAAAAAAFBQAAACAAAAUHAAAAAAAABQgAAAAgAAAFCgAAAAAAAAULAAAAAAAABg0AAAAgAAEFEAAAAAAAAQUSAAAAIAABBRYAAAAAAAIFGAAAACAAAwUgAAAAAAADBSgAAAAAAAYEQAAAABAABgRAAAAAIAAHBYAAAAAAAAkGAAIAAAAACwYACAAAMAAABAAAAAAQAAAEAQAAACAAAAUCAAAAIAAABQMAAAAgAAAFBQAAACAAAAUGAAAAIAAABQgAAAAgAAAFCQAAACAAAAULAAAAIAAABQwAAAAAAAAGDwAAACAAAQUSAAAAIAABBRQAAAAgAAIFGAAAACAAAgUcAAAAIAADBSgAAAAgAAQFMAAAAAAAEAYAAAEAAAAPBgCAAAAAAA4GAEAAAAAADQYAIABBgBcLhwIBAAEBBQAAAAAAAAUAAAAAAAAGBD0AAAAAAAkF/QEAAAAADwX9fwAAAAAVBf3/HwAAAAMFBQAAAAAABwR9AAAAAAAMBf0PAAAAABIF/f8DAAAAFwX9/38AAAAFBR0AAAAAAAgE/QAAAAAADgX9PwAAAAAUBf3/DwAAAAIFAQAAABAABwR9AAAAAAALBf0HAAAAABEF/f8BAAAAFgX9/z8AAAAEBQ0AAAAQAAgE/QAAAAAADQX9HwAAAAATBf3/BwAAAAEFAQAAABAABgQ9AAAAAAAKBf0DAAAAABAF/f8AAAAAHAX9//8PAAAbBf3//wcAABoF/f//AwAAGQX9//8BAAAYBf3//wBBkBkLhgQBAAEBBgAAAAAAAAYDAAAAAAAABAQAAAAgAAAFBQAAAAAAAAUGAAAAAAAABQgAAAAAAAAFCQAAAAAAAAULAAAAAAAABg0AAAAAAAAGEAAAAAAAAAYTAAAAAAAABhYAAAAAAAAGGQAAAAAAAAYcAAAAAAAABh8AAAAAAAAGIgAAAAAAAQYlAAAAAAABBikAAAAAAAIGLwAAAAAAAwY7AAAAAAAEBlMAAAAAAAcGgwAAAAAACQYDAgAAEAAABAQAAAAAAAAEBQAAACAAAAUGAAAAAAAABQcAAAAgAAAFCQAAAAAAAAUKAAAAAAAABgwAAAAAAAAGDwAAAAAAAAYSAAAAAAAABhUAAAAAAAAGGAAAAAAAAAYbAAAAAAAABh4AAAAAAAAGIQAAAAAAAQYjAAAAAAABBicAAAAAAAIGKwAAAAAAAwYzAAAAAAAEBkMAAAAAAAUGYwAAAAAACAYDAQAAIAAABAQAAAAwAAAEBAAAABAAAAQFAAAAIAAABQcAAAAgAAAFCAAAACAAAAUKAAAAIAAABQsAAAAAAAAGDgAAAAAAAAYRAAAAAAAABhQAAAAAAAAGFwAAAAAAAAYaAAAAAAAABh0AAAAAAAAGIAAAAAAAEAYDAAEAAAAPBgOAAAAAAA4GA0AAAAAADQYDIAAAAAAMBgMQAAAAAAsGAwgAAAAACgYDBABBpB0L2QEBAAAAAwAAAAcAAAAPAAAAHwAAAD8AAAB/AAAA/wAAAP8BAAD/AwAA/wcAAP8PAAD/HwAA/z8AAP9/AAD//wAA//8BAP//AwD//wcA//8PAP//HwD//z8A//9/AP///wD///8B////A////wf///8P////H////z////9/AAAAAAEAAAACAAAABAAAAAAAAAACAAAABAAAAAgAAAAAAAAAAQAAAAIAAAABAAAABAAAAAQAAAAEAAAABAAAAAgAAAAIAAAACAAAAAcAAAAIAAAACQAAAAoAAAALAEGgIAsDwBBQ",Eb=new WeakMap;let Cb;class Sb extends $m{constructor(t){super(t),this.transcoderPath="",this.transcoderBinary=null,this.transcoderPending=null,this.workerPool=new Jy,this.workerSourceURL="",this.workerConfig=null}setTranscoderPath(t){return this.transcoderPath=t,this}setWorkerLimit(t){return this.workerPool.setWorkerLimit(t),this}async detectSupportAsync(t){return this.workerConfig={astcSupported:await t.hasFeatureAsync("texture-compression-astc"),etc1Supported:await t.hasFeatureAsync("texture-compression-etc1"),etc2Supported:await t.hasFeatureAsync("texture-compression-etc2"),dxtSupported:await t.hasFeatureAsync("texture-compression-bc"),bptcSupported:await t.hasFeatureAsync("texture-compression-bptc"),pvrtcSupported:await t.hasFeatureAsync("texture-compression-pvrtc")},this}detectSupport(t){return!0===t.isWebGPURenderer?this.workerConfig={astcSupported:t.hasFeature("texture-compression-astc"),etc1Supported:t.hasFeature("texture-compression-etc1"),etc2Supported:t.hasFeature("texture-compression-etc2"),dxtSupported:t.hasFeature("texture-compression-bc"),bptcSupported:t.hasFeature("texture-compression-bptc"),pvrtcSupported:t.hasFeature("texture-compression-pvrtc")}:this.workerConfig={astcSupported:t.extensions.has("WEBGL_compressed_texture_astc"),etc1Supported:t.extensions.has("WEBGL_compressed_texture_etc1"),etc2Supported:t.extensions.has("WEBGL_compressed_texture_etc"),dxtSupported:t.extensions.has("WEBGL_compressed_texture_s3tc"),bptcSupported:t.extensions.has("EXT_texture_compression_bptc"),pvrtcSupported:t.extensions.has("WEBGL_compressed_texture_pvrtc")||t.extensions.has("WEBKIT_WEBGL_compressed_texture_pvrtc")},this}init(){if(!this.transcoderPending){const t=new n_(this.manager);t.setPath(this.transcoderPath),t.setWithCredentials(this.withCredentials);const e=t.loadAsync("basis_transcoder.js"),n=new n_(this.manager);n.setPath(this.transcoderPath),n.setResponseType("arraybuffer"),n.setWithCredentials(this.withCredentials);const i=n.loadAsync("basis_transcoder.wasm");this.transcoderPending=Promise.all([e,i]).then((([t,e])=>{const n=Sb.BasisWorker.toString(),i=["/* constants */","let _EngineFormat = "+JSON.stringify(Sb.EngineFormat),"let _TranscoderFormat = "+JSON.stringify(Sb.TranscoderFormat),"let _BasisFormat = "+JSON.stringify(Sb.BasisFormat),"/* basis_transcoder.js */",t,"/* worker */",n.substring(n.indexOf("{")+1,n.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([i])),this.transcoderBinary=e,this.workerPool.setWorkerCreator((()=>{const t=new Worker(this.workerSourceURL),e=this.transcoderBinary.slice(0);return t.postMessage({type:"init",config:this.workerConfig,transcoderBinary:e},[e]),t}))}))}return this.transcoderPending}load(t,e,n,i){if(null===this.workerConfig)throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");const r=new n_(this.manager);r.setResponseType("arraybuffer"),r.setWithCredentials(this.withCredentials),r.load(t,(t=>{if(Eb.has(t)){return Eb.get(t).promise.then(e).catch(i)}this._createTexture(t).then((t=>e?e(t):null)).catch(i)}),n,i)}_createTextureFrom(t,e){const{faces:n,width:i,height:r,format:s,type:a,error:o,dfdFlags:c}=t;if("error"===a)return Promise.reject(o);let l;if(6===e.faceCount)l=new XA(n,s,Ra);else{const t=n[0].mipmaps;l=e.layerCount>1?new YA(t,i,r,e.layerCount,s,Ra):new qA(t,i,r,s,Ra)}return l.minFilter=1===n[0].mipmaps.length?Ia:Ba,l.magFilter=Ia,l.generateMipmaps=!1,l.needsUpdate=!0,l.colorSpace=Bb(e),l.premultiplyAlpha=!!(1&c),l}async _createTexture(t,e={}){const n=function(t){const e=new Uint8Array(t.buffer,t.byteOffset,gb.length);if(e[0]!==gb[0]||e[1]!==gb[1]||e[2]!==gb[2]||e[3]!==gb[3]||e[4]!==gb[4]||e[5]!==gb[5]||e[6]!==gb[6]||e[7]!==gb[7]||e[8]!==gb[8]||e[9]!==gb[9]||e[10]!==gb[10]||e[11]!==gb[11])throw new Error("Missing KTX 2.0 identifier.");const n=new fb,i=17*Uint32Array.BYTES_PER_ELEMENT,r=new Ab(t,gb.length,i,!0);n.vkFormat=r._nextUint32(),n.typeSize=r._nextUint32(),n.pixelWidth=r._nextUint32(),n.pixelHeight=r._nextUint32(),n.pixelDepth=r._nextUint32(),n.layerCount=r._nextUint32(),n.faceCount=r._nextUint32();const s=r._nextUint32();n.supercompressionScheme=r._nextUint32();const a=r._nextUint32(),o=r._nextUint32(),c=r._nextUint32(),l=r._nextUint32(),h=r._nextUint64(),u=r._nextUint64(),d=new Ab(t,gb.length+i,3*s*8,!0);for(let e=0;e<s;e++)n.levels.push({levelData:new Uint8Array(t.buffer,t.byteOffset+d._nextUint64(),d._nextUint64()),uncompressedByteLength:d._nextUint64()});const p=new Ab(t,a,o,!0),f={vendorId:p._skip(4)._nextUint16(),descriptorType:p._nextUint16(),versionNumber:p._nextUint16(),descriptorBlockSize:p._nextUint16(),colorModel:p._nextUint8(),colorPrimaries:p._nextUint8(),transferFunction:p._nextUint8(),flags:p._nextUint8(),texelBlockDimension:[p._nextUint8(),p._nextUint8(),p._nextUint8(),p._nextUint8()],bytesPlane:[p._nextUint8(),p._nextUint8(),p._nextUint8(),p._nextUint8(),p._nextUint8(),p._nextUint8(),p._nextUint8(),p._nextUint8()],samples:[]},A=(f.descriptorBlockSize/4-6)/4;for(let t=0;t<A;t++){const e={bitOffset:p._nextUint16(),bitLength:p._nextUint8(),channelType:p._nextUint8(),samplePosition:[p._nextUint8(),p._nextUint8(),p._nextUint8(),p._nextUint8()],sampleLower:-1/0,sampleUpper:1/0};64&e.channelType?(e.sampleLower=p._nextInt32(),e.sampleUpper=p._nextInt32()):(e.sampleLower=p._nextUint32(),e.sampleUpper=p._nextUint32()),f.samples[t]=e}n.dataFormatDescriptor.length=0,n.dataFormatDescriptor.push(f);const g=new Ab(t,c,l,!0);for(;g._offset<l;){const t=g._nextUint32(),e=g._scan(t),i=mb(e),r=g._scan(t-e.byteLength);n.keyValue[i]=i.match(/^ktx/i)?mb(r):r,g._offset%4&&g._skip(4-g._offset%4)}if(u<=0)return n;const m=new Ab(t,h,u,!0),_=m._nextUint16(),v=m._nextUint16(),y=m._nextUint32(),b=m._nextUint32(),x=m._nextUint32(),w=m._nextUint32(),E=[];for(let t=0;t<s;t++)E.push({imageFlags:m._nextUint32(),rgbSliceByteOffset:m._nextUint32(),rgbSliceByteLength:m._nextUint32(),alphaSliceByteOffset:m._nextUint32(),alphaSliceByteLength:m._nextUint32()});const C=h+m._offset,S=C+y,M=S+b,I=M+x,T=new Uint8Array(t.buffer,t.byteOffset+C,y),B=new Uint8Array(t.buffer,t.byteOffset+S,b),R=new Uint8Array(t.buffer,t.byteOffset+M,x),D=new Uint8Array(t.buffer,t.byteOffset+I,w);return n.globalData={endpointCount:_,selectorCount:v,imageDescs:E,endpointsData:T,selectorsData:B,tablesData:R,extendedData:D},n}(new Uint8Array(t));if(0!==n.vkFormat)return async function(t){const{vkFormat:e}=t;if(void 0===Ib[e])throw new Error("THREE.KTX2Loader: Unsupported vkFormat.");let n;2===t.supercompressionScheme&&(Cb||(Cb=new Promise((async t=>{const e=new xb;await e.init(),t(e)}))),n=await Cb);const i=[];for(let r=0;r<t.levels.length;r++){const s=Math.max(1,t.pixelWidth>>r),a=Math.max(1,t.pixelHeight>>r),o=t.pixelDepth?Math.max(1,t.pixelDepth>>r):0,c=t.levels[r];let l,h;if(0===t.supercompressionScheme)l=c.levelData;else{if(2!==t.supercompressionScheme)throw new Error("THREE.KTX2Loader: Unsupported supercompressionScheme.");l=n.decode(c.levelData,c.uncompressedByteLength)}h=Tb[e]===ka?new Float32Array(l.buffer,l.byteOffset,l.byteLength/Float32Array.BYTES_PER_ELEMENT):Tb[e]===Oa?new Uint16Array(l.buffer,l.byteOffset,l.byteLength/Uint16Array.BYTES_PER_ELEMENT):l,i.push({data:h,width:s,height:a,depth:o})}let r;if(Mb.has(Ib[e]))r=0===t.pixelDepth?new Wf(i[0].data,t.pixelWidth,t.pixelHeight):new Hc(i[0].data,t.pixelWidth,t.pixelHeight,t.pixelDepth);else{if(t.pixelDepth>0)throw new Error("THREE.KTX2Loader: Unsupported pixelDepth.");r=new qA(i,t.pixelWidth,t.pixelHeight)}return r.mipmaps=i,r.type=Tb[e],r.format=Ib[e],r.colorSpace=Bb(t),r.needsUpdate=!0,Promise.resolve(r)}(n);const i=e,r=this.init().then((()=>this.workerPool.postMessage({type:"transcode",buffer:t,taskConfig:i},[t]))).then((t=>this._createTextureFrom(t.data,n)));return Eb.set(t,{promise:r}),r}dispose(){return this.workerPool.dispose(),this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),this}}Sb.BasisFormat={ETC1S:0,UASTC_4x4:1},Sb.TranscoderFormat={ETC1:0,ETC2:1,BC1:2,BC3:3,BC4:4,BC5:5,BC7_M6_OPAQUE_ONLY:6,BC7_M5:7,PVRTC1_4_RGB:8,PVRTC1_4_RGBA:9,ASTC_4x4:10,ATC_RGB:11,ATC_RGBA_INTERPOLATED_ALPHA:12,RGBA32:13,RGB565:14,BGR565:15,RGBA4444:16},Sb.EngineFormat={RGBAFormat:Qa,RGBA_ASTC_4x4_Format:so,RGBA_BPTC_Format:yo,RGBA_ETC2_EAC_Format:ro,RGBA_PVRTC_4BPPV1_Format:to,RGBA_S3TC_DXT5_Format:Ka,RGB_ETC1_Format:no,RGB_ETC2_Format:io,RGB_PVRTC_4BPPV1_Format:Za,RGBA_S3TC_DXT1_Format:Xa},Sb.BasisWorker=function(){let t,e,n;const i=_EngineFormat,r=_TranscoderFormat,s=_BasisFormat;self.addEventListener("message",(function(a){const u=a.data;switch(u.type){case"init":t=u.config,d=u.transcoderBinary,e=new Promise((t=>{n={wasmBinary:d,onRuntimeInitialized:t},BASIS(n)})).then((()=>{n.initializeBasis(),n.KTX2File}));break;case"transcode":e.then((()=>{try{const{faces:e,buffers:a,width:d,height:p,hasAlpha:f,format:A,dfdFlags:g}=function(e){const a=new n.KTX2File(new Uint8Array(e));function u(){a.close(),a.delete()}if(!a.isValid())throw u(),new Error("THREE.KTX2Loader:\tInvalid or unsupported .ktx2 file");const d=a.isUASTC()?s.UASTC_4x4:s.ETC1S,p=a.getWidth(),f=a.getHeight(),A=a.getLayers()||1,g=a.getLevels(),m=a.getFaces(),_=a.getHasAlpha(),v=a.getDFDFlags(),{transcoderFormat:y,engineFormat:b}=function(e,n,a,h){let u,d;const p=e===s.ETC1S?o:c;for(let i=0;i<p.length;i++){const r=p[i];if(t[r.if]&&(r.basisFormat.includes(e)&&!(h&&r.transcoderFormat.length<2)&&(!r.needsPowerOfTwo||l(n)&&l(a))))return u=r.transcoderFormat[h?1:0],d=r.engineFormat[h?1:0],{transcoderFormat:u,engineFormat:d}}return u=r.RGBA32,d=i.RGBAFormat,{transcoderFormat:u,engineFormat:d}}(d,p,f,_);if(!p||!f||!g)throw u(),new Error("THREE.KTX2Loader:\tInvalid texture");if(!a.startTranscoding())throw u(),new Error("THREE.KTX2Loader: .startTranscoding failed");const x=[],w=[];for(let t=0;t<m;t++){const e=[];for(let n=0;n<g;n++){const i=[];let r,s;for(let e=0;e<A;e++){const o=a.getImageLevelInfo(n,e,t);0===t&&0===n&&0===e&&(o.origWidth%4!=0||o.origHeight),g>1?(r=o.origWidth,s=o.origHeight):(r=o.width,s=o.height);const c=new Uint8Array(a.getImageTranscodedSizeInBytes(n,e,0,y));if(!a.transcodeImage(c,n,e,t,y,0,-1,-1))throw u(),new Error("THREE.KTX2Loader: .transcodeImage failed.");i.push(c)}const o=h(i);e.push({data:o,width:r,height:s}),w.push(o.buffer)}x.push({mipmaps:e,width:p,height:f,format:b})}return u(),{faces:x,buffers:w,width:p,height:f,hasAlpha:_,format:b,dfdFlags:v}}(u.buffer);self.postMessage({type:"transcode",id:u.id,faces:e,width:d,height:p,hasAlpha:f,format:A,dfdFlags:g},a)}catch(t){self.postMessage({type:"error",id:u.id,error:t.message})}}))}var d}));const a=[{if:"astcSupported",basisFormat:[s.UASTC_4x4],transcoderFormat:[r.ASTC_4x4,r.ASTC_4x4],engineFormat:[i.RGBA_ASTC_4x4_Format,i.RGBA_ASTC_4x4_Format],priorityETC1S:1/0,priorityUASTC:1,needsPowerOfTwo:!1},{if:"bptcSupported",basisFormat:[s.ETC1S,s.UASTC_4x4],transcoderFormat:[r.BC7_M5,r.BC7_M5],engineFormat:[i.RGBA_BPTC_Format,i.RGBA_BPTC_Format],priorityETC1S:3,priorityUASTC:2,needsPowerOfTwo:!1},{if:"dxtSupported",basisFormat:[s.ETC1S,s.UASTC_4x4],transcoderFormat:[r.BC1,r.BC3],engineFormat:[i.RGBA_S3TC_DXT1_Format,i.RGBA_S3TC_DXT5_Format],priorityETC1S:4,priorityUASTC:5,needsPowerOfTwo:!1},{if:"etc2Supported",basisFormat:[s.ETC1S,s.UASTC_4x4],transcoderFormat:[r.ETC1,r.ETC2],engineFormat:[i.RGB_ETC2_Format,i.RGBA_ETC2_EAC_Format],priorityETC1S:1,priorityUASTC:3,needsPowerOfTwo:!1},{if:"etc1Supported",basisFormat:[s.ETC1S,s.UASTC_4x4],transcoderFormat:[r.ETC1],engineFormat:[i.RGB_ETC1_Format],priorityETC1S:2,priorityUASTC:4,needsPowerOfTwo:!1},{if:"pvrtcSupported",basisFormat:[s.ETC1S,s.UASTC_4x4],transcoderFormat:[r.PVRTC1_4_RGB,r.PVRTC1_4_RGBA],engineFormat:[i.RGB_PVRTC_4BPPV1_Format,i.RGBA_PVRTC_4BPPV1_Format],priorityETC1S:5,priorityUASTC:6,needsPowerOfTwo:!0}],o=a.sort((function(t,e){return t.priorityETC1S-e.priorityETC1S})),c=a.sort((function(t,e){return t.priorityUASTC-e.priorityUASTC}));function l(t){return t<=2||!(t&t-1)&&0!==t}function h(t){if(1===t.length)return t[0];let e=0;for(let n=0;n<t.length;n++){e+=t[n].byteLength}const n=new Uint8Array(e);let i=0;for(let e=0;e<t.length;e++){const r=t[e];n.set(r,i),i+=r.byteLength}return n}};const Mb=new Set([Qa,ja,Ha]),Ib={[ub]:Qa,[cb]:Qa,[rb]:Qa,[sb]:Qa,[hb]:ja,[ob]:ja,[nb]:ja,[ib]:ja,[lb]:Ha,[ab]:Ha,[eb]:Ha,[tb]:Ha,[pb]:lo,[db]:lo},Tb={[ub]:ka,[cb]:Oa,[rb]:Ra,[sb]:Ra,[hb]:ka,[ob]:Oa,[nb]:Ra,[ib]:Ra,[lb]:ka,[ab]:Oa,[eb]:Ra,[tb]:Ra,[pb]:Ra,[db]:Ra};function Bb(t){const e=t.dataFormatDescriptor[0];return e.colorPrimaries===Zy?e.transferFunction===Ky?Oo:Uo:e.colorPrimaries===$y?e.transferFunction===Ky?No:Fo:(e.colorPrimaries,ko)}var Rb=function(){var t=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]),e=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if("object"!=typeof WebAssembly)return{supported:!1};var n,i=WebAssembly.validate(t)?"b9H79TebbbeKl9Gbb9Gvuuuuueu9Giuuub9Geueuikqbbebeedddilve9Weeeviebeoweuec:q;Aekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbdY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVblE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtboK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbrL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbwl79IV9RbDq;t9tqlbzik9:evu8Jjjjjbcz9Rhbcbheincbhdcbhiinabcwfadfaicjuaead4ceGglE86bbaialfhiadcefgdcw9hmbkaec:q:yjjbfai86bbaecitc:q1jjbfab8Piw83ibaecefgecjd9hmbkk;h8JlHud97euo978Jjjjjbcj;kb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Rad;8qbbcj;abad9UhoaicefhldnadTmbaoc;WFbGgocjdaocjd6EhwcbhDinaDae9pmeawaeaD9RaDawfae6Egqcsfgoc9WGgkci2hxakcethmaocl4cifcd4hPabaDad2fhscbhzdnincehHalhOcbhAdninaraO9RaP6miavcj;cbfaAak2fhCaOaPfhlcbhidnakc;ab6mbaral9Rc;Gb6mbcbhoinaCaofhidndndndndnaOaoco4fRbbgXciGPlbedibkaipxbbbbbbbbbbbbbbbbpklbxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklbalczfhlkdndndndndnaXcd4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklzxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklzalczfhlkdndndndndnaXcl4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklaxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklaalczfhlkdndndndndnaXco4Plbedibkaipxbbbbbbbbbbbbbbbbpkl8WxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WalclfaYpQbfaXc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WalcwfaYpQbfaXc:q:yjjbfRbbfhlxekaialpbbbpkl8Walczfhlkaoc;abfhiaocjefak0meaihoaral9Rc;Fb0mbkkdndnaiak9pmbaici4hoinaral9RcK6mdaCaifhXdndndndndnaOaico4fRbbaocoG4ciGPlbedibkaXpxbbbbbbbbbbbbbbbbpklbxikaXalpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaXalpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaXalpbbbpklbalczfhlkaocdfhoaiczfgiak6mbkkalTmbaAci6hHalhOaAcefgohAaoclSmdxekkcbhlaHceGmdkdnakTmbavcjdfazfhiavazfpbdbhYcbhXinaiavcj;cbfaXfgopblbgLcep9TaLpxeeeeeeeeeeeeeeeegQp9op9Hp9rgLaoakfpblbg8Acep9Ta8AaQp9op9Hp9rg8ApmbzeHdOiAlCvXoQrLgEaoamfpblbg3cep9Ta3aQp9op9Hp9rg3aoaxfpblbg5cep9Ta5aQp9op9Hp9rg5pmbzeHdOiAlCvXoQrLg8EpmbezHdiOAlvCXorQLgQaQpmbedibedibedibediaYp9UgYp9AdbbaiadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaEa8EpmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaLa8ApmwKDYq8AkEx3m5P8Es8FgLa3a5pmwKDYq8AkEx3m5P8Es8Fg8ApmbezHdiOAlvCXorQLgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaLa8ApmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfhiaXczfgXak6mbkkazclfgzad6mbkasavcjdfaqad2;8qbbavavcjdfaqcufad2fad;8qbbaqaDfhDc9:hoalmexikkc9:hoxekcbc99aral9Radcaadca0ESEhokavcj;kbf8Kjjjjbaokwbz:bjjjbk;uzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecje;8kbavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhDcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgrc;Ve0mbavc;abfalarcl4cu7fcsGcitfgPydlhsaPydbhzdnarcsGgPak9pmbavaiarcu7fcsGcdtfydbaxaPEhraPThPdndnadcd9hmbabaDcetfgHaz87ebaHcdfas87ebaHclfar87ebxekabaDcdtfgHazBdbaHclfasBdbaHcwfarBdbkaxaPfhxavc;abfalcitfgHarBdbaHasBdlavaicdtfarBdbavc;abfalcefcsGglcitfgHazBdbaHarBdlaiaPfhialcefhlxdkdndnaPcsSmbamaPfaPc987fcefhmxekaocefhrao8SbbgPcFeGhHdndnaPcu9mmbarhoxekaocvfhoaHcFbGhHcrhPdninar8SbbgOcFbGaPtaHVhHaOcu9kmearcefhraPcrfgPc8J9hmbxdkkarcefhokaHce4cbaHceG9R7amfhmkdndnadcd9hmbabaDcetfgraz87ebarcdfas87ebarclfam87ebxekabaDcdtfgrazBdbarclfasBdbarcwfamBdbkavc;abfalcitfgramBdbarasBdlavaicdtfamBdbavc;abfalcefcsGglcitfgrazBdbaramBdlaicefhialcefhlxekdnarcpe0mbaxcefgOavaiaqarcsGfRbbgPcl49RcsGcdtfydbaPcz6gHEhravaiaP9RcsGcdtfydbaOaHfgsaPcsGgOEhPaOThOdndnadcd9hmbabaDcetfgzax87ebazcdfar87ebazclfaP87ebxekabaDcdtfgzaxBdbazclfarBdbazcwfaPBdbkavaicdtfaxBdbavc;abfalcitfgzarBdbazaxBdlavaicefgicsGcdtfarBdbavc;abfalcefcsGcitfgzaPBdbazarBdlavaiaHfcsGgicdtfaPBdbavc;abfalcdfcsGglcitfgraxBdbaraPBdlalcefhlaiaOfhiasaOfhxxekaxcbaoRbbgzEgAarc;:eSgrfhsazcsGhCazcl4hXdndnazcs0mbascefhOxekashOavaiaX9RcsGcdtfydbhskdndnaCmbaOcefhxxekaOhxavaiaz9RcsGcdtfydbhOkdndnarTmbaocefhrxekaocdfhrao8SbegHcFeGhPdnaHcu9kmbaocofhAaPcFbGhPcrhodninar8SbbgHcFbGaotaPVhPaHcu9kmearcefhraocrfgoc8J9hmbkaAhrxekarcefhrkaPce4cbaPceG9R7amfgmhAkdndnaXcsSmbarhPxekarcefhPar8SbbgocFeGhHdnaocu9kmbarcvfhsaHcFbGhHcrhodninaP8SbbgrcFbGaotaHVhHarcu9kmeaPcefhPaocrfgoc8J9hmbkashPxekaPcefhPkaHce4cbaHceG9R7amfgmhskdndnaCcsSmbaPhoxekaPcefhoaP8SbbgrcFeGhHdnarcu9kmbaPcvfhOaHcFbGhHcrhrdninao8SbbgPcFbGartaHVhHaPcu9kmeaocefhoarcrfgrc8J9hmbkaOhoxekaocefhokaHce4cbaHceG9R7amfgmhOkdndnadcd9hmbabaDcetfgraA87ebarcdfas87ebarclfaO87ebxekabaDcdtfgraABdbarclfasBdbarcwfaOBdbkavc;abfalcitfgrasBdbaraABdlavaicdtfaABdbavc;abfalcefcsGcitfgraOBdbarasBdlavaicefgicsGcdtfasBdbavc;abfalcdfcsGcitfgraABdbaraOBdlavaiazcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiaDcifgDae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:llevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:EPliuo97eue978Jjjjjbca9Rhidndnadcl9hmbdnaec98GglTmbcbhvabhdinadadpbbbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDpxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpkbbadczfhdavclfgval6mbkkalae9pmeaiaeciGgvcdtgdVcbczad9R;8kbaiabalcdtfglad;8qbbdnavTmbaiaipblbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDpxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpklbkalaiad;8qbbskdnaec98GgxTmbcbhvabhdinadczfglalpbbbgopxbbbbbbFFbbbbbbFFgkp9oadpbbbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eaDaopmbediwDqkzHOAKY8AEgoczp:Sep;6egrp;Geaoczp:Reczp:Sep;6egwp;Gep;Kep;Legopxb;:FSb;:FSb;:FSb;:FSawaopxbbbbbbbbbbbbbbbbp:2egqawpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegwawp;Meaoaop;Mearaqaramp9op9rp;Kegoaop;Mep;Kep;Kep;Jep;Negrp;Mepxbbn0bbn0bbn0bbn0gqp;Keczp:Reawarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9op9qgwaoarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpkbbadaDakp9oawaopmbezHdiOAlvCXorQLp9qpkbbadcafhdavclfgvax6mbkkaxae9pmbaiaeciGgvcitgdfcbcaad9R;8kbaiabaxcitfglad;8qbbdnavTmbaiaipblzgopxbbbbbbFFbbbbbbFFgkp9oaipblbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eaDaopmbediwDqkzHOAKY8AEgoczp:Sep;6egrp;Geaoczp:Reczp:Sep;6egwp;Gep;Kep;Legopxb;:FSb;:FSb;:FSb;:FSawaopxbbbbbbbbbbbbbbbbp:2egqawpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegwawp;Meaoaop;Mearaqaramp9op9rp;Kegoaop;Mep;Kep;Kep;Jep;Negrp;Mepxbbn0bbn0bbn0bbn0gqp;Keczp:Reawarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9op9qgwaoarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpklzaiaDakp9oawaopmbezHdiOAlvCXorQLp9qpklbkalaiad;8qbbkk;4wllue97euv978Jjjjjbc8W9Rhidnaec98GglTmbcbhvabhoinaiaopbbbgraoczfgwpbbbgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklbaopxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaqakp;Mearp;Keczp:ReaDakp;Mearp;Keamp9op9qgkpmbezHdiOAlvCXorQLgrp5baipblbpEb:T:j83ibaocwfarp5eaipblbpEe:T:j83ibawaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblbpEd:T:j83ibaocKfakp5eaipblbpEi:T:j83ibaocafhoavclfgval6mbkkdnalae9pmbaiaeciGgvcitgofcbcaao9R;8kbaiabalcitfgwao;8qbbdnavTmbaiaipblbgraipblzgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklaaipxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaqakp;Mearp;Keczp:ReaDakp;Mearp;Keamp9op9qgkpmbezHdiOAlvCXorQLgrp5baipblapEb:T:j83ibaiarp5eaipblapEe:T:j83iwaiaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblapEd:T:j83izaiakp5eaipblapEi:T:j83iKkawaiao;8qbbkk:Pddiue978Jjjjjbc;ab9Rhidnadcd4ae2glc98GgvTmbcbhdabheinaeaepbbbgocwp:Recwp:Sep;6eaocep:SepxbbjZbbjZbbjZbbjZp:UepxbbjFbbjFbbjFbbjFp9op;Mepkbbaeczfheadclfgdav6mbkkdnaval9pmbaialciGgdcdtgeVcbc;abae9R;8kbaiabavcdtfgvae;8qbbdnadTmbaiaipblbgocwp:Recwp:Sep;6eaocep:SepxbbjZbbjZbbjZbbjZp:UepxbbjFbbjFbbjFbbjFp9op;Mepklbkavaiae;8qbbkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaikkkebcjwklz9Tbb":"b9H79Tebbbe8Fv9Gbb9Gvuuuuueu9Giuuub9Geueu9Giuuueuikqbeeedddillviebeoweuec:q;iekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbeY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVbdE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbiL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtblK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbol79IV9Rbrq:P8Yqdbk;3sezu8Jjjjjbcj;eb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Radz1jjjbhwcj;abad9UhoaicefhldnadTmbaoc;WFbGgocjdaocjd6EhDcbhqinaqae9pmeaDaeaq9RaqaDfae6Egkcsfgocl4cifcd4hxdndndndnaoc9WGgmTmbcbhPcehsawcjdfhzalhHinaraH9Rax6midnaraHaxfgl9RcK6mbczhoinawcj;cbfaogifgoc9WfhOdndndndndnaHaic9WfgAco4fRbbaAci4coG4ciGPlbedibkaO9cb83ibaOcwf9cb83ibxikaOalRblalRbbgAco4gCaCciSgCE86bbaocGfalclfaCfgORbbaAcl4ciGgCaCciSgCE86bbaocVfaOaCfgORbbaAcd4ciGgCaCciSgCE86bbaoc7faOaCfgORbbaAciGgAaAciSgAE86bbaoctfaOaAfgARbbalRbegOco4gCaCciSgCE86bbaoc91faAaCfgARbbaOcl4ciGgCaCciSgCE86bbaoc4faAaCfgARbbaOcd4ciGgCaCciSgCE86bbaoc93faAaCfgARbbaOciGgOaOciSgOE86bbaoc94faAaOfgARbbalRbdgOco4gCaCciSgCE86bbaoc95faAaCfgARbbaOcl4ciGgCaCciSgCE86bbaoc96faAaCfgARbbaOcd4ciGgCaCciSgCE86bbaoc97faAaCfgARbbaOciGgOaOciSgOE86bbaoc98faAaOfgORbbalRbiglco4gAaAciSgAE86bbaoc99faOaAfgORbbalcl4ciGgAaAciSgAE86bbaoc9:faOaAfgORbbalcd4ciGgAaAciSgAE86bbaocufaOaAfgoRbbalciGglalciSglE86bbaoalfhlxdkaOalRbwalRbbgAcl4gCaCcsSgCE86bbaocGfalcwfaCfgORbbaAcsGgAaAcsSgAE86bbaocVfaOaAfgORbbalRbegAcl4gCaCcsSgCE86bbaoc7faOaCfgORbbaAcsGgAaAcsSgAE86bbaoctfaOaAfgORbbalRbdgAcl4gCaCcsSgCE86bbaoc91faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc4faOaAfgORbbalRbigAcl4gCaCcsSgCE86bbaoc93faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc94faOaAfgORbbalRblgAcl4gCaCcsSgCE86bbaoc95faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc96faOaAfgORbbalRbvgAcl4gCaCcsSgCE86bbaoc97faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc98faOaAfgORbbalRbogAcl4gCaCcsSgCE86bbaoc99faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc9:faOaAfgORbbalRbrglcl4gAaAcsSgAE86bbaocufaOaAfgoRbbalcsGglalcsSglE86bbaoalfhlxekaOal8Pbb83bbaOcwfalcwf8Pbb83bbalczfhlkdnaiam9pmbaiczfhoaral9RcL0mekkaiam6mialTmidnakTmbawaPfRbbhOcbhoazhiinaiawcj;cbfaofRbbgAce4cbaAceG9R7aOfgO86bbaiadfhiaocefgoak9hmbkkazcefhzaPcefgPad6hsalhHaPad9hmexvkkcbhlasceGmdxikalaxad2fhCdnakTmbcbhHcehsawcjdfhminaral9Rax6mialTmdalaxfhlawaHfRbbhOcbhoamhiinaiawcj;cbfaofRbbgAce4cbaAceG9R7aOfgO86bbaiadfhiaocefgoak9hmbkamcefhmaHcefgHad6hsaHad9hmbkaChlxikcbhocehsinaral9Rax6mdalTmealaxfhlaocefgoad6hsadao9hmbkaChlxdkcbhlasceGTmekc9:hoxikabaqad2fawcjdfakad2z1jjjb8Aawawcjdfakcufad2fadz1jjjb8Aakaqfhqalmbkc9:hoxekcbc99aral9Radcaadca0ESEhokavcj;ebf8Kjjjjbaok;yzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecjez:jjjjb8AavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhDcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgrc;Ve0mbavc;abfalarcl4cu7fcsGcitfgPydlhsaPydbhzdnarcsGgPak9pmbavaiarcu7fcsGcdtfydbaxaPEhraPThPdndnadcd9hmbabaDcetfgHaz87ebaHcdfas87ebaHclfar87ebxekabaDcdtfgHazBdbaHclfasBdbaHcwfarBdbkaxaPfhxavc;abfalcitfgHarBdbaHasBdlavaicdtfarBdbavc;abfalcefcsGglcitfgHazBdbaHarBdlaiaPfhialcefhlxdkdndnaPcsSmbamaPfaPc987fcefhmxekaocefhrao8SbbgPcFeGhHdndnaPcu9mmbarhoxekaocvfhoaHcFbGhHcrhPdninar8SbbgOcFbGaPtaHVhHaOcu9kmearcefhraPcrfgPc8J9hmbxdkkarcefhokaHce4cbaHceG9R7amfhmkdndnadcd9hmbabaDcetfgraz87ebarcdfas87ebarclfam87ebxekabaDcdtfgrazBdbarclfasBdbarcwfamBdbkavc;abfalcitfgramBdbarasBdlavaicdtfamBdbavc;abfalcefcsGglcitfgrazBdbaramBdlaicefhialcefhlxekdnarcpe0mbaxcefgOavaiaqarcsGfRbbgPcl49RcsGcdtfydbaPcz6gHEhravaiaP9RcsGcdtfydbaOaHfgsaPcsGgOEhPaOThOdndnadcd9hmbabaDcetfgzax87ebazcdfar87ebazclfaP87ebxekabaDcdtfgzaxBdbazclfarBdbazcwfaPBdbkavaicdtfaxBdbavc;abfalcitfgzarBdbazaxBdlavaicefgicsGcdtfarBdbavc;abfalcefcsGcitfgzaPBdbazarBdlavaiaHfcsGgicdtfaPBdbavc;abfalcdfcsGglcitfgraxBdbaraPBdlalcefhlaiaOfhiasaOfhxxekaxcbaoRbbgzEgAarc;:eSgrfhsazcsGhCazcl4hXdndnazcs0mbascefhOxekashOavaiaX9RcsGcdtfydbhskdndnaCmbaOcefhxxekaOhxavaiaz9RcsGcdtfydbhOkdndnarTmbaocefhrxekaocdfhrao8SbegHcFeGhPdnaHcu9kmbaocofhAaPcFbGhPcrhodninar8SbbgHcFbGaotaPVhPaHcu9kmearcefhraocrfgoc8J9hmbkaAhrxekarcefhrkaPce4cbaPceG9R7amfgmhAkdndnaXcsSmbarhPxekarcefhPar8SbbgocFeGhHdnaocu9kmbarcvfhsaHcFbGhHcrhodninaP8SbbgrcFbGaotaHVhHarcu9kmeaPcefhPaocrfgoc8J9hmbkashPxekaPcefhPkaHce4cbaHceG9R7amfgmhskdndnaCcsSmbaPhoxekaPcefhoaP8SbbgrcFeGhHdnarcu9kmbaPcvfhOaHcFbGhHcrhrdninao8SbbgPcFbGartaHVhHaPcu9kmeaocefhoarcrfgrc8J9hmbkaOhoxekaocefhokaHce4cbaHceG9R7amfgmhOkdndnadcd9hmbabaDcetfgraA87ebarcdfas87ebarclfaO87ebxekabaDcdtfgraABdbarclfasBdbarcwfaOBdbkavc;abfalcitfgrasBdbaraABdlavaicdtfaABdbavc;abfalcefcsGcitfgraOBdbarasBdlavaicefgicsGcdtfasBdbavc;abfalcdfcsGcitfgraABdbaraOBdlavaiazcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiaDcifgDae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:llevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:Lvoeue99dud99eud99dndnadcl9hmbaeTmeindndnabcdfgd8Sbb:Yab8Sbbgi:Ygl:l:tabcefgv8Sbbgo:Ygr:l:tgwJbb;:9cawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai86bbdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad86bbdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad86bbabclfhbaecufgembxdkkaeTmbindndnabclfgd8Ueb:Yab8Uebgi:Ygl:l:tabcdfgv8Uebgo:Ygr:l:tgwJb;:FSawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai87ebdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad87ebdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad87ebabcwfhbaecufgembkkk;siliui99iue99dnaeTmbcbhiabhlindndnJ;Zl81Zalcof8UebgvciV:Y:vgoal8Ueb:YNgrJb;:FSNJbbbZJbbb:;arJbbbb9GEMgw:lJbbb9p9DTmbaw:OhDxekcjjjj94hDkalclf8Uebhqalcdf8UebhkabavcefciGaiVcetfaD87ebdndnaoak:YNgwJb;:FSNJbbbZJbbb:;awJbbbb9GEMgx:lJbbb9p9DTmbax:Ohkxekcjjjj94hkkabavcdfciGaiVcetfak87ebdndnaoaq:YNgoJb;:FSNJbbbZJbbb:;aoJbbbb9GEMgx:lJbbb9p9DTmbax:Ohqxekcjjjj94hqkabavcufciGaiVcetfaq87ebdndnJbbjZararN:tawawN:taoaoN:tgrJbbbbarJbbbb9GE:rJb;:FSNJbbbZMgr:lJbbb9p9DTmbar:Ohqxekcjjjj94hqkabavciGaiVcetfaq87ebalcwfhlaiclfhiaecufgembkkk9mbdnadcd4ae2geTmbinababydbgdcwtcw91:Yadce91cjjj;8ifcjjj98G::NUdbabclfhbaecufgembkkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik;LeeeudndnaeabVciGTmbabhixekdndnadcz9pmbabhixekabhiinaiaeydbBdbaiclfaeclfydbBdbaicwfaecwfydbBdbaicxfaecxfydbBdbaiczfhiaeczfheadc9Wfgdcs0mbkkadcl6mbinaiaeydbBdbaeclfheaiclfhiadc98fgdci0mbkkdnadTmbinaiaeRbb86bbaicefhiaecefheadcufgdmbkkabk;aeedudndnabciGTmbabhixekaecFeGc:b:c:ew2hldndnadcz9pmbabhixekabhiinaialBdbaicxfalBdbaicwfalBdbaiclfalBdbaiczfhiadc9Wfgdcs0mbkkadcl6mbinaialBdbaiclfhiadc98fgdci0mbkkdnadTmbinaiae86bbaicefhiadcufgdmbkkabkkkebcjwklz9Kbb",r=WebAssembly.instantiate(s(i),{}).then((function(t){(n=t.instance).exports.__wasm_call_ctors()}));function s(t){for(var n=new Uint8Array(t.length),i=0;i<t.length;++i){var r=t.charCodeAt(i);n[i]=r>96?r-97:r>64?r-39:r+4}var s=0;for(i=0;i<t.length;++i)n[s++]=n[i]<60?e[n[i]]:64*(n[i]-60)+n[++i];return n.buffer.slice(0,s)}function a(t,e,i,r,s,a){var o=n.exports.sbrk,c=i+3&-4,l=o(c*r),h=o(s.length),u=new Uint8Array(n.exports.memory.buffer);u.set(s,h);var d=t(l,i,r,h,s.length);if(0==d&&a&&a(l,c,r),e.set(u.subarray(l,l+i*r)),o(l-o(0)),0!=d)throw new Error("Malformed buffer data: "+d)}var o={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},c={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"},l=[],h=0;function u(t){var e={object:new Worker(t),pending:0,requests:{}};return e.object.onmessage=function(t){var n=t.data;e.pending-=n.count,e.requests[n.id][n.action](n.value),delete e.requests[n.id]},e}function d(t){for(var e="var instance; var ready = WebAssembly.instantiate(new Uint8Array(["+new Uint8Array(s(i))+"]), {}).then(function(result) { instance = result.instance; instance.exports.__wasm_call_ctors(); });self.onmessage = workerProcess;"+a.toString()+p.toString(),n=new Blob([e],{type:"text/javascript"}),r=URL.createObjectURL(n),o=0;o<t;++o)l[o]=u(r);URL.revokeObjectURL(r)}function p(t){r.then((function(){var e=t.data;try{var i=new Uint8Array(e.count*e.size);a(n.exports[e.mode],i,e.count,e.size,e.source,n.exports[e.filter]),self.postMessage({id:e.id,count:e.count,action:"resolve",value:i},[i.buffer])}catch(t){self.postMessage({id:e.id,count:e.count,action:"reject",value:t})}}))}return{ready:r,supported:!0,useWorkers:function(t){d(t)},decodeVertexBuffer:function(t,e,i,r,s){a(n.exports.meshopt_decodeVertexBuffer,t,e,i,r,n.exports[o[s]])},decodeIndexBuffer:function(t,e,i,r){a(n.exports.meshopt_decodeIndexBuffer,t,e,i,r)},decodeIndexSequence:function(t,e,i,r){a(n.exports.meshopt_decodeIndexSequence,t,e,i,r)},decodeGltfBuffer:function(t,e,i,r,s,l){a(n.exports[c[s]],t,e,i,r,n.exports[o[l]])},decodeGltfBufferAsync:function(t,e,i,s,u){return l.length>0?function(t,e,n,i,r){for(var s=l[0],a=1;a<l.length;++a)l[a].pending<s.pending&&(s=l[a]);return new Promise((function(a,o){var c=new Uint8Array(n),l=h++;s.pending+=t,s.requests[l]={resolve:a,reject:o},s.object.postMessage({id:l,count:t,size:e,source:c,mode:i,filter:r},[c.buffer])}))}(t,e,i,c[s],o[u]):r.then((function(){var r=new Uint8Array(t*e);return a(n.exports[c[s]],r,t,e,i,n.exports[o[u]]),r}))}}}();const Db=new WeakMap;class Lb extends $m{constructor(t){super(t),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(t){return this.decoderPath=t,this}setDecoderConfig(t){return this.decoderConfig=t,this}setWorkerLimit(t){return this.workerLimit=t,this}load(t,e,n,i){const r=new n_(this.manager);r.setPath(this.path),r.setResponseType("arraybuffer"),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials),r.load(t,(t=>{this.parse(t,e,i)}),n,i)}parse(t,e,n=()=>{}){this.decodeDracoFile(t,e,null,null,Oo,n).catch(n)}decodeDracoFile(t,e,n,i,r=Uo,s=()=>{}){const a={attributeIDs:n||this.defaultAttributeIDs,attributeTypes:i||this.defaultAttributeTypes,useUniqueIDs:!!n,vertexColorSpace:r};return this.decodeGeometry(t,a).then(e).catch(s)}decodeGeometry(t,e){const n=JSON.stringify(e);if(Db.has(t)){const e=Db.get(t);if(e.key===n)return e.promise;if(0===t.byteLength)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let i;const r=this.workerNextTaskID++,s=t.byteLength,a=this._getWorker(r,s).then((n=>(i=n,new Promise(((n,s)=>{i._callbacks[r]={resolve:n,reject:s},i.postMessage({type:"decode",id:r,taskConfig:e,buffer:t},[t])}))))).then((t=>this._createGeometry(t.geometry)));return a.catch((()=>!0)).then((()=>{i&&r&&this._releaseTask(i,r)})),Db.set(t,{key:n,promise:a}),a}_createGeometry(t){const e=new Lh;t.index&&e.setIndex(new xh(t.index.array,1));for(let n=0;n<t.attributes.length;n++){const i=t.attributes[n],r=i.name,s=i.array,a=i.itemSize,o=new xh(s,a);"color"===r&&(this._assignVertexColorSpace(o,i.vertexColorSpace),o.normalized=s instanceof Float32Array==!1),e.setAttribute(r,o)}return e}_assignVertexColorSpace(t,e){if(e!==Oo)return;const n=new hh;for(let e=0,i=t.count;e<i;e++)n.fromBufferAttribute(t,e).convertSRGBToLinear(),t.setXYZ(e,n.r,n.g,n.b)}_loadLibrary(t,e){const n=new n_(this.manager);return n.setPath(this.decoderPath),n.setResponseType(e),n.setWithCredentials(this.withCredentials),new Promise(((e,i)=>{n.load(t,e,void 0,i)}))}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const t="object"!=typeof WebAssembly||"js"===this.decoderConfig.type,e=[];return t?e.push(this._loadLibrary("draco_decoder.js","text")):(e.push(this._loadLibrary("draco_wasm_wrapper.js","text")),e.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(e).then((e=>{const n=e[0];t||(this.decoderConfig.wasmBinary=e[1]);const i=Pb.toString(),r=["/* draco decoder */",n,"","/* worker */",i.substring(i.indexOf("{")+1,i.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([r]))})),this.decoderPending}_getWorker(t,e){return this._initDecoder().then((()=>{if(this.workerPool.length<this.workerLimit){const t=new Worker(this.workerSourceURL);t._callbacks={},t._taskCosts={},t._taskLoad=0,t.postMessage({type:"init",decoderConfig:this.decoderConfig}),t.onmessage=function(e){const n=e.data;switch(n.type){case"decode":t._callbacks[n.id].resolve(n);break;case"error":t._callbacks[n.id].reject(n)}},this.workerPool.push(t)}else this.workerPool.sort((function(t,e){return t._taskLoad>e._taskLoad?-1:1}));const n=this.workerPool[this.workerPool.length-1];return n._taskCosts[t]=e,n._taskLoad+=e,n}))}_releaseTask(t,e){t._taskLoad-=t._taskCosts[e],delete t._callbacks[e],delete t._taskCosts[e]}debug(){}dispose(){for(let t=0;t<this.workerPool.length;++t)this.workerPool[t].terminate();return this.workerPool.length=0,""!==this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),this}}function Pb(){let t,e;function n(t,e,n,i,r,s){const a=s.num_components(),o=n.num_points()*a,c=o*r.BYTES_PER_ELEMENT,l=function(t,e){switch(e){case Float32Array:return t.DT_FLOAT32;case Int8Array:return t.DT_INT8;case Int16Array:return t.DT_INT16;case Int32Array:return t.DT_INT32;case Uint8Array:return t.DT_UINT8;case Uint16Array:return t.DT_UINT16;case Uint32Array:return t.DT_UINT32}}(t,r),h=t._malloc(c);e.GetAttributeDataArrayForAllPoints(n,s,l,c,h);const u=new r(t.HEAPF32.buffer,h,o).slice();return t._free(h),{name:i,array:u,itemSize:a}}onmessage=function(i){const r=i.data;switch(r.type){case"init":t=r.decoderConfig,e=new Promise((function(e){t.onModuleLoaded=function(t){e({draco:t})},DracoDecoderModule(t)}));break;case"decode":const i=r.buffer,s=r.taskConfig;e.then((t=>{const e=t.draco,a=new e.Decoder;try{const t=function(t,e,i,r){const s=r.attributeIDs,a=r.attributeTypes;let o,c;const l=e.GetEncodedGeometryType(i);if(l===t.TRIANGULAR_MESH)o=new t.Mesh,c=e.DecodeArrayToMesh(i,i.byteLength,o);else{if(l!==t.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");o=new t.PointCloud,c=e.DecodeArrayToPointCloud(i,i.byteLength,o)}if(!c.ok()||0===o.ptr)throw new Error("THREE.DRACOLoader: Decoding failed: "+c.error_msg());const h={index:null,attributes:[]};for(const i in s){const c=self[a[i]];let l,u;if(r.useUniqueIDs)u=s[i],l=e.GetAttributeByUniqueId(o,u);else{if(u=e.GetAttributeId(o,t[s[i]]),-1===u)continue;l=e.GetAttribute(o,u)}const d=n(t,e,o,i,c,l);"color"===i&&(d.vertexColorSpace=r.vertexColorSpace),h.attributes.push(d)}l===t.TRIANGULAR_MESH&&(h.index=function(t,e,n){const i=n.num_faces(),r=3*i,s=4*r,a=t._malloc(s);e.GetTrianglesUInt32Array(n,s,a);const o=new Uint32Array(t.HEAPF32.buffer,a,r).slice();return t._free(a),{array:o,itemSize:1}}(t,e,o));return t.destroy(o),h}(e,a,new Int8Array(i),s),o=t.attributes.map((t=>t.array.buffer));t.index&&o.push(t.index.array.buffer),self.postMessage({type:"decode",id:r.id,geometry:t},o)}catch(t){self.postMessage({type:"error",id:r.id,error:t.message})}finally{e.destroy(a)}}))}}}class kb extends s_{constructor(t){super(t),this.type=Oa}parse(t){const e=function(t,e){switch(t){case 1:throw new Error("THREE.RGBELoader: Read Error: "+(e||""));case 2:throw new Error("THREE.RGBELoader: Write Error: "+(e||""));case 3:throw new Error("THREE.RGBELoader: Bad File Format: "+(e||""));default:throw new Error("THREE.RGBELoader: Memory Error: "+(e||""))}},n=function(t,e,n){e=e||1024;let i=t.pos,r=-1,s=0,a="",o=String.fromCharCode.apply(null,new Uint16Array(t.subarray(i,i+128)));for(;0>(r=o.indexOf("\n"))&&s<e&&i<t.byteLength;)a+=o,s+=o.length,i+=128,o+=String.fromCharCode.apply(null,new Uint16Array(t.subarray(i,i+128)));return-1<r&&(t.pos+=s+r+1,a+o.slice(0,r))},i=function(t,e,n,i){const r=t[e+3],s=Math.pow(2,r-128)/255;n[i+0]=t[e+0]*s,n[i+1]=t[e+1]*s,n[i+2]=t[e+2]*s,n[i+3]=1},r=function(t,e,n,i){const r=t[e+3],s=Math.pow(2,r-128)/255;n[i+0]=vh.toHalfFloat(Math.min(t[e+0]*s,65504)),n[i+1]=vh.toHalfFloat(Math.min(t[e+1]*s,65504)),n[i+2]=vh.toHalfFloat(Math.min(t[e+2]*s,65504)),n[i+3]=vh.toHalfFloat(1)},s=new Uint8Array(t);s.pos=0;const a=function(t){const i=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,r=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,s=/^\s*FORMAT=(\S+)\s*$/,a=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,o={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};let c,l;for((t.pos>=t.byteLength||!(c=n(t)))&&e(1,"no header found"),(l=c.match(/^#\?(\S+)/))||e(3,"bad initial token"),o.valid|=1,o.programtype=l[1],o.string+=c+"\n";c=n(t),!1!==c;)if(o.string+=c+"\n","#"!==c.charAt(0)){if((l=c.match(i))&&(o.gamma=parseFloat(l[1])),(l=c.match(r))&&(o.exposure=parseFloat(l[1])),(l=c.match(s))&&(o.valid|=2,o.format=l[1]),(l=c.match(a))&&(o.valid|=4,o.height=parseInt(l[1],10),o.width=parseInt(l[2],10)),2&o.valid&&4&o.valid)break}else o.comments+=c+"\n";return 2&o.valid||e(3,"missing format specifier"),4&o.valid||e(3,"missing image size specifier"),o}(s),o=a.width,c=a.height,l=function(t,n,i){const r=n;if(r<8||r>32767||2!==t[0]||2!==t[1]||128&t[2])return new Uint8Array(t);r!==(t[2]<<8|t[3])&&e(3,"wrong scanline width");const s=new Uint8Array(4*n*i);s.length||e(4,"unable to allocate buffer space");let a=0,o=0;const c=4*r,l=new Uint8Array(4),h=new Uint8Array(c);let u=i;for(;u>0&&o<t.byteLength;){o+4>t.byteLength&&e(1),l[0]=t[o++],l[1]=t[o++],l[2]=t[o++],l[3]=t[o++],2==l[0]&&2==l[1]&&(l[2]<<8|l[3])==r||e(3,"bad rgbe scanline format");let n,i=0;for(;i<c&&o<t.byteLength;){n=t[o++];const r=n>128;if(r&&(n-=128),(0===n||i+n>c)&&e(3,"bad scanline data"),r){const e=t[o++];for(let t=0;t<n;t++)h[i++]=e}else h.set(t.subarray(o,o+n),i),i+=n,o+=n}const d=r;for(let t=0;t<d;t++){let e=0;s[a]=h[t+e],e+=r,s[a+1]=h[t+e],e+=r,s[a+2]=h[t+e],e+=r,s[a+3]=h[t+e],a+=4}u--}return s}(s.subarray(s.pos),o,c);let h,u,d;switch(this.type){case ka:d=l.length/4;const t=new Float32Array(4*d);for(let e=0;e<d;e++)i(l,4*e,t,4*e);h=t,u=ka;break;case Oa:d=l.length/4;const e=new Uint16Array(4*d);for(let t=0;t<d;t++)r(l,4*t,e,4*t);h=e,u=Oa;break;default:throw new Error("THREE.RGBELoader: Unsupported type: "+this.type)}return{width:o,height:c,data:h,header:a.string,gamma:a.gamma,exposure:a.exposure,type:u}}setDataType(t){return this.type=t,this}load(t,e,n,i){return super.load(t,(function(t,n){switch(t.type){case ka:case Oa:"colorSpace"in t?t.colorSpace="srgb-linear":t.encoding=3e3,t.minFilter=Ia,t.magFilter=Ia,t.generateMipmaps=!1,t.flipY=!0}e&&e(t,n)}),n,i)}}const Ob=new Array(52).fill(0).map(((t,e)=>e));const Ub=function(t){const e={};return Ob.forEach(((n,i)=>{e[t[n]]=i})),e}(["eyeBlinkLeft","eyeLookDownLeft","eyeLookInLeft","eyeLookOutLeft","eyeLookUpLeft","eyeSquintLeft","eyeWideLeft","eyeBlinkRight","eyeLookDownRight","eyeLookInRight","eyeLookOutRight","eyeLookUpRight","eyeSquintRight","eyeWideRight","jawForward","jawLeft","jawRight","jawOpen","mouthClose","mouthFunnel","mouthPucker","mouthLeft","mouthRight","mouthSmileLeft","mouthSmileRight","mouthFrownLeft","mouthFrownRight","mouthDimpleLeft","mouthDimpleRight","mouthStretchLeft","mouthStretchRight","mouthRollLower","mouthRollUpper","mouthShrugLower","mouthShrugUpper","mouthPressLeft","mouthPressRight","mouthLowerDownLeft","mouthLowerDownRight","mouthUpperUpLeft","mouthUpperUpRight","browDownLeft","browDownRight","browInnerUp","browOuterUpLeft","browOuterUpRight","cheekPuff","cheekSquintLeft","cheekSquintRight","noseSneerLeft","noseSneerRight","tongueOut","xiuxing"]),Nb=(t="",e=0,n="quan")=>("mouthFunnel"===t||"jawOpen"===t?e*=.8:"mouthClose"===t?e*=.1:["mouthSmileLeft","mouthSmileRight"].includes(t)&&(e+=.35),e),Fb=t=>{const{dictionary:e,shapes:n,prefix:i="",suffix:r="",index:s}=t,a=Ub;if(e)for(const[o,c]of Object.entries(e)){const l=o.replace(`${i}`,"").replace(`${r}`,"");try{if(l.startsWith("mouth")||l.startsWith("jawOpen"))t.morphTargetInfluences[c]=Nb(l,a[l]>=0?n[a[l]]:0,t.code);else if("eyeBlinkLeft"===l||"eyeBlinkRight"===l)if(s){const e=s%70;s>=70&&e<=6&&(t.morphTargetInfluences[c]=[0,.33,.66,1,.66,.33,0][e])}else t.morphTargetInfluences[c]=0;else t.morphTargetInfluences[c]=n[a[l]]||0}catch(t){}e.xiuxing&&(t.morphTargetInfluences[e.xiuxing]=1)}return t.morphTargetInfluences},Qb=new Array(52).fill(0).map(((t,e)=>e));const zb=function(t=[]){const e={};return Qb.forEach(((n,i)=>{e[t[n]]=i})),e}(["eyeBlinkLeft","eyeLookDownLeft","eyeLookInLeft","eyeLookOutLeft","eyeLookUpLeft","eyeSquintLeft","eyeWideLeft","eyeBlinkRight","eyeLookDownRight","eyeLookInRight","eyeLookOutRight","eyeLookUpRight","eyeSquintRight","eyeWideRight","jawForward","jawLeft","jawRight","jawOpen","mouthClose","mouthFunnel","mouthPucker","mouthLeft","mouthRight","mouthSmileLeft","mouthSmileRight","mouthFrownLeft","mouthFrownRight","mouthDimpleLeft","mouthDimpleRight","mouthStretchLeft","mouthStretchRight","mouthRollLower","mouthRollUpper","mouthShrugLower","mouthShrugUpper","mouthPressLeft","mouthPressRight","mouthLowerDownLeft","mouthLowerDownRight","mouthUpperUpLeft","mouthUpperUpRight","browDownLeft","browDownRight","browInnerUp","browOuterUpLeft","browOuterUpRight","cheekPuff","cheekSquintLeft","cheekSquintRight","noseSneerLeft","noseSneerRight","tongueOut"]),Gb=t=>{const{dictionary:e,shapes:n,prefix:i="",suffix:r="",index:s,code:a}=t,o=zb;if(e)for(const[a,c]of Object.entries(e)){const e=a.replace(`${i}`,"").replace(`${r}`,"");try{if(e.startsWith("mouth")||e.startsWith("jawOpen"))switch(t.morphTargetInfluences[c]=o[e]>=0?n[o[e]]:0,e){case"jawOpen":t.morphTargetInfluences[c]=Math.max(0,t.morphTargetInfluences[c]-.2);break;case"mouthClose":case"mouthFunnel":case"mouthFrownLeft":case"mouthFrownRight":t.morphTargetInfluences[c]=Math.max(0,t.morphTargetInfluences[c]-.1);break;case"mouthRollLower":case"mouthRollUpper":t.morphTargetInfluences[c]=Math.max(0,t.morphTargetInfluences[c]-.06);break;case"mouthPucker":t.morphTargetInfluences[c]=Math.max(0,.7*t.morphTargetInfluences[c]);break;case"mouthUpperUpLeft":case"mouthUpperUpRight":t.morphTargetInfluences[c]=Math.max(0,t.morphTargetInfluences[c]-.04)}else if("eyeBlinkLeft"===e||"eyeBlinkRight"===e)if(s){const e=s%70;s>=70&&e<=11&&(t.morphTargetInfluences[c]=[0,.1,.2,.4,.6,.8,1,.8,.6,.4,.2,.1][e])}else t.morphTargetInfluences[c]=0;else t.morphTargetInfluences[c]=n[zb[e]]||0}catch(t){}}return t.morphTargetInfluences};var Hb="object"==typeof Tr&&Tr&&Tr.Object===Object&&Tr,Vb="object"==typeof self&&self&&self.Object===Object&&self,jb=Hb||Vb||Function("return this")(),Wb=jb.Symbol,qb=Object.prototype,Yb=qb.hasOwnProperty,Xb=qb.toString,Jb=Wb?Wb.toStringTag:void 0;var Kb=Object.prototype.toString;var Zb="[object Null]",$b="[object Undefined]",tx=Wb?Wb.toStringTag:void 0;function ex(t){return null==t?void 0===t?$b:Zb:tx&&tx in Object(t)?function(t){var e=Yb.call(t,Jb),n=t[Jb];try{t[Jb]=void 0;var i=!0}catch(t){}var r=Xb.call(t);return i&&(e?t[Jb]=n:delete t[Jb]),r}(t):function(t){return Kb.call(t)}(t)}function nx(t){return null!=t&&"object"==typeof t}var ix="[object Symbol]";var rx=Array.isArray,sx=/\s/;var ax=/^\s+/;function ox(t){return t?t.slice(0,function(t){for(var e=t.length;e--&&sx.test(t.charAt(e)););return e}(t)+1).replace(ax,""):t}function cx(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}var lx=NaN,hx=/^[-+]0x[0-9a-f]+$/i,ux=/^0b[01]+$/i,dx=/^0o[0-7]+$/i,px=parseInt;function fx(t){if("number"==typeof t)return t;if(function(t){return"symbol"==typeof t||nx(t)&&ex(t)==ix}(t))return lx;if(cx(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=cx(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=ox(t);var n=ux.test(t);return n||dx.test(t)?px(t.slice(2),n?2:8):hx.test(t)?lx:+t}var Ax=1/0,gx=17976931348623157e292;function mx(t){return t?(t=fx(t))===Ax||t===-Ax?(t<0?-1:1)*gx:t==t?t:0:0===t?t:0}function _x(t){return t}var vx="[object AsyncFunction]",yx="[object Function]",bx="[object GeneratorFunction]",xx="[object Proxy]";function wx(t){if(!cx(t))return!1;var e=ex(t);return e==yx||e==bx||e==vx||e==xx}var Ex,Cx=jb["__core-js_shared__"],Sx=(Ex=/[^.]+$/.exec(Cx&&Cx.keys&&Cx.keys.IE_PROTO||""))?"Symbol(src)_1."+Ex:"";var Mx=Function.prototype.toString;var Ix=/^\[object .+?Constructor\]$/,Tx=Function.prototype,Bx=Object.prototype,Rx=Tx.toString,Dx=Bx.hasOwnProperty,Lx=RegExp("^"+Rx.call(Dx).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Px(t){return!(!cx(t)||(e=t,Sx&&Sx in e))&&(wx(t)?Lx:Ix).test(function(t){if(null!=t){try{return Mx.call(t)}catch(t){}try{return t+""}catch(t){}}return""}(t));var e}function kx(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return Px(n)?n:void 0}var Ox=Object.create,Ux=function(){function t(){}return function(e){if(!cx(e))return{};if(Ox)return Ox(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}();var Nx=Date.now;var Fx,Qx,zx,Gx=function(){try{var t=kx(Object,"defineProperty");return t({},"",{}),t}catch(t){}}(),Hx=Gx?function(t,e){return Gx(t,"toString",{configurable:!0,enumerable:!1,value:(n=e,function(){return n}),writable:!0});var n}:_x,Vx=(Fx=Hx,Qx=0,zx=0,function(){var t=Nx(),e=16-(t-zx);if(zx=t,e>0){if(++Qx>=800)return arguments[0]}else Qx=0;return Fx.apply(void 0,arguments)}),jx=9007199254740991,Wx=/^(?:0|[1-9]\d*)$/;function qx(t,e){var n=typeof t;return!!(e=null==e?jx:e)&&("number"==n||"symbol"!=n&&Wx.test(t))&&t>-1&&t%1==0&&t<e}function Yx(t,e,n){"__proto__"==e&&Gx?Gx(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}function Xx(t,e){return t===e||t!=t&&e!=e}var Jx=Object.prototype.hasOwnProperty;function Kx(t,e,n){var i=t[e];Jx.call(t,e)&&Xx(i,n)&&(void 0!==n||e in t)||Yx(t,e,n)}var Zx=Math.max;function $x(t,e){return Vx(function(t,e,n){return e=Zx(void 0===e?t.length-1:e,0),function(){for(var i=arguments,r=-1,s=Zx(i.length-e,0),a=Array(s);++r<s;)a[r]=i[e+r];r=-1;for(var o=Array(e+1);++r<e;)o[r]=i[r];return o[e]=n(a),function(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}(t,this,o)}}(t,e,_x),t+"")}var tw=9007199254740991;function ew(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=tw}function nw(t){return null!=t&&ew(t.length)&&!wx(t)}function iw(t,e,n){if(!cx(n))return!1;var i=typeof e;return!!("number"==i?nw(n)&&qx(e,n.length):"string"==i&&e in n)&&Xx(n[e],t)}var rw=Object.prototype;function sw(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||rw)}function aw(t){return nx(t)&&"[object Arguments]"==ex(t)}var ow=Object.prototype,cw=ow.hasOwnProperty,lw=ow.propertyIsEnumerable,hw=aw(function(){return arguments}())?aw:function(t){return nx(t)&&cw.call(t,"callee")&&!lw.call(t,"callee")};var uw="object"==typeof exports&&exports&&!exports.nodeType&&exports,dw=uw&&"object"==typeof module&&module&&!module.nodeType&&module,pw=dw&&dw.exports===uw?jb.Buffer:void 0,fw=(pw?pw.isBuffer:void 0)||function(){return!1},Aw={};Aw["[object Float32Array]"]=Aw["[object Float64Array]"]=Aw["[object Int8Array]"]=Aw["[object Int16Array]"]=Aw["[object Int32Array]"]=Aw["[object Uint8Array]"]=Aw["[object Uint8ClampedArray]"]=Aw["[object Uint16Array]"]=Aw["[object Uint32Array]"]=!0,Aw["[object Arguments]"]=Aw["[object Array]"]=Aw["[object ArrayBuffer]"]=Aw["[object Boolean]"]=Aw["[object DataView]"]=Aw["[object Date]"]=Aw["[object Error]"]=Aw["[object Function]"]=Aw["[object Map]"]=Aw["[object Number]"]=Aw["[object Object]"]=Aw["[object RegExp]"]=Aw["[object Set]"]=Aw["[object String]"]=Aw["[object WeakMap]"]=!1;var gw="object"==typeof exports&&exports&&!exports.nodeType&&exports,mw=gw&&"object"==typeof module&&module&&!module.nodeType&&module,_w=mw&&mw.exports===gw&&Hb.process,vw=function(){try{var t=mw&&mw.require&&mw.require("util").types;return t||_w&&_w.binding&&_w.binding("util")}catch(t){}}(),yw=vw&&vw.isTypedArray,bw=yw?function(t){return function(e){return t(e)}}(yw):function(t){return nx(t)&&ew(t.length)&&!!Aw[ex(t)]};function xw(t,e){var n=rx(t),i=!n&&hw(t),r=!n&&!i&&fw(t),s=!n&&!i&&!r&&bw(t),a=n||i||r||s,o=a?function(t,e){for(var n=-1,i=Array(t);++n<t;)i[n]=e(n);return i}(t.length,String):[],c=o.length;for(var l in t)a&&("length"==l||r&&("offset"==l||"parent"==l)||s&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||qx(l,c))||o.push(l);return o}var ww=Object.prototype.hasOwnProperty;function Ew(t){if(!cx(t))return function(t){var e=[];if(null!=t)for(var n in Object(t))e.push(n);return e}(t);var e=sw(t),n=[];for(var i in t)("constructor"!=i||!e&&ww.call(t,i))&&n.push(i);return n}function Cw(t){return nw(t)?xw(t):Ew(t)}var Sw=kx(Object,"create");var Mw=Object.prototype.hasOwnProperty;var Iw=Object.prototype.hasOwnProperty;function Tw(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var i=t[e];this.set(i[0],i[1])}}function Bw(t,e){for(var n=t.length;n--;)if(Xx(t[n][0],e))return n;return-1}Tw.prototype.clear=function(){this.__data__=Sw?Sw(null):{},this.size=0},Tw.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},Tw.prototype.get=function(t){var e=this.__data__;if(Sw){var n=e[t];return"__lodash_hash_undefined__"===n?void 0:n}return Mw.call(e,t)?e[t]:void 0},Tw.prototype.has=function(t){var e=this.__data__;return Sw?void 0!==e[t]:Iw.call(e,t)},Tw.prototype.set=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=Sw&&void 0===e?"__lodash_hash_undefined__":e,this};var Rw=Array.prototype.splice;function Dw(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var i=t[e];this.set(i[0],i[1])}}Dw.prototype.clear=function(){this.__data__=[],this.size=0},Dw.prototype.delete=function(t){var e=this.__data__,n=Bw(e,t);return!(n<0)&&(n==e.length-1?e.pop():Rw.call(e,n,1),--this.size,!0)},Dw.prototype.get=function(t){var e=this.__data__,n=Bw(e,t);return n<0?void 0:e[n][1]},Dw.prototype.has=function(t){return Bw(this.__data__,t)>-1},Dw.prototype.set=function(t,e){var n=this.__data__,i=Bw(n,t);return i<0?(++this.size,n.push([t,e])):n[i][1]=e,this};var Lw=kx(jb,"Map");function Pw(t,e){var n,i,r=t.__data__;return("string"==(i=typeof(n=e))||"number"==i||"symbol"==i||"boolean"==i?"__proto__"!==n:null===n)?r["string"==typeof e?"string":"hash"]:r.map}function kw(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var i=t[e];this.set(i[0],i[1])}}kw.prototype.clear=function(){this.size=0,this.__data__={hash:new Tw,map:new(Lw||Dw),string:new Tw}},kw.prototype.delete=function(t){var e=Pw(this,t).delete(t);return this.size-=e?1:0,e},kw.prototype.get=function(t){return Pw(this,t).get(t)},kw.prototype.has=function(t){return Pw(this,t).has(t)},kw.prototype.set=function(t,e){var n=Pw(this,t),i=n.size;return n.set(t,e),this.size+=n.size==i?0:1,this};var Ow=function(t,e){return function(n){return t(e(n))}}(Object.getPrototypeOf,Object),Uw="[object Object]",Nw=Function.prototype,Fw=Object.prototype,Qw=Nw.toString,zw=Fw.hasOwnProperty,Gw=Qw.call(Object);function Hw(t){var e=this.__data__=new Dw(t);this.size=e.size}Hw.prototype.clear=function(){this.__data__=new Dw,this.size=0},Hw.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},Hw.prototype.get=function(t){return this.__data__.get(t)},Hw.prototype.has=function(t){return this.__data__.has(t)},Hw.prototype.set=function(t,e){var n=this.__data__;if(n instanceof Dw){var i=n.__data__;if(!Lw||i.length<199)return i.push([t,e]),this.size=++n.size,this;n=this.__data__=new kw(i)}return n.set(t,e),this.size=n.size,this};var Vw="object"==typeof exports&&exports&&!exports.nodeType&&exports,jw=Vw&&"object"==typeof module&&module&&!module.nodeType&&module,Ww=jw&&jw.exports===Vw?jb.Buffer:void 0;Ww&&Ww.allocUnsafe;var qw=jb.Uint8Array;function Yw(t,e){var n,i,r=(n=t.buffer,i=new n.constructor(n.byteLength),new qw(i).set(new qw(n)),i);return new t.constructor(r,t.byteOffset,t.length)}var Xw=function(t,e,n){for(var i=-1,r=Object(t),s=n(t),a=s.length;a--;){var o=s[++i];if(!1===e(r[o],o,r))break}return t},Jw=function(){return jb.Date.now()},Kw=Math.max,Zw=Math.min;function $w(t,e,n){var i,r,s,a,o,c,l=0,h=!1,u=!1,d=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function p(e){var n=i,s=r;return i=r=void 0,l=e,a=t.apply(s,n)}function f(t){var n=t-c;return void 0===c||n>=e||n<0||u&&t-l>=s}function A(){var t=Jw();if(f(t))return g(t);o=setTimeout(A,function(t){var n=e-(t-c);return u?Zw(n,s-(t-l)):n}(t))}function g(t){return o=void 0,d&&i?p(t):(i=r=void 0,a)}function m(){var t=Jw(),n=f(t);if(i=arguments,r=this,c=t,n){if(void 0===o)return function(t){return l=t,o=setTimeout(A,e),h?p(t):a}(c);if(u)return clearTimeout(o),o=setTimeout(A,e),p(c)}return void 0===o&&(o=setTimeout(A,e)),a}return e=fx(e)||0,cx(n)&&(h=!!n.leading,s=(u="maxWait"in n)?Kw(fx(n.maxWait)||0,e):s,d="trailing"in n?!!n.trailing:d),m.cancel=function(){void 0!==o&&clearTimeout(o),l=0,i=c=r=o=void 0},m.flush=function(){return void 0===o?a:g(Jw())},m}function tE(t,e,n){(void 0!==n&&!Xx(t[e],n)||void 0===n&&!(e in t))&&Yx(t,e,n)}function eE(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}function nE(t){return function(t,e,n,i){var r=!n;n||(n={});for(var s=-1,a=e.length;++s<a;){var o=e[s],c=void 0;void 0===c&&(c=t[o]),r?Yx(n,o,c):Kx(n,o,c)}return n}(t,Cw(t))}function iE(t,e,n,i,r,s,a){var o=eE(t,n),c=eE(e,n),l=a.get(c);if(l)tE(t,n,l);else{var h,u=s?s(o,c,n+"",t,e,a):void 0,d=void 0===u;if(d){var p=rx(c),f=!p&&fw(c),A=!p&&!f&&bw(c);u=c,p||f||A?rx(o)?u=o:nx(h=o)&&nw(h)?u=function(t,e){var n=-1,i=t.length;for(e||(e=Array(i));++n<i;)e[n]=t[n];return e}(o):f?(d=!1,u=c.slice()):A?(d=!1,u=Yw(c)):u=[]:function(t){if(!nx(t)||ex(t)!=Uw)return!1;var e=Ow(t);if(null===e)return!0;var n=zw.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&Qw.call(n)==Gw}(c)||hw(c)?(u=o,hw(o)?u=nE(o):cx(o)&&!wx(o)||(u=function(t){return"function"!=typeof t.constructor||sw(t)?{}:Ux(Ow(t))}(c))):d=!1}d&&(a.set(c,u),r(u,c,i,s,a),a.delete(c)),tE(t,n,u)}}function rE(t,e,n,i,r){t!==e&&Xw(e,(function(s,a){if(r||(r=new Hw),cx(s))iE(t,e,a,n,rE,i,r);else{var o=i?i(eE(t,a),s,a+"",t,e,r):void 0;void 0===o&&(o=s),tE(t,a,o)}}),Cw)}var sE,aE=(sE=function(t,e,n){rE(t,e,n)},$x((function(t,e){var n=-1,i=e.length,r=i>1?e[i-1]:void 0,s=i>2?e[2]:void 0;for(r=sE.length>3&&"function"==typeof r?(i--,r):void 0,s&&iw(e[0],e[1],s)&&(r=i<3?void 0:r,i=1),t=Object(t);++n<i;){var a=e[n];a&&sE(t,a,n,r)}return t}))),oE=Math.floor,cE=Math.random;var lE=parseFloat,hE=Math.min,uE=Math.random;function dE(t,e,n){if(n&&"boolean"!=typeof n&&iw(t,e,n)&&(e=n=void 0),void 0===n&&("boolean"==typeof e?(n=e,e=void 0):"boolean"==typeof t&&(n=t,t=void 0)),void 0===t&&void 0===e?(t=0,e=1):(t=mx(t),void 0===e?(e=t,t=0):e=mx(e)),t>e){var i=t;t=e,e=i}if(n||t%1||e%1){var r=uE();return hE(t+r*(e-t+lE("1e-"+((r+"").length-1))),e)}return function(t,e){return t+oE(cE()*(e-t+1))}(t,e)}function pE(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function fE(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}var AE,gE,mE,_E,vE,yE,bE,xE,wE,EE,CE,SE={autoSleep:120,force3D:"auto",nullTargetWarn:1,units:{lineHeight:""}},ME={duration:.5,overwrite:!1,delay:0},IE=1e8,TE=1e-8,BE=2*Math.PI,RE=BE/4,DE=0,LE=Math.sqrt,PE=Math.cos,kE=Math.sin,OE=function(t){return"string"==typeof t},UE=function(t){return"function"==typeof t},NE=function(t){return"number"==typeof t},FE=function(t){return void 0===t},QE=function(t){return"object"==typeof t},zE=function(t){return!1!==t},GE=function(){return"undefined"!=typeof window},HE=function(t){return UE(t)||OE(t)},VE="function"==typeof ArrayBuffer&&ArrayBuffer.isView||function(){},jE=Array.isArray,WE=/(?:-?\.?\d|\.)+/gi,qE=/[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g,YE=/[-+=.]*\d+[.e-]*\d*[a-z%]*/g,XE=/[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi,JE=/[+-]=-?[.\d]+/,KE=/[^,'"\[\]\s]+/gi,ZE=/^[+\-=e\s\d]*\d+[.\d]*([a-z]*|%)\s*$/i,$E={},tC={},eC=function(t){return(tC=TC(t,$E))&&BM},nC=function(t,e){return!e&&void 0},iC=function(t,e){return t&&($E[t]=e)&&tC&&(tC[t]=e)||$E},rC=function(){return 0},sC={suppressEvents:!0,isStart:!0,kill:!1},aC={suppressEvents:!0,kill:!1},oC={suppressEvents:!0},cC={},lC=[],hC={},uC={},dC={},pC=30,fC=[],AC="",gC=function(t){var e,n,i=t[0];if(QE(i)||UE(i)||(t=[t]),!(e=(i._gsap||{}).harness)){for(n=fC.length;n--&&!fC[n].targetTest(i););e=fC[n]}for(n=t.length;n--;)t[n]&&(t[n]._gsap||(t[n]._gsap=new VS(t[n],e)))||t.splice(n,1);return t},mC=function(t){return t._gsap||gC(oS(t))[0]._gsap},_C=function(t,e,n){return(n=t[e])&&UE(n)?t[e]():FE(n)&&t.getAttribute&&t.getAttribute(e)||n},vC=function(t,e){return(t=t.split(",")).forEach(e)||t},yC=function(t){return Math.round(1e5*t)/1e5||0},bC=function(t){return Math.round(1e7*t)/1e7||0},xC=function(t,e){var n=e.charAt(0),i=parseFloat(e.substr(2));return t=parseFloat(t),"+"===n?t+i:"-"===n?t-i:"*"===n?t*i:t/i},wC=function(t,e){for(var n=e.length,i=0;t.indexOf(e[i])<0&&++i<n;);return i<n},EC=function(){var t,e,n=lC.length,i=lC.slice(0);for(hC={},lC.length=0,t=0;t<n;t++)(e=i[t])&&e._lazy&&(e.render(e._lazy[0],e._lazy[1],!0)._lazy=0)},CC=function(t,e,n,i){lC.length&&!gE&&EC(),t.render(e,n,gE&&e<0&&(t._initted||t._startAt)),lC.length&&!gE&&EC()},SC=function(t){var e=parseFloat(t);return(e||0===e)&&(t+"").match(KE).length<2?e:OE(t)?t.trim():t},MC=function(t){return t},IC=function(t,e){for(var n in e)n in t||(t[n]=e[n]);return t},TC=function(t,e){for(var n in e)t[n]=e[n];return t},BC=function t(e,n){for(var i in n)"__proto__"!==i&&"constructor"!==i&&"prototype"!==i&&(e[i]=QE(n[i])?t(e[i]||(e[i]={}),n[i]):n[i]);return e},RC=function(t,e){var n,i={};for(n in t)n in e||(i[n]=t[n]);return i},DC=function(t){var e,n=t.parent||_E,i=t.keyframes?(e=jE(t.keyframes),function(t,n){for(var i in n)i in t||"duration"===i&&e||"ease"===i||(t[i]=n[i])}):IC;if(zE(t.inherit))for(;n;)i(t,n.vars.defaults),n=n.parent||n._dp;return t},LC=function(t,e,n,i,r){var s,a=t[i];if(r)for(s=e[r];a&&a[r]>s;)a=a._prev;return a?(e._next=a._next,a._next=e):(e._next=t[n],t[n]=e),e._next?e._next._prev=e:t[i]=e,e._prev=a,e.parent=e._dp=t,e},PC=function(t,e,n,i){void 0===n&&(n="_first"),void 0===i&&(i="_last");var r=e._prev,s=e._next;r?r._next=s:t[n]===e&&(t[n]=s),s?s._prev=r:t[i]===e&&(t[i]=r),e._next=e._prev=e.parent=null},kC=function(t,e){t.parent&&(!e||t.parent.autoRemoveChildren)&&t.parent.remove&&t.parent.remove(t),t._act=0},OC=function(t,e){if(t&&(!e||e._end>t._dur||e._start<0))for(var n=t;n;)n._dirty=1,n=n.parent;return t},UC=function(t,e,n,i){return t._startAt&&(gE?t._startAt.revert(aC):t.vars.immediateRender&&!t.vars.autoRevert||t._startAt.render(e,!0,i))},NC=function t(e){return!e||e._ts&&t(e.parent)},FC=function(t){return t._repeat?QC(t._tTime,t=t.duration()+t._rDelay)*t:0},QC=function(t,e){var n=Math.floor(t/=e);return t&&n===t?n-1:n},zC=function(t,e){return(t-e._start)*e._ts+(e._ts>=0?0:e._dirty?e.totalDuration():e._tDur)},GC=function(t){return t._end=bC(t._start+(t._tDur/Math.abs(t._ts||t._rts||TE)||0))},HC=function(t,e){var n=t._dp;return n&&n.smoothChildTiming&&t._ts&&(t._start=bC(n._time-(t._ts>0?e/t._ts:((t._dirty?t.totalDuration():t._tDur)-e)/-t._ts)),GC(t),n._dirty||OC(n,t)),t},VC=function(t,e){var n;if((e._time||!e._dur&&e._initted||e._start<t._time&&(e._dur||!e.add))&&(n=zC(t.rawTime(),e),(!e._dur||iS(0,e.totalDuration(),n)-e._tTime>TE)&&e.render(n,!0)),OC(t,e)._dp&&t._initted&&t._time>=t._dur&&t._ts){if(t._dur<t.duration())for(n=t;n._dp;)n.rawTime()>=0&&n.totalTime(n._tTime),n=n._dp;t._zTime=-1e-8}},jC=function(t,e,n,i){return e.parent&&kC(e),e._start=bC((NE(n)?n:n||t!==_E?tS(t,n,e):t._time)+e._delay),e._end=bC(e._start+(e.totalDuration()/Math.abs(e.timeScale())||0)),LC(t,e,"_first","_last",t._sort?"_start":0),XC(e)||(t._recent=e),i||VC(t,e),t._ts<0&&HC(t,t._tTime),t},WC=function(t,e){return $E.ScrollTrigger?$E.ScrollTrigger.create(e,t):void 0},qC=function(t,e,n,i,r){return ZS(t,e,r),t._initted?!n&&t._pt&&!gE&&(t._dur&&!1!==t.vars.lazy||!t._dur&&t.vars.lazy)&&wE!==RS.frame?(lC.push(t),t._lazy=[r,i],1):void 0:1},YC=function t(e){var n=e.parent;return n&&n._ts&&n._initted&&!n._lock&&(n.rawTime()<0||t(n))},XC=function(t){var e=t.data;return"isFromStart"===e||"isStart"===e},JC=function(t,e,n,i){var r=t._repeat,s=bC(e)||0,a=t._tTime/t._tDur;return a&&!i&&(t._time*=s/t._dur),t._dur=s,t._tDur=r?r<0?1e10:bC(s*(r+1)+t._rDelay*r):s,a>0&&!i&&HC(t,t._tTime=t._tDur*a),t.parent&&GC(t),n||OC(t.parent,t),t},KC=function(t){return t instanceof WS?OC(t):JC(t,t._dur)},ZC={_start:0,endTime:rC,totalDuration:rC},tS=function t(e,n,i){var r,s,a,o=e.labels,c=e._recent||ZC,l=e.duration()>=IE?c.endTime(!1):e._dur;return OE(n)&&(isNaN(n)||n in o)?(s=n.charAt(0),a="%"===n.substr(-1),r=n.indexOf("="),"<"===s||">"===s?(r>=0&&(n=n.replace(/=/,"")),("<"===s?c._start:c.endTime(c._repeat>=0))+(parseFloat(n.substr(1))||0)*(a?(r<0?c:i).totalDuration()/100:1)):r<0?(n in o||(o[n]=l),o[n]):(s=parseFloat(n.charAt(r-1)+n.substr(r+1)),a&&i&&(s=s/100*(jE(i)?i[0]:i).totalDuration()),r>1?t(e,n.substr(0,r-1),i)+s:l+s)):null==n?l:+n},eS=function(t,e,n){var i,r,s=NE(e[1]),a=(s?2:1)+(t<2?0:1),o=e[a];if(s&&(o.duration=e[1]),o.parent=n,t){for(i=o,r=n;r&&!("immediateRender"in i);)i=r.vars.defaults||{},r=zE(r.vars.inherit)&&r.parent;o.immediateRender=zE(i.immediateRender),t<2?o.runBackwards=1:o.startAt=e[a-1]}return new iM(e[0],o,e[a+1])},nS=function(t,e){return t||0===t?e(t):e},iS=function(t,e,n){return n<t?t:n>e?e:n},rS=function(t,e){return OE(t)&&(e=ZE.exec(t))?e[1]:""},sS=[].slice,aS=function(t,e){return t&&QE(t)&&"length"in t&&(!e&&!t.length||t.length-1 in t&&QE(t[0]))&&!t.nodeType&&t!==vE},oS=function(t,e,n){return mE&&!e&&mE.selector?mE.selector(t):!OE(t)||n||!yE&&DS()?jE(t)?function(t,e,n){return void 0===n&&(n=[]),t.forEach((function(t){var i;return OE(t)&&!e||aS(t,1)?(i=n).push.apply(i,oS(t)):n.push(t)}))||n}(t,n):aS(t)?sS.call(t,0):t?[t]:[]:sS.call((e||bE).querySelectorAll(t),0)},cS=function(t){return t=oS(t)[0]||nC()||{},function(e){var n=t.current||t.nativeElement||t;return oS(e,n.querySelectorAll?n:n===t?nC()||bE.createElement("div"):t)}},lS=function(t){return t.sort((function(){return.5-Math.random()}))},hS=function(t){if(UE(t))return t;var e=QE(t)?t:{each:t},n=FS(e.ease),i=e.from||0,r=parseFloat(e.base)||0,s={},a=i>0&&i<1,o=isNaN(i)||a,c=e.axis,l=i,h=i;return OE(i)?l=h={center:.5,edges:.5,end:1}[i]||0:!a&&o&&(l=i[0],h=i[1]),function(t,a,u){var d,p,f,A,g,m,_,v,y,b=(u||e).length,x=s[b];if(!x){if(!(y="auto"===e.grid?0:(e.grid||[1,IE])[1])){for(_=-1e8;_<(_=u[y++].getBoundingClientRect().left)&&y<b;);y<b&&y--}for(x=s[b]=[],d=o?Math.min(y,b)*l-.5:i%y,p=y===IE?0:o?b*h/y-.5:i/y|0,_=0,v=IE,m=0;m<b;m++)f=m%y-d,A=p-(m/y|0),x[m]=g=c?Math.abs("y"===c?A:f):LE(f*f+A*A),g>_&&(_=g),g<v&&(v=g);"random"===i&&lS(x),x.max=_-v,x.min=v,x.v=b=(parseFloat(e.amount)||parseFloat(e.each)*(y>b?b-1:c?"y"===c?b/y:y:Math.max(y,b/y))||0)*("edges"===i?-1:1),x.b=b<0?r-b:r,x.u=rS(e.amount||e.each)||0,n=n&&b<0?US(n):n}return b=(x[t]-x.min)/x.max||0,bC(x.b+(n?n(b):b)*x.v)+x.u}},uS=function(t){var e=Math.pow(10,((t+"").split(".")[1]||"").length);return function(n){var i=bC(Math.round(parseFloat(n)/t)*t*e);return(i-i%1)/e+(NE(n)?0:rS(n))}},dS=function(t,e){var n,i,r=jE(t);return!r&&QE(t)&&(n=r=t.radius||IE,t.values?(t=oS(t.values),(i=!NE(t[0]))&&(n*=n)):t=uS(t.increment)),nS(e,r?UE(t)?function(e){return i=t(e),Math.abs(i-e)<=n?i:e}:function(e){for(var r,s,a=parseFloat(i?e.x:e),o=parseFloat(i?e.y:0),c=IE,l=0,h=t.length;h--;)(r=i?(r=t[h].x-a)*r+(s=t[h].y-o)*s:Math.abs(t[h]-a))<c&&(c=r,l=h);return l=!n||c<=n?t[l]:e,i||l===e||NE(e)?l:l+rS(e)}:uS(t))},pS=function(t,e,n,i){return nS(jE(t)?!e:!0===n?!!(n=0):!i,(function(){return jE(t)?t[~~(Math.random()*t.length)]:(n=n||1e-5)&&(i=n<1?Math.pow(10,(n+"").length-2):1)&&Math.floor(Math.round((t-n/2+Math.random()*(e-t+.99*n))/n)*n*i)/i}))},fS=function(t,e,n){return nS(n,(function(n){return t[~~e(n)]}))},AS=function(t){for(var e,n,i,r,s=0,a="";~(e=t.indexOf("random(",s));)i=t.indexOf(")",e),r="["===t.charAt(e+7),n=t.substr(e+7,i-e-7).match(r?KE:WE),a+=t.substr(s,e-s)+pS(r?n:+n[0],r?0:+n[1],+n[2]||1e-5),s=i+1;return a+t.substr(s,t.length-s)},gS=function(t,e,n,i,r){var s=e-t,a=i-n;return nS(r,(function(e){return n+((e-t)/s*a||0)}))},mS=function(t,e,n){var i,r,s,a=t.labels,o=IE;for(i in a)(r=a[i]-e)<0==!!n&&r&&o>(r=Math.abs(r))&&(s=i,o=r);return s},_S=function(t,e,n){var i,r,s,a=t.vars,o=a[e],c=mE,l=t._ctx;if(o)return i=a[e+"Params"],r=a.callbackScope||t,n&&lC.length&&EC(),l&&(mE=l),s=i?o.apply(r,i):o.call(r),mE=c,s},vS=function(t){return kC(t),t.scrollTrigger&&t.scrollTrigger.kill(!!gE),t.progress()<1&&_S(t,"onInterrupt"),t},yS=[],bS=function(t){if(t)if(t=!t.name&&t.default||t,GE()||t.headless){var e=t.name,n=UE(t),i=e&&!n&&t.init?function(){this._props=[]}:t,r={init:rC,render:dM,add:JS,kill:fM,modifier:pM,rawVars:0},s={targetTest:0,get:0,getSetter:cM,aliases:{},register:0};if(DS(),t!==i){if(uC[e])return;IC(i,IC(RC(t,r),s)),TC(i.prototype,TC(r,RC(t,s))),uC[i.prop=e]=i,t.targetTest&&(fC.push(i),cC[e]=1),e=("css"===e?"CSS":e.charAt(0).toUpperCase()+e.substr(1))+"Plugin"}iC(e,i),t.register&&t.register(BM,i,mM)}else yS.push(t)},xS=255,wS={aqua:[0,xS,xS],lime:[0,xS,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,xS],navy:[0,0,128],white:[xS,xS,xS],olive:[128,128,0],yellow:[xS,xS,0],orange:[xS,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[xS,0,0],pink:[xS,192,203],cyan:[0,xS,xS],transparent:[xS,xS,xS,0]},ES=function(t,e,n){return(6*(t+=t<0?1:t>1?-1:0)<1?e+(n-e)*t*6:t<.5?n:3*t<2?e+(n-e)*(2/3-t)*6:e)*xS+.5|0},CS=function(t,e,n){var i,r,s,a,o,c,l,h,u,d,p=t?NE(t)?[t>>16,t>>8&xS,t&xS]:0:wS.black;if(!p){if(","===t.substr(-1)&&(t=t.substr(0,t.length-1)),wS[t])p=wS[t];else if("#"===t.charAt(0)){if(t.length<6&&(i=t.charAt(1),r=t.charAt(2),s=t.charAt(3),t="#"+i+i+r+r+s+s+(5===t.length?t.charAt(4)+t.charAt(4):"")),9===t.length)return[(p=parseInt(t.substr(1,6),16))>>16,p>>8&xS,p&xS,parseInt(t.substr(7),16)/255];p=[(t=parseInt(t.substr(1),16))>>16,t>>8&xS,t&xS]}else if("hsl"===t.substr(0,3))if(p=d=t.match(WE),e){if(~t.indexOf("="))return p=t.match(qE),n&&p.length<4&&(p[3]=1),p}else a=+p[0]%360/360,o=+p[1]/100,i=2*(c=+p[2]/100)-(r=c<=.5?c*(o+1):c+o-c*o),p.length>3&&(p[3]*=1),p[0]=ES(a+1/3,i,r),p[1]=ES(a,i,r),p[2]=ES(a-1/3,i,r);else p=t.match(WE)||wS.transparent;p=p.map(Number)}return e&&!d&&(i=p[0]/xS,r=p[1]/xS,s=p[2]/xS,c=((l=Math.max(i,r,s))+(h=Math.min(i,r,s)))/2,l===h?a=o=0:(u=l-h,o=c>.5?u/(2-l-h):u/(l+h),a=l===i?(r-s)/u+(r<s?6:0):l===r?(s-i)/u+2:(i-r)/u+4,a*=60),p[0]=~~(a+.5),p[1]=~~(100*o+.5),p[2]=~~(100*c+.5)),n&&p.length<4&&(p[3]=1),p},SS=function(t){var e=[],n=[],i=-1;return t.split(IS).forEach((function(t){var r=t.match(YE)||[];e.push.apply(e,r),n.push(i+=r.length+1)})),e.c=n,e},MS=function(t,e,n){var i,r,s,a,o="",c=(t+o).match(IS),l=e?"hsla(":"rgba(",h=0;if(!c)return t;if(c=c.map((function(t){return(t=CS(t,e,1))&&l+(e?t[0]+","+t[1]+"%,"+t[2]+"%,"+t[3]:t.join(","))+")"})),n&&(s=SS(t),(i=n.c).join(o)!==s.c.join(o)))for(a=(r=t.replace(IS,"1").split(YE)).length-1;h<a;h++)o+=r[h]+(~i.indexOf(h)?c.shift()||l+"0,0,0,0)":(s.length?s:c.length?c:n).shift());if(!r)for(a=(r=t.split(IS)).length-1;h<a;h++)o+=r[h]+c[h];return o+r[a]},IS=function(){var t,e="(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3,4}){1,2}\\b";for(t in wS)e+="|"+t+"\\b";return new RegExp(e+")","gi")}(),TS=/hsl[a]?\(/,BS=function(t){var e,n=t.join(" ");if(IS.lastIndex=0,IS.test(n))return e=TS.test(n),t[1]=MS(t[1],e),t[0]=MS(t[0],e,SS(t[1])),!0},RS=function(){var t,e,n,i,r,s,a=Date.now,o=500,c=33,l=a(),h=l,u=1e3/240,d=u,p=[],f=function n(f){var A,g,m,_,v=a()-h,y=!0===f;if((v>o||v<0)&&(l+=v-c),((A=(m=(h+=v)-l)-d)>0||y)&&(_=++i.frame,r=m-1e3*i.time,i.time=m/=1e3,d+=A+(A>=u?4:u-A),g=1),y||(t=e(n)),g)for(s=0;s<p.length;s++)p[s](m,r,_,f)};return i={time:0,frame:0,tick:function(){f(!0)},deltaRatio:function(t){return r/(1e3/(t||60))},wake:function(){xE&&(!yE&&GE()&&(vE=yE=window,bE=vE.document||{},$E.gsap=BM,(vE.gsapVersions||(vE.gsapVersions=[])).push(BM.version),eC(tC||vE.GreenSockGlobals||!vE.gsap&&vE||{}),yS.forEach(bS)),n="undefined"!=typeof requestAnimationFrame&&requestAnimationFrame,t&&i.sleep(),e=n||function(t){return setTimeout(t,d-1e3*i.time+1|0)},CE=1,f(2))},sleep:function(){(n?cancelAnimationFrame:clearTimeout)(t),CE=0,e=rC},lagSmoothing:function(t,e){o=t||1/0,c=Math.min(e||33,o)},fps:function(t){u=1e3/(t||240),d=1e3*i.time+u},add:function(t,e,n){var r=e?function(e,n,s,a){t(e,n,s,a),i.remove(r)}:t;return i.remove(t),p[n?"unshift":"push"](r),DS(),r},remove:function(t,e){~(e=p.indexOf(t))&&p.splice(e,1)&&s>=e&&s--},_listeners:p},i}(),DS=function(){return!CE&&RS.wake()},LS={},PS=/^[\d.\-M][\d.\-,\s]/,kS=/["']/g,OS=function(t){for(var e,n,i,r={},s=t.substr(1,t.length-3).split(":"),a=s[0],o=1,c=s.length;o<c;o++)n=s[o],e=o!==c-1?n.lastIndexOf(","):n.length,i=n.substr(0,e),r[a]=isNaN(i)?i.replace(kS,"").trim():+i,a=n.substr(e+1).trim();return r},US=function(t){return function(e){return 1-t(1-e)}},NS=function t(e,n){for(var i,r=e._first;r;)r instanceof WS?t(r,n):!r.vars.yoyoEase||r._yoyo&&r._repeat||r._yoyo===n||(r.timeline?t(r.timeline,n):(i=r._ease,r._ease=r._yEase,r._yEase=i,r._yoyo=n)),r=r._next},FS=function(t,e){return t&&(UE(t)?t:LS[t]||function(t){var e,n,i,r,s=(t+"").split("("),a=LS[s[0]];return a&&s.length>1&&a.config?a.config.apply(null,~t.indexOf("{")?[OS(s[1])]:(e=t,n=e.indexOf("(")+1,i=e.indexOf(")"),r=e.indexOf("(",n),e.substring(n,~r&&r<i?e.indexOf(")",i+1):i)).split(",").map(SC)):LS._CE&&PS.test(t)?LS._CE("",t):a}(t))||e},QS=function(t,e,n,i){void 0===n&&(n=function(t){return 1-e(1-t)}),void 0===i&&(i=function(t){return t<.5?e(2*t)/2:1-e(2*(1-t))/2});var r,s={easeIn:e,easeOut:n,easeInOut:i};return vC(t,(function(t){for(var e in LS[t]=$E[t]=s,LS[r=t.toLowerCase()]=n,s)LS[r+("easeIn"===e?".in":"easeOut"===e?".out":".inOut")]=LS[t+"."+e]=s[e]})),s},zS=function(t){return function(e){return e<.5?(1-t(1-2*e))/2:.5+t(2*(e-.5))/2}},GS=function t(e,n,i){var r=n>=1?n:1,s=(i||(e?.3:.45))/(n<1?n:1),a=s/BE*(Math.asin(1/r)||0),o=function(t){return 1===t?1:r*Math.pow(2,-10*t)*kE((t-a)*s)+1},c="out"===e?o:"in"===e?function(t){return 1-o(1-t)}:zS(o);return s=BE/s,c.config=function(n,i){return t(e,n,i)},c},HS=function t(e,n){void 0===n&&(n=1.70158);var i=function(t){return t?--t*t*((n+1)*t+n)+1:0},r="out"===e?i:"in"===e?function(t){return 1-i(1-t)}:zS(i);return r.config=function(n){return t(e,n)},r};vC("Linear,Quad,Cubic,Quart,Quint,Strong",(function(t,e){var n=e<5?e+1:e;QS(t+",Power"+(n-1),e?function(t){return Math.pow(t,n)}:function(t){return t},(function(t){return 1-Math.pow(1-t,n)}),(function(t){return t<.5?Math.pow(2*t,n)/2:1-Math.pow(2*(1-t),n)/2}))})),LS.Linear.easeNone=LS.none=LS.Linear.easeIn,QS("Elastic",GS("in"),GS("out"),GS()),function(t,e){var n=1/e,i=2*n,r=2.5*n,s=function(s){return s<n?t*s*s:s<i?t*Math.pow(s-1.5/e,2)+.75:s<r?t*(s-=2.25/e)*s+.9375:t*Math.pow(s-2.625/e,2)+.984375};QS("Bounce",(function(t){return 1-s(1-t)}),s)}(7.5625,2.75),QS("Expo",(function(t){return t?Math.pow(2,10*(t-1)):0})),QS("Circ",(function(t){return-(LE(1-t*t)-1)})),QS("Sine",(function(t){return 1===t?1:1-PE(t*RE)})),QS("Back",HS("in"),HS("out"),HS()),LS.SteppedEase=LS.steps=$E.SteppedEase={config:function(t,e){void 0===t&&(t=1);var n=1/t,i=t+(e?0:1),r=e?1:0;return function(t){return((i*iS(0,.99999999,t)|0)+r)*n}}},ME.ease=LS["quad.out"],vC("onComplete,onUpdate,onStart,onRepeat,onReverseComplete,onInterrupt",(function(t){return AC+=t+","+t+"Params,"}));var VS=function(t,e){this.id=DE++,t._gsap=this,this.target=t,this.harness=e,this.get=e?e.get:_C,this.set=e?e.getSetter:cM},jS=function(){function t(t){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,JC(this,+t.duration,1,1),this.data=t.data,mE&&(this._ctx=mE,mE.data.push(this)),CE||RS.wake()}var e=t.prototype;return e.delay=function(t){return t||0===t?(this.parent&&this.parent.smoothChildTiming&&this.startTime(this._start+t-this._delay),this._delay=t,this):this._delay},e.duration=function(t){return arguments.length?this.totalDuration(this._repeat>0?t+(t+this._rDelay)*this._repeat:t):this.totalDuration()&&this._dur},e.totalDuration=function(t){return arguments.length?(this._dirty=0,JC(this,this._repeat<0?t:(t-this._repeat*this._rDelay)/(this._repeat+1))):this._tDur},e.totalTime=function(t,e){if(DS(),!arguments.length)return this._tTime;var n=this._dp;if(n&&n.smoothChildTiming&&this._ts){for(HC(this,t),!n._dp||n.parent||VC(n,this);n&&n.parent;)n.parent._time!==n._start+(n._ts>=0?n._tTime/n._ts:(n.totalDuration()-n._tTime)/-n._ts)&&n.totalTime(n._tTime,!0),n=n.parent;!this.parent&&this._dp.autoRemoveChildren&&(this._ts>0&&t<this._tDur||this._ts<0&&t>0||!this._tDur&&!t)&&jC(this._dp,this,this._start-this._delay)}return(this._tTime!==t||!this._dur&&!e||this._initted&&Math.abs(this._zTime)===TE||!t&&!this._initted&&(this.add||this._ptLookup))&&(this._ts||(this._pTime=t),CC(this,t,e)),this},e.time=function(t,e){return arguments.length?this.totalTime(Math.min(this.totalDuration(),t+FC(this))%(this._dur+this._rDelay)||(t?this._dur:0),e):this._time},e.totalProgress=function(t,e){return arguments.length?this.totalTime(this.totalDuration()*t,e):this.totalDuration()?Math.min(1,this._tTime/this._tDur):this.rawTime()>0?1:0},e.progress=function(t,e){return arguments.length?this.totalTime(this.duration()*(!this._yoyo||1&this.iteration()?t:1-t)+FC(this),e):this.duration()?Math.min(1,this._time/this._dur):this.rawTime()>0?1:0},e.iteration=function(t,e){var n=this.duration()+this._rDelay;return arguments.length?this.totalTime(this._time+(t-1)*n,e):this._repeat?QC(this._tTime,n)+1:1},e.timeScale=function(t,e){if(!arguments.length)return-1e-8===this._rts?0:this._rts;if(this._rts===t)return this;var n=this.parent&&this._ts?zC(this.parent._time,this):this._tTime;return this._rts=+t||0,this._ts=this._ps||-1e-8===t?0:this._rts,this.totalTime(iS(-Math.abs(this._delay),this._tDur,n),!1!==e),GC(this),function(t){for(var e=t.parent;e&&e.parent;)e._dirty=1,e.totalDuration(),e=e.parent;return t}(this)},e.paused=function(t){return arguments.length?(this._ps!==t&&(this._ps=t,t?(this._pTime=this._tTime||Math.max(-this._delay,this.rawTime()),this._ts=this._act=0):(DS(),this._ts=this._rts,this.totalTime(this.parent&&!this.parent.smoothChildTiming?this.rawTime():this._tTime||this._pTime,1===this.progress()&&Math.abs(this._zTime)!==TE&&(this._tTime-=TE)))),this):this._ps},e.startTime=function(t){if(arguments.length){this._start=t;var e=this.parent||this._dp;return e&&(e._sort||!this.parent)&&jC(e,this,t-this._delay),this}return this._start},e.endTime=function(t){return this._start+(zE(t)?this.totalDuration():this.duration())/Math.abs(this._ts||1)},e.rawTime=function(t){var e=this.parent||this._dp;return e?t&&(!this._ts||this._repeat&&this._time&&this.totalProgress()<1)?this._tTime%(this._dur+this._rDelay):this._ts?zC(e.rawTime(t),this):this._tTime:this._tTime},e.revert=function(t){void 0===t&&(t=oC);var e=gE;return gE=t,(this._initted||this._startAt)&&(this.timeline&&this.timeline.revert(t),this.totalTime(-.01,t.suppressEvents)),"nested"!==this.data&&!1!==t.kill&&this.kill(),gE=e,this},e.globalTime=function(t){for(var e=this,n=arguments.length?t:e.rawTime();e;)n=e._start+n/(Math.abs(e._ts)||1),e=e._dp;return!this.parent&&this._sat?this._sat.globalTime(t):n},e.repeat=function(t){return arguments.length?(this._repeat=t===1/0?-2:t,KC(this)):-2===this._repeat?1/0:this._repeat},e.repeatDelay=function(t){if(arguments.length){var e=this._time;return this._rDelay=t,KC(this),e?this.time(e):this}return this._rDelay},e.yoyo=function(t){return arguments.length?(this._yoyo=t,this):this._yoyo},e.seek=function(t,e){return this.totalTime(tS(this,t),zE(e))},e.restart=function(t,e){return this.play().totalTime(t?-this._delay:0,zE(e))},e.play=function(t,e){return null!=t&&this.seek(t,e),this.reversed(!1).paused(!1)},e.reverse=function(t,e){return null!=t&&this.seek(t||this.totalDuration(),e),this.reversed(!0).paused(!1)},e.pause=function(t,e){return null!=t&&this.seek(t,e),this.paused(!0)},e.resume=function(){return this.paused(!1)},e.reversed=function(t){return arguments.length?(!!t!==this.reversed()&&this.timeScale(-this._rts||(t?-1e-8:0)),this):this._rts<0},e.invalidate=function(){return this._initted=this._act=0,this._zTime=-1e-8,this},e.isActive=function(){var t,e=this.parent||this._dp,n=this._start;return!(e&&!(this._ts&&this._initted&&e.isActive()&&(t=e.rawTime(!0))>=n&&t<this.endTime(!0)-TE))},e.eventCallback=function(t,e,n){var i=this.vars;return arguments.length>1?(e?(i[t]=e,n&&(i[t+"Params"]=n),"onUpdate"===t&&(this._onUpdate=e)):delete i[t],this):i[t]},e.then=function(t){var e=this;return new Promise((function(n){var i=UE(t)?t:MC,r=function(){var t=e.then;e.then=null,UE(i)&&(i=i(e))&&(i.then||i===e)&&(e.then=t),n(i),e.then=t};e._initted&&1===e.totalProgress()&&e._ts>=0||!e._tTime&&e._ts<0?r():e._prom=r}))},e.kill=function(){vS(this)},t}();IC(jS.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:-1e-8,_prom:0,_ps:!1,_rts:1});var WS=function(t){function e(e,n){var i;return void 0===e&&(e={}),(i=t.call(this,e)||this).labels={},i.smoothChildTiming=!!e.smoothChildTiming,i.autoRemoveChildren=!!e.autoRemoveChildren,i._sort=zE(e.sortChildren),_E&&jC(e.parent||_E,pE(i),n),e.reversed&&i.reverse(),e.paused&&i.paused(!0),e.scrollTrigger&&WC(pE(i),e.scrollTrigger),i}fE(e,t);var n=e.prototype;return n.to=function(t,e,n){return eS(0,arguments,this),this},n.from=function(t,e,n){return eS(1,arguments,this),this},n.fromTo=function(t,e,n,i){return eS(2,arguments,this),this},n.set=function(t,e,n){return e.duration=0,e.parent=this,DC(e).repeatDelay||(e.repeat=0),e.immediateRender=!!e.immediateRender,new iM(t,e,tS(this,n),1),this},n.call=function(t,e,n){return jC(this,iM.delayedCall(0,t,e),n)},n.staggerTo=function(t,e,n,i,r,s,a){return n.duration=e,n.stagger=n.stagger||i,n.onComplete=s,n.onCompleteParams=a,n.parent=this,new iM(t,n,tS(this,r)),this},n.staggerFrom=function(t,e,n,i,r,s,a){return n.runBackwards=1,DC(n).immediateRender=zE(n.immediateRender),this.staggerTo(t,e,n,i,r,s,a)},n.staggerFromTo=function(t,e,n,i,r,s,a,o){return i.startAt=n,DC(i).immediateRender=zE(i.immediateRender),this.staggerTo(t,e,i,r,s,a,o)},n.render=function(t,e,n){var i,r,s,a,o,c,l,h,u,d,p,f,A=this._time,g=this._dirty?this.totalDuration():this._tDur,m=this._dur,_=t<=0?0:bC(t),v=this._zTime<0!=t<0&&(this._initted||!m);if(this!==_E&&_>g&&t>=0&&(_=g),_!==this._tTime||n||v){if(A!==this._time&&m&&(_+=this._time-A,t+=this._time-A),i=_,u=this._start,c=!(h=this._ts),v&&(m||(A=this._zTime),(t||!e)&&(this._zTime=t)),this._repeat){if(p=this._yoyo,o=m+this._rDelay,this._repeat<-1&&t<0)return this.totalTime(100*o+t,e,n);if(i=bC(_%o),_===g?(a=this._repeat,i=m):((a=~~(_/o))&&a===_/o&&(i=m,a--),i>m&&(i=m)),d=QC(this._tTime,o),!A&&this._tTime&&d!==a&&this._tTime-d*o-this._dur<=0&&(d=a),p&&1&a&&(i=m-i,f=1),a!==d&&!this._lock){var y=p&&1&d,b=y===(p&&1&a);if(a<d&&(y=!y),A=y?0:_%m?m:_,this._lock=1,this.render(A||(f?0:bC(a*o)),e,!m)._lock=0,this._tTime=_,!e&&this.parent&&_S(this,"onRepeat"),this.vars.repeatRefresh&&!f&&(this.invalidate()._lock=1),A&&A!==this._time||c!==!this._ts||this.vars.onRepeat&&!this.parent&&!this._act)return this;if(m=this._dur,g=this._tDur,b&&(this._lock=2,A=y?m:-1e-4,this.render(A,!0),this.vars.repeatRefresh&&!f&&this.invalidate()),this._lock=0,!this._ts&&!c)return this;NS(this,f)}}if(this._hasPause&&!this._forcing&&this._lock<2&&(l=function(t,e,n){var i;if(n>e)for(i=t._first;i&&i._start<=n;){if("isPause"===i.data&&i._start>e)return i;i=i._next}else for(i=t._last;i&&i._start>=n;){if("isPause"===i.data&&i._start<e)return i;i=i._prev}}(this,bC(A),bC(i)),l&&(_-=i-(i=l._start))),this._tTime=_,this._time=i,this._act=!h,this._initted||(this._onUpdate=this.vars.onUpdate,this._initted=1,this._zTime=t,A=0),!A&&i&&!e&&!a&&(_S(this,"onStart"),this._tTime!==_))return this;if(i>=A&&t>=0)for(r=this._first;r;){if(s=r._next,(r._act||i>=r._start)&&r._ts&&l!==r){if(r.parent!==this)return this.render(t,e,n);if(r.render(r._ts>0?(i-r._start)*r._ts:(r._dirty?r.totalDuration():r._tDur)+(i-r._start)*r._ts,e,n),i!==this._time||!this._ts&&!c){l=0,s&&(_+=this._zTime=-1e-8);break}}r=s}else{r=this._last;for(var x=t<0?t:i;r;){if(s=r._prev,(r._act||x<=r._end)&&r._ts&&l!==r){if(r.parent!==this)return this.render(t,e,n);if(r.render(r._ts>0?(x-r._start)*r._ts:(r._dirty?r.totalDuration():r._tDur)+(x-r._start)*r._ts,e,n||gE&&(r._initted||r._startAt)),i!==this._time||!this._ts&&!c){l=0,s&&(_+=this._zTime=x?-1e-8:TE);break}}r=s}}if(l&&!e&&(this.pause(),l.render(i>=A?0:-1e-8)._zTime=i>=A?1:-1,this._ts))return this._start=u,GC(this),this.render(t,e,n);this._onUpdate&&!e&&_S(this,"onUpdate",!0),(_===g&&this._tTime>=this.totalDuration()||!_&&A)&&(u!==this._start&&Math.abs(h)===Math.abs(this._ts)||this._lock||((t||!m)&&(_===g&&this._ts>0||!_&&this._ts<0)&&kC(this,1),e||t<0&&!A||!_&&!A&&g||(_S(this,_===g&&t>=0?"onComplete":"onReverseComplete",!0),this._prom&&!(_<g&&this.timeScale()>0)&&this._prom())))}return this},n.add=function(t,e){var n=this;if(NE(e)||(e=tS(this,e,t)),!(t instanceof jS)){if(jE(t))return t.forEach((function(t){return n.add(t,e)})),this;if(OE(t))return this.addLabel(t,e);if(!UE(t))return this;t=iM.delayedCall(0,t)}return this!==t?jC(this,t,e):this},n.getChildren=function(t,e,n,i){void 0===t&&(t=!0),void 0===e&&(e=!0),void 0===n&&(n=!0),void 0===i&&(i=-1e8);for(var r=[],s=this._first;s;)s._start>=i&&(s instanceof iM?e&&r.push(s):(n&&r.push(s),t&&r.push.apply(r,s.getChildren(!0,e,n)))),s=s._next;return r},n.getById=function(t){for(var e=this.getChildren(1,1,1),n=e.length;n--;)if(e[n].vars.id===t)return e[n]},n.remove=function(t){return OE(t)?this.removeLabel(t):UE(t)?this.killTweensOf(t):(PC(this,t),t===this._recent&&(this._recent=this._last),OC(this))},n.totalTime=function(e,n){return arguments.length?(this._forcing=1,!this._dp&&this._ts&&(this._start=bC(RS.time-(this._ts>0?e/this._ts:(this.totalDuration()-e)/-this._ts))),t.prototype.totalTime.call(this,e,n),this._forcing=0,this):this._tTime},n.addLabel=function(t,e){return this.labels[t]=tS(this,e),this},n.removeLabel=function(t){return delete this.labels[t],this},n.addPause=function(t,e,n){var i=iM.delayedCall(0,e||rC,n);return i.data="isPause",this._hasPause=1,jC(this,i,tS(this,t))},n.removePause=function(t){var e=this._first;for(t=tS(this,t);e;)e._start===t&&"isPause"===e.data&&kC(e),e=e._next},n.killTweensOf=function(t,e,n){for(var i=this.getTweensOf(t,n),r=i.length;r--;)qS!==i[r]&&i[r].kill(t,e);return this},n.getTweensOf=function(t,e){for(var n,i=[],r=oS(t),s=this._first,a=NE(e);s;)s instanceof iM?wC(s._targets,r)&&(a?(!qS||s._initted&&s._ts)&&s.globalTime(0)<=e&&s.globalTime(s.totalDuration())>e:!e||s.isActive())&&i.push(s):(n=s.getTweensOf(r,e)).length&&i.push.apply(i,n),s=s._next;return i},n.tweenTo=function(t,e){e=e||{};var n,i=this,r=tS(i,t),s=e,a=s.startAt,o=s.onStart,c=s.onStartParams,l=s.immediateRender,h=iM.to(i,IC({ease:e.ease||"none",lazy:!1,immediateRender:!1,time:r,overwrite:"auto",duration:e.duration||Math.abs((r-(a&&"time"in a?a.time:i._time))/i.timeScale())||TE,onStart:function(){if(i.pause(),!n){var t=e.duration||Math.abs((r-(a&&"time"in a?a.time:i._time))/i.timeScale());h._dur!==t&&JC(h,t,0,1).render(h._time,!0,!0),n=1}o&&o.apply(h,c||[])}},e));return l?h.render(0):h},n.tweenFromTo=function(t,e,n){return this.tweenTo(e,IC({startAt:{time:tS(this,t)}},n))},n.recent=function(){return this._recent},n.nextLabel=function(t){return void 0===t&&(t=this._time),mS(this,tS(this,t))},n.previousLabel=function(t){return void 0===t&&(t=this._time),mS(this,tS(this,t),1)},n.currentLabel=function(t){return arguments.length?this.seek(t,!0):this.previousLabel(this._time+TE)},n.shiftChildren=function(t,e,n){void 0===n&&(n=0);for(var i,r=this._first,s=this.labels;r;)r._start>=n&&(r._start+=t,r._end+=t),r=r._next;if(e)for(i in s)s[i]>=n&&(s[i]+=t);return OC(this)},n.invalidate=function(e){var n=this._first;for(this._lock=0;n;)n.invalidate(e),n=n._next;return t.prototype.invalidate.call(this,e)},n.clear=function(t){void 0===t&&(t=!0);for(var e,n=this._first;n;)e=n._next,this.remove(n),n=e;return this._dp&&(this._time=this._tTime=this._pTime=0),t&&(this.labels={}),OC(this)},n.totalDuration=function(t){var e,n,i,r=0,s=this,a=s._last,o=IE;if(arguments.length)return s.timeScale((s._repeat<0?s.duration():s.totalDuration())/(s.reversed()?-t:t));if(s._dirty){for(i=s.parent;a;)e=a._prev,a._dirty&&a.totalDuration(),(n=a._start)>o&&s._sort&&a._ts&&!s._lock?(s._lock=1,jC(s,a,n-a._delay,1)._lock=0):o=n,n<0&&a._ts&&(r-=n,(!i&&!s._dp||i&&i.smoothChildTiming)&&(s._start+=n/s._ts,s._time-=n,s._tTime-=n),s.shiftChildren(-n,!1,-Infinity),o=0),a._end>r&&a._ts&&(r=a._end),a=e;JC(s,s===_E&&s._time>r?s._time:r,1,1),s._dirty=0}return s._tDur},e.updateRoot=function(t){if(_E._ts&&(CC(_E,zC(t,_E)),wE=RS.frame),RS.frame>=pC){pC+=SE.autoSleep||120;var e=_E._first;if((!e||!e._ts)&&SE.autoSleep&&RS._listeners.length<2){for(;e&&!e._ts;)e=e._next;e||RS.sleep()}}},e}(jS);IC(WS.prototype,{_lock:0,_hasPause:0,_forcing:0});var qS,YS,XS=function(t,e,n,i,r,s,a){var o,c,l,h,u,d,p,f,A=new mM(this._pt,t,e,0,1,uM,null,r),g=0,m=0;for(A.b=n,A.e=i,n+="",(p=~(i+="").indexOf("random("))&&(i=AS(i)),s&&(s(f=[n,i],t,e),n=f[0],i=f[1]),c=n.match(XE)||[];o=XE.exec(i);)h=o[0],u=i.substring(g,o.index),l?l=(l+1)%5:"rgba("===u.substr(-5)&&(l=1),h!==c[m++]&&(d=parseFloat(c[m-1])||0,A._pt={_next:A._pt,p:u||1===m?u:",",s:d,c:"="===h.charAt(1)?xC(d,h)-d:parseFloat(h)-d,m:l&&l<4?Math.round:0},g=XE.lastIndex);return A.c=g<i.length?i.substring(g,i.length):"",A.fp=a,(JE.test(i)||p)&&(A.e=0),this._pt=A,A},JS=function(t,e,n,i,r,s,a,o,c,l){UE(i)&&(i=i(r||0,t,s));var h,u=t[e],d="get"!==n?n:UE(u)?c?t[e.indexOf("set")||!UE(t["get"+e.substr(3)])?e:"get"+e.substr(3)](c):t[e]():u,p=UE(u)?c?aM:sM:rM;if(OE(i)&&(~i.indexOf("random(")&&(i=AS(i)),"="===i.charAt(1)&&((h=xC(d,i)+(rS(d)||0))||0===h)&&(i=h)),!l||d!==i||YS)return isNaN(d*i)||""===i?XS.call(this,t,e,d,i,p,o||SE.stringFilter,c):(h=new mM(this._pt,t,e,+d||0,i-(d||0),"boolean"==typeof u?hM:lM,0,p),c&&(h.fp=c),a&&h.modifier(a,this,t),this._pt=h)},KS=function(t,e,n,i,r,s){var a,o,c,l;if(uC[t]&&!1!==(a=new uC[t]).init(r,a.rawVars?e[t]:function(t,e,n,i,r){if(UE(t)&&(t=tM(t,r,e,n,i)),!QE(t)||t.style&&t.nodeType||jE(t)||VE(t))return OE(t)?tM(t,r,e,n,i):t;var s,a={};for(s in t)a[s]=tM(t[s],r,e,n,i);return a}(e[t],i,r,s,n),n,i,s)&&(n._pt=o=new mM(n._pt,r,t,0,1,a.render,a,0,a.priority),n!==EE))for(c=n._ptLookup[n._targets.indexOf(r)],l=a._props.length;l--;)c[a._props[l]]=o;return a},ZS=function t(e,n,i){var r,s,a,o,c,l,h,u,d,p,f,A,g,m=e.vars,_=m.ease,v=m.startAt,y=m.immediateRender,b=m.lazy,x=m.onUpdate,w=m.runBackwards,E=m.yoyoEase,C=m.keyframes,S=m.autoRevert,M=e._dur,I=e._startAt,T=e._targets,B=e.parent,R=B&&"nested"===B.data?B.vars.targets:T,D="auto"===e._overwrite&&!AE,L=e.timeline;if(L&&(!C||!_)&&(_="none"),e._ease=FS(_,ME.ease),e._yEase=E?US(FS(!0===E?_:E,ME.ease)):0,E&&e._yoyo&&!e._repeat&&(E=e._yEase,e._yEase=e._ease,e._ease=E),e._from=!L&&!!m.runBackwards,!L||C&&!m.stagger){if(A=(u=T[0]?mC(T[0]).harness:0)&&m[u.prop],r=RC(m,cC),I&&(I._zTime<0&&I.progress(1),n<0&&w&&y&&!S?I.render(-1,!0):I.revert(w&&M?aC:sC),I._lazy=0),v){if(kC(e._startAt=iM.set(T,IC({data:"isStart",overwrite:!1,parent:B,immediateRender:!0,lazy:!I&&zE(b),startAt:null,delay:0,onUpdate:x&&function(){return _S(e,"onUpdate")},stagger:0},v))),e._startAt._dp=0,e._startAt._sat=e,n<0&&(gE||!y&&!S)&&e._startAt.revert(aC),y&&M&&n<=0&&i<=0)return void(n&&(e._zTime=n))}else if(w&&M&&!I)if(n&&(y=!1),a=IC({overwrite:!1,data:"isFromStart",lazy:y&&!I&&zE(b),immediateRender:y,stagger:0,parent:B},r),A&&(a[u.prop]=A),kC(e._startAt=iM.set(T,a)),e._startAt._dp=0,e._startAt._sat=e,n<0&&(gE?e._startAt.revert(aC):e._startAt.render(-1,!0)),e._zTime=n,y){if(!n)return}else t(e._startAt,TE,TE);for(e._pt=e._ptCache=0,b=M&&zE(b)||b&&!M,s=0;s<T.length;s++){if(h=(c=T[s])._gsap||gC(T)[s]._gsap,e._ptLookup[s]=p={},hC[h.id]&&lC.length&&EC(),f=R===T?s:R.indexOf(c),u&&!1!==(d=new u).init(c,A||r,e,f,R)&&(e._pt=o=new mM(e._pt,c,d.name,0,1,d.render,d,0,d.priority),d._props.forEach((function(t){p[t]=o})),d.priority&&(l=1)),!u||A)for(a in r)uC[a]&&(d=KS(a,r,e,f,c,R))?d.priority&&(l=1):p[a]=o=JS.call(e,c,a,"get",r[a],f,R,0,m.stringFilter);e._op&&e._op[s]&&e.kill(c,e._op[s]),D&&e._pt&&(qS=e,_E.killTweensOf(c,p,e.globalTime(n)),g=!e.parent,qS=0),e._pt&&b&&(hC[h.id]=1)}l&&gM(e),e._onInit&&e._onInit(e)}e._onUpdate=x,e._initted=(!e._op||e._pt)&&!g,C&&n<=0&&L.render(IE,!0,!0)},$S=function(t,e,n,i){var r,s,a=e.ease||i||"power1.inOut";if(jE(e))s=n[t]||(n[t]=[]),e.forEach((function(t,n){return s.push({t:n/(e.length-1)*100,v:t,e:a})}));else for(r in e)s=n[r]||(n[r]=[]),"ease"===r||s.push({t:parseFloat(t),v:e[r],e:a})},tM=function(t,e,n,i,r){return UE(t)?t.call(e,n,i,r):OE(t)&&~t.indexOf("random(")?AS(t):t},eM=AC+"repeat,repeatDelay,yoyo,repeatRefresh,yoyoEase,autoRevert",nM={};vC(eM+",id,stagger,delay,duration,paused,scrollTrigger",(function(t){return nM[t]=1}));var iM=function(t){function e(e,n,i,r){var s;"number"==typeof n&&(i.duration=n,n=i,i=null);var a,o,c,l,h,u,d,p,f=(s=t.call(this,r?n:DC(n))||this).vars,A=f.duration,g=f.delay,m=f.immediateRender,_=f.stagger,v=f.overwrite,y=f.keyframes,b=f.defaults,x=f.scrollTrigger,w=f.yoyoEase,E=n.parent||_E,C=(jE(e)||VE(e)?NE(e[0]):"length"in n)?[e]:oS(e);if(s._targets=C.length?gC(C):nC(0,!SE.nullTargetWarn)||[],s._ptLookup=[],s._overwrite=v,y||_||HE(A)||HE(g)){if(n=s.vars,(a=s.timeline=new WS({data:"nested",defaults:b||{},targets:E&&"nested"===E.data?E.vars.targets:C})).kill(),a.parent=a._dp=pE(s),a._start=0,_||HE(A)||HE(g)){if(l=C.length,d=_&&hS(_),QE(_))for(h in _)~eM.indexOf(h)&&(p||(p={}),p[h]=_[h]);for(o=0;o<l;o++)(c=RC(n,nM)).stagger=0,w&&(c.yoyoEase=w),p&&TC(c,p),u=C[o],c.duration=+tM(A,pE(s),o,u,C),c.delay=(+tM(g,pE(s),o,u,C)||0)-s._delay,!_&&1===l&&c.delay&&(s._delay=g=c.delay,s._start+=g,c.delay=0),a.to(u,c,d?d(o,u,C):0),a._ease=LS.none;a.duration()?A=g=0:s.timeline=0}else if(y){DC(IC(a.vars.defaults,{ease:"none"})),a._ease=FS(y.ease||n.ease||"none");var S,M,I,T=0;if(jE(y))y.forEach((function(t){return a.to(C,t,">")})),a.duration();else{for(h in c={},y)"ease"===h||"easeEach"===h||$S(h,y[h],c,y.easeEach);for(h in c)for(S=c[h].sort((function(t,e){return t.t-e.t})),T=0,o=0;o<S.length;o++)(I={ease:(M=S[o]).e,duration:(M.t-(o?S[o-1].t:0))/100*A})[h]=M.v,a.to(C,I,T),T+=I.duration;a.duration()<A&&a.to({},{duration:A-a.duration()})}}A||s.duration(A=a.duration())}else s.timeline=0;return!0!==v||AE||(qS=pE(s),_E.killTweensOf(C),qS=0),jC(E,pE(s),i),n.reversed&&s.reverse(),n.paused&&s.paused(!0),(m||!A&&!y&&s._start===bC(E._time)&&zE(m)&&NC(pE(s))&&"nested"!==E.data)&&(s._tTime=-1e-8,s.render(Math.max(0,-g)||0)),x&&WC(pE(s),x),s}fE(e,t);var n=e.prototype;return n.render=function(t,e,n){var i,r,s,a,o,c,l,h,u,d=this._time,p=this._tDur,f=this._dur,A=t<0,g=t>p-TE&&!A?p:t<TE?0:t;if(f){if(g!==this._tTime||!t||n||!this._initted&&this._tTime||this._startAt&&this._zTime<0!==A){if(i=g,h=this.timeline,this._repeat){if(a=f+this._rDelay,this._repeat<-1&&A)return this.totalTime(100*a+t,e,n);if(i=bC(g%a),g===p?(s=this._repeat,i=f):((s=~~(g/a))&&s===bC(g/a)&&(i=f,s--),i>f&&(i=f)),(c=this._yoyo&&1&s)&&(u=this._yEase,i=f-i),o=QC(this._tTime,a),i===d&&!n&&this._initted&&s===o)return this._tTime=g,this;s!==o&&(h&&this._yEase&&NS(h,c),this.vars.repeatRefresh&&!c&&!this._lock&&this._time!==a&&this._initted&&(this._lock=n=1,this.render(bC(a*s),!0).invalidate()._lock=0))}if(!this._initted){if(qC(this,A?t:i,n,e,g))return this._tTime=0,this;if(!(d===this._time||n&&this.vars.repeatRefresh&&s!==o))return this;if(f!==this._dur)return this.render(t,e,n)}if(this._tTime=g,this._time=i,!this._act&&this._ts&&(this._act=1,this._lazy=0),this.ratio=l=(u||this._ease)(i/f),this._from&&(this.ratio=l=1-l),i&&!d&&!e&&!s&&(_S(this,"onStart"),this._tTime!==g))return this;for(r=this._pt;r;)r.r(l,r.d),r=r._next;h&&h.render(t<0?t:h._dur*h._ease(i/this._dur),e,n)||this._startAt&&(this._zTime=t),this._onUpdate&&!e&&(A&&UC(this,t,0,n),_S(this,"onUpdate")),this._repeat&&s!==o&&this.vars.onRepeat&&!e&&this.parent&&_S(this,"onRepeat"),g!==this._tDur&&g||this._tTime!==g||(A&&!this._onUpdate&&UC(this,t,0,!0),(t||!f)&&(g===this._tDur&&this._ts>0||!g&&this._ts<0)&&kC(this,1),e||A&&!d||!(g||d||c)||(_S(this,g===p?"onComplete":"onReverseComplete",!0),this._prom&&!(g<p&&this.timeScale()>0)&&this._prom()))}}else!function(t,e,n,i){var r,s,a,o=t.ratio,c=e<0||!e&&(!t._start&&YC(t)&&(t._initted||!XC(t))||(t._ts<0||t._dp._ts<0)&&!XC(t))?0:1,l=t._rDelay,h=0;if(l&&t._repeat&&(h=iS(0,t._tDur,e),s=QC(h,l),t._yoyo&&1&s&&(c=1-c),s!==QC(t._tTime,l)&&(o=1-c,t.vars.repeatRefresh&&t._initted&&t.invalidate())),c!==o||gE||i||t._zTime===TE||!e&&t._zTime){if(!t._initted&&qC(t,e,i,n,h))return;for(a=t._zTime,t._zTime=e||(n?TE:0),n||(n=e&&!a),t.ratio=c,t._from&&(c=1-c),t._time=0,t._tTime=h,r=t._pt;r;)r.r(c,r.d),r=r._next;e<0&&UC(t,e,0,!0),t._onUpdate&&!n&&_S(t,"onUpdate"),h&&t._repeat&&!n&&t.parent&&_S(t,"onRepeat"),(e>=t._tDur||e<0)&&t.ratio===c&&(c&&kC(t,1),n||gE||(_S(t,c?"onComplete":"onReverseComplete",!0),t._prom&&t._prom()))}else t._zTime||(t._zTime=e)}(this,t,e,n);return this},n.targets=function(){return this._targets},n.invalidate=function(e){return(!e||!this.vars.runBackwards)&&(this._startAt=0),this._pt=this._op=this._onUpdate=this._lazy=this.ratio=0,this._ptLookup=[],this.timeline&&this.timeline.invalidate(e),t.prototype.invalidate.call(this,e)},n.resetTo=function(t,e,n,i,r){CE||RS.wake(),this._ts||this.play();var s=Math.min(this._dur,(this._dp._time-this._start)*this._ts);return this._initted||ZS(this,s),function(t,e,n,i,r,s,a,o){var c,l,h,u,d=(t._pt&&t._ptCache||(t._ptCache={}))[e];if(!d)for(d=t._ptCache[e]=[],h=t._ptLookup,u=t._targets.length;u--;){if((c=h[u][e])&&c.d&&c.d._pt)for(c=c.d._pt;c&&c.p!==e&&c.fp!==e;)c=c._next;if(!c)return YS=1,t.vars[e]="+=0",ZS(t,a),YS=0,o?nC():1;d.push(c)}for(u=d.length;u--;)(c=(l=d[u])._pt||l).s=!i&&0!==i||r?c.s+(i||0)+s*c.c:i,c.c=n-c.s,l.e&&(l.e=yC(n)+rS(l.e)),l.b&&(l.b=c.s+rS(l.b))}(this,t,e,n,i,this._ease(s/this._dur),s,r)?this.resetTo(t,e,n,i,1):(HC(this,0),this.parent||LC(this._dp,this,"_first","_last",this._dp._sort?"_start":0),this.render(0))},n.kill=function(t,e){if(void 0===e&&(e="all"),!(t||e&&"all"!==e))return this._lazy=this._pt=0,this.parent?vS(this):this;if(this.timeline){var n=this.timeline.totalDuration();return this.timeline.killTweensOf(t,e,qS&&!0!==qS.vars.overwrite)._first||vS(this),this.parent&&n!==this.timeline.totalDuration()&&JC(this,this._dur*this.timeline._tDur/n,0,1),this}var i,r,s,a,o,c,l,h=this._targets,u=t?oS(t):h,d=this._ptLookup,p=this._pt;if((!e||"all"===e)&&function(t,e){for(var n=t.length,i=n===e.length;i&&n--&&t[n]===e[n];);return n<0}(h,u))return"all"===e&&(this._pt=0),vS(this);for(i=this._op=this._op||[],"all"!==e&&(OE(e)&&(o={},vC(e,(function(t){return o[t]=1})),e=o),e=function(t,e){var n,i,r,s,a=t[0]?mC(t[0]).harness:0,o=a&&a.aliases;if(!o)return e;for(i in n=TC({},e),o)if(i in n)for(r=(s=o[i].split(",")).length;r--;)n[s[r]]=n[i];return n}(h,e)),l=h.length;l--;)if(~u.indexOf(h[l]))for(o in r=d[l],"all"===e?(i[l]=e,a=r,s={}):(s=i[l]=i[l]||{},a=e),a)(c=r&&r[o])&&("kill"in c.d&&!0!==c.d.kill(o)||PC(this,c,"_pt"),delete r[o]),"all"!==s&&(s[o]=1);return this._initted&&!this._pt&&p&&vS(this),this},e.to=function(t,n){return new e(t,n,arguments[2])},e.from=function(t,e){return eS(1,arguments)},e.delayedCall=function(t,n,i,r){return new e(n,0,{immediateRender:!1,lazy:!1,overwrite:!1,delay:t,onComplete:n,onReverseComplete:n,onCompleteParams:i,onReverseCompleteParams:i,callbackScope:r})},e.fromTo=function(t,e,n){return eS(2,arguments)},e.set=function(t,n){return n.duration=0,n.repeatDelay||(n.repeat=0),new e(t,n)},e.killTweensOf=function(t,e,n){return _E.killTweensOf(t,e,n)},e}(jS);IC(iM.prototype,{_targets:[],_lazy:0,_startAt:0,_op:0,_onInit:0}),vC("staggerTo,staggerFrom,staggerFromTo",(function(t){iM[t]=function(){var e=new WS,n=sS.call(arguments,0);return n.splice("staggerFromTo"===t?5:4,0,0),e[t].apply(e,n)}}));var rM=function(t,e,n){return t[e]=n},sM=function(t,e,n){return t[e](n)},aM=function(t,e,n,i){return t[e](i.fp,n)},oM=function(t,e,n){return t.setAttribute(e,n)},cM=function(t,e){return UE(t[e])?sM:FE(t[e])&&t.setAttribute?oM:rM},lM=function(t,e){return e.set(e.t,e.p,Math.round(1e6*(e.s+e.c*t))/1e6,e)},hM=function(t,e){return e.set(e.t,e.p,!!(e.s+e.c*t),e)},uM=function(t,e){var n=e._pt,i="";if(!t&&e.b)i=e.b;else if(1===t&&e.e)i=e.e;else{for(;n;)i=n.p+(n.m?n.m(n.s+n.c*t):Math.round(1e4*(n.s+n.c*t))/1e4)+i,n=n._next;i+=e.c}e.set(e.t,e.p,i,e)},dM=function(t,e){for(var n=e._pt;n;)n.r(t,n.d),n=n._next},pM=function(t,e,n,i){for(var r,s=this._pt;s;)r=s._next,s.p===i&&s.modifier(t,e,n),s=r},fM=function(t){for(var e,n,i=this._pt;i;)n=i._next,i.p===t&&!i.op||i.op===t?PC(this,i,"_pt"):i.dep||(e=1),i=n;return!e},AM=function(t,e,n,i){i.mSet(t,e,i.m.call(i.tween,n,i.mt),i)},gM=function(t){for(var e,n,i,r,s=t._pt;s;){for(e=s._next,n=i;n&&n.pr>s.pr;)n=n._next;(s._prev=n?n._prev:r)?s._prev._next=s:i=s,(s._next=n)?n._prev=s:r=s,s=e}t._pt=i},mM=function(){function t(t,e,n,i,r,s,a,o,c){this.t=e,this.s=i,this.c=r,this.p=n,this.r=s||lM,this.d=a||this,this.set=o||rM,this.pr=c||0,this._next=t,t&&(t._prev=this)}return t.prototype.modifier=function(t,e,n){this.mSet=this.mSet||this.set,this.set=AM,this.m=t,this.mt=n,this.tween=e},t}();vC(AC+"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(t){return cC[t]=1})),$E.TweenMax=$E.TweenLite=iM,$E.TimelineLite=$E.TimelineMax=WS,_E=new WS({sortChildren:!1,defaults:ME,autoRemoveChildren:!0,id:"root",smoothChildTiming:!0}),SE.stringFilter=BS;var _M=[],vM={},yM=[],bM=0,xM=0,wM=function(t){return(vM[t]||yM).map((function(t){return t()}))},EM=function(){var t=Date.now(),e=[];t-bM>2&&(wM("matchMediaInit"),_M.forEach((function(t){var n,i,r,s,a=t.queries,o=t.conditions;for(i in a)(n=vE.matchMedia(a[i]).matches)&&(r=1),n!==o[i]&&(o[i]=n,s=1);s&&(t.revert(),r&&e.push(t))})),wM("matchMediaRevert"),e.forEach((function(t){return t.onMatch(t,(function(e){return t.add(null,e)}))})),bM=t,wM("matchMedia"))},CM=function(){function t(t,e){this.selector=e&&cS(e),this.data=[],this._r=[],this.isReverted=!1,this.id=xM++,t&&this.add(t)}var e=t.prototype;return e.add=function(t,e,n){UE(t)&&(n=e,e=t,t=UE);var i=this,r=function(){var t,r=mE,s=i.selector;return r&&r!==i&&r.data.push(i),n&&(i.selector=cS(n)),mE=i,t=e.apply(i,arguments),UE(t)&&i._r.push(t),mE=r,i.selector=s,i.isReverted=!1,t};return i.last=r,t===UE?r(i,(function(t){return i.add(null,t)})):t?i[t]=r:r},e.ignore=function(t){var e=mE;mE=null,t(this),mE=e},e.getTweens=function(){var e=[];return this.data.forEach((function(n){return n instanceof t?e.push.apply(e,n.getTweens()):n instanceof iM&&!(n.parent&&"nested"===n.parent.data)&&e.push(n)})),e},e.clear=function(){this._r.length=this.data.length=0},e.kill=function(t,e){var n=this;if(t?function(){for(var e,i=n.getTweens(),r=n.data.length;r--;)"isFlip"===(e=n.data[r]).data&&(e.revert(),e.getChildren(!0,!0,!1).forEach((function(t){return i.splice(i.indexOf(t),1)})));for(i.map((function(t){return{g:t._dur||t._delay||t._sat&&!t._sat.vars.immediateRender?t.globalTime(0):-1/0,t:t}})).sort((function(t,e){return e.g-t.g||-1/0})).forEach((function(e){return e.t.revert(t)})),r=n.data.length;r--;)(e=n.data[r])instanceof WS?"nested"!==e.data&&(e.scrollTrigger&&e.scrollTrigger.revert(),e.kill()):!(e instanceof iM)&&e.revert&&e.revert(t);n._r.forEach((function(e){return e(t,n)})),n.isReverted=!0}():this.data.forEach((function(t){return t.kill&&t.kill()})),this.clear(),e)for(var i=_M.length;i--;)_M[i].id===this.id&&_M.splice(i,1)},e.revert=function(t){this.kill(t||{})},t}(),SM=function(){function t(t){this.contexts=[],this.scope=t,mE&&mE.data.push(this)}var e=t.prototype;return e.add=function(t,e,n){QE(t)||(t={matches:t});var i,r,s,a=new CM(0,n||this.scope),o=a.conditions={};for(r in mE&&!a.selector&&(a.selector=mE.selector),this.contexts.push(a),e=a.add("onMatch",e),a.queries=t,t)"all"===r?s=1:(i=vE.matchMedia(t[r]))&&(_M.indexOf(a)<0&&_M.push(a),(o[r]=i.matches)&&(s=1),i.addListener?i.addListener(EM):i.addEventListener("change",EM));return s&&e(a,(function(t){return a.add(null,t)})),this},e.revert=function(t){this.kill(t||{})},e.kill=function(t){this.contexts.forEach((function(e){return e.kill(t,!0)}))},t}(),MM={registerPlugin:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];e.forEach((function(t){return bS(t)}))},timeline:function(t){return new WS(t)},getTweensOf:function(t,e){return _E.getTweensOf(t,e)},getProperty:function(t,e,n,i){OE(t)&&(t=oS(t)[0]);var r=mC(t||{}).get,s=n?MC:SC;return"native"===n&&(n=""),t?e?s((uC[e]&&uC[e].get||r)(t,e,n,i)):function(e,n,i){return s((uC[e]&&uC[e].get||r)(t,e,n,i))}:t},quickSetter:function(t,e,n){if((t=oS(t)).length>1){var i=t.map((function(t){return BM.quickSetter(t,e,n)})),r=i.length;return function(t){for(var e=r;e--;)i[e](t)}}t=t[0]||{};var s=uC[e],a=mC(t),o=a.harness&&(a.harness.aliases||{})[e]||e,c=s?function(e){var i=new s;EE._pt=0,i.init(t,n?e+n:e,EE,0,[t]),i.render(1,i),EE._pt&&dM(1,EE)}:a.set(t,o);return s?c:function(e){return c(t,o,n?e+n:e,a,1)}},quickTo:function(t,e,n){var i,r=BM.to(t,TC(((i={})[e]="+=0.1",i.paused=!0,i),n||{})),s=function(t,n,i){return r.resetTo(e,t,n,i)};return s.tween=r,s},isTweening:function(t){return _E.getTweensOf(t,!0).length>0},defaults:function(t){return t&&t.ease&&(t.ease=FS(t.ease,ME.ease)),BC(ME,t||{})},config:function(t){return BC(SE,t||{})},registerEffect:function(t){var e=t.name,n=t.effect,i=t.plugins,r=t.defaults,s=t.extendTimeline;(i||"").split(",").forEach((function(t){return t&&!uC[t]&&!$E[t]&&nC()})),dC[e]=function(t,e,i){return n(oS(t),IC(e||{},r),i)},s&&(WS.prototype[e]=function(t,n,i){return this.add(dC[e](t,QE(n)?n:(i=n)&&{},this),i)})},registerEase:function(t,e){LS[t]=FS(e)},parseEase:function(t,e){return arguments.length?FS(t,e):LS},getById:function(t){return _E.getById(t)},exportRoot:function(t,e){void 0===t&&(t={});var n,i,r=new WS(t);for(r.smoothChildTiming=zE(t.smoothChildTiming),_E.remove(r),r._dp=0,r._time=r._tTime=_E._time,n=_E._first;n;)i=n._next,!e&&!n._dur&&n instanceof iM&&n.vars.onComplete===n._targets[0]||jC(r,n,n._start-n._delay),n=i;return jC(_E,r,0),r},context:function(t,e){return t?new CM(t,e):mE},matchMedia:function(t){return new SM(t)},matchMediaRefresh:function(){return _M.forEach((function(t){var e,n,i=t.conditions;for(n in i)i[n]&&(i[n]=!1,e=1);e&&t.revert()}))||EM()},addEventListener:function(t,e){var n=vM[t]||(vM[t]=[]);~n.indexOf(e)||n.push(e)},removeEventListener:function(t,e){var n=vM[t],i=n&&n.indexOf(e);i>=0&&n.splice(i,1)},utils:{wrap:function t(e,n,i){var r=n-e;return jE(e)?fS(e,t(0,e.length),n):nS(i,(function(t){return(r+(t-e)%r)%r+e}))},wrapYoyo:function t(e,n,i){var r=n-e,s=2*r;return jE(e)?fS(e,t(0,e.length-1),n):nS(i,(function(t){return e+((t=(s+(t-e)%s)%s||0)>r?s-t:t)}))},distribute:hS,random:pS,snap:dS,normalize:function(t,e,n){return gS(t,e,0,1,n)},getUnit:rS,clamp:function(t,e,n){return nS(n,(function(n){return iS(t,e,n)}))},splitColor:CS,toArray:oS,selector:cS,mapRange:gS,pipe:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return function(t){return e.reduce((function(t,e){return e(t)}),t)}},unitize:function(t,e){return function(n){return t(parseFloat(n))+(e||rS(n))}},interpolate:function t(e,n,i,r){var s=isNaN(e+n)?0:function(t){return(1-t)*e+t*n};if(!s){var a,o,c,l,h,u=OE(e),d={};if(!0===i&&(r=1)&&(i=null),u)e={p:e},n={p:n};else if(jE(e)&&!jE(n)){for(c=[],l=e.length,h=l-2,o=1;o<l;o++)c.push(t(e[o-1],e[o]));l--,s=function(t){t*=l;var e=Math.min(h,~~t);return c[e](t-e)},i=n}else r||(e=TC(jE(e)?[]:{},e));if(!c){for(a in n)JS.call(d,e,a,"get",n[a]);s=function(t){return dM(t,d)||(u?e.p:e)}}}return nS(i,s)},shuffle:lS},install:eC,effects:dC,ticker:RS,updateRoot:WS.updateRoot,plugins:uC,globalTimeline:_E,core:{PropTween:mM,globals:iC,Tween:iM,Timeline:WS,Animation:jS,getCache:mC,_removeLinkedListItem:PC,reverting:function(){return gE},context:function(t){return t&&mE&&(mE.data.push(t),t._ctx=mE),mE},suppressOverwrites:function(t){return AE=t}}};vC("to,from,fromTo,delayedCall,set,killTweensOf",(function(t){return MM[t]=iM[t]})),RS.add(WS.updateRoot),EE=MM.to({},{duration:0});var IM=function(t,e){for(var n=t._pt;n&&n.p!==e&&n.op!==e&&n.fp!==e;)n=n._next;return n},TM=function(t,e){return{name:t,rawVars:1,init:function(t,n,i){i._onInit=function(t){var i,r;if(OE(n)&&(i={},vC(n,(function(t){return i[t]=1})),n=i),e){for(r in i={},n)i[r]=e(n[r]);n=i}!function(t,e){var n,i,r,s=t._targets;for(n in e)for(i=s.length;i--;)(r=t._ptLookup[i][n])&&(r=r.d)&&(r._pt&&(r=IM(r,n)),r&&r.modifier&&r.modifier(e[n],t,s[i],n))}(t,n)}}}},BM=MM.registerPlugin({name:"attr",init:function(t,e,n,i,r){var s,a,o;for(s in this.tween=n,e)o=t.getAttribute(s)||"",(a=this.add(t,"setAttribute",(o||0)+"",e[s],i,r,0,0,s)).op=s,a.b=o,this._props.push(s)},render:function(t,e){for(var n=e._pt;n;)gE?n.set(n.t,n.p,n.b,n):n.r(t,n.d),n=n._next}},{name:"endArray",init:function(t,e){for(var n=e.length;n--;)this.add(t,n,t[n]||0,e[n],0,0,0,0,0,1)}},TM("roundProps",uS),TM("modifiers"),TM("snap",dS))||MM;iM.version=WS.version=BM.version="3.12.5",xE=1,GE()&&DS(),LS.Power0,LS.Power1,LS.Power2,LS.Power3,LS.Power4,LS.Linear,LS.Quad,LS.Cubic,LS.Quart,LS.Quint,LS.Strong,LS.Elastic,LS.Back,LS.SteppedEase,LS.Bounce,LS.Sine,LS.Expo,LS.Circ;var RM,DM,LM,PM,kM,OM,UM,NM,FM={},QM=180/Math.PI,zM=Math.PI/180,GM=Math.atan2,HM=/([A-Z])/g,VM=/(left|right|width|margin|padding|x)/i,jM=/[\s,\(]\S/,WM={autoAlpha:"opacity,visibility",scale:"scaleX,scaleY",alpha:"opacity"},qM=function(t,e){return e.set(e.t,e.p,Math.round(1e4*(e.s+e.c*t))/1e4+e.u,e)},YM=function(t,e){return e.set(e.t,e.p,1===t?e.e:Math.round(1e4*(e.s+e.c*t))/1e4+e.u,e)},XM=function(t,e){return e.set(e.t,e.p,t?Math.round(1e4*(e.s+e.c*t))/1e4+e.u:e.b,e)},JM=function(t,e){var n=e.s+e.c*t;e.set(e.t,e.p,~~(n+(n<0?-.5:.5))+e.u,e)},KM=function(t,e){return e.set(e.t,e.p,t?e.e:e.b,e)},ZM=function(t,e){return e.set(e.t,e.p,1!==t?e.b:e.e,e)},$M=function(t,e,n){return t.style[e]=n},tI=function(t,e,n){return t.style.setProperty(e,n)},eI=function(t,e,n){return t._gsap[e]=n},nI=function(t,e,n){return t._gsap.scaleX=t._gsap.scaleY=n},iI=function(t,e,n,i,r){var s=t._gsap;s.scaleX=s.scaleY=n,s.renderTransform(r,s)},rI=function(t,e,n,i,r){var s=t._gsap;s[e]=n,s.renderTransform(r,s)},sI="transform",aI=sI+"Origin",oI=function t(e,n){var i=this,r=this.target,s=r.style,a=r._gsap;if(e in FM&&s){if(this.tfm=this.tfm||{},"transform"===e)return WM.transform.split(",").forEach((function(e){return t.call(i,e,n)}));if(~(e=WM[e]||e).indexOf(",")?e.split(",").forEach((function(t){return i.tfm[t]=CI(r,t)})):this.tfm[e]=a.x?a[e]:CI(r,e),e===aI&&(this.tfm.zOrigin=a.zOrigin),this.props.indexOf(sI)>=0)return;a.svg&&(this.svgo=r.getAttribute("data-svg-origin"),this.props.push(aI,n,"")),e=sI}(s||n)&&this.props.push(e,n,s[e])},cI=function(t){t.translate&&(t.removeProperty("translate"),t.removeProperty("scale"),t.removeProperty("rotate"))},lI=function(){var t,e,n=this.props,i=this.target,r=i.style,s=i._gsap;for(t=0;t<n.length;t+=3)n[t+1]?i[n[t]]=n[t+2]:n[t+2]?r[n[t]]=n[t+2]:r.removeProperty("--"===n[t].substr(0,2)?n[t]:n[t].replace(HM,"-$1").toLowerCase());if(this.tfm){for(e in this.tfm)s[e]=this.tfm[e];s.svg&&(s.renderTransform(),i.setAttribute("data-svg-origin",this.svgo||"")),(t=UM())&&t.isStart||r[sI]||(cI(r),s.zOrigin&&r[aI]&&(r[aI]+=" "+s.zOrigin+"px",s.zOrigin=0,s.renderTransform()),s.uncache=1)}},hI=function(t,e){var n={target:t,props:[],revert:lI,save:oI};return t._gsap||BM.core.getCache(t),e&&e.split(",").forEach((function(t){return n.save(t)})),n},uI=function(t,e){var n=DM.createElementNS?DM.createElementNS((e||"http://www.w3.org/1999/xhtml").replace(/^https/,"http"),t):DM.createElement(t);return n&&n.style?n:DM.createElement(t)},dI=function t(e,n,i){var r=getComputedStyle(e);return r[n]||r.getPropertyValue(n.replace(HM,"-$1").toLowerCase())||r.getPropertyValue(n)||!i&&t(e,fI(n)||n,1)||""},pI="O,Moz,ms,Ms,Webkit".split(","),fI=function(t,e,n){var i=(e||kM).style,r=5;if(t in i&&!n)return t;for(t=t.charAt(0).toUpperCase()+t.substr(1);r--&&!(pI[r]+t in i););return r<0?null:(3===r?"ms":r>=0?pI[r]:"")+t},AI=function(){"undefined"!=typeof window&&window.document&&(RM=window,DM=RM.document,LM=DM.documentElement,kM=uI("div")||{style:{}},uI("div"),sI=fI(sI),aI=sI+"Origin",kM.style.cssText="border-width:0;line-height:0;position:absolute;padding:0",NM=!!fI("perspective"),UM=BM.core.reverting,PM=1)},gI=function t(e){var n,i=uI("svg",this.ownerSVGElement&&this.ownerSVGElement.getAttribute("xmlns")||"http://www.w3.org/2000/svg"),r=this.parentNode,s=this.nextSibling,a=this.style.cssText;if(LM.appendChild(i),i.appendChild(this),this.style.display="block",e)try{n=this.getBBox(),this._gsapBBox=this.getBBox,this.getBBox=t}catch(t){}else this._gsapBBox&&(n=this._gsapBBox());return r&&(s?r.insertBefore(this,s):r.appendChild(this)),LM.removeChild(i),this.style.cssText=a,n},mI=function(t,e){for(var n=e.length;n--;)if(t.hasAttribute(e[n]))return t.getAttribute(e[n])},_I=function(t){var e;try{e=t.getBBox()}catch(n){e=gI.call(t,!0)}return e&&(e.width||e.height)||t.getBBox===gI||(e=gI.call(t,!0)),!e||e.width||e.x||e.y?e:{x:+mI(t,["x","cx","x1"])||0,y:+mI(t,["y","cy","y1"])||0,width:0,height:0}},vI=function(t){return!(!t.getCTM||t.parentNode&&!t.ownerSVGElement||!_I(t))},yI=function(t,e){if(e){var n,i=t.style;e in FM&&e!==aI&&(e=sI),i.removeProperty?("ms"!==(n=e.substr(0,2))&&"webkit"!==e.substr(0,6)||(e="-"+e),i.removeProperty("--"===n?e:e.replace(HM,"-$1").toLowerCase())):i.removeAttribute(e)}},bI=function(t,e,n,i,r,s){var a=new mM(t._pt,e,n,0,1,s?ZM:KM);return t._pt=a,a.b=i,a.e=r,t._props.push(n),a},xI={deg:1,rad:1,turn:1},wI={grid:1,flex:1},EI=function t(e,n,i,r){var s,a,o,c,l=parseFloat(i)||0,h=(i+"").trim().substr((l+"").length)||"px",u=kM.style,d=VM.test(n),p="svg"===e.tagName.toLowerCase(),f=(p?"client":"offset")+(d?"Width":"Height"),A=100,g="px"===r,m="%"===r;if(r===h||!l||xI[r]||xI[h])return l;if("px"!==h&&!g&&(l=t(e,n,i,"px")),c=e.getCTM&&vI(e),(m||"%"===h)&&(FM[n]||~n.indexOf("adius")))return s=c?e.getBBox()[d?"width":"height"]:e[f],yC(m?l/s*A:l/100*s);if(u[d?"width":"height"]=A+(g?h:r),a=~n.indexOf("adius")||"em"===r&&e.appendChild&&!p?e:e.parentNode,c&&(a=(e.ownerSVGElement||{}).parentNode),a&&a!==DM&&a.appendChild||(a=DM.body),(o=a._gsap)&&m&&o.width&&d&&o.time===RS.time&&!o.uncache)return yC(l/o.width*A);if(!m||"height"!==n&&"width"!==n)(m||"%"===h)&&!wI[dI(a,"display")]&&(u.position=dI(e,"position")),a===e&&(u.position="static"),a.appendChild(kM),s=kM[f],a.removeChild(kM),u.position="absolute";else{var _=e.style[n];e.style[n]=A+r,s=e[f],_?e.style[n]=_:yI(e,n)}return d&&m&&((o=mC(a)).time=RS.time,o.width=a[f]),yC(g?s*l/A:s&&l?A/s*l:0)},CI=function(t,e,n,i){var r;return PM||AI(),e in WM&&"transform"!==e&&~(e=WM[e]).indexOf(",")&&(e=e.split(",")[0]),FM[e]&&"transform"!==e?(r=UI(t,i),r="transformOrigin"!==e?r[e]:r.svg?r.origin:NI(dI(t,aI))+" "+r.zOrigin+"px"):(!(r=t.style[e])||"auto"===r||i||~(r+"").indexOf("calc("))&&(r=BI[e]&&BI[e](t,e,n)||dI(t,e)||_C(t,e)||("opacity"===e?1:0)),n&&!~(r+"").trim().indexOf(" ")?EI(t,e,r,n)+n:r},SI=function(t,e,n,i){if(!n||"none"===n){var r=fI(e,t,1),s=r&&dI(t,r,1);s&&s!==n?(e=r,n=s):"borderColor"===e&&(n=dI(t,"borderTopColor"))}var a,o,c,l,h,u,d,p,f,A,g,m=new mM(this._pt,t.style,e,0,1,uM),_=0,v=0;if(m.b=n,m.e=i,n+="","auto"===(i+="")&&(u=t.style[e],t.style[e]=i,i=dI(t,e)||i,u?t.style[e]=u:yI(t,e)),BS(a=[n,i]),i=a[1],c=(n=a[0]).match(YE)||[],(i.match(YE)||[]).length){for(;o=YE.exec(i);)d=o[0],f=i.substring(_,o.index),h?h=(h+1)%5:"rgba("!==f.substr(-5)&&"hsla("!==f.substr(-5)||(h=1),d!==(u=c[v++]||"")&&(l=parseFloat(u)||0,g=u.substr((l+"").length),"="===d.charAt(1)&&(d=xC(l,d)+g),p=parseFloat(d),A=d.substr((p+"").length),_=YE.lastIndex-A.length,A||(A=A||SE.units[e]||g,_===i.length&&(i+=A,m.e+=A)),g!==A&&(l=EI(t,e,u,A)||0),m._pt={_next:m._pt,p:f||1===v?f:",",s:l,c:p-l,m:h&&h<4||"zIndex"===e?Math.round:0});m.c=_<i.length?i.substring(_,i.length):""}else m.r="display"===e&&"none"===i?ZM:KM;return JE.test(i)&&(m.e=0),this._pt=m,m},MI={top:"0%",bottom:"100%",left:"0%",right:"100%",center:"50%"},II=function(t){var e=t.split(" "),n=e[0],i=e[1]||"50%";return"top"!==n&&"bottom"!==n&&"left"!==i&&"right"!==i||(t=n,n=i,i=t),e[0]=MI[n]||n,e[1]=MI[i]||i,e.join(" ")},TI=function(t,e){if(e.tween&&e.tween._time===e.tween._dur){var n,i,r,s=e.t,a=s.style,o=e.u,c=s._gsap;if("all"===o||!0===o)a.cssText="",i=1;else for(r=(o=o.split(",")).length;--r>-1;)n=o[r],FM[n]&&(i=1,n="transformOrigin"===n?aI:sI),yI(s,n);i&&(yI(s,sI),c&&(c.svg&&s.removeAttribute("transform"),UI(s,1),c.uncache=1,cI(a)))}},BI={clearProps:function(t,e,n,i,r){if("isFromStart"!==r.data){var s=t._pt=new mM(t._pt,e,n,0,0,TI);return s.u=i,s.pr=-10,s.tween=r,t._props.push(n),1}}},RI=[1,0,0,1,0,0],DI={},LI=function(t){return"matrix(1, 0, 0, 1, 0, 0)"===t||"none"===t||!t},PI=function(t){var e=dI(t,sI);return LI(e)?RI:e.substr(7).match(qE).map(yC)},kI=function(t,e){var n,i,r,s,a=t._gsap||mC(t),o=t.style,c=PI(t);return a.svg&&t.getAttribute("transform")?"1,0,0,1,0,0"===(c=[(r=t.transform.baseVal.consolidate().matrix).a,r.b,r.c,r.d,r.e,r.f]).join(",")?RI:c:(c!==RI||t.offsetParent||t===LM||a.svg||(r=o.display,o.display="block",(n=t.parentNode)&&t.offsetParent||(s=1,i=t.nextElementSibling,LM.appendChild(t)),c=PI(t),r?o.display=r:yI(t,"display"),s&&(i?n.insertBefore(t,i):n?n.appendChild(t):LM.removeChild(t))),e&&c.length>6?[c[0],c[1],c[4],c[5],c[12],c[13]]:c)},OI=function(t,e,n,i,r,s){var a,o,c,l=t._gsap,h=r||kI(t,!0),u=l.xOrigin||0,d=l.yOrigin||0,p=l.xOffset||0,f=l.yOffset||0,A=h[0],g=h[1],m=h[2],_=h[3],v=h[4],y=h[5],b=e.split(" "),x=parseFloat(b[0])||0,w=parseFloat(b[1])||0;n?h!==RI&&(o=A*_-g*m)&&(c=x*(-g/o)+w*(A/o)-(A*y-g*v)/o,x=x*(_/o)+w*(-m/o)+(m*y-_*v)/o,w=c):(x=(a=_I(t)).x+(~b[0].indexOf("%")?x/100*a.width:x),w=a.y+(~(b[1]||b[0]).indexOf("%")?w/100*a.height:w)),i||!1!==i&&l.smooth?(v=x-u,y=w-d,l.xOffset=p+(v*A+y*m)-v,l.yOffset=f+(v*g+y*_)-y):l.xOffset=l.yOffset=0,l.xOrigin=x,l.yOrigin=w,l.smooth=!!i,l.origin=e,l.originIsAbsolute=!!n,t.style[aI]="0px 0px",s&&(bI(s,l,"xOrigin",u,x),bI(s,l,"yOrigin",d,w),bI(s,l,"xOffset",p,l.xOffset),bI(s,l,"yOffset",f,l.yOffset)),t.setAttribute("data-svg-origin",x+" "+w)},UI=function(t,e){var n=t._gsap||new VS(t);if("x"in n&&!e&&!n.uncache)return n;var i,r,s,a,o,c,l,h,u,d,p,f,A,g,m,_,v,y,b,x,w,E,C,S,M,I,T,B,R,D,L,P,k=t.style,O=n.scaleX<0,U="px",N="deg",F=getComputedStyle(t),Q=dI(t,aI)||"0";return i=r=s=c=l=h=u=d=p=0,a=o=1,n.svg=!(!t.getCTM||!vI(t)),F.translate&&("none"===F.translate&&"none"===F.scale&&"none"===F.rotate||(k[sI]=("none"!==F.translate?"translate3d("+(F.translate+" 0 0").split(" ").slice(0,3).join(", ")+") ":"")+("none"!==F.rotate?"rotate("+F.rotate+") ":"")+("none"!==F.scale?"scale("+F.scale.split(" ").join(",")+") ":"")+("none"!==F[sI]?F[sI]:"")),k.scale=k.rotate=k.translate="none"),g=kI(t,n.svg),n.svg&&(n.uncache?(M=t.getBBox(),Q=n.xOrigin-M.x+"px "+(n.yOrigin-M.y)+"px",S=""):S=!e&&t.getAttribute("data-svg-origin"),OI(t,S||Q,!!S||n.originIsAbsolute,!1!==n.smooth,g)),f=n.xOrigin||0,A=n.yOrigin||0,g!==RI&&(y=g[0],b=g[1],x=g[2],w=g[3],i=E=g[4],r=C=g[5],6===g.length?(a=Math.sqrt(y*y+b*b),o=Math.sqrt(w*w+x*x),c=y||b?GM(b,y)*QM:0,(u=x||w?GM(x,w)*QM+c:0)&&(o*=Math.abs(Math.cos(u*zM))),n.svg&&(i-=f-(f*y+A*x),r-=A-(f*b+A*w))):(P=g[6],D=g[7],T=g[8],B=g[9],R=g[10],L=g[11],i=g[12],r=g[13],s=g[14],l=(m=GM(P,R))*QM,m&&(S=E*(_=Math.cos(-m))+T*(v=Math.sin(-m)),M=C*_+B*v,I=P*_+R*v,T=E*-v+T*_,B=C*-v+B*_,R=P*-v+R*_,L=D*-v+L*_,E=S,C=M,P=I),h=(m=GM(-x,R))*QM,m&&(_=Math.cos(-m),L=w*(v=Math.sin(-m))+L*_,y=S=y*_-T*v,b=M=b*_-B*v,x=I=x*_-R*v),c=(m=GM(b,y))*QM,m&&(S=y*(_=Math.cos(m))+b*(v=Math.sin(m)),M=E*_+C*v,b=b*_-y*v,C=C*_-E*v,y=S,E=M),l&&Math.abs(l)+Math.abs(c)>359.9&&(l=c=0,h=180-h),a=yC(Math.sqrt(y*y+b*b+x*x)),o=yC(Math.sqrt(C*C+P*P)),m=GM(E,C),u=Math.abs(m)>2e-4?m*QM:0,p=L?1/(L<0?-L:L):0),n.svg&&(S=t.getAttribute("transform"),n.forceCSS=t.setAttribute("transform","")||!LI(dI(t,sI)),S&&t.setAttribute("transform",S))),Math.abs(u)>90&&Math.abs(u)<270&&(O?(a*=-1,u+=c<=0?180:-180,c+=c<=0?180:-180):(o*=-1,u+=u<=0?180:-180)),e=e||n.uncache,n.x=i-((n.xPercent=i&&(!e&&n.xPercent||(Math.round(t.offsetWidth/2)===Math.round(-i)?-50:0)))?t.offsetWidth*n.xPercent/100:0)+U,n.y=r-((n.yPercent=r&&(!e&&n.yPercent||(Math.round(t.offsetHeight/2)===Math.round(-r)?-50:0)))?t.offsetHeight*n.yPercent/100:0)+U,n.z=s+U,n.scaleX=yC(a),n.scaleY=yC(o),n.rotation=yC(c)+N,n.rotationX=yC(l)+N,n.rotationY=yC(h)+N,n.skewX=u+N,n.skewY=d+N,n.transformPerspective=p+U,(n.zOrigin=parseFloat(Q.split(" ")[2])||!e&&n.zOrigin||0)&&(k[aI]=NI(Q)),n.xOffset=n.yOffset=0,n.force3D=SE.force3D,n.renderTransform=n.svg?jI:NM?VI:QI,n.uncache=0,n},NI=function(t){return(t=t.split(" "))[0]+" "+t[1]},FI=function(t,e,n){var i=rS(e);return yC(parseFloat(e)+parseFloat(EI(t,"x",n+"px",i)))+i},QI=function(t,e){e.z="0px",e.rotationY=e.rotationX="0deg",e.force3D=0,VI(t,e)},zI="0deg",GI="0px",HI=") ",VI=function(t,e){var n=e||this,i=n.xPercent,r=n.yPercent,s=n.x,a=n.y,o=n.z,c=n.rotation,l=n.rotationY,h=n.rotationX,u=n.skewX,d=n.skewY,p=n.scaleX,f=n.scaleY,A=n.transformPerspective,g=n.force3D,m=n.target,_=n.zOrigin,v="",y="auto"===g&&t&&1!==t||!0===g;if(_&&(h!==zI||l!==zI)){var b,x=parseFloat(l)*zM,w=Math.sin(x),E=Math.cos(x);x=parseFloat(h)*zM,b=Math.cos(x),s=FI(m,s,w*b*-_),a=FI(m,a,-Math.sin(x)*-_),o=FI(m,o,E*b*-_+_)}A!==GI&&(v+="perspective("+A+HI),(i||r)&&(v+="translate("+i+"%, "+r+"%) "),(y||s!==GI||a!==GI||o!==GI)&&(v+=o!==GI||y?"translate3d("+s+", "+a+", "+o+") ":"translate("+s+", "+a+HI),c!==zI&&(v+="rotate("+c+HI),l!==zI&&(v+="rotateY("+l+HI),h!==zI&&(v+="rotateX("+h+HI),u===zI&&d===zI||(v+="skew("+u+", "+d+HI),1===p&&1===f||(v+="scale("+p+", "+f+HI),m.style[sI]=v||"translate(0, 0)"},jI=function(t,e){var n,i,r,s,a,o=e||this,c=o.xPercent,l=o.yPercent,h=o.x,u=o.y,d=o.rotation,p=o.skewX,f=o.skewY,A=o.scaleX,g=o.scaleY,m=o.target,_=o.xOrigin,v=o.yOrigin,y=o.xOffset,b=o.yOffset,x=o.forceCSS,w=parseFloat(h),E=parseFloat(u);d=parseFloat(d),p=parseFloat(p),(f=parseFloat(f))&&(p+=f=parseFloat(f),d+=f),d||p?(d*=zM,p*=zM,n=Math.cos(d)*A,i=Math.sin(d)*A,r=Math.sin(d-p)*-g,s=Math.cos(d-p)*g,p&&(f*=zM,a=Math.tan(p-f),r*=a=Math.sqrt(1+a*a),s*=a,f&&(a=Math.tan(f),n*=a=Math.sqrt(1+a*a),i*=a)),n=yC(n),i=yC(i),r=yC(r),s=yC(s)):(n=A,s=g,i=r=0),(w&&!~(h+"").indexOf("px")||E&&!~(u+"").indexOf("px"))&&(w=EI(m,"x",h,"px"),E=EI(m,"y",u,"px")),(_||v||y||b)&&(w=yC(w+_-(_*n+v*r)+y),E=yC(E+v-(_*i+v*s)+b)),(c||l)&&(a=m.getBBox(),w=yC(w+c/100*a.width),E=yC(E+l/100*a.height)),a="matrix("+n+","+i+","+r+","+s+","+w+","+E+")",m.setAttribute("transform",a),x&&(m.style[sI]=a)},WI=function(t,e,n,i,r){var s,a,o=360,c=OE(r),l=parseFloat(r)*(c&&~r.indexOf("rad")?QM:1)-i,h=i+l+"deg";return c&&("short"===(s=r.split("_")[1])&&(l%=o)!==l%180&&(l+=l<0?o:-360),"cw"===s&&l<0?l=(l+36e9)%o-~~(l/o)*o:"ccw"===s&&l>0&&(l=(l-36e9)%o-~~(l/o)*o)),t._pt=a=new mM(t._pt,e,n,i,l,YM),a.e=h,a.u="deg",t._props.push(n),a},qI=function(t,e){for(var n in e)t[n]=e[n];return t},YI=function(t,e,n){var i,r,s,a,o,c,l,h=qI({},n._gsap),u=n.style;for(r in h.svg?(s=n.getAttribute("transform"),n.setAttribute("transform",""),u[sI]=e,i=UI(n,1),yI(n,sI),n.setAttribute("transform",s)):(s=getComputedStyle(n)[sI],u[sI]=e,i=UI(n,1),u[sI]=s),FM)(s=h[r])!==(a=i[r])&&"perspective,force3D,transformOrigin,svgOrigin".indexOf(r)<0&&(o=rS(s)!==(l=rS(a))?EI(n,r,s,l):parseFloat(s),c=parseFloat(a),t._pt=new mM(t._pt,i,r,o,c-o,qM),t._pt.u=l||0,t._props.push(r));qI(i,h)};vC("padding,margin,Width,Radius",(function(t,e){var n="Top",i="Right",r="Bottom",s="Left",a=(e<3?[n,i,r,s]:[n+s,n+i,r+i,r+s]).map((function(n){return e<2?t+n:"border"+n+t}));BI[e>1?"border"+t:t]=function(t,e,n,i,r){var s,o;if(arguments.length<4)return s=a.map((function(e){return CI(t,e,n)})),5===(o=s.join(" ")).split(s[0]).length?s[0]:o;s=(i+"").split(" "),o={},a.forEach((function(t,e){return o[t]=s[e]=s[e]||s[(e-1)/2|0]})),t.init(e,o,r)}}));var XI,JI,KI,ZI={name:"css",register:AI,targetTest:function(t){return t.style&&t.nodeType},init:function(t,e,n,i,r){var s,a,o,c,l,h,u,d,p,f,A,g,m,_,v,y,b=this._props,x=t.style,w=n.vars.startAt;for(u in PM||AI(),this.styles=this.styles||hI(t),y=this.styles.props,this.tween=n,e)if("autoRound"!==u&&(a=e[u],!uC[u]||!KS(u,e,n,i,t,r)))if(l=typeof a,h=BI[u],"function"===l&&(l=typeof(a=a.call(n,i,t,r))),"string"===l&&~a.indexOf("random(")&&(a=AS(a)),h)h(this,t,u,a,n)&&(v=1);else if("--"===u.substr(0,2))s=(getComputedStyle(t).getPropertyValue(u)+"").trim(),a+="",IS.lastIndex=0,IS.test(s)||(d=rS(s),p=rS(a)),p?d!==p&&(s=EI(t,u,s,p)+p):d&&(a+=d),this.add(x,"setProperty",s,a,i,r,0,0,u),b.push(u),y.push(u,0,x[u]);else if("undefined"!==l){if(w&&u in w?(s="function"==typeof w[u]?w[u].call(n,i,t,r):w[u],OE(s)&&~s.indexOf("random(")&&(s=AS(s)),rS(s+"")||"auto"===s||(s+=SE.units[u]||rS(CI(t,u))||""),"="===(s+"").charAt(1)&&(s=CI(t,u))):s=CI(t,u),c=parseFloat(s),(f="string"===l&&"="===a.charAt(1)&&a.substr(0,2))&&(a=a.substr(2)),o=parseFloat(a),u in WM&&("autoAlpha"===u&&(1===c&&"hidden"===CI(t,"visibility")&&o&&(c=0),y.push("visibility",0,x.visibility),bI(this,x,"visibility",c?"inherit":"hidden",o?"inherit":"hidden",!o)),"scale"!==u&&"transform"!==u&&~(u=WM[u]).indexOf(",")&&(u=u.split(",")[0])),A=u in FM)if(this.styles.save(u),g||((m=t._gsap).renderTransform&&!e.parseTransform||UI(t,e.parseTransform),_=!1!==e.smoothOrigin&&m.smooth,(g=this._pt=new mM(this._pt,x,sI,0,1,m.renderTransform,m,0,-1)).dep=1),"scale"===u)this._pt=new mM(this._pt,m,"scaleY",m.scaleY,(f?xC(m.scaleY,f+o):o)-m.scaleY||0,qM),this._pt.u=0,b.push("scaleY",u),u+="X";else{if("transformOrigin"===u){y.push(aI,0,x[aI]),a=II(a),m.svg?OI(t,a,0,_,0,this):((p=parseFloat(a.split(" ")[2])||0)!==m.zOrigin&&bI(this,m,"zOrigin",m.zOrigin,p),bI(this,x,u,NI(s),NI(a)));continue}if("svgOrigin"===u){OI(t,a,1,_,0,this);continue}if(u in DI){WI(this,m,u,c,f?xC(c,f+a):a);continue}if("smoothOrigin"===u){bI(this,m,"smooth",m.smooth,a);continue}if("force3D"===u){m[u]=a;continue}if("transform"===u){YI(this,a,t);continue}}else u in x||(u=fI(u)||u);if(A||(o||0===o)&&(c||0===c)&&!jM.test(a)&&u in x)o||(o=0),(d=(s+"").substr((c+"").length))!==(p=rS(a)||(u in SE.units?SE.units[u]:d))&&(c=EI(t,u,s,p)),this._pt=new mM(this._pt,A?m:x,u,c,(f?xC(c,f+o):o)-c,A||"px"!==p&&"zIndex"!==u||!1===e.autoRound?qM:JM),this._pt.u=p||0,d!==p&&"%"!==p&&(this._pt.b=s,this._pt.r=XM);else if(u in x)SI.call(this,t,u,s,f?f+a:a);else if(u in t)this.add(t,u,s||t[u],f?f+a:a,i,r);else if("parseTransform"!==u)continue;A||(u in x?y.push(u,0,x[u]):y.push(u,1,s||t[u])),b.push(u)}v&&gM(this)},render:function(t,e){if(e.tween._time||!UM())for(var n=e._pt;n;)n.r(t,n.d),n=n._next;else e.styles.revert()},get:CI,aliases:WM,getSetter:function(t,e,n){var i=WM[e];return i&&i.indexOf(",")<0&&(e=i),e in FM&&e!==aI&&(t._gsap.x||CI(t,"x"))?n&&OM===n?"scale"===e?nI:eI:(OM=n||{})&&("scale"===e?iI:rI):t.style&&!FE(t.style[e])?$M:~e.indexOf("-")?tI:cM(t,e)},core:{_removeProperty:yI,_getMatrix:kI}};BM.utils.checkPrefix=fI,BM.core.getStyleSaver=hI,KI=vC((XI="x,y,z,scale,scaleX,scaleY,xPercent,yPercent")+","+(JI="rotation,rotationX,rotationY,skewX,skewY")+",transform,transformOrigin,svgOrigin,force3D,smoothOrigin,transformPerspective",(function(t){FM[t]=1})),vC(JI,(function(t){SE.units[t]="deg",DI[t]=1})),WM[KI[13]]=XI+","+JI,vC("0:translateX,1:translateY,2:translateZ,8:rotate,8:rotationZ,8:rotateZ,9:rotateX,10:rotateY",(function(t){var e=t.split(":");WM[e[1]]=KI[e[0]]})),vC("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective",(function(t){SE.units[t]="px"})),BM.registerPlugin(ZI);var $I=BM.registerPlugin(ZI)||BM;$I.core.Tween;class tT{action;listener={};config={};constructor(t,e={}){this.action=t,this.listener={},this.config=aE({timeBeforeFinished:1},e)}on(t,e){this.listener[t]=e}update(t){const{loop:e,time:n,_loopCount:i,repetitions:r}=this.action;if(2201===e&&(r===1/0||r-i!=1))return;const s=this.action.getClip().duration,a=s-this.config.timeBeforeFinished,o=this.listener.beforeFinished;o&&n>=a&&n<a+t&&(Reflect.deleteProperty(this.listener,"beforeFinished"),o(this.action));const c=this.listener.finished;c&&n>=s&&n<s+t&&(Reflect.deleteProperty(this.listener,"finished"),c(this.action))}}class eT{constructor(t,e,n,i,r="div"){this.parent=t,this.object=e,this.property=n,this._disabled=!1,this._hidden=!1,this.initialValue=this.getValue(),this.domElement=document.createElement(r),this.domElement.classList.add("controller"),this.domElement.classList.add(i),this.$name=document.createElement("div"),this.$name.classList.add("name"),eT.nextNameID=eT.nextNameID||0,this.$name.id="lil-gui-name-"+ ++eT.nextNameID,this.$widget=document.createElement("div"),this.$widget.classList.add("widget"),this.$disable=this.$widget,this.domElement.appendChild(this.$name),this.domElement.appendChild(this.$widget),this.domElement.addEventListener("keydown",(t=>t.stopPropagation())),this.domElement.addEventListener("keyup",(t=>t.stopPropagation())),this.parent.children.push(this),this.parent.controllers.push(this),this.parent.$children.appendChild(this.domElement),this._listenCallback=this._listenCallback.bind(this),this.name(n)}name(t){return this._name=t,this.$name.textContent=t,this}onChange(t){return this._onChange=t,this}_callOnChange(){this.parent._callOnChange(this),void 0!==this._onChange&&this._onChange.call(this,this.getValue()),this._changed=!0}onFinishChange(t){return this._onFinishChange=t,this}_callOnFinishChange(){this._changed&&(this.parent._callOnFinishChange(this),void 0!==this._onFinishChange&&this._onFinishChange.call(this,this.getValue())),this._changed=!1}reset(){return this.setValue(this.initialValue),this._callOnFinishChange(),this}enable(t=!0){return this.disable(!t)}disable(t=!0){return t===this._disabled||(this._disabled=t,this.domElement.classList.toggle("disabled",t),this.$disable.toggleAttribute("disabled",t)),this}show(t=!0){return this._hidden=!t,this.domElement.style.display=this._hidden?"none":"",this}hide(){return this.show(!1)}options(t){const e=this.parent.add(this.object,this.property,t);return e.name(this._name),this.destroy(),e}min(t){return this}max(t){return this}step(t){return this}decimals(t){return this}listen(t=!0){return this._listening=t,void 0!==this._listenCallbackID&&(cancelAnimationFrame(this._listenCallbackID),this._listenCallbackID=void 0),this._listening&&this._listenCallback(),this}_listenCallback(){this._listenCallbackID=requestAnimationFrame(this._listenCallback);const t=this.save();t!==this._listenPrevValue&&this.updateDisplay(),this._listenPrevValue=t}getValue(){return this.object[this.property]}setValue(t){return this.getValue()!==t&&(this.object[this.property]=t,this._callOnChange(),this.updateDisplay()),this}updateDisplay(){return this}load(t){return this.setValue(t),this._callOnFinishChange(),this}save(){return this.getValue()}destroy(){this.listen(!1),this.parent.children.splice(this.parent.children.indexOf(this),1),this.parent.controllers.splice(this.parent.controllers.indexOf(this),1),this.parent.$children.removeChild(this.domElement)}}class nT extends eT{constructor(t,e,n){super(t,e,n,"boolean","label"),this.$input=document.createElement("input"),this.$input.setAttribute("type","checkbox"),this.$input.setAttribute("aria-labelledby",this.$name.id),this.$widget.appendChild(this.$input),this.$input.addEventListener("change",(()=>{this.setValue(this.$input.checked),this._callOnFinishChange()})),this.$disable=this.$input,this.updateDisplay()}updateDisplay(){return this.$input.checked=this.getValue(),this}}function iT(t){let e,n;return(e=t.match(/(#|0x)?([a-f0-9]{6})/i))?n=e[2]:(e=t.match(/rgb\(\s*(\d*)\s*,\s*(\d*)\s*,\s*(\d*)\s*\)/))?n=parseInt(e[1]).toString(16).padStart(2,0)+parseInt(e[2]).toString(16).padStart(2,0)+parseInt(e[3]).toString(16).padStart(2,0):(e=t.match(/^#?([a-f0-9])([a-f0-9])([a-f0-9])$/i))&&(n=e[1]+e[1]+e[2]+e[2]+e[3]+e[3]),!!n&&"#"+n}const rT={isPrimitive:!0,match:t=>"string"==typeof t,fromHexString:iT,toHexString:iT},sT={isPrimitive:!0,match:t=>"number"==typeof t,fromHexString:t=>parseInt(t.substring(1),16),toHexString:t=>"#"+t.toString(16).padStart(6,0)},aT={isPrimitive:!1,match:t=>Array.isArray(t),fromHexString(t,e,n=1){const i=sT.fromHexString(t);e[0]=(i>>16&255)/255*n,e[1]=(i>>8&255)/255*n,e[2]=(255&i)/255*n},toHexString:([t,e,n],i=1)=>sT.toHexString(t*(i=255/i)<<16^e*i<<8^n*i)},oT={isPrimitive:!1,match:t=>Object(t)===t,fromHexString(t,e,n=1){const i=sT.fromHexString(t);e.r=(i>>16&255)/255*n,e.g=(i>>8&255)/255*n,e.b=(255&i)/255*n},toHexString:({r:t,g:e,b:n},i=1)=>sT.toHexString(t*(i=255/i)<<16^e*i<<8^n*i)},cT=[rT,sT,aT,oT];class lT extends eT{constructor(t,e,n,i){var r;super(t,e,n,"color"),this.$input=document.createElement("input"),this.$input.setAttribute("type","color"),this.$input.setAttribute("tabindex",-1),this.$input.setAttribute("aria-labelledby",this.$name.id),this.$text=document.createElement("input"),this.$text.setAttribute("type","text"),this.$text.setAttribute("spellcheck","false"),this.$text.setAttribute("aria-labelledby",this.$name.id),this.$display=document.createElement("div"),this.$display.classList.add("display"),this.$display.appendChild(this.$input),this.$widget.appendChild(this.$display),this.$widget.appendChild(this.$text),this._format=(r=this.initialValue,cT.find((t=>t.match(r)))),this._rgbScale=i,this._initialValueHexString=this.save(),this._textFocused=!1,this.$input.addEventListener("input",(()=>{this._setValueFromHexString(this.$input.value)})),this.$input.addEventListener("blur",(()=>{this._callOnFinishChange()})),this.$text.addEventListener("input",(()=>{const t=iT(this.$text.value);t&&this._setValueFromHexString(t)})),this.$text.addEventListener("focus",(()=>{this._textFocused=!0,this.$text.select()})),this.$text.addEventListener("blur",(()=>{this._textFocused=!1,this.updateDisplay(),this._callOnFinishChange()})),this.$disable=this.$text,this.updateDisplay()}reset(){return this._setValueFromHexString(this._initialValueHexString),this}_setValueFromHexString(t){if(this._format.isPrimitive){const e=this._format.fromHexString(t);this.setValue(e)}else this._format.fromHexString(t,this.getValue(),this._rgbScale),this._callOnChange(),this.updateDisplay()}save(){return this._format.toHexString(this.getValue(),this._rgbScale)}load(t){return this._setValueFromHexString(t),this._callOnFinishChange(),this}updateDisplay(){return this.$input.value=this._format.toHexString(this.getValue(),this._rgbScale),this._textFocused||(this.$text.value=this.$input.value.substring(1)),this.$display.style.backgroundColor=this.$input.value,this}}class hT extends eT{constructor(t,e,n){super(t,e,n,"function"),this.$button=document.createElement("button"),this.$button.appendChild(this.$name),this.$widget.appendChild(this.$button),this.$button.addEventListener("click",(t=>{t.preventDefault(),this.getValue().call(this.object),this._callOnChange()})),this.$button.addEventListener("touchstart",(()=>{}),{passive:!0}),this.$disable=this.$button}}class uT extends eT{constructor(t,e,n,i,r,s){super(t,e,n,"number"),this._initInput(),this.min(i),this.max(r);const a=void 0!==s;this.step(a?s:this._getImplicitStep(),a),this.updateDisplay()}decimals(t){return this._decimals=t,this.updateDisplay(),this}min(t){return this._min=t,this._onUpdateMinMax(),this}max(t){return this._max=t,this._onUpdateMinMax(),this}step(t,e=!0){return this._step=t,this._stepExplicit=e,this}updateDisplay(){const t=this.getValue();if(this._hasSlider){let e=(t-this._min)/(this._max-this._min);e=Math.max(0,Math.min(e,1)),this.$fill.style.width=100*e+"%"}return this._inputFocused||(this.$input.value=void 0===this._decimals?t:t.toFixed(this._decimals)),this}_initInput(){this.$input=document.createElement("input"),this.$input.setAttribute("type","text"),this.$input.setAttribute("aria-labelledby",this.$name.id);window.matchMedia("(pointer: coarse)").matches&&(this.$input.setAttribute("type","number"),this.$input.setAttribute("step","any")),this.$widget.appendChild(this.$input),this.$disable=this.$input;const t=t=>{const e=parseFloat(this.$input.value);isNaN(e)||(this._snapClampSetValue(e+t),this.$input.value=this.getValue())};let e,n,i,r,s,a=!1;const o=t=>{if(a){const i=t.clientX-e,r=t.clientY-n;Math.abs(r)>5?(t.preventDefault(),this.$input.blur(),a=!1,this._setDraggingStyle(!0,"vertical")):Math.abs(i)>5&&c()}if(!a){const e=t.clientY-i;s-=e*this._step*this._arrowKeyMultiplier(t),r+s>this._max?s=this._max-r:r+s<this._min&&(s=this._min-r),this._snapClampSetValue(r+s)}i=t.clientY},c=()=>{this._setDraggingStyle(!1,"vertical"),this._callOnFinishChange(),window.removeEventListener("mousemove",o),window.removeEventListener("mouseup",c)};this.$input.addEventListener("input",(()=>{let t=parseFloat(this.$input.value);isNaN(t)||(this._stepExplicit&&(t=this._snap(t)),this.setValue(this._clamp(t)))})),this.$input.addEventListener("keydown",(e=>{"Enter"===e.key&&this.$input.blur(),"ArrowUp"===e.code&&(e.preventDefault(),t(this._step*this._arrowKeyMultiplier(e))),"ArrowDown"===e.code&&(e.preventDefault(),t(this._step*this._arrowKeyMultiplier(e)*-1))})),this.$input.addEventListener("wheel",(e=>{this._inputFocused&&(e.preventDefault(),t(this._step*this._normalizeMouseWheel(e)))}),{passive:!1}),this.$input.addEventListener("mousedown",(t=>{e=t.clientX,n=i=t.clientY,a=!0,r=this.getValue(),s=0,window.addEventListener("mousemove",o),window.addEventListener("mouseup",c)})),this.$input.addEventListener("focus",(()=>{this._inputFocused=!0})),this.$input.addEventListener("blur",(()=>{this._inputFocused=!1,this.updateDisplay(),this._callOnFinishChange()}))}_initSlider(){this._hasSlider=!0,this.$slider=document.createElement("div"),this.$slider.classList.add("slider"),this.$fill=document.createElement("div"),this.$fill.classList.add("fill"),this.$slider.appendChild(this.$fill),this.$widget.insertBefore(this.$slider,this.$input),this.domElement.classList.add("hasSlider");const t=t=>{const e=this.$slider.getBoundingClientRect();let n=(i=t,r=e.left,s=e.right,a=this._min,o=this._max,(i-r)/(s-r)*(o-a)+a);var i,r,s,a,o;this._snapClampSetValue(n)},e=e=>{t(e.clientX)},n=()=>{this._callOnFinishChange(),this._setDraggingStyle(!1),window.removeEventListener("mousemove",e),window.removeEventListener("mouseup",n)};let i,r,s=!1;const a=e=>{e.preventDefault(),this._setDraggingStyle(!0),t(e.touches[0].clientX),s=!1},o=e=>{if(s){const t=e.touches[0].clientX-i,n=e.touches[0].clientY-r;Math.abs(t)>Math.abs(n)?a(e):(window.removeEventListener("touchmove",o),window.removeEventListener("touchend",c))}else e.preventDefault(),t(e.touches[0].clientX)},c=()=>{this._callOnFinishChange(),this._setDraggingStyle(!1),window.removeEventListener("touchmove",o),window.removeEventListener("touchend",c)},l=this._callOnFinishChange.bind(this);let h;this.$slider.addEventListener("mousedown",(i=>{this._setDraggingStyle(!0),t(i.clientX),window.addEventListener("mousemove",e),window.addEventListener("mouseup",n)})),this.$slider.addEventListener("touchstart",(t=>{t.touches.length>1||(this._hasScrollBar?(i=t.touches[0].clientX,r=t.touches[0].clientY,s=!0):a(t),window.addEventListener("touchmove",o,{passive:!1}),window.addEventListener("touchend",c))}),{passive:!1}),this.$slider.addEventListener("wheel",(t=>{if(Math.abs(t.deltaX)<Math.abs(t.deltaY)&&this._hasScrollBar)return;t.preventDefault();const e=this._normalizeMouseWheel(t)*this._step;this._snapClampSetValue(this.getValue()+e),this.$input.value=this.getValue(),clearTimeout(h),h=setTimeout(l,400)}),{passive:!1})}_setDraggingStyle(t,e="horizontal"){this.$slider&&this.$slider.classList.toggle("active",t),document.body.classList.toggle("lil-gui-dragging",t),document.body.classList.toggle(`lil-gui-${e}`,t)}_getImplicitStep(){return this._hasMin&&this._hasMax?(this._max-this._min)/1e3:.1}_onUpdateMinMax(){!this._hasSlider&&this._hasMin&&this._hasMax&&(this._stepExplicit||this.step(this._getImplicitStep(),!1),this._initSlider(),this.updateDisplay())}_normalizeMouseWheel(t){let{deltaX:e,deltaY:n}=t;Math.floor(t.deltaY)!==t.deltaY&&t.wheelDelta&&(e=0,n=-t.wheelDelta/120,n*=this._stepExplicit?1:10);return e+-n}_arrowKeyMultiplier(t){let e=this._stepExplicit?1:10;return t.shiftKey?e*=10:t.altKey&&(e/=10),e}_snap(t){let e=0;return this._hasMin?e=this._min:this._hasMax&&(e=this._max),t-=e,t=Math.round(t/this._step)*this._step,t+=e,t=parseFloat(t.toPrecision(15))}_clamp(t){return t<this._min&&(t=this._min),t>this._max&&(t=this._max),t}_snapClampSetValue(t){this.setValue(this._clamp(this._snap(t)))}get _hasScrollBar(){const t=this.parent.root.$children;return t.scrollHeight>t.clientHeight}get _hasMin(){return void 0!==this._min}get _hasMax(){return void 0!==this._max}}class dT extends eT{constructor(t,e,n,i){super(t,e,n,"option"),this.$select=document.createElement("select"),this.$select.setAttribute("aria-labelledby",this.$name.id),this.$display=document.createElement("div"),this.$display.classList.add("display"),this.$select.addEventListener("change",(()=>{this.setValue(this._values[this.$select.selectedIndex]),this._callOnFinishChange()})),this.$select.addEventListener("focus",(()=>{this.$display.classList.add("focus")})),this.$select.addEventListener("blur",(()=>{this.$display.classList.remove("focus")})),this.$widget.appendChild(this.$select),this.$widget.appendChild(this.$display),this.$disable=this.$select,this.options(i)}options(t){return this._values=Array.isArray(t)?t:Object.values(t),this._names=Array.isArray(t)?t:Object.keys(t),this.$select.replaceChildren(),this._names.forEach((t=>{const e=document.createElement("option");e.textContent=t,this.$select.appendChild(e)})),this.updateDisplay(),this}updateDisplay(){const t=this.getValue(),e=this._values.indexOf(t);return this.$select.selectedIndex=e,this.$display.textContent=-1===e?t:this._names[e],this}}class pT extends eT{constructor(t,e,n){super(t,e,n,"string"),this.$input=document.createElement("input"),this.$input.setAttribute("type","text"),this.$input.setAttribute("spellcheck","false"),this.$input.setAttribute("aria-labelledby",this.$name.id),this.$input.addEventListener("input",(()=>{this.setValue(this.$input.value)})),this.$input.addEventListener("keydown",(t=>{"Enter"===t.code&&this.$input.blur()})),this.$input.addEventListener("blur",(()=>{this._callOnFinishChange()})),this.$widget.appendChild(this.$input),this.$disable=this.$input,this.updateDisplay()}updateDisplay(){return this.$input.value=this.getValue(),this}}let fT=!1;class AT{constructor({parent:t,autoPlace:e=void 0===t,container:n,width:i,title:r="Controls",closeFolders:s=!1,injectStyles:a=!0,touchStyles:o=!0}={}){if(this.parent=t,this.root=t?t.root:this,this.children=[],this.controllers=[],this.folders=[],this._closed=!1,this._hidden=!1,this.domElement=document.createElement("div"),this.domElement.classList.add("lil-gui"),this.$title=document.createElement("button"),this.$title.classList.add("title"),this.$title.setAttribute("aria-expanded",!0),this.$title.addEventListener("click",(()=>this.openAnimated(this._closed))),this.$title.addEventListener("touchstart",(()=>{}),{passive:!0}),this.$children=document.createElement("div"),this.$children.classList.add("children"),this.domElement.appendChild(this.$title),this.domElement.appendChild(this.$children),this.title(r),this.parent)return this.parent.children.push(this),this.parent.folders.push(this),void this.parent.$children.appendChild(this.domElement);this.domElement.classList.add("root"),o&&this.domElement.classList.add("allow-touch-styles"),!fT&&a&&(!function(t){const e=document.createElement("style");e.innerHTML=t;const n=document.querySelector("head link[rel=stylesheet], head style");n?document.head.insertBefore(e,n):document.head.appendChild(e)}('.lil-gui {\n font-family: var(--font-family);\n font-size: var(--font-size);\n line-height: 1;\n font-weight: normal;\n font-style: normal;\n text-align: left;\n color: var(--text-color);\n user-select: none;\n -webkit-user-select: none;\n touch-action: manipulation;\n --background-color: #1f1f1f;\n --text-color: #ebebeb;\n --title-background-color: #111111;\n --title-text-color: #ebebeb;\n --widget-color: #424242;\n --hover-color: #4f4f4f;\n --focus-color: #595959;\n --number-color: #2cc9ff;\n --string-color: #a2db3c;\n --font-size: 11px;\n --input-font-size: 11px;\n --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;\n --font-family-mono: Menlo, Monaco, Consolas, "Droid Sans Mono", monospace;\n --padding: 4px;\n --spacing: 4px;\n --widget-height: 20px;\n --title-height: calc(var(--widget-height) + var(--spacing) * 1.25);\n --name-width: 45%;\n --slider-knob-width: 2px;\n --slider-input-width: 27%;\n --color-input-width: 27%;\n --slider-input-min-width: 45px;\n --color-input-min-width: 45px;\n --folder-indent: 7px;\n --widget-padding: 0 0 0 3px;\n --widget-border-radius: 2px;\n --checkbox-size: calc(0.75 * var(--widget-height));\n --scrollbar-width: 5px;\n}\n.lil-gui, .lil-gui * {\n box-sizing: border-box;\n margin: 0;\n padding: 0;\n}\n.lil-gui.root {\n width: var(--width, 245px);\n display: flex;\n flex-direction: column;\n background: var(--background-color);\n}\n.lil-gui.root > .title {\n background: var(--title-background-color);\n color: var(--title-text-color);\n}\n.lil-gui.root > .children {\n overflow-x: hidden;\n overflow-y: auto;\n}\n.lil-gui.root > .children::-webkit-scrollbar {\n width: var(--scrollbar-width);\n height: var(--scrollbar-width);\n background: var(--background-color);\n}\n.lil-gui.root > .children::-webkit-scrollbar-thumb {\n border-radius: var(--scrollbar-width);\n background: var(--focus-color);\n}\n@media (pointer: coarse) {\n .lil-gui.allow-touch-styles, .lil-gui.allow-touch-styles .lil-gui {\n --widget-height: 28px;\n --padding: 6px;\n --spacing: 6px;\n --font-size: 13px;\n --input-font-size: 16px;\n --folder-indent: 10px;\n --scrollbar-width: 7px;\n --slider-input-min-width: 50px;\n --color-input-min-width: 65px;\n }\n}\n.lil-gui.force-touch-styles, .lil-gui.force-touch-styles .lil-gui {\n --widget-height: 28px;\n --padding: 6px;\n --spacing: 6px;\n --font-size: 13px;\n --input-font-size: 16px;\n --folder-indent: 10px;\n --scrollbar-width: 7px;\n --slider-input-min-width: 50px;\n --color-input-min-width: 65px;\n}\n.lil-gui.autoPlace {\n max-height: 100%;\n position: fixed;\n top: 0;\n right: 15px;\n z-index: 1001;\n}\n\n.lil-gui .controller {\n display: flex;\n align-items: center;\n padding: 0 var(--padding);\n margin: var(--spacing) 0;\n}\n.lil-gui .controller.disabled {\n opacity: 0.5;\n}\n.lil-gui .controller.disabled, .lil-gui .controller.disabled * {\n pointer-events: none !important;\n}\n.lil-gui .controller > .name {\n min-width: var(--name-width);\n flex-shrink: 0;\n white-space: pre;\n padding-right: var(--spacing);\n line-height: var(--widget-height);\n}\n.lil-gui .controller .widget {\n position: relative;\n display: flex;\n align-items: center;\n width: 100%;\n min-height: var(--widget-height);\n}\n.lil-gui .controller.string input {\n color: var(--string-color);\n}\n.lil-gui .controller.boolean {\n cursor: pointer;\n}\n.lil-gui .controller.color .display {\n width: 100%;\n height: var(--widget-height);\n border-radius: var(--widget-border-radius);\n position: relative;\n}\n@media (hover: hover) {\n .lil-gui .controller.color .display:hover:before {\n content: " ";\n display: block;\n position: absolute;\n border-radius: var(--widget-border-radius);\n border: 1px solid #fff9;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n }\n}\n.lil-gui .controller.color input[type=color] {\n opacity: 0;\n width: 100%;\n height: 100%;\n cursor: pointer;\n}\n.lil-gui .controller.color input[type=text] {\n margin-left: var(--spacing);\n font-family: var(--font-family-mono);\n min-width: var(--color-input-min-width);\n width: var(--color-input-width);\n flex-shrink: 0;\n}\n.lil-gui .controller.option select {\n opacity: 0;\n position: absolute;\n width: 100%;\n max-width: 100%;\n}\n.lil-gui .controller.option .display {\n position: relative;\n pointer-events: none;\n border-radius: var(--widget-border-radius);\n height: var(--widget-height);\n line-height: var(--widget-height);\n max-width: 100%;\n overflow: hidden;\n word-break: break-all;\n padding-left: 0.55em;\n padding-right: 1.75em;\n background: var(--widget-color);\n}\n@media (hover: hover) {\n .lil-gui .controller.option .display.focus {\n background: var(--focus-color);\n }\n}\n.lil-gui .controller.option .display.active {\n background: var(--focus-color);\n}\n.lil-gui .controller.option .display:after {\n font-family: "lil-gui";\n content: "↕";\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n padding-right: 0.375em;\n}\n.lil-gui .controller.option .widget,\n.lil-gui .controller.option select {\n cursor: pointer;\n}\n@media (hover: hover) {\n .lil-gui .controller.option .widget:hover .display {\n background: var(--hover-color);\n }\n}\n.lil-gui .controller.number input {\n color: var(--number-color);\n}\n.lil-gui .controller.number.hasSlider input {\n margin-left: var(--spacing);\n width: var(--slider-input-width);\n min-width: var(--slider-input-min-width);\n flex-shrink: 0;\n}\n.lil-gui .controller.number .slider {\n width: 100%;\n height: var(--widget-height);\n background: var(--widget-color);\n border-radius: var(--widget-border-radius);\n padding-right: var(--slider-knob-width);\n overflow: hidden;\n cursor: ew-resize;\n touch-action: pan-y;\n}\n@media (hover: hover) {\n .lil-gui .controller.number .slider:hover {\n background: var(--hover-color);\n }\n}\n.lil-gui .controller.number .slider.active {\n background: var(--focus-color);\n}\n.lil-gui .controller.number .slider.active .fill {\n opacity: 0.95;\n}\n.lil-gui .controller.number .fill {\n height: 100%;\n border-right: var(--slider-knob-width) solid var(--number-color);\n box-sizing: content-box;\n}\n\n.lil-gui-dragging .lil-gui {\n --hover-color: var(--widget-color);\n}\n.lil-gui-dragging * {\n cursor: ew-resize !important;\n}\n\n.lil-gui-dragging.lil-gui-vertical * {\n cursor: ns-resize !important;\n}\n\n.lil-gui .title {\n height: var(--title-height);\n font-weight: 600;\n padding: 0 var(--padding);\n width: 100%;\n text-align: left;\n background: none;\n text-decoration-skip: objects;\n}\n.lil-gui .title:before {\n font-family: "lil-gui";\n content: "▾";\n padding-right: 2px;\n display: inline-block;\n}\n.lil-gui .title:active {\n background: var(--title-background-color);\n opacity: 0.75;\n}\n@media (hover: hover) {\n body:not(.lil-gui-dragging) .lil-gui .title:hover {\n background: var(--title-background-color);\n opacity: 0.85;\n }\n .lil-gui .title:focus {\n text-decoration: underline var(--focus-color);\n }\n}\n.lil-gui.root > .title:focus {\n text-decoration: none !important;\n}\n.lil-gui.closed > .title:before {\n content: "▸";\n}\n.lil-gui.closed > .children {\n transform: translateY(-7px);\n opacity: 0;\n}\n.lil-gui.closed:not(.transition) > .children {\n display: none;\n}\n.lil-gui.transition > .children {\n transition-duration: 300ms;\n transition-property: height, opacity, transform;\n transition-timing-function: cubic-bezier(0.2, 0.6, 0.35, 1);\n overflow: hidden;\n pointer-events: none;\n}\n.lil-gui .children:empty:before {\n content: "Empty";\n padding: 0 var(--padding);\n margin: var(--spacing) 0;\n display: block;\n height: var(--widget-height);\n font-style: italic;\n line-height: var(--widget-height);\n opacity: 0.5;\n}\n.lil-gui.root > .children > .lil-gui > .title {\n border: 0 solid var(--widget-color);\n border-width: 1px 0;\n transition: border-color 300ms;\n}\n.lil-gui.root > .children > .lil-gui.closed > .title {\n border-bottom-color: transparent;\n}\n.lil-gui + .controller {\n border-top: 1px solid var(--widget-color);\n margin-top: 0;\n padding-top: var(--spacing);\n}\n.lil-gui .lil-gui .lil-gui > .title {\n border: none;\n}\n.lil-gui .lil-gui .lil-gui > .children {\n border: none;\n margin-left: var(--folder-indent);\n border-left: 2px solid var(--widget-color);\n}\n.lil-gui .lil-gui .controller {\n border: none;\n}\n\n.lil-gui label, .lil-gui input, .lil-gui button {\n -webkit-tap-highlight-color: transparent;\n}\n.lil-gui input {\n border: 0;\n outline: none;\n font-family: var(--font-family);\n font-size: var(--input-font-size);\n border-radius: var(--widget-border-radius);\n height: var(--widget-height);\n background: var(--widget-color);\n color: var(--text-color);\n width: 100%;\n}\n@media (hover: hover) {\n .lil-gui input:hover {\n background: var(--hover-color);\n }\n .lil-gui input:active {\n background: var(--focus-color);\n }\n}\n.lil-gui input:disabled {\n opacity: 1;\n}\n.lil-gui input[type=text],\n.lil-gui input[type=number] {\n padding: var(--widget-padding);\n -moz-appearance: textfield;\n}\n.lil-gui input[type=text]:focus,\n.lil-gui input[type=number]:focus {\n background: var(--focus-color);\n}\n.lil-gui input[type=checkbox] {\n appearance: none;\n width: var(--checkbox-size);\n height: var(--checkbox-size);\n border-radius: var(--widget-border-radius);\n text-align: center;\n cursor: pointer;\n}\n.lil-gui input[type=checkbox]:checked:before {\n font-family: "lil-gui";\n content: "✓";\n font-size: var(--checkbox-size);\n line-height: var(--checkbox-size);\n}\n@media (hover: hover) {\n .lil-gui input[type=checkbox]:focus {\n box-shadow: inset 0 0 0 1px var(--focus-color);\n }\n}\n.lil-gui button {\n outline: none;\n cursor: pointer;\n font-family: var(--font-family);\n font-size: var(--font-size);\n color: var(--text-color);\n width: 100%;\n border: none;\n}\n.lil-gui .controller button {\n height: var(--widget-height);\n text-transform: none;\n background: var(--widget-color);\n border-radius: var(--widget-border-radius);\n}\n@media (hover: hover) {\n .lil-gui .controller button:hover {\n background: var(--hover-color);\n }\n .lil-gui .controller button:focus {\n box-shadow: inset 0 0 0 1px var(--focus-color);\n }\n}\n.lil-gui .controller button:active {\n background: var(--focus-color);\n}\n\n@font-face {\n font-family: "lil-gui";\n src: url("data:application/font-woff;charset=utf-8;base64,d09GRgABAAAAAAUsAAsAAAAACJwAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABCAAAAH4AAADAImwmYE9TLzIAAAGIAAAAPwAAAGBKqH5SY21hcAAAAcgAAAD0AAACrukyyJBnbHlmAAACvAAAAF8AAACEIZpWH2hlYWQAAAMcAAAAJwAAADZfcj2zaGhlYQAAA0QAAAAYAAAAJAC5AHhobXR4AAADXAAAABAAAABMAZAAAGxvY2EAAANsAAAAFAAAACgCEgIybWF4cAAAA4AAAAAeAAAAIAEfABJuYW1lAAADoAAAASIAAAIK9SUU/XBvc3QAAATEAAAAZgAAAJCTcMc2eJxVjbEOgjAURU+hFRBK1dGRL+ALnAiToyMLEzFpnPz/eAshwSa97517c/MwwJmeB9kwPl+0cf5+uGPZXsqPu4nvZabcSZldZ6kfyWnomFY/eScKqZNWupKJO6kXN3K9uCVoL7iInPr1X5baXs3tjuMqCtzEuagm/AAlzQgPAAB4nGNgYRBlnMDAysDAYM/gBiT5oLQBAwuDJAMDEwMrMwNWEJDmmsJwgCFeXZghBcjlZMgFCzOiKOIFAB71Bb8AeJy1kjFuwkAQRZ+DwRAwBtNQRUGKQ8OdKCAWUhAgKLhIuAsVSpWz5Bbkj3dEgYiUIszqWdpZe+Z7/wB1oCYmIoboiwiLT2WjKl/jscrHfGg/pKdMkyklC5Zs2LEfHYpjcRoPzme9MWWmk3dWbK9ObkWkikOetJ554fWyoEsmdSlt+uR0pCJR34b6t/TVg1SY3sYvdf8vuiKrpyaDXDISiegp17p7579Gp3p++y7HPAiY9pmTibljrr85qSidtlg4+l25GLCaS8e6rRxNBmsnERunKbaOObRz7N72ju5vdAjYpBXHgJylOAVsMseDAPEP8LYoUHicY2BiAAEfhiAGJgZWBgZ7RnFRdnVJELCQlBSRlATJMoLV2DK4glSYs6ubq5vbKrJLSbGrgEmovDuDJVhe3VzcXFwNLCOILB/C4IuQ1xTn5FPilBTj5FPmBAB4WwoqAHicY2BkYGAA4sk1sR/j+W2+MnAzpDBgAyEMQUCSg4EJxAEAwUgFHgB4nGNgZGBgSGFggJMhDIwMqEAYAByHATJ4nGNgAIIUNEwmAABl3AGReJxjYAACIQYlBiMGJ3wQAEcQBEV4nGNgZGBgEGZgY2BiAAEQyQWEDAz/wXwGAAsPATIAAHicXdBNSsNAHAXwl35iA0UQXYnMShfS9GPZA7T7LgIu03SSpkwzYTIt1BN4Ak/gKTyAeCxfw39jZkjymzcvAwmAW/wgwHUEGDb36+jQQ3GXGot79L24jxCP4gHzF/EIr4jEIe7wxhOC3g2TMYy4Q7+Lu/SHuEd/ivt4wJd4wPxbPEKMX3GI5+DJFGaSn4qNzk8mcbKSR6xdXdhSzaOZJGtdapd4vVPbi6rP+cL7TGXOHtXKll4bY1Xl7EGnPtp7Xy2n00zyKLVHfkHBa4IcJ2oD3cgggWvt/V/FbDrUlEUJhTn/0azVWbNTNr0Ens8de1tceK9xZmfB1CPjOmPH4kitmvOubcNpmVTN3oFJyjzCvnmrwhJTzqzVj9jiSX911FjeAAB4nG3HMRKCMBBA0f0giiKi4DU8k0V2GWbIZDOh4PoWWvq6J5V8If9NVNQcaDhyouXMhY4rPTcG7jwYmXhKq8Wz+p762aNaeYXom2n3m2dLTVgsrCgFJ7OTmIkYbwIbC6vIB7WmFfAAAA==") format("woff");\n}'),fT=!0),n?n.appendChild(this.domElement):e&&(this.domElement.classList.add("autoPlace"),document.body.appendChild(this.domElement)),i&&this.domElement.style.setProperty("--width",i+"px"),this._closeFolders=s}add(t,e,n,i,r){if(Object(n)===n)return new dT(this,t,e,n);switch(typeof t[e]){case"number":return new uT(this,t,e,n,i,r);case"boolean":return new nT(this,t,e);case"string":return new pT(this,t,e);case"function":return new hT(this,t,e)}}addColor(t,e,n=1){return new lT(this,t,e,n)}addFolder(t){const e=new AT({parent:this,title:t});return this.root._closeFolders&&e.close(),e}load(t,e=!0){return t.controllers&&this.controllers.forEach((e=>{e instanceof hT||e._name in t.controllers&&e.load(t.controllers[e._name])})),e&&t.folders&&this.folders.forEach((e=>{e._title in t.folders&&e.load(t.folders[e._title])})),this}save(t=!0){const e={controllers:{},folders:{}};return this.controllers.forEach((t=>{if(!(t instanceof hT)){if(t._name in e.controllers)throw new Error(`Cannot save GUI with duplicate property "${t._name}"`);e.controllers[t._name]=t.save()}})),t&&this.folders.forEach((t=>{if(t._title in e.folders)throw new Error(`Cannot save GUI with duplicate folder "${t._title}"`);e.folders[t._title]=t.save()})),e}open(t=!0){return this._setClosed(!t),this.$title.setAttribute("aria-expanded",!this._closed),this.domElement.classList.toggle("closed",this._closed),this}close(){return this.open(!1)}_setClosed(t){this._closed!==t&&(this._closed=t,this._callOnOpenClose(this))}show(t=!0){return this._hidden=!t,this.domElement.style.display=this._hidden?"none":"",this}hide(){return this.show(!1)}openAnimated(t=!0){return this._setClosed(!t),this.$title.setAttribute("aria-expanded",!this._closed),requestAnimationFrame((()=>{const e=this.$children.clientHeight;this.$children.style.height=e+"px",this.domElement.classList.add("transition");const n=t=>{t.target===this.$children&&(this.$children.style.height="",this.domElement.classList.remove("transition"),this.$children.removeEventListener("transitionend",n))};this.$children.addEventListener("transitionend",n);const i=t?this.$children.scrollHeight:0;this.domElement.classList.toggle("closed",!t),requestAnimationFrame((()=>{this.$children.style.height=i+"px"}))})),this}title(t){return this._title=t,this.$title.textContent=t,this}reset(t=!0){return(t?this.controllersRecursive():this.controllers).forEach((t=>t.reset())),this}onChange(t){return this._onChange=t,this}_callOnChange(t){this.parent&&this.parent._callOnChange(t),void 0!==this._onChange&&this._onChange.call(this,{object:t.object,property:t.property,value:t.getValue(),controller:t})}onFinishChange(t){return this._onFinishChange=t,this}_callOnFinishChange(t){this.parent&&this.parent._callOnFinishChange(t),void 0!==this._onFinishChange&&this._onFinishChange.call(this,{object:t.object,property:t.property,value:t.getValue(),controller:t})}onOpenClose(t){return this._onOpenClose=t,this}_callOnOpenClose(t){this.parent&&this.parent._callOnOpenClose(t),void 0!==this._onOpenClose&&this._onOpenClose.call(this,t)}destroy(){this.parent&&(this.parent.children.splice(this.parent.children.indexOf(this),1),this.parent.folders.splice(this.parent.folders.indexOf(this),1)),this.domElement.parentElement&&this.domElement.parentElement.removeChild(this.domElement),Array.from(this.children).forEach((t=>t.destroy()))}controllersRecursive(){let t=Array.from(this.controllers);return this.folders.forEach((e=>{t=t.concat(e.controllersRecursive())})),t}foldersRecursive(){let t=Array.from(this.folders);return this.folders.forEach((e=>{t=t.concat(e.foldersRecursive())})),t}}var gT,mT={exports:{}};mT.exports=(gT=function(){function t(t){return i.appendChild(t.dom),t}function e(t){for(var e=0;e<i.children.length;e++)i.children[e].style.display=e===t?"block":"none";n=t}var n=0,i=document.createElement("div");i.style.cssText="position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000",i.addEventListener("click",(function(t){t.preventDefault(),e(++n%i.children.length)}),!1);var r=(performance||Date).now(),s=r,a=0,o=t(new gT.Panel("FPS","#0ff","#002")),c=t(new gT.Panel("MS","#0f0","#020"));if(self.performance&&self.performance.memory)var l=t(new gT.Panel("MB","#f08","#201"));return e(0),{REVISION:16,dom:i,addPanel:t,showPanel:e,begin:function(){r=(performance||Date).now()},end:function(){a++;var t=(performance||Date).now();if(c.update(t-r,200),t>s+1e3&&(o.update(1e3*a/(t-s),100),s=t,a=0,l)){var e=performance.memory;l.update(e.usedJSHeapSize/1048576,e.jsHeapSizeLimit/1048576)}return t},update:function(){r=this.end()},domElement:i,setMode:e}},gT.Panel=function(t,e,n){var i=1/0,r=0,s=Math.round,a=s(window.devicePixelRatio||1),o=80*a,c=48*a,l=3*a,h=2*a,u=3*a,d=15*a,p=74*a,f=30*a,A=document.createElement("canvas");A.width=o,A.height=c,A.style.cssText="width:80px;height:48px";var g=A.getContext("2d");return g.font="bold "+9*a+"px Helvetica,Arial,sans-serif",g.textBaseline="top",g.fillStyle=n,g.fillRect(0,0,o,c),g.fillStyle=e,g.fillText(t,l,h),g.fillRect(u,d,p,f),g.fillStyle=n,g.globalAlpha=.9,g.fillRect(u,d,p,f),{dom:A,update:function(c,m){i=Math.min(i,c),r=Math.max(r,c),g.fillStyle=n,g.globalAlpha=1,g.fillRect(0,0,o,d),g.fillStyle=e,g.fillText(s(c)+" "+t+" ("+s(i)+"-"+s(r)+")",l,h),g.drawImage(A,u+a,d,p-a,f,u,d,p-a,f),g.fillRect(u+p-a,d,a,f),g.fillStyle=n,g.globalAlpha=.9,g.fillRect(u+p-a,d,a,s((1-c/m)*f))}}},gT);var _T=b(mT.exports);class vT{gui;scene;mixer;clips=[];gridHelper;helpers=[];stats;orbitControls;flyControls;constructor(t,e,n=[],i={}){this.scene=t,this.mixer=e,this.clips=n,this.orbitControls=i.orbitControls,this.flyControls=i.flyControls,this.gui=new AT({width:300}),this.addSceneFolder(),this.addLightsFolder(),this.addCamerasFolder(),this.addModelsFolder(),this.addAnimationsFolder(),this.addDisplayFolder(),this.addControlsFolder(),this.addPerformanceFolder()}addSceneFolder(){const t=this.gui.addFolder("Scene");t.close();const e={background:this.scene.background?.getHex?.()??0};t.addColor(e,"background").onChange((t=>{this.scene.background=new hh(t)})),this.scene.fog instanceof uf&&(t.add(this.scene.fog,"near",.1,50).name("Fog Near"),t.add(this.scene.fog,"far",1,200).name("Fog Far"))}addLightsFolder(){const t=[];if(this.scene.traverse((e=>{e.isLight&&t.push(e)})),0===t.length)return;const e=this.gui.addFolder("Lights");e.close(),t.forEach(((t,n)=>{const i=e.addFolder(`${t.type} ${t.name||n}`);i.close(),i.add(t.rotation,"x",-Math.PI,Math.PI,.01).name("rotX"),i.add(t.rotation,"y",-Math.PI,Math.PI,.01).name("rotY"),i.add(t.rotation,"z",-Math.PI,Math.PI,.01).name("rotZ");if(i.add({helper:!1},"helper").onChange((e=>{if(e){let e=null;t instanceof v_&&(e=new Cv(t)),t instanceof f_&&(e=new vv(t)),t instanceof b_&&(e=new Pv(t)),t instanceof c_&&(e=new Tv(t,5)),e&&(this.scene.add(e),this.helpers.push(e))}else{const e=this.helpers.find((e=>e.light===t));e&&(this.scene.remove(e),this.helpers=this.helpers.filter((t=>t!==e)))}})),"intensity"in t&&i.add(t,"intensity",0,10,.01),"color"in t){const e={color:t.color.getHex()};i.addColor(e,"color").onChange((e=>{t.color.setHex(e)}))}"position"in t&&(i.add(t.position,"x",-50,50,.1),i.add(t.position,"y",-50,50,.1),i.add(t.position,"z",-50,50,.1))}))}addCamerasFolder(){const t=[];if(this.scene.traverse((e=>{e.isCamera&&t.push(e)})),0===t.length)return;const e=this.gui.addFolder("Cameras");e.close(),t.forEach(((t,n)=>{const i=e.addFolder(t.name||`Camera ${n+1}`);i.close(),i.add(t.rotation,"x",-Math.PI,Math.PI,.01).name("rotX"),i.add(t.rotation,"y",-Math.PI,Math.PI,.01).name("rotY"),i.add(t.rotation,"z",-Math.PI,Math.PI,.01).name("rotZ");i.add({helper:!1},"helper").onChange((e=>{if(e){const e=new Uv(t);this.scene.add(e),this.helpers.push(e)}else{const e=this.helpers.find((e=>e instanceof Uv&&e.camera===t));e&&(this.scene.remove(e),this.helpers=this.helpers.filter((t=>t!==e)))}})),t instanceof lu&&(i.add(t,"fov",10,100).onChange((()=>t.updateProjectionMatrix())),i.add(t,"near",.1,10).onChange((()=>t.updateProjectionMatrix())),i.add(t,"far",10,2e3).onChange((()=>t.updateProjectionMatrix()))),t instanceof Ou&&i.add(t,"zoom",.1,10).onChange((()=>t.updateProjectionMatrix()))}))}addModelsFolder(){const t=[];if(this.scene.traverse((e=>{e.isMesh&&t.push(e)})),0===t.length)return;const e=this.gui.addFolder("Models");e.close(),t.forEach(((t,n)=>{const i=e.addFolder(t.name||`Mesh ${n+1}`);i.close(),i.add(t.position,"x",-10,10,.1),i.add(t.position,"y",-10,10,.1),i.add(t.position,"z",-10,10,.1),i.add(t.rotation,"x",-Math.PI,Math.PI,.01),i.add(t.rotation,"y",-Math.PI,Math.PI,.01),i.add(t.rotation,"z",-Math.PI,Math.PI,.01),i.add(t.scale,"x",.1,10,.1),i.add(t.scale,"y",.1,10,.1),i.add(t.scale,"z",.1,10,.1);if(i.add({helper:!1},"helper").onChange((e=>{if(e){const e=new Qv(t,16711680);this.scene.add(e),this.helpers.push(e)}else{const e=this.helpers.find((e=>e instanceof Qv&&e.object===t));e&&(this.scene.remove(e),this.helpers=this.helpers.filter((t=>t!==e)))}})),t.morphTargetInfluences&&t.morphTargetDictionary){const e=i.addFolder("Morph Targets");Object.keys(t.morphTargetDictionary).forEach((n=>{const i=t.morphTargetDictionary[n];e.add(t.morphTargetInfluences,i,0,1,.01).name(n).listen()}))}}))}addAnimationsFolder(){if(!this.mixer||0===this.clips.length)return;const t=this.gui.addFolder("Animations");t.close();const e={};this.clips.forEach((t=>{e[t.name]=this.mixer.clipAction(t)}));const n={};Object.keys(e).forEach((i=>{n[i]=!1,t.add(n,i).listen().onChange((t=>{t?e[i].reset().play():e[i].stop()}))})),t.add({stopAll:()=>Object.values(e).forEach((t=>t.stop()))},"stopAll").name("Stop All")}addDisplayFolder(){const t=this.gui.addFolder("Display");t.close();const e={autoRotate:!!this.orbitControls&&this.orbitControls.autoRotate,wireframe:!1,grid:!1,skeleton:!1};this.orbitControls&&t.add(e,"autoRotate").onChange((t=>{this.orbitControls.autoRotate=t})),t.add(e,"grid").onChange((t=>{t?(this.gridHelper=new Bv(50,50),this.scene.add(this.gridHelper),this.helpers.push(this.gridHelper)):this.gridHelper&&(this.scene.remove(this.gridHelper),this.helpers=this.helpers.filter((t=>t!==this.gridHelper)))})),t.add(e,"wireframe").onChange((t=>{this.scene.traverse((e=>{if(e.isMesh){const n=e;Array.isArray(n.material)?n.material.forEach((e=>{"wireframe"in e&&(e.wireframe=t)})):"wireframe"in n.material&&(n.material.wireframe=t)}}))})),t.add(e,"skeleton").onChange((t=>{this.scene.traverse((e=>{if(e.isSkinnedMesh)if(t){const t=new wv(e);this.scene.add(t),this.helpers.push(t)}else{const t=this.helpers.find((t=>t instanceof wv&&t.root===e));t&&(this.scene.remove(t),this.helpers=this.helpers.filter((e=>e!==t)))}}))}))}addControlsFolder(){const t=this.gui.addFolder("Controls");t.close();const e={orbitControls:!!this.orbitControls,flyControls:!!this.flyControls};t.add(e,"orbitControls").listen().onChange((t=>{this.orbitControls&&(this.orbitControls.enabled=t)})),t.add(e,"flyControls").listen().onChange((t=>{this.flyControls&&(this.flyControls.enabled=t)}))}addPerformanceFolder(){this.stats=new _T,this.stats.showPanel(0),document.body.appendChild(this.stats.dom);const t=this.gui.addFolder("Performance");t.close();const e={fps:"0",memory:"0 MB"},n=t.add(e,"fps").name("FPS").listen(),i=t.add(e,"memory").name("Memory").listen();setInterval((()=>{performance.memory&&(e.memory=`${Math.round(performance.memory.usedJSHeapSize/1048576)} MB`)}),1e3),this.update=()=>{this.stats&&this.stats.update(),e.fps=this.stats?this.stats.dom.innerText.split("\n")[0]:"0",n.updateDisplay(),i.updateDisplay()}}update(){this.stats&&this.stats.update()}dispose(){this.gui.destroy(),this.helpers.forEach((t=>this.scene.remove(t))),this.helpers=[],this.stats&&this.stats.dom.parentElement&&document.body.removeChild(this.stats.dom)}exportScene(){return{lights:this.scene.children.filter((t=>t.isLight)).map((t=>t.toJSON())),cameras:this.scene.children.filter((t=>t.isCamera)).map((t=>t.toJSON())),scene:this.scene.toJSON()}}getGUI(){return this.gui}}class yT extends _{animationFrameId=0;container=null;scene=null;camera=null;renderer=null;loader=null;ktx2Loader=null;controls=null;width=1;height=1;depth=10;config;model={};mixer=null;animations=[];actions=[];isNotRender=!1;animationMixer=null;clock=null;body={};characterGroup=new $p;lightGroup=new $p;state={};onWindowResizeBound=null;onAnimationFinishedBound=()=>{};actionDefalutMap={};animationGroup=new sv;rotationCenter=new jc(0,0,0);muteActionState=!1;actionNotifier=null;_container="";objectLoader=new B_;gui=null;constructor(t="",e){super(),this.config=e,this.loader=new $v,this.ktx2Loader=new Sb,this.ktx2Loader.setTranscoderPath("three/examples/jsm/libs/basis/");const n=new Lb;n.setDecoderPath(`${this.config.dracoPath}`),this.loader.setKTX2Loader(this.ktx2Loader),this.loader.setMeshoptDecoder(Rb),this.loader.setDRACOLoader(n),this._container=t,this.setContainer(),this.isNotRender||this.init(),window.THREE=Vv}init(){this.container.innerHTML="",this.width=this.container.offsetWidth,this.height=this.container.offsetHeight;const{scene:t,camera:e}=this.loadScene(this.config.scene);if(this.scene=t||new df,this.camera=this.loadCamera(this.config.camera)||e,this.renderer=new lf({antialias:!0}),this.ktx2Loader.detectSupport(this.renderer),this.clock=new Q_,this.renderer?.setSize(this.width,this.height),this.renderer?.setPixelRatio(2),this.renderer?.setClearColor(0,0),this.renderer.toneMapping=ha,this.renderer.toneMappingExposure=1,this.container.appendChild(this.renderer.domElement),this.config.gridHelper){const{size:t=10,divisions:e=10,color1:n="",color2:i=""}=this.config.gridHelper,r=new Bv(t,e,n,i);this.characterGroup.add(r)}this.initLights(this.config.lights||[]),this.onWindowResizeBound=this.onWindowResize.bind(this),window.addEventListener("resize",this.onWindowResizeBound,!1)}setContainer(){this._container?"string"==typeof this._container?this.container=document.getElementById(this._container):this.container=this._container:this.isNotRender=!0}updateLight(){this.lightGroup.children.forEach((t=>{t.target&&(t.target.position.copy(this.characterGroup.position),t.updateMatrixWorld(!0))}))}initLights(t=[]){this.scene?.add(this.lightGroup),t.forEach((t=>{if(t.metadata){const e=this.objectLoader.parse(t);this.lightGroup.add(e)}else this.setLight(t)}))}loadCamera(t){if(!t)return new lu(this.config.camera?.fov||60,this.width/this.height,.1,2e3);if(t.metadata){const e=this.objectLoader.parse(t);return e instanceof lu?e:void 0}const e=new lu(this.config.camera?.fov||60,this.width/this.height,.1,2e3);return this.setCamera(e,t),e}loadScene(t){if(!t)return{};const e=this.objectLoader.parse(t);let n;return e.traverse((t=>{t instanceof lu&&(n=t)})),{scene:e,camera:n}}degree2Euler(t){return[fc.degToRad(t[0]),fc.degToRad(t[1]),fc.degToRad(t[2])]}dataToMatrix4(t){const e=[t[0],t[4],t[8],t[12],t[1],t[5],t[9],t[13],t[2],t[6],t[10],t[14],t[3],t[7],t[11],t[15]],n=new bl;return n.set(...e),n}setLight(t){const e=t=>{this.lightGroup.add(t)};switch(t.type){case"AmbientLight":const n=t,i=new x_(new hh(n.color||16777215),n.intensity);if(n.matrix){const t=this.dataToMatrix4(n.matrix);i.matrixAutoUpdate=!1,i.matrix.copy(t),i.updateMatrixWorld(!0)}e(i);break;case"DirectionalLight":const r=t,s=new b_(new hh(r.color||16777215),r.intensity);if(r.matrix){const t=this.dataToMatrix4(r.matrix);s.matrixAutoUpdate=!1,s.matrix.copy(t),s.updateMatrixWorld(!0)}else r.position&&s.position.set(...r.position);s.castShadow=r.castShadow??!1,e(s);break;case"SpotLight":const a=t,o=new f_(a.color,a.intensity,a.distance,a.angle,a.penumbra,a.decay);if(o.target=this.characterGroup,a.matrix){const t=this.dataToMatrix4(a.matrix);o.matrixAutoUpdate=!1,o.matrix.copy(t),o.updateMatrixWorld(!0)}if(a.up&&o.up.set(...a.up),a.shadow&&(o.castShadow=a.castShadow??!0,a.shadow.radius&&(o.shadow.radius=a.shadow.radius),a.shadow.camera)){const t=o.shadow.camera;Object.assign(t,a.shadow.camera)}e(o);break;case"PointLight":const c=t,l=new v_(c.color,c.intensity,c.distance,c.decay);if(l.castShadow=c.castShadow??!1,c.castShadow&&(l.receiveShadow=!0),c.shadow&&(c.shadow.radius&&(l.shadow.radius=c.shadow.radius),c.shadow.camera&&Object.keys(c.shadow.camera).forEach((t=>{l.shadow.camera[t]=c.shadow.camera[t]}))),c.matrix){const t=this.dataToMatrix4(c.matrix);l.matrixAutoUpdate=!1,l.matrix.copy(t),l.updateMatrixWorld(!0)}else c.position&&l.position.set(...c.position),c.rotation&&l.rotation.set(...this.degree2Euler(c.rotation)),c.scale&&l.scale.set(...c.scale);e(l);break;case"RectAreaLight":const h=t,u=new w_(h.color,h.intensity,h.width,h.height);u.position.set(5,5,0),h.position&&u.position.set(...h.position),h.rotation&&u.rotation.set(...this.degree2Euler(h.rotation)),h.scale&&u.scale.set(...h.scale),e(u);break;case"HemisphereLight":const d=t,p=new c_(d.color??d.skyColor,d.groundColor,d.intensity);if(d.matrix){const t=this.dataToMatrix4(d.matrix);p.matrixAutoUpdate=!1,p.matrix.copy(t),p.updateMatrixWorld(!0)}e(p)}}setAngleView({camera:t}){((t,e=2)=>{const n=this.dataToMatrix4(t),i=new jc,r=new Vc,s=new jc;n.decompose(i,r,s),$I.to(this.camera.position,{x:i.x,y:i.y,z:i.z,duration:e,ease:"power2.inOut",onUpdate:()=>{this.camera.updateMatrixWorld()}}),$I.to(this.camera.quaternion,{x:r.x,y:r.y,z:r.z,w:r.w,duration:e,ease:"power2.inOut",onUpdate:()=>{this.camera.updateMatrixWorld()}}),$I.to(this.characterGroup.rotation,{x:0,y:0,z:0,duration:e,ease:"power2.inOut"})})(t.matrix,t.duration)}async gsapContainer(t){return new Promise((e=>this.container?t.attr?(cancelAnimationFrame(this.animationFrameId),this.container.offsetWidth,this.container.offsetHeight,void $I.to(this.container,{duration:1,ease:"power2.inOut",...t.attr,onUpdate:()=>{const t=$I.getProperty(this.container,"width"),e=$I.getProperty(this.container,"height");this.width=parseFloat(`${t}`),this.height=parseFloat(`${e}`),this.renderer?.setSize(this.width,this.height),this.renderer?.render(this.scene,this.camera)},onComplete:()=>{this.onWindowResize(),this.animate(),e(!0)}})):void e(!1):e(!1)))}initOrbitControls(){if(!this.camera||!this.renderer||!this.config.orbitControls?.useOrbitControl)return;this.controls=new Kv(this.camera,this.renderer.domElement),void 0!==this.config.orbitControls.minPolarAngle&&(this.controls.minPolarAngle=this.config.orbitControls.minPolarAngle),void 0!==this.config.orbitControls.maxPolarAngle&&(this.controls.maxPolarAngle=this.config.orbitControls.maxPolarAngle),this.controls.minDistance=this.config.orbitControls.minDistance||1,this.controls.maxDistance=this.config.orbitControls.maxDistance||10;const t=(new Yc).setFromObject(this.characterGroup),e=new jc;t.getCenter(e),this.controls.target.copy(e),this.camera.lookAt(this.controls.target)}setBackground(t=""){(new kb).load(t,(t=>{t.mapping=va,this.scene.background=t,this.scene.environment=t}))}loadGLBModel(t){(new $v).load(t,(t=>{this.scene.add(t.scene)}))}loadLowResTexture(t){const e=new a_;return new Promise((n=>{e.load(t,(t=>{t.minFilter=Ia,t.generateMipmaps=!1,n(t)}))}))}cloneTrack(t,e){return new Hm(e,t.times.slice(),t.values.slice())}changeBundle(t){this.loader.parse(t.buffer,"",(t=>{this.scene?.add(t.scene)}),(t=>{}))}loadBundles(t,e){const n=[],i={};return t.forEach((async r=>{i[r.bundle]={url:r.bundle,progress:0,total:0},n.push(new Promise(((n,s)=>{this.loader.parse(r.buffer,"",(s=>{n({...r,gltf:s}),((n="",r=0,s=0)=>{i[n]={url:n,progress:r,total:s};let a=0,o=0;t.forEach((({bundle:t})=>{a+=i[t].total,o+=i[t].progress}));const c=Math.floor(o/a*100);e(c)})(r.bundle,1,1)}),(t=>{s("Error loading GLB model")}))})))})),Promise.all(n).then((t=>{if(t.forEach((({code:t,gltf:e,name:n,enabled:i,type:r})=>{if(!e)return;const s=e.scene;if(s.name=t,"apose"===r)this.characterGroup.add(s),this.animationGroup.add(s),s.traverse((async t=>{t.isMesh&&(t.material.side=2)}));else if("animation"===r||"animation_system"===r){e.animations.forEach((t=>{const e=t.tracks.findIndex((t=>"BS_Mod.morphTargetInfluences"===t.name));if(e>=0){const n=t.tracks[e],i=this.config.model?.body.options.find((t=>t.key.startsWith("Head_Mod"))),r=this.config.model?.body.options.find((t=>t.key.startsWith("Eyelashes_Mod")));if(i&&r){const s=this.cloneTrack(n,`${i.key}.morphTargetInfluences`),a=this.cloneTrack(n,`${r.key}.morphTargetInfluences`);t.tracks.splice(e,1),t.tracks.push(s,a)}}}));const i=e.animations.map((e=>({code:t,animation:e,type:r,text:n})));if(this.animations.push(...i),"animation_system"===r){let e=t.includes("idle_")?"idle":t.includes("talk_")?"talk":"";e&&(this.actionDefalutMap[e]=t)}}this.model[t]=e,(t===this.config.model?.body.name||t.includes("_mesh_body"))&&this.config.model?.body.options.forEach((t=>{this.body[t.key]={...t,mesh:s.getObjectByName(t.name)}}))})),this.animationMixer=new cv(this.animationGroup),this.animations.forEach((t=>{const e=this.animationMixer.clipAction(t.animation);this.actions.push({name:t.animation.name,code:t.code,action:e,animation:t.animation,type:t.type,text:t.text})})),!this.isNotRender){const{scale:t,position:e,rotation:n}=this.config.model||{};t&&this.characterGroup.scale.set(...t),e&&this.characterGroup.position.set(...e),n&&this.characterGroup.rotation.set(fc.degToRad(n[0]),fc.degToRad(n[1]),fc.degToRad(n[2])),this.onAnimationFinishedBound=this.animationFinished.bind(this),this.animationMixer.addEventListener("finished",this.onAnimationFinishedBound),this.initOrbitControls(),this.onWindowResize(),this.registerListeners()}this.emit("core.bundles.loaded",t)})).then((()=>(this.setCharacterCenter(),this.config.debug&&(this.gui=new vT(this.scene,this.animationMixer,this.animations.map((t=>t.animation)))),!0))).catch((t=>!1))}animationFinished(t){const{action:e,type:n}=t}onWindowResize=$w((()=>{this.setContainer(),this.width=this.container.offsetWidth,this.height=this.container.offsetHeight,this.camera.aspect=this.width/this.height,this.camera.updateProjectionMatrix(),this.renderer?.setSize(this.width,this.height)}),300,{leading:!0});setCamera(t,e){if(!t)return;const{position:n,rotation:i,matrix:r,up:s,...a}=e;if(this.state.updateCamera=!0,a.fov&&(t.fov=a.fov),r){const e=this.dataToMatrix4(r);t.matrixAutoUpdate=!1,t.matrix.copy(e),t.matrix.decompose(t.position,t.quaternion,t.scale),t.updateMatrixWorld(!0),t.matrixAutoUpdate=!0}else n&&t.position.set(...n),i&&t.rotation.set(fc.degToRad(i[0]),fc.degToRad(i[1]),fc.degToRad(i[2]));this.state.updateCamera=!1}animate(){cancelAnimationFrame(this.animationFrameId),this.animationFrameId=requestAnimationFrame(this.animate.bind(this));const t=this.clock.getDelta();this.animationMixer&&(this.animationMixer.update(t),this.actionNotifier&&this.actionNotifier.update(t)),this.updateControls(),this.renderer&&this.renderer.render(this.scene,this.camera)}startRender(){this.characterGroup&&this.scene&&!this.animationFrameId&&(this.animationMixer&&this.playAction("idle"),this.animate(),this.scene?.remove(this.characterGroup),this.scene?.add(this.characterGroup))}stopRender(){this.animationFrameId&&this.characterGroup&&this.scene&&(this.scene?.remove(this.characterGroup),this.animationMixer&&this.animationMixer.stopAllAction(),setTimeout((()=>{cancelAnimationFrame(this.animationFrameId),this.animationFrameId=0}),100))}gsapMorph(t,e,n){const i={duration:.3,ease:"easy",onComplete:()=>{}};e.forEach(((t,e)=>{i[e]=t})),$I.to(t,i)}initIdle=$w((()=>{const t=this.actionDefalutMap.idle,{action:e}=this.actions.find((e=>e.code===t))||{};e&&e._propertyBindings.forEach(((t,n)=>{if(t.binding._bindings&&t.binding._bindings.length>0){const n=t.binding._bindings.findIndex((t=>t.resolvedProperty));if(n>=0){const i=t.binding._bindings[n].parsedPath.nodeName,r=this.body[i];r&&r.morphTargetInfluences&&r.morphTargetInfluences.length>0&&("Eyelashes_Mod"===i?(t.binding._bindings[n].resolvedProperty=r.morphTargetInfluences,r.morphTargetInfluences=null):(this.gsapMorph(r.mesh.morphTargetInfluences,t.binding._bindings[n].resolvedProperty,e),setTimeout((()=>{t.binding._bindings[n].resolvedProperty=r.morphTargetInfluences,r.morphTargetInfluences=null}),300)))}}}))}),500);playAction=$w(((t,e={})=>{if(this.muteActionState&&"idle"!==t&&"talk"!==t)return;const n=aE({loop:So,repetitions:99999},e),i="idle"===t?this.actionDefalutMap.idle:"talk"===t?this.actionDefalutMap.talk:t,r=this.actions.find((t=>t.code===i));if(r)try{const{action:e}=r,i=this.actions.find((t=>t.action.isRunning()));e.setLoop(n.loop,n.repetitions),e.clampWhenFinished=!0,i?i.action!==e&&(i.action.fadeOut(1),e.reset().play(),this.animationMixer?.update(0)):(e.reset().play(),this.animationMixer?.update(0)),this.actionNotifier=new tT(e),this.actionNotifier.on("beforeFinished",(e=>{this.emit("action.beforeFinished",t);const n=this.actionDefalutMap.idle;n&&this.playAction(n)}))}catch(t){}}),500,{leading:!0});stopAllActionExcludeIdle(){}stopAllAction(){this.actions.forEach((t=>{t.action.stop(),t.action.reset()}))}updateControls(){}mousedown=t=>{this.state.isMouseDown=!0;let e=0,n=0;t instanceof MouseEvent?(e=t.clientX,n=t.clientY):t instanceof TouchEvent&&t.touches.length>0&&(e=t.touches[0].clientX,n=t.touches[0].clientY),this.state.previousMousePosition={x:e,y:n}};mouseup=()=>{this.state.isMouseDown=!1,this.state.previousMousePosition={x:0,y:0}};mousemove=t=>{if(!this.state.isMouseDown||!this.animationFrameId)return;let e=0,n=0;t instanceof MouseEvent?(e=t.clientX,n=t.clientY):t instanceof TouchEvent&&t.touches.length>0&&(e=t.touches[0].clientX,n=t.touches[0].clientY);const i=e-this.state.previousMousePosition.x,r=n-this.state.previousMousePosition.y;this.characterGroup.rotation.y+=.01*i;const s=this.characterGroup.rotation.x+.01*r;if(r>0)if(this.config.orbitControls&&this.config.orbitControls.minPolarAngle>=0){const t=Math.min(1*this.config.orbitControls.minPolarAngle,Math.PI);Math.PI/2-s>=t&&(this.characterGroup.rotation.x=s)}else this.characterGroup.rotation.x=Math.min(s,Math.PI/2);else if(r<0)if(this.config.orbitControls&&this.config.orbitControls.maxPolarAngle>=0){const t=1*this.config.orbitControls.maxPolarAngle;Math.PI/2-s<=t&&(this.characterGroup.rotation.x=s)}else this.characterGroup.rotation.x=Math.max(s,-Math.PI/2);this.state.previousMousePosition={x:e,y:n}};registerListeners(){this.container&&this.config.model?.rotate&&!this.config.orbitControls?.useOrbitControl&&(this.container.addEventListener("mousedown",this.mousedown),this.container.addEventListener("mouseup",this.mouseup),this.container.addEventListener("mousemove",this.mousemove),this.container.addEventListener("touchstart",this.mousedown),this.container.addEventListener("touchend",this.mouseup),this.container.addEventListener("touchmove",this.mousemove))}cleanMaterial(t){t.map&&t.map.dispose(),t.lightMap&&t.lightMap.dispose(),t.bumpMap&&t.bumpMap.dispose(),t.normalMap&&t.normalMap.dispose(),t.specularMap&&t.specularMap.dispose(),t.envMap&&t.envMap.dispose(),t.dispose()}destroy(){this.isNotRender||(this.animationFrameId&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=0),this.animationMixer&&(this.animationMixer.stopAllAction(),this.animationMixer.removeEventListener("finished",this.onAnimationFinishedBound),this.animationMixer=null),this.container&&(this.container.removeEventListener("mousedown",this.mousedown),this.container.removeEventListener("mouseup",this.mouseup),this.container.removeEventListener("mousemove",this.mousemove),this.container.removeEventListener("touchstart",this.mousedown),this.container.removeEventListener("touchend",this.mouseup),this.container.removeEventListener("touchmove",this.mousemove),this.container.removeEventListener("resize",this.onWindowResizeBound,!1)),this.scene.traverse((t=>{t.isMesh&&(t.geometry.dispose(),t.material.isMaterial?this.cleanMaterial(t.material):t.material.forEach((t=>this.cleanMaterial(t))))})),this.gui?.dispose(),this.gui=null,this.renderer?.dispose(),this.renderer?.domElement&&this.renderer?.domElement.parentNode?.removeChild(this.renderer?.domElement),window.removeEventListener("resize",this.onWindowResizeBound,!1),this.scene=null,this.camera=null,this.renderer=null,this.actions=[],this.controls=null,this.animations=[],this.body={},this.model={},this.characterGroup=null,this.lightGroup=null)}async playByShapes(t=[],e=0){for(const[,n]of Object.entries(this.body))if(n.mesh){let i=[];i="doctor"===this.config.name?[...Gb({dictionary:n.mesh.morphTargetDictionary,shapes:t,prefix:n.prefix,suffix:n.suffix,morphTargetInfluences:n.mesh.morphTargetInfluences,index:e,code:this.config.name})]:[...Fb({dictionary:n.mesh.morphTargetDictionary,shapes:t,prefix:n.prefix,suffix:n.suffix,morphTargetInfluences:n.mesh.morphTargetInfluences,index:e,code:this.config.name})],n.mesh.morphTargetInfluences=i,n.morphTargetInfluences=i}}addModel(t,e){const n=new $v,i=new Lb;i.setDecoderPath(`${this.config.dracoPath}`),i.setDecoderConfig({type:"js"}),n.setDRACOLoader(i),n.load(e,(e=>{const n=e.scene;n.name=t,n.position.set(0,0,0),n.rotation.set(0,0,0),n.scale.set(1,1,1),this.scene&&(this.scene.traverse((t=>{t.isMesh})),this.scene.children[1].children[1].children[0].add(n.children[0]))}),void 0,(t=>{}))}destoryModel(t){if(!this.scene)return;const e=[];this.scene.traverse((t=>{if(t.isMesh){-1!==t.name.toLowerCase().indexOf("cloth")&&(t.geometry.dispose(),Array.isArray(t.material)?t.material.forEach((t=>{t&&t.isMaterial&&this.cleanMaterial(t)})):t.material&&t.material.isMaterial&&this.cleanMaterial(t.material),t.parent&&e.push(t))}})),e.forEach((t=>{t.parent&&t.parent.remove(t)}));const n=t.indexOf("apose_cloth");-1!==n&&t.substring(n)}muteAction(t=!0){this.playAction("idle"),this.muteActionState=t}getModelInfo(){const t=[];return this.characterGroup&&function e(n){n.children.forEach((n=>{n.isGroup?e(n):t.push(n)}))}(this.characterGroup),{actor:this.characterGroup,scenes:t,animations:this.animations.map((t=>t.animation)),mixer:this.animationMixer,actions:this.actions}}loadGlb(t,e=()=>{}){return new Promise(((n,i)=>{(new $v).load(t,(t=>{n(t)}),e,(t=>{i(t)}))}))}addGlb(t,e=()=>{}){return this.loadGlb(t,e).then((t=>{const e=t.scene;return this.scene&&this.scene.add(e),t}))}setCharacterCenter(){const t=this.characterGroup.children.find((t=>t.name.includes("body")));if(t){const e=(new Yc).setFromObject(t).getCenter(new jc);this.characterGroup.children.forEach((t=>{t.position.sub(e)})),this.characterGroup.position.add(e)}}setVideoBackground(t){const e=document.createElement("video");e.crossOrigin="anonymous",e.src=t,e.loop=!0,e.muted=!0,e.autoplay=!0,e.playsInline=!0,e.play();const n=new WA(e);n.minFilter=Ia,n.magFilter=Ia;const i=2*Math.tan(fc.degToRad(this.camera.fov/2))*10,r=i*this.camera.aspect,s=new wu(r,i),a=new fh({map:n}),o=new Kh(s,a),c=new jc;this.camera.getWorldDirection(c),o.position.copy(this.camera.position).add(c.multiplyScalar(10)),o.lookAt(this.camera.position),this.scene.add(o);const l=this.animate;this.animate=()=>{this.camera.getWorldDirection(c),o.position.copy(this.camera.position).add(c.multiplyScalar(10)),o.lookAt(this.camera.position),l.call(this)}}loadCubeBackground(t){if(0===t.length)return;if(1===t.length){const e=(new a_).load(t[0]);return void(this.scene.background=e)}if(6!==t.length)return;const e=(new r_).load(t);this.scene.background=e}setBackgroundColorOrGradient(t){if(t.startsWith("linear-gradient")){const e=document.createElement("canvas");e.width=this.width,e.height=this.height;const n=e.getContext("2d"),i=t.match(/linear-gradient\(([^,]+),\s*(.+)\)/);if(!i)return;i[1].trim();const r=i[2].split(",").map((t=>t.trim())),s=n.createLinearGradient(0,0,e.width,e.height);r.forEach(((t,e)=>{s.addColorStop(e/(r.length-1),t)})),n.fillStyle=s,n.fillRect(0,0,e.width,e.height);const a=new JA(e);this.scene.background=a}else this.scene.background=new hh(t)}}var bT;!function(t){t.HUMAN_READY="human.ready",t.HUMAN_ERROR="human.error",t.HUMAN_ACTION_PENDING="human.action.pending",t.HUMAN_LOAD_PROGRESS="human.load.progress",t.CORE_BUNDLES_LOADED="core.bundles.loaded",t.RECORDER_MESSAGE="recorder.message",t.RECORDER_START="recorder.start",t.RECORDER_STOP="recorder.stop",t.RECORDER_SENDING="recorder.sending",t.VOICE_SLEEP="voice.sleep",t.VOICE_WAKE="voice.wake",t.VOICE_INTERRUPT="voice.interrupt",t.VOICE2TEXT="voice2text",t.ASRTEXT="asrtext",t.WAKE_RECORDER_START="wake.record.start",t.WAKE_RECORDER_STOP="wake.record.stop",t.AUDIO_PAUSE="audio.pause",t.AUDIO_PLAY="audio.play"}(bT||(bT={}));const xT=new URL("/images/starflake1.png",import.meta.url).href,wT=new URL("/images/starflake2.png",import.meta.url).href;class ET{hm;animationFrameId=0;container;scene;width;height;depth=1e3;zAxisNumber;camera;renderer;sphere;parameters=[];materials=[];particles_init_postion;zprogress;zprogress_second;particles_first=[];particles_second=[];constructor(t,e){this.hm=e,this.container="string"==typeof t?document.getElementById(t):t,this.width=this.container.clientWidth,this.height=this.container.clientHeight,this.scene=new df,this.scene.fog=new uf(0,0,1e4);const n=this.height/2/Math.tan(Math.PI/12);this.zAxisNumber=Math.max(n-this.depth/2,this.depth/2),this.camera=new lu(15,this.width/this.height,1,1e4),this.camera.position.set(0,0,this.zAxisNumber),this.camera.lookAt(0,0,0),this.initLight(),this.particles_init_postion=-this.zAxisNumber-this.depth/2,this.zprogress=this.particles_init_postion,this.zprogress_second=2*this.particles_init_postion,this.particles_first=this.initSceneStar(this.particles_init_postion),this.particles_second=this.initSceneStar(this.zprogress_second),this.renderer=new lf,this.renderer.setSize(this.width,this.height),this.container.appendChild(this.renderer.domElement),this.initOrbitControls(),this.animate(),this.hm.on(bT.HUMAN_LOAD_PROGRESS,this.onProgress),this.initProgressBar()}initProgressBar(){const t=document.createElement("div");t.id="loadingContainer",t.className="loading-container w-full h-full bg-[#000]",t.style.width="100%",t.style.height="100%";const e=document.createElement("div");e.className="bottom-20 flex justify-center left-0 absolute w-full items-center flex-col",e.style.display="flex",e.style.justifyContent="center",e.style.alignItems="center",e.style.flexDirection="column",e.style.position="absolute",e.style.left="0px",e.style.bottom="5rem",e.style.width="100%";const n=document.createElement("div");n.className="qt-progress-wrap w-3/4 h-[0.375rem] bg-[rgba(255,249,249,0.2)] rounded-1 overflow-hidden",n.style.backgroundColor="rgba(255,249,249,0.2)",n.style.height="0.375rem",n.style.width="75%",n.style.overflow="hidden",n.style.borderRadius=".25rem";const i=document.createElement("div");i.className="qt-progress w-[10%] h-[0.375rem] bg-white rounded-1",i.id="qtprogress",i.style.backgroundColor="rgb(255,255,255,1)",i.style.height="0.375rem",i.style.width="0",i.style.transition="width linear 0.3s",i.style.borderRadius=".25rem",n.appendChild(i),e.appendChild(n),t.appendChild(e);const r=document.createElement("div");r.className="text-white mt-4 text-sm",r.textContent="正在加载...",r.id="qtprogresstext",r.style.color="rgb(255,255,255,1)",r.style.fontSize="0.875rem",r.style.lineHeight="1.25rem",r.style.marginTop="1rem",e.appendChild(r),this.container.appendChild(t)}initScene(){this.scene=new df,this.scene.fog=new uf(0,0,1e4)}initCamera(){const t=this.width/2/Math.tan(Math.PI/12);this.zAxisNumber=Math.floor(t-this.depth/2),this.camera=new lu(15,this.width/this.height,1,1e4),this.camera.position.set(0,0,this.zAxisNumber),this.camera.lookAt(0,0,0)}initRenderer(){this.renderer=new lf,this.renderer.setSize(this.width,this.height),this.container.appendChild(this.renderer.domElement)}initOrbitControls(){const t=new Kv(this.camera,this.renderer.domElement);t.enabled=!1,t.update()}animate(){this.animationFrameId=requestAnimationFrame(this.animate.bind(this)),this.renderStarMove(),this.renderer.render(this.scene,this.camera)}initLight(){const t=new x_(16777215);this.scene.add(t);const e=new v_(415229,5,0);e.position.set(50,50,50),this.scene.add(e)}renderSphereRotate(){this.sphere.rotateY(.01)}initSceneStar(t){const e=new Lh,n=[],i=new a_,r=i.load(xT),s=i.load(wT);this.parameters=[[[.6,100,.75],r,50],[[0,0,1],s,20]];for(let t=0;t<500;t++){const t=fc.randFloatSpread(this.width),e=dE(0,3*this.height/5),i=dE(-this.depth/2,this.zAxisNumber);n.push(t,e,i)}e.setAttribute("position",new Ch(n,3));const a=[];for(let n=0;n<this.parameters.length;n++){const i=this.parameters[n][0],r=this.parameters[n][1],s=this.parameters[n][2];this.materials[n]=new FA({size:s,map:r,blending:2,transparent:!0,depthTest:!1}),this.materials[n].color.setHSL(i[0],i[1],i[2]);const o=new VA(e,this.materials[n]);o.rotation.x=.2*Math.random()-.15,o.rotation.y=.2*Math.random()-.15,o.rotation.z=.2*Math.random()-.15,o.position.setZ(t),a.push(o),this.scene.add(o)}return a}renderStarMove(){const t=5e-5*Date.now();for(let e=0;e<this.parameters.length;e++){const n=this.parameters[e][0],i=360*(n[0]+t)%360/360;this.materials[e].color.setHSL(n[0],n[1],parseFloat(i.toFixed(2)))}this.zprogress+=10,this.zprogress_second+=10,this.zprogress>=this.zAxisNumber+this.depth/2?this.zprogress=this.particles_init_postion:this.particles_first.forEach((t=>{t.position.setZ(this.zprogress)})),this.zprogress_second>=this.zAxisNumber+this.depth/2?this.zprogress_second=this.particles_init_postion:this.particles_second.forEach((t=>{t.position.setZ(this.zprogress_second)}))}onProgress({code:t,progress:e,total:n}){document.getElementById("qtprogress").style.width=`${n}%`,document.getElementById("qtprogresstext").innerText=`正在加载:${n}%`}destroy(){cancelAnimationFrame(this.animationFrameId),this.renderer.dispose(),this.hm.off(bT.HUMAN_LOAD_PROGRESS,this.onProgress),this.renderer.domElement.parentNode&&(this.renderer.domElement.parentNode.removeChild(this.renderer.domElement),this.container.innerHTML="")}}var CT=new class{prefix;ttl;cache;constructor(t={}){this.prefix=t.prefix||"app_",this.ttl=t.ttl||0,this.cache=new Map}getKey(t){return`${this.prefix}${t}`}isExpired(t){return!!t.expiry&&Date.now()>t.expiry}setItem(t,e){const n={value:e,expiry:this.ttl?Date.now()+this.ttl:null};this.cache.set(this.getKey(t),n)}getItem(t){const e=this.getKey(t);if(this.cache.has(e)){const t=this.cache.get(e);if(!this.isExpired(t))return t.value;this.cache.delete(e)}return null}removeItem(t){const e=this.getKey(t);this.cache.delete(e)}clear(){this.cache.clear()}}({prefix:"quante_",ttl:12096e5});const ST="auth-token",MT="wss-url",IT="platform-base-api",TT="apigateway-token";var BT=function(t,e){if(!(this instanceof BT))return new BT(t,e);this.url=t,e=e||{},this.headers=e.headers||{},this.payload=void 0!==e.payload?e.payload:"",this.method=e.method||(this.payload?"POST":"GET"),this.withCredentials=!!e.withCredentials,this.debug=!!e.debug,this.FIELD_SEPARATOR=":",this.listeners={},this.xhr=null,this.readyState=BT.INITIALIZING,this.progress=0,this.chunk="",this.lastEventId="",this.addEventListener=function(t,e){void 0===this.listeners[t]&&(this.listeners[t]=[]),-1===this.listeners[t].indexOf(e)&&this.listeners[t].push(e)},this.removeEventListener=function(t,e){if(void 0===this.listeners[t])return;const n=[];this.listeners[t].forEach((function(t){t!==e&&n.push(t)})),0===n.length?delete this.listeners[t]:this.listeners[t]=n},this.dispatchEvent=function(t){if(!t)return!0;this.debug,t.source=this;const e="on"+t.type;return(!this.hasOwnProperty(e)||(this[e].call(this,t),!t.defaultPrevented))&&(!this.listeners[t.type]||this.listeners[t.type].every((function(e){return e(t),!t.defaultPrevented})))},this._markClosed=function(){this.xhr=null,this.progress=0,this.chunk="",this._setReadyState(BT.CLOSED)},this._setReadyState=function(t){const e=new CustomEvent("readystatechange");e.readyState=t,this.readyState=t,this.dispatchEvent(e)},this._onStreamFailure=function(t){const e=new CustomEvent("error");e.responseCode=t.currentTarget.status,e.data=t.currentTarget.response,this.dispatchEvent(e),this._markClosed()},this._onStreamAbort=function(){this.dispatchEvent(new CustomEvent("abort")),this._markClosed()},this._onStreamProgress=function(t){if(!this.xhr)return;if(this.xhr.status<200||this.xhr.status>=300)return void this._onStreamFailure(t);const e=this.xhr.responseText.substring(this.progress);this.progress+=e.length;const n=(this.chunk+e).split(/(\r\n\r\n|\r\r|\n\n)/g),i=n.pop();n.forEach(function(t){t.trim().length>0&&this.dispatchEvent(this._parseEventChunk(t))}.bind(this)),this.chunk=i},this._onStreamLoaded=function(t){this._onStreamProgress(t),this.dispatchEvent(this._parseEventChunk(this.chunk)),this.chunk="",this._markClosed()},this._parseEventChunk=function(t){if(!t||0===t.length)return null;this.debug;const e={id:null,retry:null,data:null,event:null};t.split(/\n|\r\n|\r/).forEach(function(t){const n=t.indexOf(this.FIELD_SEPARATOR);let i,r;if(n>0){const e=" "===t[n+1]?2:1;i=t.substring(0,n),r=t.substring(n+e)}else{if(!(n<0))return;i=t,r=""}i in e&&("data"===i&&null!==e[i]?e.data+="\n"+r:e[i]=r)}.bind(this)),null!==e.id&&(this.lastEventId=e.id);const n=new CustomEvent(e.event||"message");return n.id=e.id,n.data=e.data||"",n.lastEventId=this.lastEventId,n},this._onReadyStateChange=function(){if(this.xhr&&this.xhr.readyState===XMLHttpRequest.HEADERS_RECEIVED){const t={},e=this.xhr.getAllResponseHeaders().trim().split("\r\n");for(const n of e){const[e,...i]=n.split(":"),r=i.join(":").trim();t[e.trim().toLowerCase()]=t[e.trim().toLowerCase()]||[],t[e.trim().toLowerCase()].push(r)}const n=new CustomEvent("open");n.responseCode=this.xhr.status,n.headers=t,this.dispatchEvent(n),this._setReadyState(BT.OPEN)}},this.stream=function(){if(!this.xhr){this._setReadyState(BT.CONNECTING),this.xhr=new XMLHttpRequest,this.xhr.addEventListener("progress",this._onStreamProgress.bind(this)),this.xhr.addEventListener("load",this._onStreamLoaded.bind(this)),this.xhr.addEventListener("readystatechange",this._onReadyStateChange.bind(this)),this.xhr.addEventListener("error",this._onStreamFailure.bind(this)),this.xhr.addEventListener("abort",this._onStreamAbort.bind(this)),this.xhr.open(this.method,this.url);for(let t in this.headers)this.xhr.setRequestHeader(t,this.headers[t]);this.lastEventId.length>0&&this.xhr.setRequestHeader("Last-Event-ID",this.lastEventId),this.xhr.withCredentials=this.withCredentials,this.xhr.send(this.payload)}},this.close=function(){this.readyState!==BT.CLOSED&&this.xhr.abort()},(void 0===e.start||e.start)&&this.stream()};function RT(){throw new Error("setTimeout has not been defined")}function DT(){throw new Error("clearTimeout has not been defined")}BT.INITIALIZING=-1,BT.CONNECTING=0,BT.OPEN=1,BT.CLOSED=2,"undefined"!=typeof exports&&(exports.SSE=BT);var LT=RT,PT=DT;function kT(t){if(LT===setTimeout)return setTimeout(t,0);if((LT===RT||!LT)&&setTimeout)return LT=setTimeout,setTimeout(t,0);try{return LT(t,0)}catch(e){try{return LT.call(null,t,0)}catch(e){return LT.call(this,t,0)}}}"function"==typeof Tr.setTimeout&&(LT=setTimeout),"function"==typeof Tr.clearTimeout&&(PT=clearTimeout);var OT,UT=[],NT=!1,FT=-1;function QT(){NT&&OT&&(NT=!1,OT.length?UT=OT.concat(UT):FT=-1,UT.length&&zT())}function zT(){if(!NT){var t=kT(QT);NT=!0;for(var e=UT.length;e;){for(OT=UT,UT=[];++FT<e;)OT&&OT[FT].run();FT=-1,e=UT.length}OT=null,NT=!1,function(t){if(PT===clearTimeout)return clearTimeout(t);if((PT===DT||!PT)&&clearTimeout)return PT=clearTimeout,clearTimeout(t);try{return PT(t)}catch(e){try{return PT.call(null,t)}catch(e){return PT.call(this,t)}}}(t)}}function GT(t,e){this.fun=t,this.array=e}GT.prototype.run=function(){this.fun.apply(null,this.array)};function HT(){}var VT=HT,jT=HT,WT=HT,qT=HT,YT=HT,XT=HT,JT=HT;var KT=Tr.performance||{},ZT=KT.now||KT.mozNow||KT.msNow||KT.oNow||KT.webkitNow||function(){return(new Date).getTime()};var $T=new Date;var tB={nextTick:function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];UT.push(new GT(t,e)),1!==UT.length||NT||kT(zT)},title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:VT,addListener:jT,once:WT,off:qT,removeListener:YT,removeAllListeners:XT,emit:JT,binding:function(t){throw new Error("process.binding is not supported")},cwd:function(){return"/"},chdir:function(t){throw new Error("process.chdir is not supported")},umask:function(){return 0},hrtime:function(t){var e=.001*ZT.call(KT),n=Math.floor(e),i=Math.floor(e%1*1e9);return t&&(n-=t[0],(i-=t[1])<0&&(n--,i+=1e9)),[n,i]},platform:"browser",release:{},config:{},uptime:function(){return(new Date-$T)/1e3}};function eB(t,e){return function(){return t.apply(e,arguments)}}const{toString:nB}=Object.prototype,{getPrototypeOf:iB}=Object,{iterator:rB,toStringTag:sB}=Symbol,aB=(oB=Object.create(null),t=>{const e=nB.call(t);return oB[e]||(oB[e]=e.slice(8,-1).toLowerCase())});var oB;const cB=t=>(t=t.toLowerCase(),e=>aB(e)===t),lB=t=>e=>typeof e===t,{isArray:hB}=Array,uB=lB("undefined");function dB(t){return null!==t&&!uB(t)&&null!==t.constructor&&!uB(t.constructor)&&AB(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const pB=cB("ArrayBuffer");const fB=lB("string"),AB=lB("function"),gB=lB("number"),mB=t=>null!==t&&"object"==typeof t,_B=t=>{if("object"!==aB(t))return!1;const e=iB(t);return!(null!==e&&e!==Object.prototype&&null!==Object.getPrototypeOf(e)||sB in t||rB in t)},vB=cB("Date"),yB=cB("File"),bB=cB("Blob"),xB=cB("FileList"),wB=cB("URLSearchParams"),[EB,CB,SB,MB]=["ReadableStream","Request","Response","Headers"].map(cB);function IB(t,e,{allOwnKeys:n=!1}={}){if(null==t)return;let i,r;if("object"!=typeof t&&(t=[t]),hB(t))for(i=0,r=t.length;i<r;i++)e.call(null,t[i],i,t);else{if(dB(t))return;const r=n?Object.getOwnPropertyNames(t):Object.keys(t),s=r.length;let a;for(i=0;i<s;i++)a=r[i],e.call(null,t[a],a,t)}}function TB(t,e){if(dB(t))return null;e=e.toLowerCase();const n=Object.keys(t);let i,r=n.length;for(;r-- >0;)if(i=n[r],e===i.toLowerCase())return i;return null}const BB="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:Tr,RB=t=>!uB(t)&&t!==BB;const DB=(LB="undefined"!=typeof Uint8Array&&iB(Uint8Array),t=>LB&&t instanceof LB);var LB;const PB=cB("HTMLFormElement"),kB=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),OB=cB("RegExp"),UB=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t),i={};IB(n,((n,r)=>{let s;!1!==(s=e(n,r,t))&&(i[r]=s||n)})),Object.defineProperties(t,i)};const NB=cB("AsyncFunction"),FB=(QB="function"==typeof setImmediate,zB=AB(BB.postMessage),QB?setImmediate:zB?(GB=`axios@${Math.random()}`,HB=[],BB.addEventListener("message",(({source:t,data:e})=>{t===BB&&e===GB&&HB.length&&HB.shift()()}),!1),t=>{HB.push(t),BB.postMessage(GB,"*")}):t=>setTimeout(t));var QB,zB,GB,HB;const VB="undefined"!=typeof queueMicrotask?queueMicrotask.bind(BB):void 0!==tB&&tB.nextTick||FB;var jB={isArray:hB,isArrayBuffer:pB,isBuffer:dB,isFormData:t=>{let e;return t&&("function"==typeof FormData&&t instanceof FormData||AB(t.append)&&("formdata"===(e=aB(t))||"object"===e&&AB(t.toString)&&"[object FormData]"===t.toString()))},isArrayBufferView:function(t){let e;return e="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&pB(t.buffer),e},isString:fB,isNumber:gB,isBoolean:t=>!0===t||!1===t,isObject:mB,isPlainObject:_B,isEmptyObject:t=>{if(!mB(t)||dB(t))return!1;try{return 0===Object.keys(t).length&&Object.getPrototypeOf(t)===Object.prototype}catch(t){return!1}},isReadableStream:EB,isRequest:CB,isResponse:SB,isHeaders:MB,isUndefined:uB,isDate:vB,isFile:yB,isBlob:bB,isRegExp:OB,isFunction:AB,isStream:t=>mB(t)&&AB(t.pipe),isURLSearchParams:wB,isTypedArray:DB,isFileList:xB,forEach:IB,merge:function t(){const{caseless:e}=RB(this)&&this||{},n={},i=(i,r)=>{const s=e&&TB(n,r)||r;_B(n[s])&&_B(i)?n[s]=t(n[s],i):_B(i)?n[s]=t({},i):hB(i)?n[s]=i.slice():n[s]=i};for(let t=0,e=arguments.length;t<e;t++)arguments[t]&&IB(arguments[t],i);return n},extend:(t,e,n,{allOwnKeys:i}={})=>(IB(e,((e,i)=>{n&&AB(e)?t[i]=eB(e,n):t[i]=e}),{allOwnKeys:i}),t),trim:t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:t=>(65279===t.charCodeAt(0)&&(t=t.slice(1)),t),inherits:(t,e,n,i)=>{t.prototype=Object.create(e.prototype,i),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),n&&Object.assign(t.prototype,n)},toFlatObject:(t,e,n,i)=>{let r,s,a;const o={};if(e=e||{},null==t)return e;do{for(r=Object.getOwnPropertyNames(t),s=r.length;s-- >0;)a=r[s],i&&!i(a,t,e)||o[a]||(e[a]=t[a],o[a]=!0);t=!1!==n&&iB(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},kindOf:aB,kindOfTest:cB,endsWith:(t,e,n)=>{t=String(t),(void 0===n||n>t.length)&&(n=t.length),n-=e.length;const i=t.indexOf(e,n);return-1!==i&&i===n},toArray:t=>{if(!t)return null;if(hB(t))return t;let e=t.length;if(!gB(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},forEachEntry:(t,e)=>{const n=(t&&t[rB]).call(t);let i;for(;(i=n.next())&&!i.done;){const n=i.value;e.call(t,n[0],n[1])}},matchAll:(t,e)=>{let n;const i=[];for(;null!==(n=t.exec(e));)i.push(n);return i},isHTMLForm:PB,hasOwnProperty:kB,hasOwnProp:kB,reduceDescriptors:UB,freezeMethods:t=>{UB(t,((e,n)=>{if(AB(t)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const i=t[n];AB(i)&&(e.enumerable=!1,"writable"in e?e.writable=!1:e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}))}))},toObjectSet:(t,e)=>{const n={},i=t=>{t.forEach((t=>{n[t]=!0}))};return hB(t)?i(t):i(String(t).split(e)),n},toCamelCase:t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(t,e,n){return e.toUpperCase()+n})),noop:()=>{},toFiniteNumber:(t,e)=>null!=t&&Number.isFinite(t=+t)?t:e,findKey:TB,global:BB,isContextDefined:RB,isSpecCompliantForm:function(t){return!!(t&&AB(t.append)&&"FormData"===t[sB]&&t[rB])},toJSONObject:t=>{const e=new Array(10),n=(t,i)=>{if(mB(t)){if(e.indexOf(t)>=0)return;if(dB(t))return t;if(!("toJSON"in t)){e[i]=t;const r=hB(t)?[]:{};return IB(t,((t,e)=>{const s=n(t,i+1);!uB(s)&&(r[e]=s)})),e[i]=void 0,r}}return t};return n(t,0)},isAsyncFn:NB,isThenable:t=>t&&(mB(t)||AB(t))&&AB(t.then)&&AB(t.catch),setImmediate:FB,asap:VB,isIterable:t=>null!=t&&AB(t[rB])};function WB(t,e,n,i,r){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=t,this.name="AxiosError",e&&(this.code=e),n&&(this.config=n),i&&(this.request=i),r&&(this.response=r,this.status=r.status?r.status:null)}jB.inherits(WB,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:jB.toJSONObject(this.config),code:this.code,status:this.status}}});const qB=WB.prototype,YB={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((t=>{YB[t]={value:t}})),Object.defineProperties(WB,YB),Object.defineProperty(qB,"isAxiosError",{value:!0}),WB.from=(t,e,n,i,r,s)=>{const a=Object.create(qB);return jB.toFlatObject(t,a,(function(t){return t!==Error.prototype}),(t=>"isAxiosError"!==t)),WB.call(a,t.message,e,n,i,r),a.cause=t,a.name=t.name,s&&Object.assign(a,s),a};function XB(t){return jB.isPlainObject(t)||jB.isArray(t)}function JB(t){return jB.endsWith(t,"[]")?t.slice(0,-2):t}function KB(t,e,n){return t?t.concat(e).map((function(t,e){return t=JB(t),!n&&e?"["+t+"]":t})).join(n?".":""):e}const ZB=jB.toFlatObject(jB,{},null,(function(t){return/^is[A-Z]/.test(t)}));function $B(t,e,n){if(!jB.isObject(t))throw new TypeError("target must be an object");e=e||new FormData;const i=(n=jB.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(t,e){return!jB.isUndefined(e[t])}))).metaTokens,r=n.visitor||l,s=n.dots,a=n.indexes,o=(n.Blob||"undefined"!=typeof Blob&&Blob)&&jB.isSpecCompliantForm(e);if(!jB.isFunction(r))throw new TypeError("visitor must be a function");function c(t){if(null===t)return"";if(jB.isDate(t))return t.toISOString();if(jB.isBoolean(t))return t.toString();if(!o&&jB.isBlob(t))throw new WB("Blob is not supported. Use a Buffer instead.");return jB.isArrayBuffer(t)||jB.isTypedArray(t)?o&&"function"==typeof Blob?new Blob([t]):Hr.from(t):t}function l(t,n,r){let o=t;if(t&&!r&&"object"==typeof t)if(jB.endsWith(n,"{}"))n=i?n:n.slice(0,-2),t=JSON.stringify(t);else if(jB.isArray(t)&&function(t){return jB.isArray(t)&&!t.some(XB)}(t)||(jB.isFileList(t)||jB.endsWith(n,"[]"))&&(o=jB.toArray(t)))return n=JB(n),o.forEach((function(t,i){!jB.isUndefined(t)&&null!==t&&e.append(!0===a?KB([n],i,s):null===a?n:n+"[]",c(t))})),!1;return!!XB(t)||(e.append(KB(r,n,s),c(t)),!1)}const h=[],u=Object.assign(ZB,{defaultVisitor:l,convertValue:c,isVisitable:XB});if(!jB.isObject(t))throw new TypeError("data must be an object");return function t(n,i){if(!jB.isUndefined(n)){if(-1!==h.indexOf(n))throw Error("Circular reference detected in "+i.join("."));h.push(n),jB.forEach(n,(function(n,s){!0===(!(jB.isUndefined(n)||null===n)&&r.call(e,n,jB.isString(s)?s.trim():s,i,u))&&t(n,i?i.concat(s):[s])})),h.pop()}}(t),e}function tR(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,(function(t){return e[t]}))}function eR(t,e){this._pairs=[],t&&$B(t,this,e)}const nR=eR.prototype;function iR(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function rR(t,e,n){if(!e)return t;const i=n&&n.encode||iR;jB.isFunction(n)&&(n={serialize:n});const r=n&&n.serialize;let s;if(s=r?r(e,n):jB.isURLSearchParams(e)?e.toString():new eR(e,n).toString(i),s){const e=t.indexOf("#");-1!==e&&(t=t.slice(0,e)),t+=(-1===t.indexOf("?")?"?":"&")+s}return t}nR.append=function(t,e){this._pairs.push([t,e])},nR.toString=function(t){const e=t?function(e){return t.call(this,e,tR)}:tR;return this._pairs.map((function(t){return e(t[0])+"="+e(t[1])}),"").join("&")};class sR{constructor(){this.handlers=[]}use(t,e,n){return this.handlers.push({fulfilled:t,rejected:e,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){jB.forEach(this.handlers,(function(e){null!==e&&t(e)}))}}var aR={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},oR={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:eR,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const cR="undefined"!=typeof window&&"undefined"!=typeof document,lR="object"==typeof navigator&&navigator||void 0,hR=cR&&(!lR||["ReactNative","NativeScript","NS"].indexOf(lR.product)<0),uR="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,dR=cR&&window.location.href||"http://localhost";var pR={...Object.freeze({__proto__:null,hasBrowserEnv:cR,hasStandardBrowserEnv:hR,hasStandardBrowserWebWorkerEnv:uR,navigator:lR,origin:dR}),...oR};function fR(t){function e(t,n,i,r){let s=t[r++];if("__proto__"===s)return!0;const a=Number.isFinite(+s),o=r>=t.length;if(s=!s&&jB.isArray(i)?i.length:s,o)return jB.hasOwnProp(i,s)?i[s]=[i[s],n]:i[s]=n,!a;i[s]&&jB.isObject(i[s])||(i[s]=[]);return e(t,n,i[s],r)&&jB.isArray(i[s])&&(i[s]=function(t){const e={},n=Object.keys(t);let i;const r=n.length;let s;for(i=0;i<r;i++)s=n[i],e[s]=t[s];return e}(i[s])),!a}if(jB.isFormData(t)&&jB.isFunction(t.entries)){const n={};return jB.forEachEntry(t,((t,i)=>{e(function(t){return jB.matchAll(/\w+|\[(\w*)]/g,t).map((t=>"[]"===t[0]?"":t[1]||t[0]))}(t),i,n,0)})),n}return null}const AR={transitional:aR,adapter:["xhr","http","fetch"],transformRequest:[function(t,e){const n=e.getContentType()||"",i=n.indexOf("application/json")>-1,r=jB.isObject(t);r&&jB.isHTMLForm(t)&&(t=new FormData(t));if(jB.isFormData(t))return i?JSON.stringify(fR(t)):t;if(jB.isArrayBuffer(t)||jB.isBuffer(t)||jB.isStream(t)||jB.isFile(t)||jB.isBlob(t)||jB.isReadableStream(t))return t;if(jB.isArrayBufferView(t))return t.buffer;if(jB.isURLSearchParams(t))return e.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let s;if(r){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(t,e){return $B(t,new pR.classes.URLSearchParams,{visitor:function(t,e,n,i){return pR.isNode&&jB.isBuffer(t)?(this.append(e,t.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...e})}(t,this.formSerializer).toString();if((s=jB.isFileList(t))||n.indexOf("multipart/form-data")>-1){const e=this.env&&this.env.FormData;return $B(s?{"files[]":t}:t,e&&new e,this.formSerializer)}}return r||i?(e.setContentType("application/json",!1),function(t,e,n){if(jB.isString(t))try{return(e||JSON.parse)(t),jB.trim(t)}catch(t){if("SyntaxError"!==t.name)throw t}return(n||JSON.stringify)(t)}(t)):t}],transformResponse:[function(t){const e=this.transitional||AR.transitional,n=e&&e.forcedJSONParsing,i="json"===this.responseType;if(jB.isResponse(t)||jB.isReadableStream(t))return t;if(t&&jB.isString(t)&&(n&&!this.responseType||i)){const n=!(e&&e.silentJSONParsing)&&i;try{return JSON.parse(t)}catch(t){if(n){if("SyntaxError"===t.name)throw WB.from(t,WB.ERR_BAD_RESPONSE,this,null,this.response);throw t}}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:pR.classes.FormData,Blob:pR.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};jB.forEach(["delete","get","head","post","put","patch"],(t=>{AR.headers[t]={}}));const gR=jB.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);const mR=Symbol("internals");function _R(t){return t&&String(t).trim().toLowerCase()}function vR(t){return!1===t||null==t?t:jB.isArray(t)?t.map(vR):String(t)}function yR(t,e,n,i,r){return jB.isFunction(i)?i.call(this,e,n):(r&&(e=n),jB.isString(e)?jB.isString(i)?-1!==e.indexOf(i):jB.isRegExp(i)?i.test(e):void 0:void 0)}class bR{constructor(t){t&&this.set(t)}set(t,e,n){const i=this;function r(t,e,n){const r=_R(e);if(!r)throw new Error("header name must be a non-empty string");const s=jB.findKey(i,r);(!s||void 0===i[s]||!0===n||void 0===n&&!1!==i[s])&&(i[s||e]=vR(t))}const s=(t,e)=>jB.forEach(t,((t,n)=>r(t,n,e)));if(jB.isPlainObject(t)||t instanceof this.constructor)s(t,e);else if(jB.isString(t)&&(t=t.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim()))s((t=>{const e={};let n,i,r;return t&&t.split("\n").forEach((function(t){r=t.indexOf(":"),n=t.substring(0,r).trim().toLowerCase(),i=t.substring(r+1).trim(),!n||e[n]&&gR[n]||("set-cookie"===n?e[n]?e[n].push(i):e[n]=[i]:e[n]=e[n]?e[n]+", "+i:i)})),e})(t),e);else if(jB.isObject(t)&&jB.isIterable(t)){let n,i,r={};for(const e of t){if(!jB.isArray(e))throw TypeError("Object iterator must return a key-value pair");r[i=e[0]]=(n=r[i])?jB.isArray(n)?[...n,e[1]]:[n,e[1]]:e[1]}s(r,e)}else null!=t&&r(e,t,n);return this}get(t,e){if(t=_R(t)){const n=jB.findKey(this,t);if(n){const t=this[n];if(!e)return t;if(!0===e)return function(t){const e=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let i;for(;i=n.exec(t);)e[i[1]]=i[2];return e}(t);if(jB.isFunction(e))return e.call(this,t,n);if(jB.isRegExp(e))return e.exec(t);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,e){if(t=_R(t)){const n=jB.findKey(this,t);return!(!n||void 0===this[n]||e&&!yR(0,this[n],n,e))}return!1}delete(t,e){const n=this;let i=!1;function r(t){if(t=_R(t)){const r=jB.findKey(n,t);!r||e&&!yR(0,n[r],r,e)||(delete n[r],i=!0)}}return jB.isArray(t)?t.forEach(r):r(t),i}clear(t){const e=Object.keys(this);let n=e.length,i=!1;for(;n--;){const r=e[n];t&&!yR(0,this[r],r,t,!0)||(delete this[r],i=!0)}return i}normalize(t){const e=this,n={};return jB.forEach(this,((i,r)=>{const s=jB.findKey(n,r);if(s)return e[s]=vR(i),void delete e[r];const a=t?function(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((t,e,n)=>e.toUpperCase()+n))}(r):String(r).trim();a!==r&&delete e[r],e[a]=vR(i),n[a]=!0})),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const e=Object.create(null);return jB.forEach(this,((n,i)=>{null!=n&&!1!==n&&(e[i]=t&&jB.isArray(n)?n.join(", "):n)})),e}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([t,e])=>t+": "+e)).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...e){const n=new this(t);return e.forEach((t=>n.set(t))),n}static accessor(t){const e=(this[mR]=this[mR]={accessors:{}}).accessors,n=this.prototype;function i(t){const i=_R(t);e[i]||(!function(t,e){const n=jB.toCamelCase(" "+e);["get","set","has"].forEach((i=>{Object.defineProperty(t,i+n,{value:function(t,n,r){return this[i].call(this,e,t,n,r)},configurable:!0})}))}(n,t),e[i]=!0)}return jB.isArray(t)?t.forEach(i):i(t),this}}function xR(t,e){const n=this||AR,i=e||n,r=bR.from(i.headers);let s=i.data;return jB.forEach(t,(function(t){s=t.call(n,s,r.normalize(),e?e.status:void 0)})),r.normalize(),s}function wR(t){return!(!t||!t.__CANCEL__)}function ER(t,e,n){WB.call(this,null==t?"canceled":t,WB.ERR_CANCELED,e,n),this.name="CanceledError"}function CR(t,e,n){const i=n.config.validateStatus;n.status&&i&&!i(n.status)?e(new WB("Request failed with status code "+n.status,[WB.ERR_BAD_REQUEST,WB.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):t(n)}bR.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),jB.reduceDescriptors(bR.prototype,(({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(t){this[n]=t}}})),jB.freezeMethods(bR),jB.inherits(ER,WB,{__CANCEL__:!0});const SR=(t,e,n=3)=>{let i=0;const r=function(t,e){t=t||10;const n=new Array(t),i=new Array(t);let r,s=0,a=0;return e=void 0!==e?e:1e3,function(o){const c=Date.now(),l=i[a];r||(r=c),n[s]=o,i[s]=c;let h=a,u=0;for(;h!==s;)u+=n[h++],h%=t;if(s=(s+1)%t,s===a&&(a=(a+1)%t),c-r<e)return;const d=l&&c-l;return d?Math.round(1e3*u/d):void 0}}(50,250);return function(t,e){let n,i,r=0,s=1e3/e;const a=(e,s=Date.now())=>{r=s,n=null,i&&(clearTimeout(i),i=null),t(...e)};return[(...t)=>{const e=Date.now(),o=e-r;o>=s?a(t,e):(n=t,i||(i=setTimeout((()=>{i=null,a(n)}),s-o)))},()=>n&&a(n)]}((n=>{const s=n.loaded,a=n.lengthComputable?n.total:void 0,o=s-i,c=r(o);i=s;t({loaded:s,total:a,progress:a?s/a:void 0,bytes:o,rate:c||void 0,estimated:c&&a&&s<=a?(a-s)/c:void 0,event:n,lengthComputable:null!=a,[e?"download":"upload"]:!0})}),n)},MR=(t,e)=>{const n=null!=t;return[i=>e[0]({lengthComputable:n,total:t,loaded:i}),e[1]]},IR=t=>(...e)=>jB.asap((()=>t(...e)));var TR=pR.hasStandardBrowserEnv?((t,e)=>n=>(n=new URL(n,pR.origin),t.protocol===n.protocol&&t.host===n.host&&(e||t.port===n.port)))(new URL(pR.origin),pR.navigator&&/(msie|trident)/i.test(pR.navigator.userAgent)):()=>!0,BR=pR.hasStandardBrowserEnv?{write(t,e,n,i,r,s){const a=[t+"="+encodeURIComponent(e)];jB.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),jB.isString(i)&&a.push("path="+i),jB.isString(r)&&a.push("domain="+r),!0===s&&a.push("secure"),document.cookie=a.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read:()=>null,remove(){}};function RR(t,e,n){let i=!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e);return t&&(i||0==n)?function(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}(t,e):e}const DR=t=>t instanceof bR?{...t}:t;function LR(t,e){e=e||{};const n={};function i(t,e,n,i){return jB.isPlainObject(t)&&jB.isPlainObject(e)?jB.merge.call({caseless:i},t,e):jB.isPlainObject(e)?jB.merge({},e):jB.isArray(e)?e.slice():e}function r(t,e,n,r){return jB.isUndefined(e)?jB.isUndefined(t)?void 0:i(void 0,t,0,r):i(t,e,0,r)}function s(t,e){if(!jB.isUndefined(e))return i(void 0,e)}function a(t,e){return jB.isUndefined(e)?jB.isUndefined(t)?void 0:i(void 0,t):i(void 0,e)}function o(n,r,s){return s in e?i(n,r):s in t?i(void 0,n):void 0}const c={url:s,method:s,data:s,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:o,headers:(t,e,n)=>r(DR(t),DR(e),0,!0)};return jB.forEach(Object.keys({...t,...e}),(function(i){const s=c[i]||r,a=s(t[i],e[i],i);jB.isUndefined(a)&&s!==o||(n[i]=a)})),n}var PR=t=>{const e=LR({},t);let n,{data:i,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:a,headers:o,auth:c}=e;if(e.headers=o=bR.from(o),e.url=rR(RR(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),c&&o.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),jB.isFormData(i))if(pR.hasStandardBrowserEnv||pR.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(!1!==(n=o.getContentType())){const[t,...e]=n?n.split(";").map((t=>t.trim())).filter(Boolean):[];o.setContentType([t||"multipart/form-data",...e].join("; "))}if(pR.hasStandardBrowserEnv&&(r&&jB.isFunction(r)&&(r=r(e)),r||!1!==r&&TR(e.url))){const t=s&&a&&BR.read(a);t&&o.set(s,t)}return e};var kR="undefined"!=typeof XMLHttpRequest&&function(t){return new Promise((function(e,n){const i=PR(t);let r=i.data;const s=bR.from(i.headers).normalize();let a,o,c,l,h,{responseType:u,onUploadProgress:d,onDownloadProgress:p}=i;function f(){l&&l(),h&&h(),i.cancelToken&&i.cancelToken.unsubscribe(a),i.signal&&i.signal.removeEventListener("abort",a)}let A=new XMLHttpRequest;function g(){if(!A)return;const i=bR.from("getAllResponseHeaders"in A&&A.getAllResponseHeaders());CR((function(t){e(t),f()}),(function(t){n(t),f()}),{data:u&&"text"!==u&&"json"!==u?A.response:A.responseText,status:A.status,statusText:A.statusText,headers:i,config:t,request:A}),A=null}A.open(i.method.toUpperCase(),i.url,!0),A.timeout=i.timeout,"onloadend"in A?A.onloadend=g:A.onreadystatechange=function(){A&&4===A.readyState&&(0!==A.status||A.responseURL&&0===A.responseURL.indexOf("file:"))&&setTimeout(g)},A.onabort=function(){A&&(n(new WB("Request aborted",WB.ECONNABORTED,t,A)),A=null)},A.onerror=function(){n(new WB("Network Error",WB.ERR_NETWORK,t,A)),A=null},A.ontimeout=function(){let e=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const r=i.transitional||aR;i.timeoutErrorMessage&&(e=i.timeoutErrorMessage),n(new WB(e,r.clarifyTimeoutError?WB.ETIMEDOUT:WB.ECONNABORTED,t,A)),A=null},void 0===r&&s.setContentType(null),"setRequestHeader"in A&&jB.forEach(s.toJSON(),(function(t,e){A.setRequestHeader(e,t)})),jB.isUndefined(i.withCredentials)||(A.withCredentials=!!i.withCredentials),u&&"json"!==u&&(A.responseType=i.responseType),p&&([c,h]=SR(p,!0),A.addEventListener("progress",c)),d&&A.upload&&([o,l]=SR(d),A.upload.addEventListener("progress",o),A.upload.addEventListener("loadend",l)),(i.cancelToken||i.signal)&&(a=e=>{A&&(n(!e||e.type?new ER(null,t,A):e),A.abort(),A=null)},i.cancelToken&&i.cancelToken.subscribe(a),i.signal&&(i.signal.aborted?a():i.signal.addEventListener("abort",a)));const m=function(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}(i.url);m&&-1===pR.protocols.indexOf(m)?n(new WB("Unsupported protocol "+m+":",WB.ERR_BAD_REQUEST,t)):A.send(r||null)}))};const OR=(t,e)=>{const{length:n}=t=t?t.filter(Boolean):[];if(e||n){let n,i=new AbortController;const r=function(t){if(!n){n=!0,a();const e=t instanceof Error?t:this.reason;i.abort(e instanceof WB?e:new ER(e instanceof Error?e.message:e))}};let s=e&&setTimeout((()=>{s=null,r(new WB(`timeout ${e} of ms exceeded`,WB.ETIMEDOUT))}),e);const a=()=>{t&&(s&&clearTimeout(s),s=null,t.forEach((t=>{t.unsubscribe?t.unsubscribe(r):t.removeEventListener("abort",r)})),t=null)};t.forEach((t=>t.addEventListener("abort",r)));const{signal:o}=i;return o.unsubscribe=()=>jB.asap(a),o}},UR=function*(t,e){let n=t.byteLength;if(!e||n<e)return void(yield t);let i,r=0;for(;r<n;)i=r+e,yield t.slice(r,i),r=i},NR=async function*(t){if(t[Symbol.asyncIterator])return void(yield*t);const e=t.getReader();try{for(;;){const{done:t,value:n}=await e.read();if(t)break;yield n}}finally{await e.cancel()}},FR=(t,e,n,i)=>{const r=async function*(t,e){for await(const n of NR(t))yield*UR(n,e)}(t,e);let s,a=0,o=t=>{s||(s=!0,i&&i(t))};return new ReadableStream({async pull(t){try{const{done:e,value:i}=await r.next();if(e)return o(),void t.close();let s=i.byteLength;if(n){let t=a+=s;n(t)}t.enqueue(new Uint8Array(i))}catch(t){throw o(t),t}},cancel:t=>(o(t),r.return())},{highWaterMark:2})},QR="function"==typeof fetch&&"function"==typeof Request&&"function"==typeof Response,zR=QR&&"function"==typeof ReadableStream,GR=QR&&("function"==typeof TextEncoder?(HR=new TextEncoder,t=>HR.encode(t)):async t=>new Uint8Array(await new Response(t).arrayBuffer()));var HR;const VR=(t,...e)=>{try{return!!t(...e)}catch(t){return!1}},jR=zR&&VR((()=>{let t=!1;const e=new Request(pR.origin,{body:new ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type");return t&&!e})),WR=zR&&VR((()=>jB.isReadableStream(new Response("").body))),qR={stream:WR&&(t=>t.body)};var YR;QR&&(YR=new Response,["text","arrayBuffer","blob","formData","stream"].forEach((t=>{!qR[t]&&(qR[t]=jB.isFunction(YR[t])?e=>e[t]():(e,n)=>{throw new WB(`Response type '${t}' is not supported`,WB.ERR_NOT_SUPPORT,n)})})));const XR=async(t,e)=>{const n=jB.toFiniteNumber(t.getContentLength());return null==n?(async t=>{if(null==t)return 0;if(jB.isBlob(t))return t.size;if(jB.isSpecCompliantForm(t)){const e=new Request(pR.origin,{method:"POST",body:t});return(await e.arrayBuffer()).byteLength}return jB.isArrayBufferView(t)||jB.isArrayBuffer(t)?t.byteLength:(jB.isURLSearchParams(t)&&(t+=""),jB.isString(t)?(await GR(t)).byteLength:void 0)})(e):n};var JR=QR&&(async t=>{let{url:e,method:n,data:i,signal:r,cancelToken:s,timeout:a,onDownloadProgress:o,onUploadProgress:c,responseType:l,headers:h,withCredentials:u="same-origin",fetchOptions:d}=PR(t);l=l?(l+"").toLowerCase():"text";let p,f=OR([r,s&&s.toAbortSignal()],a);const A=f&&f.unsubscribe&&(()=>{f.unsubscribe()});let g;try{if(c&&jR&&"get"!==n&&"head"!==n&&0!==(g=await XR(h,i))){let t,n=new Request(e,{method:"POST",body:i,duplex:"half"});if(jB.isFormData(i)&&(t=n.headers.get("content-type"))&&h.setContentType(t),n.body){const[t,e]=MR(g,SR(IR(c)));i=FR(n.body,65536,t,e)}}jB.isString(u)||(u=u?"include":"omit");const r="credentials"in Request.prototype;p=new Request(e,{...d,signal:f,method:n.toUpperCase(),headers:h.normalize().toJSON(),body:i,duplex:"half",credentials:r?u:void 0});let s=await fetch(p,d);const a=WR&&("stream"===l||"response"===l);if(WR&&(o||a&&A)){const t={};["status","statusText","headers"].forEach((e=>{t[e]=s[e]}));const e=jB.toFiniteNumber(s.headers.get("content-length")),[n,i]=o&&MR(e,SR(IR(o),!0))||[];s=new Response(FR(s.body,65536,n,(()=>{i&&i(),A&&A()})),t)}l=l||"text";let m=await qR[jB.findKey(qR,l)||"text"](s,t);return!a&&A&&A(),await new Promise(((e,n)=>{CR(e,n,{data:m,headers:bR.from(s.headers),status:s.status,statusText:s.statusText,config:t,request:p})}))}catch(e){if(A&&A(),e&&"TypeError"===e.name&&/Load failed|fetch/i.test(e.message))throw Object.assign(new WB("Network Error",WB.ERR_NETWORK,t,p),{cause:e.cause||e});throw WB.from(e,e&&e.code,t,p)}});const KR={http:null,xhr:kR,fetch:JR};jB.forEach(KR,((t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch(t){}Object.defineProperty(t,"adapterName",{value:e})}}));const ZR=t=>`- ${t}`,$R=t=>jB.isFunction(t)||null===t||!1===t;var tD=t=>{t=jB.isArray(t)?t:[t];const{length:e}=t;let n,i;const r={};for(let s=0;s<e;s++){let e;if(n=t[s],i=n,!$R(n)&&(i=KR[(e=String(n)).toLowerCase()],void 0===i))throw new WB(`Unknown adapter '${e}'`);if(i)break;r[e||"#"+s]=i}if(!i){const t=Object.entries(r).map((([t,e])=>`adapter ${t} `+(!1===e?"is not supported by the environment":"is not available in the build")));throw new WB("There is no suitable adapter to dispatch the request "+(e?t.length>1?"since :\n"+t.map(ZR).join("\n"):" "+ZR(t[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return i};function eD(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new ER(null,t)}function nD(t){eD(t),t.headers=bR.from(t.headers),t.data=xR.call(t,t.transformRequest),-1!==["post","put","patch"].indexOf(t.method)&&t.headers.setContentType("application/x-www-form-urlencoded",!1);return tD(t.adapter||AR.adapter)(t).then((function(e){return eD(t),e.data=xR.call(t,t.transformResponse,e),e.headers=bR.from(e.headers),e}),(function(e){return wR(e)||(eD(t),e&&e.response&&(e.response.data=xR.call(t,t.transformResponse,e.response),e.response.headers=bR.from(e.response.headers))),Promise.reject(e)}))}const iD="1.11.0",rD={};["object","boolean","number","function","string","symbol"].forEach(((t,e)=>{rD[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}}));const sD={};rD.transitional=function(t,e,n){return(i,r,s)=>{if(!1===t)throw new WB(function(t,e){return"[Axios v"+iD+"] Transitional option '"+t+"'"+e+(n?". "+n:"")}(r," has been removed"+(e?" in "+e:"")),WB.ERR_DEPRECATED);return e&&!sD[r]&&(sD[r]=!0),!t||t(i,r,s)}},rD.spelling=function(t){return(t,e)=>!0};var aD={assertOptions:function(t,e,n){if("object"!=typeof t)throw new WB("options must be an object",WB.ERR_BAD_OPTION_VALUE);const i=Object.keys(t);let r=i.length;for(;r-- >0;){const s=i[r],a=e[s];if(a){const e=t[s],n=void 0===e||a(e,s,t);if(!0!==n)throw new WB("option "+s+" must be "+n,WB.ERR_BAD_OPTION_VALUE)}else if(!0!==n)throw new WB("Unknown option "+s,WB.ERR_BAD_OPTION)}},validators:rD};const oD=aD.validators;class cD{constructor(t){this.defaults=t||{},this.interceptors={request:new sR,response:new sR}}async request(t,e){try{return await this._request(t,e)}catch(t){if(t instanceof Error){let e={};Error.captureStackTrace?Error.captureStackTrace(e):e=new Error;const n=e.stack?e.stack.replace(/^.+\n/,""):"";try{t.stack?n&&!String(t.stack).endsWith(n.replace(/^.+\n.+\n/,""))&&(t.stack+="\n"+n):t.stack=n}catch(t){}}throw t}}_request(t,e){"string"==typeof t?(e=e||{}).url=t:e=t||{},e=LR(this.defaults,e);const{transitional:n,paramsSerializer:i,headers:r}=e;void 0!==n&&aD.assertOptions(n,{silentJSONParsing:oD.transitional(oD.boolean),forcedJSONParsing:oD.transitional(oD.boolean),clarifyTimeoutError:oD.transitional(oD.boolean)},!1),null!=i&&(jB.isFunction(i)?e.paramsSerializer={serialize:i}:aD.assertOptions(i,{encode:oD.function,serialize:oD.function},!0)),void 0!==e.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?e.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:e.allowAbsoluteUrls=!0),aD.assertOptions(e,{baseUrl:oD.spelling("baseURL"),withXsrfToken:oD.spelling("withXSRFToken")},!0),e.method=(e.method||this.defaults.method||"get").toLowerCase();let s=r&&jB.merge(r.common,r[e.method]);r&&jB.forEach(["delete","get","head","post","put","patch","common"],(t=>{delete r[t]})),e.headers=bR.concat(s,r);const a=[];let o=!0;this.interceptors.request.forEach((function(t){"function"==typeof t.runWhen&&!1===t.runWhen(e)||(o=o&&t.synchronous,a.unshift(t.fulfilled,t.rejected))}));const c=[];let l;this.interceptors.response.forEach((function(t){c.push(t.fulfilled,t.rejected)}));let h,u=0;if(!o){const t=[nD.bind(this),void 0];for(t.unshift(...a),t.push(...c),h=t.length,l=Promise.resolve(e);u<h;)l=l.then(t[u++],t[u++]);return l}h=a.length;let d=e;for(u=0;u<h;){const t=a[u++],e=a[u++];try{d=t(d)}catch(t){e.call(this,t);break}}try{l=nD.call(this,d)}catch(t){return Promise.reject(t)}for(u=0,h=c.length;u<h;)l=l.then(c[u++],c[u++]);return l}getUri(t){return rR(RR((t=LR(this.defaults,t)).baseURL,t.url,t.allowAbsoluteUrls),t.params,t.paramsSerializer)}}jB.forEach(["delete","get","head","options"],(function(t){cD.prototype[t]=function(e,n){return this.request(LR(n||{},{method:t,url:e,data:(n||{}).data}))}})),jB.forEach(["post","put","patch"],(function(t){function e(e){return function(n,i,r){return this.request(LR(r||{},{method:t,headers:e?{"Content-Type":"multipart/form-data"}:{},url:n,data:i}))}}cD.prototype[t]=e(),cD.prototype[t+"Form"]=e(!0)}));const lD={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(lD).forEach((([t,e])=>{lD[e]=t}));const hD=function t(e){const n=new cD(e),i=eB(cD.prototype.request,n);return jB.extend(i,cD.prototype,n,{allOwnKeys:!0}),jB.extend(i,n,null,{allOwnKeys:!0}),i.create=function(n){return t(LR(e,n))},i}(AR);hD.Axios=cD,hD.CanceledError=ER,hD.CancelToken=class t{constructor(t){if("function"!=typeof t)throw new TypeError("executor must be a function.");let e;this.promise=new Promise((function(t){e=t}));const n=this;this.promise.then((t=>{if(!n._listeners)return;let e=n._listeners.length;for(;e-- >0;)n._listeners[e](t);n._listeners=null})),this.promise.then=t=>{let e;const i=new Promise((t=>{n.subscribe(t),e=t})).then(t);return i.cancel=function(){n.unsubscribe(e)},i},t((function(t,i,r){n.reason||(n.reason=new ER(t,i,r),e(n.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){this.reason?t(this.reason):this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const e=this._listeners.indexOf(t);-1!==e&&this._listeners.splice(e,1)}toAbortSignal(){const t=new AbortController,e=e=>{t.abort(e)};return this.subscribe(e),t.signal.unsubscribe=()=>this.unsubscribe(e),t.signal}static source(){let e;return{token:new t((function(t){e=t})),cancel:e}}},hD.isCancel=wR,hD.VERSION=iD,hD.toFormData=$B,hD.AxiosError=WB,hD.Cancel=hD.CanceledError,hD.all=function(t){return Promise.all(t)},hD.spread=function(t){return function(e){return t.apply(null,e)}},hD.isAxiosError=function(t){return jB.isObject(t)&&!0===t.isAxiosError},hD.mergeConfig=LR,hD.AxiosHeaders=bR,hD.formToJSON=t=>fR(jB.isHTMLForm(t)?new FormData(t):t),hD.getAdapter=tD,hD.HttpStatusCode=lD,hD.default=hD;const uD={baseURL:"https://ai.quantekeji.com/platform-api",timeout:3e4,withCredentials:!0};var dD=new class{service;constructor(t){this.service=this.setConfig(t)}setConfig(t){const e=hD.create(aE(uD,t));return e.interceptors.request.use((t=>{const e=CT.getItem(ST);return e&&t.headers&&"function"==typeof t.headers.set&&t.headers.set("Authorization","Bearer "+e),t}),(t=>Promise.reject(t))),e.interceptors.response.use((t=>{const{data:e,status:n}=t;return 401===n||e.code&&0!==e.code?Promise.reject(e):e}),(async t=>(t.message.indexOf("timeout"),t.message.indexOf("Network Error"),Promise.reject(t)))),this.service=e,e}get(t,e={},n={}){return this.service.get(t,{params:e,...n})}post(t,e={},n={}){return this.service.post(t,e,n)}download(t,e={},n={}){return this.service.post(t,e,{...n,responseType:"blob"})}template(t,e={},n={}){return this.service.get(t,{params:e,...n,responseType:"blob"})}upload(t,e={},n={}){return this.service.post(t,e,{...n,headers:{"Content-Type":"multipart/form-data"}})}}(uD);const pD=hD.CancelToken,fD={fetchFloat32Array:[],apiText2Speech:[],apiAsk:[]},AD=async(t,e,n)=>{const i=CT.getItem(IT),r=CT.getItem(ST),s=e.message[e.message.length-1].content;Reflect.deleteProperty(e,"message");const a=aE({query:"",language:"",conversation_id:"",response_mode:"streaming",files:[],inputs:{}},{...e,query:s});try{fD.apiAsk.length>0&&fD.apiAsk.forEach((t=>{t.close()}));const e=`${i}/human-auth/characters/${t}/chat-messages`,s={responseType:"streaming"===a.response_mode?"stream":"json","Content-Type":"application/json",Authorization:`Bearer ${r}`},o=new BT(`${e}`,{method:"POST",headers:s,payload:JSON.stringify(a)});fD.apiAsk=[o],o.addEventListener("message",(t=>{const e={code:0,msg:"success",data:null};if("streaming"===a.response_mode)if(t.data)e.data=JSON.parse(t.data);else{const n=JSON.parse(t.source.xhr.responseText);e.code=n.code,e.data=n.data,e.msg=n.msg}else e.code=t.code,e.data=t.data,e.msg=t.msg;n&&n(e)})),o.onerror=t=>{throw new Error(t)},o.onabort=t=>{},o.onreadystatechange=t=>{2===t.readyState&&(fD.apiAsk=[])}}catch(t){throw new Error(t)}},gD=async(t,e)=>{const n=pD.source();return fD.apiText2Speech.push(n),dD.post(`/human-auth/characters/${t}/text-to-speech`,e,{cancelToken:n.token}).then((t=>{const e=fD.apiText2Speech.findIndex((t=>t===n));return fD.apiText2Speech.splice(e,1),t}))},mD=(t=[],e)=>{if(0===t.length)return[];if("[object Array]"===Object.prototype.toString.call(t[0]))return t;const n=[];for(let i=0;i<t.length;i+=e){const r=t.slice(i,i+e);n.push(r)}return n},_D=t=>{const e=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9"];let n=[];const i=e.length;for(let r=0;r<t;r++){const t=Math.floor(Math.random()*i);n.push(e[t])}return n.join("")},vD=(t,e=!0)=>{if(!t)return"";const n=e?/[,,。.!!??;;]$/:/[,,。.!!??;;]/g;return t.replace(n,"")};var yD={};!function(t){!function(){var e=function(){this.init()};e.prototype={init:function(){var t=this||n;return t._counter=1e3,t._html5AudioPool=[],t.html5PoolSize=10,t._codecs={},t._howls=[],t._muted=!1,t._volume=1,t._canPlayEvent="canplaythrough",t._navigator="undefined"!=typeof window&&window.navigator?window.navigator:null,t.masterGain=null,t.noAudio=!1,t.usingWebAudio=!0,t.autoSuspend=!0,t.ctx=null,t.autoUnlock=!0,t._setup(),t},volume:function(t){var e=this||n;if(t=parseFloat(t),e.ctx||h(),void 0!==t&&t>=0&&t<=1){if(e._volume=t,e._muted)return e;e.usingWebAudio&&e.masterGain.gain.setValueAtTime(t,n.ctx.currentTime);for(var i=0;i<e._howls.length;i++)if(!e._howls[i]._webAudio)for(var r=e._howls[i]._getSoundIds(),s=0;s<r.length;s++){var a=e._howls[i]._soundById(r[s]);a&&a._node&&(a._node.volume=a._volume*t)}return e}return e._volume},mute:function(t){var e=this||n;e.ctx||h(),e._muted=t,e.usingWebAudio&&e.masterGain.gain.setValueAtTime(t?0:e._volume,n.ctx.currentTime);for(var i=0;i<e._howls.length;i++)if(!e._howls[i]._webAudio)for(var r=e._howls[i]._getSoundIds(),s=0;s<r.length;s++){var a=e._howls[i]._soundById(r[s]);a&&a._node&&(a._node.muted=!!t||a._muted)}return e},stop:function(){for(var t=this||n,e=0;e<t._howls.length;e++)t._howls[e].stop();return t},unload:function(){for(var t=this||n,e=t._howls.length-1;e>=0;e--)t._howls[e].unload();return t.usingWebAudio&&t.ctx&&void 0!==t.ctx.close&&(t.ctx.close(),t.ctx=null,h()),t},codecs:function(t){return(this||n)._codecs[t.replace(/^x-/,"")]},_setup:function(){var t=this||n;if(t.state=t.ctx&&t.ctx.state||"suspended",t._autoSuspend(),!t.usingWebAudio)if("undefined"!=typeof Audio)try{void 0===(new Audio).oncanplaythrough&&(t._canPlayEvent="canplay")}catch(e){t.noAudio=!0}else t.noAudio=!0;try{(new Audio).muted&&(t.noAudio=!0)}catch(t){}return t.noAudio||t._setupCodecs(),t},_setupCodecs:function(){var t=this||n,e=null;try{e="undefined"!=typeof Audio?new Audio:null}catch(e){return t}if(!e||"function"!=typeof e.canPlayType)return t;var i=e.canPlayType("audio/mpeg;").replace(/^no$/,""),r=t._navigator?t._navigator.userAgent:"",s=r.match(/OPR\/(\d+)/g),a=s&&parseInt(s[0].split("/")[1],10)<33,o=-1!==r.indexOf("Safari")&&-1===r.indexOf("Chrome"),c=r.match(/Version\/(.*?) /),l=o&&c&&parseInt(c[1],10)<15;return t._codecs={mp3:!(a||!i&&!e.canPlayType("audio/mp3;").replace(/^no$/,"")),mpeg:!!i,opus:!!e.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/,""),ogg:!!e.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),oga:!!e.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),wav:!!(e.canPlayType('audio/wav; codecs="1"')||e.canPlayType("audio/wav")).replace(/^no$/,""),aac:!!e.canPlayType("audio/aac;").replace(/^no$/,""),caf:!!e.canPlayType("audio/x-caf;").replace(/^no$/,""),m4a:!!(e.canPlayType("audio/x-m4a;")||e.canPlayType("audio/m4a;")||e.canPlayType("audio/aac;")).replace(/^no$/,""),m4b:!!(e.canPlayType("audio/x-m4b;")||e.canPlayType("audio/m4b;")||e.canPlayType("audio/aac;")).replace(/^no$/,""),mp4:!!(e.canPlayType("audio/x-mp4;")||e.canPlayType("audio/mp4;")||e.canPlayType("audio/aac;")).replace(/^no$/,""),weba:!(l||!e.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),webm:!(l||!e.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),dolby:!!e.canPlayType('audio/mp4; codecs="ec-3"').replace(/^no$/,""),flac:!!(e.canPlayType("audio/x-flac;")||e.canPlayType("audio/flac;")).replace(/^no$/,"")},t},_unlockAudio:function(){var t=this||n;if(!t._audioUnlocked&&t.ctx){t._audioUnlocked=!1,t.autoUnlock=!1,t._mobileUnloaded||44100===t.ctx.sampleRate||(t._mobileUnloaded=!0,t.unload()),t._scratchBuffer=t.ctx.createBuffer(1,1,22050);var e=function(n){for(;t._html5AudioPool.length<t.html5PoolSize;)try{var i=new Audio;i._unlocked=!0,t._releaseHtml5Audio(i)}catch(n){t.noAudio=!0;break}for(var r=0;r<t._howls.length;r++)if(!t._howls[r]._webAudio)for(var s=t._howls[r]._getSoundIds(),a=0;a<s.length;a++){var o=t._howls[r]._soundById(s[a]);o&&o._node&&!o._node._unlocked&&(o._node._unlocked=!0,o._node.load())}t._autoResume();var c=t.ctx.createBufferSource();c.buffer=t._scratchBuffer,c.connect(t.ctx.destination),void 0===c.start?c.noteOn(0):c.start(0),"function"==typeof t.ctx.resume&&t.ctx.resume(),c.onended=function(){c.disconnect(0),t._audioUnlocked=!0,document.removeEventListener("touchstart",e,!0),document.removeEventListener("touchend",e,!0),document.removeEventListener("click",e,!0),document.removeEventListener("keydown",e,!0);for(var n=0;n<t._howls.length;n++)t._howls[n]._emit("unlock")}};return document.addEventListener("touchstart",e,!0),document.addEventListener("touchend",e,!0),document.addEventListener("click",e,!0),document.addEventListener("keydown",e,!0),t}},_obtainHtml5Audio:function(){var t=this||n;if(t._html5AudioPool.length)return t._html5AudioPool.pop();var e=(new Audio).play();return e&&"undefined"!=typeof Promise&&(e instanceof Promise||"function"==typeof e.then)&&e.catch((function(){})),new Audio},_releaseHtml5Audio:function(t){var e=this||n;return t._unlocked&&e._html5AudioPool.push(t),e},_autoSuspend:function(){var t=this;if(t.autoSuspend&&t.ctx&&void 0!==t.ctx.suspend&&n.usingWebAudio){for(var e=0;e<t._howls.length;e++)if(t._howls[e]._webAudio)for(var i=0;i<t._howls[e]._sounds.length;i++)if(!t._howls[e]._sounds[i]._paused)return t;return t._suspendTimer&&clearTimeout(t._suspendTimer),t._suspendTimer=setTimeout((function(){if(t.autoSuspend){t._suspendTimer=null,t.state="suspending";var e=function(){t.state="suspended",t._resumeAfterSuspend&&(delete t._resumeAfterSuspend,t._autoResume())};t.ctx.suspend().then(e,e)}}),3e4),t}},_autoResume:function(){var t=this;if(t.ctx&&void 0!==t.ctx.resume&&n.usingWebAudio)return"running"===t.state&&"interrupted"!==t.ctx.state&&t._suspendTimer?(clearTimeout(t._suspendTimer),t._suspendTimer=null):"suspended"===t.state||"running"===t.state&&"interrupted"===t.ctx.state?(t.ctx.resume().then((function(){t.state="running";for(var e=0;e<t._howls.length;e++)t._howls[e]._emit("resume")})),t._suspendTimer&&(clearTimeout(t._suspendTimer),t._suspendTimer=null)):"suspending"===t.state&&(t._resumeAfterSuspend=!0),t}};var n=new e,i=function(t){t.src&&0!==t.src.length&&this.init(t)};i.prototype={init:function(t){var e=this;return n.ctx||h(),e._autoplay=t.autoplay||!1,e._format="string"!=typeof t.format?t.format:[t.format],e._html5=t.html5||!1,e._muted=t.mute||!1,e._loop=t.loop||!1,e._pool=t.pool||5,e._preload="boolean"!=typeof t.preload&&"metadata"!==t.preload||t.preload,e._rate=t.rate||1,e._sprite=t.sprite||{},e._src="string"!=typeof t.src?t.src:[t.src],e._volume=void 0!==t.volume?t.volume:1,e._xhr={method:t.xhr&&t.xhr.method?t.xhr.method:"GET",headers:t.xhr&&t.xhr.headers?t.xhr.headers:null,withCredentials:!(!t.xhr||!t.xhr.withCredentials)&&t.xhr.withCredentials},e._duration=0,e._state="unloaded",e._sounds=[],e._endTimers={},e._queue=[],e._playLock=!1,e._onend=t.onend?[{fn:t.onend}]:[],e._onfade=t.onfade?[{fn:t.onfade}]:[],e._onload=t.onload?[{fn:t.onload}]:[],e._onloaderror=t.onloaderror?[{fn:t.onloaderror}]:[],e._onplayerror=t.onplayerror?[{fn:t.onplayerror}]:[],e._onpause=t.onpause?[{fn:t.onpause}]:[],e._onplay=t.onplay?[{fn:t.onplay}]:[],e._onstop=t.onstop?[{fn:t.onstop}]:[],e._onmute=t.onmute?[{fn:t.onmute}]:[],e._onvolume=t.onvolume?[{fn:t.onvolume}]:[],e._onrate=t.onrate?[{fn:t.onrate}]:[],e._onseek=t.onseek?[{fn:t.onseek}]:[],e._onunlock=t.onunlock?[{fn:t.onunlock}]:[],e._onresume=[],e._webAudio=n.usingWebAudio&&!e._html5,void 0!==n.ctx&&n.ctx&&n.autoUnlock&&n._unlockAudio(),n._howls.push(e),e._autoplay&&e._queue.push({event:"play",action:function(){e.play()}}),e._preload&&"none"!==e._preload&&e.load(),e},load:function(){var t=this,e=null;if(n.noAudio)t._emit("loaderror",null,"No audio support.");else{"string"==typeof t._src&&(t._src=[t._src]);for(var i=0;i<t._src.length;i++){var s,o;if(t._format&&t._format[i])s=t._format[i];else{if("string"!=typeof(o=t._src[i])){t._emit("loaderror",null,"Non-string found in selected audio sources - ignoring.");continue}(s=/^data:audio\/([^;,]+);/i.exec(o))||(s=/\.([^.]+)$/.exec(o.split("?",1)[0])),s&&(s=s[1].toLowerCase())}if(s&&n.codecs(s)){e=t._src[i];break}}if(e)return t._src=e,t._state="loading","https:"===window.location.protocol&&"http:"===e.slice(0,5)&&(t._html5=!0,t._webAudio=!1),new r(t),t._webAudio&&a(t),t;t._emit("loaderror",null,"No codec support for selected audio sources.")}},play:function(t,e){var i=this,r=null;if("number"==typeof t)r=t,t=null;else{if("string"==typeof t&&"loaded"===i._state&&!i._sprite[t])return null;if(void 0===t&&(t="__default",!i._playLock)){for(var s=0,a=0;a<i._sounds.length;a++)i._sounds[a]._paused&&!i._sounds[a]._ended&&(s++,r=i._sounds[a]._id);1===s?t=null:r=null}}var o=r?i._soundById(r):i._inactiveSound();if(!o)return null;if(r&&!t&&(t=o._sprite||"__default"),"loaded"!==i._state){o._sprite=t,o._ended=!1;var c=o._id;return i._queue.push({event:"play",action:function(){i.play(c)}}),c}if(r&&!o._paused)return e||i._loadQueue("play"),o._id;i._webAudio&&n._autoResume();var l=Math.max(0,o._seek>0?o._seek:i._sprite[t][0]/1e3),h=Math.max(0,(i._sprite[t][0]+i._sprite[t][1])/1e3-l),u=1e3*h/Math.abs(o._rate),d=i._sprite[t][0]/1e3,p=(i._sprite[t][0]+i._sprite[t][1])/1e3;o._sprite=t,o._ended=!1;var f=function(){o._paused=!1,o._seek=l,o._start=d,o._stop=p,o._loop=!(!o._loop&&!i._sprite[t][2])};if(!(l>=p)){var A=o._node;if(i._webAudio){var g=function(){i._playLock=!1,f(),i._refreshBuffer(o);var t=o._muted||i._muted?0:o._volume;A.gain.setValueAtTime(t,n.ctx.currentTime),o._playStart=n.ctx.currentTime,void 0===A.bufferSource.start?o._loop?A.bufferSource.noteGrainOn(0,l,86400):A.bufferSource.noteGrainOn(0,l,h):o._loop?A.bufferSource.start(0,l,86400):A.bufferSource.start(0,l,h),u!==1/0&&(i._endTimers[o._id]=setTimeout(i._ended.bind(i,o),u)),e||setTimeout((function(){i._emit("play",o._id),i._loadQueue()}),0)};"running"===n.state&&"interrupted"!==n.ctx.state?g():(i._playLock=!0,i.once("resume",g),i._clearTimer(o._id))}else{var m=function(){A.currentTime=l,A.muted=o._muted||i._muted||n._muted||A.muted,A.volume=o._volume*n.volume(),A.playbackRate=o._rate;try{var r=A.play();if(r&&"undefined"!=typeof Promise&&(r instanceof Promise||"function"==typeof r.then)?(i._playLock=!0,f(),r.then((function(){i._playLock=!1,A._unlocked=!0,e?i._loadQueue():i._emit("play",o._id)})).catch((function(){i._playLock=!1,i._emit("playerror",o._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction."),o._ended=!0,o._paused=!0}))):e||(i._playLock=!1,f(),i._emit("play",o._id)),A.playbackRate=o._rate,A.paused)return void i._emit("playerror",o._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction.");"__default"!==t||o._loop?i._endTimers[o._id]=setTimeout(i._ended.bind(i,o),u):(i._endTimers[o._id]=function(){i._ended(o),A.removeEventListener("ended",i._endTimers[o._id],!1)},A.addEventListener("ended",i._endTimers[o._id],!1))}catch(t){i._emit("playerror",o._id,t)}};"data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA"===A.src&&(A.src=i._src,A.load());var _=window&&window.ejecta||!A.readyState&&n._navigator.isCocoonJS;if(A.readyState>=3||_)m();else{i._playLock=!0,i._state="loading";var v=function(){i._state="loaded",m(),A.removeEventListener(n._canPlayEvent,v,!1)};A.addEventListener(n._canPlayEvent,v,!1),i._clearTimer(o._id)}}return o._id}i._ended(o)},pause:function(t){var e=this;if("loaded"!==e._state||e._playLock)return e._queue.push({event:"pause",action:function(){e.pause(t)}}),e;for(var n=e._getSoundIds(t),i=0;i<n.length;i++){e._clearTimer(n[i]);var r=e._soundById(n[i]);if(r&&!r._paused&&(r._seek=e.seek(n[i]),r._rateSeek=0,r._paused=!0,e._stopFade(n[i]),r._node))if(e._webAudio){if(!r._node.bufferSource)continue;void 0===r._node.bufferSource.stop?r._node.bufferSource.noteOff(0):r._node.bufferSource.stop(0),e._cleanBuffer(r._node)}else isNaN(r._node.duration)&&r._node.duration!==1/0||r._node.pause();arguments[1]||e._emit("pause",r?r._id:null)}return e},stop:function(t,e){var n=this;if("loaded"!==n._state||n._playLock)return n._queue.push({event:"stop",action:function(){n.stop(t)}}),n;for(var i=n._getSoundIds(t),r=0;r<i.length;r++){n._clearTimer(i[r]);var s=n._soundById(i[r]);s&&(s._seek=s._start||0,s._rateSeek=0,s._paused=!0,s._ended=!0,n._stopFade(i[r]),s._node&&(n._webAudio?s._node.bufferSource&&(void 0===s._node.bufferSource.stop?s._node.bufferSource.noteOff(0):s._node.bufferSource.stop(0),n._cleanBuffer(s._node)):isNaN(s._node.duration)&&s._node.duration!==1/0||(s._node.currentTime=s._start||0,s._node.pause(),s._node.duration===1/0&&n._clearSound(s._node))),e||n._emit("stop",s._id))}return n},mute:function(t,e){var i=this;if("loaded"!==i._state||i._playLock)return i._queue.push({event:"mute",action:function(){i.mute(t,e)}}),i;if(void 0===e){if("boolean"!=typeof t)return i._muted;i._muted=t}for(var r=i._getSoundIds(e),s=0;s<r.length;s++){var a=i._soundById(r[s]);a&&(a._muted=t,a._interval&&i._stopFade(a._id),i._webAudio&&a._node?a._node.gain.setValueAtTime(t?0:a._volume,n.ctx.currentTime):a._node&&(a._node.muted=!!n._muted||t),i._emit("mute",a._id))}return i},volume:function(){var t,e,i,r=this,s=arguments;if(0===s.length)return r._volume;if(1===s.length||2===s.length&&void 0===s[1]?r._getSoundIds().indexOf(s[0])>=0?e=parseInt(s[0],10):t=parseFloat(s[0]):s.length>=2&&(t=parseFloat(s[0]),e=parseInt(s[1],10)),!(void 0!==t&&t>=0&&t<=1))return(i=e?r._soundById(e):r._sounds[0])?i._volume:0;if("loaded"!==r._state||r._playLock)return r._queue.push({event:"volume",action:function(){r.volume.apply(r,s)}}),r;void 0===e&&(r._volume=t),e=r._getSoundIds(e);for(var a=0;a<e.length;a++)(i=r._soundById(e[a]))&&(i._volume=t,s[2]||r._stopFade(e[a]),r._webAudio&&i._node&&!i._muted?i._node.gain.setValueAtTime(t,n.ctx.currentTime):i._node&&!i._muted&&(i._node.volume=t*n.volume()),r._emit("volume",i._id));return r},fade:function(t,e,i,r){var s=this;if("loaded"!==s._state||s._playLock)return s._queue.push({event:"fade",action:function(){s.fade(t,e,i,r)}}),s;t=Math.min(Math.max(0,parseFloat(t)),1),e=Math.min(Math.max(0,parseFloat(e)),1),i=parseFloat(i),s.volume(t,r);for(var a=s._getSoundIds(r),o=0;o<a.length;o++){var c=s._soundById(a[o]);if(c){if(r||s._stopFade(a[o]),s._webAudio&&!c._muted){var l=n.ctx.currentTime,h=l+i/1e3;c._volume=t,c._node.gain.setValueAtTime(t,l),c._node.gain.linearRampToValueAtTime(e,h)}s._startFadeInterval(c,t,e,i,a[o],void 0===r)}}return s},_startFadeInterval:function(t,e,n,i,r,s){var a=this,o=e,c=n-e,l=Math.abs(c/.01),h=Math.max(4,l>0?i/l:i),u=Date.now();t._fadeTo=n,t._interval=setInterval((function(){var r=(Date.now()-u)/i;u=Date.now(),o+=c*r,o=Math.round(100*o)/100,o=c<0?Math.max(n,o):Math.min(n,o),a._webAudio?t._volume=o:a.volume(o,t._id,!0),s&&(a._volume=o),(n<e&&o<=n||n>e&&o>=n)&&(clearInterval(t._interval),t._interval=null,t._fadeTo=null,a.volume(n,t._id),a._emit("fade",t._id))}),h)},_stopFade:function(t){var e=this,i=e._soundById(t);return i&&i._interval&&(e._webAudio&&i._node.gain.cancelScheduledValues(n.ctx.currentTime),clearInterval(i._interval),i._interval=null,e.volume(i._fadeTo,t),i._fadeTo=null,e._emit("fade",t)),e},loop:function(){var t,e,n,i=this,r=arguments;if(0===r.length)return i._loop;if(1===r.length){if("boolean"!=typeof r[0])return!!(n=i._soundById(parseInt(r[0],10)))&&n._loop;t=r[0],i._loop=t}else 2===r.length&&(t=r[0],e=parseInt(r[1],10));for(var s=i._getSoundIds(e),a=0;a<s.length;a++)(n=i._soundById(s[a]))&&(n._loop=t,i._webAudio&&n._node&&n._node.bufferSource&&(n._node.bufferSource.loop=t,t&&(n._node.bufferSource.loopStart=n._start||0,n._node.bufferSource.loopEnd=n._stop,i.playing(s[a])&&(i.pause(s[a],!0),i.play(s[a],!0)))));return i},rate:function(){var t,e,i,r=this,s=arguments;if(0===s.length)e=r._sounds[0]._id;else if(1===s.length){r._getSoundIds().indexOf(s[0])>=0?e=parseInt(s[0],10):t=parseFloat(s[0])}else 2===s.length&&(t=parseFloat(s[0]),e=parseInt(s[1],10));if("number"!=typeof t)return(i=r._soundById(e))?i._rate:r._rate;if("loaded"!==r._state||r._playLock)return r._queue.push({event:"rate",action:function(){r.rate.apply(r,s)}}),r;void 0===e&&(r._rate=t),e=r._getSoundIds(e);for(var a=0;a<e.length;a++)if(i=r._soundById(e[a])){r.playing(e[a])&&(i._rateSeek=r.seek(e[a]),i._playStart=r._webAudio?n.ctx.currentTime:i._playStart),i._rate=t,r._webAudio&&i._node&&i._node.bufferSource?i._node.bufferSource.playbackRate.setValueAtTime(t,n.ctx.currentTime):i._node&&(i._node.playbackRate=t);var o=r.seek(e[a]),c=1e3*((r._sprite[i._sprite][0]+r._sprite[i._sprite][1])/1e3-o)/Math.abs(i._rate);!r._endTimers[e[a]]&&i._paused||(r._clearTimer(e[a]),r._endTimers[e[a]]=setTimeout(r._ended.bind(r,i),c)),r._emit("rate",i._id)}return r},seek:function(){var t,e,i=this,r=arguments;if(0===r.length)i._sounds.length&&(e=i._sounds[0]._id);else if(1===r.length){i._getSoundIds().indexOf(r[0])>=0?e=parseInt(r[0],10):i._sounds.length&&(e=i._sounds[0]._id,t=parseFloat(r[0]))}else 2===r.length&&(t=parseFloat(r[0]),e=parseInt(r[1],10));if(void 0===e)return 0;if("number"==typeof t&&("loaded"!==i._state||i._playLock))return i._queue.push({event:"seek",action:function(){i.seek.apply(i,r)}}),i;var s=i._soundById(e);if(s){if(!("number"==typeof t&&t>=0)){if(i._webAudio){var a=i.playing(e)?n.ctx.currentTime-s._playStart:0,o=s._rateSeek?s._rateSeek-s._seek:0;return s._seek+(o+a*Math.abs(s._rate))}return s._node.currentTime}var c=i.playing(e);c&&i.pause(e,!0),s._seek=t,s._ended=!1,i._clearTimer(e),i._webAudio||!s._node||isNaN(s._node.duration)||(s._node.currentTime=t);var l=function(){c&&i.play(e,!0),i._emit("seek",e)};if(c&&!i._webAudio){var h=function(){i._playLock?setTimeout(h,0):l()};setTimeout(h,0)}else l()}return i},playing:function(t){var e=this;if("number"==typeof t){var n=e._soundById(t);return!!n&&!n._paused}for(var i=0;i<e._sounds.length;i++)if(!e._sounds[i]._paused)return!0;return!1},duration:function(t){var e=this,n=e._duration,i=e._soundById(t);return i&&(n=e._sprite[i._sprite][1]/1e3),n},state:function(){return this._state},unload:function(){for(var t=this,e=t._sounds,i=0;i<e.length;i++)e[i]._paused||t.stop(e[i]._id),t._webAudio||(t._clearSound(e[i]._node),e[i]._node.removeEventListener("error",e[i]._errorFn,!1),e[i]._node.removeEventListener(n._canPlayEvent,e[i]._loadFn,!1),e[i]._node.removeEventListener("ended",e[i]._endFn,!1),n._releaseHtml5Audio(e[i]._node)),delete e[i]._node,t._clearTimer(e[i]._id);var r=n._howls.indexOf(t);r>=0&&n._howls.splice(r,1);var a=!0;for(i=0;i<n._howls.length;i++)if(n._howls[i]._src===t._src||t._src.indexOf(n._howls[i]._src)>=0){a=!1;break}return s&&a&&delete s[t._src],n.noAudio=!1,t._state="unloaded",t._sounds=[],t=null,null},on:function(t,e,n,i){var r=this["_on"+t];return"function"==typeof e&&r.push(i?{id:n,fn:e,once:i}:{id:n,fn:e}),this},off:function(t,e,n){var i=this,r=i["_on"+t],s=0;if("number"==typeof e&&(n=e,e=null),e||n)for(s=0;s<r.length;s++){var a=n===r[s].id;if(e===r[s].fn&&a||!e&&a){r.splice(s,1);break}}else if(t)i["_on"+t]=[];else{var o=Object.keys(i);for(s=0;s<o.length;s++)0===o[s].indexOf("_on")&&Array.isArray(i[o[s]])&&(i[o[s]]=[])}return i},once:function(t,e,n){return this.on(t,e,n,1),this},_emit:function(t,e,n){for(var i=this,r=i["_on"+t],s=r.length-1;s>=0;s--)r[s].id&&r[s].id!==e&&"load"!==t||(setTimeout(function(t){t.call(this,e,n)}.bind(i,r[s].fn),0),r[s].once&&i.off(t,r[s].fn,r[s].id));return i._loadQueue(t),i},_loadQueue:function(t){var e=this;if(e._queue.length>0){var n=e._queue[0];n.event===t&&(e._queue.shift(),e._loadQueue()),t||n.action()}return e},_ended:function(t){var e=this,i=t._sprite;if(!e._webAudio&&t._node&&!t._node.paused&&!t._node.ended&&t._node.currentTime<t._stop)return setTimeout(e._ended.bind(e,t),100),e;var r=!(!t._loop&&!e._sprite[i][2]);if(e._emit("end",t._id),!e._webAudio&&r&&e.stop(t._id,!0).play(t._id),e._webAudio&&r){e._emit("play",t._id),t._seek=t._start||0,t._rateSeek=0,t._playStart=n.ctx.currentTime;var s=1e3*(t._stop-t._start)/Math.abs(t._rate);e._endTimers[t._id]=setTimeout(e._ended.bind(e,t),s)}return e._webAudio&&!r&&(t._paused=!0,t._ended=!0,t._seek=t._start||0,t._rateSeek=0,e._clearTimer(t._id),e._cleanBuffer(t._node),n._autoSuspend()),e._webAudio||r||e.stop(t._id,!0),e},_clearTimer:function(t){var e=this;if(e._endTimers[t]){if("function"!=typeof e._endTimers[t])clearTimeout(e._endTimers[t]);else{var n=e._soundById(t);n&&n._node&&n._node.removeEventListener("ended",e._endTimers[t],!1)}delete e._endTimers[t]}return e},_soundById:function(t){for(var e=this,n=0;n<e._sounds.length;n++)if(t===e._sounds[n]._id)return e._sounds[n];return null},_inactiveSound:function(){var t=this;t._drain();for(var e=0;e<t._sounds.length;e++)if(t._sounds[e]._ended)return t._sounds[e].reset();return new r(t)},_drain:function(){var t=this,e=t._pool,n=0,i=0;if(!(t._sounds.length<e)){for(i=0;i<t._sounds.length;i++)t._sounds[i]._ended&&n++;for(i=t._sounds.length-1;i>=0;i--){if(n<=e)return;t._sounds[i]._ended&&(t._webAudio&&t._sounds[i]._node&&t._sounds[i]._node.disconnect(0),t._sounds.splice(i,1),n--)}}},_getSoundIds:function(t){if(void 0===t){for(var e=[],n=0;n<this._sounds.length;n++)e.push(this._sounds[n]._id);return e}return[t]},_refreshBuffer:function(t){return t._node.bufferSource=n.ctx.createBufferSource(),t._node.bufferSource.buffer=s[this._src],t._panner?t._node.bufferSource.connect(t._panner):t._node.bufferSource.connect(t._node),t._node.bufferSource.loop=t._loop,t._loop&&(t._node.bufferSource.loopStart=t._start||0,t._node.bufferSource.loopEnd=t._stop||0),t._node.bufferSource.playbackRate.setValueAtTime(t._rate,n.ctx.currentTime),this},_cleanBuffer:function(t){var e=n._navigator&&n._navigator.vendor.indexOf("Apple")>=0;if(!t.bufferSource)return this;if(n._scratchBuffer&&t.bufferSource&&(t.bufferSource.onended=null,t.bufferSource.disconnect(0),e))try{t.bufferSource.buffer=n._scratchBuffer}catch(t){}return t.bufferSource=null,this},_clearSound:function(t){/MSIE |Trident\//.test(n._navigator&&n._navigator.userAgent)||(t.src="data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA")}};var r=function(t){this._parent=t,this.init()};r.prototype={init:function(){var t=this,e=t._parent;return t._muted=e._muted,t._loop=e._loop,t._volume=e._volume,t._rate=e._rate,t._seek=0,t._paused=!0,t._ended=!0,t._sprite="__default",t._id=++n._counter,e._sounds.push(t),t.create(),t},create:function(){var t=this,e=t._parent,i=n._muted||t._muted||t._parent._muted?0:t._volume;return e._webAudio?(t._node=void 0===n.ctx.createGain?n.ctx.createGainNode():n.ctx.createGain(),t._node.gain.setValueAtTime(i,n.ctx.currentTime),t._node.paused=!0,t._node.connect(n.masterGain)):n.noAudio||(t._node=n._obtainHtml5Audio(),t._errorFn=t._errorListener.bind(t),t._node.addEventListener("error",t._errorFn,!1),t._loadFn=t._loadListener.bind(t),t._node.addEventListener(n._canPlayEvent,t._loadFn,!1),t._endFn=t._endListener.bind(t),t._node.addEventListener("ended",t._endFn,!1),t._node.src=e._src,t._node.preload=!0===e._preload?"auto":e._preload,t._node.volume=i*n.volume(),t._node.load()),t},reset:function(){var t=this,e=t._parent;return t._muted=e._muted,t._loop=e._loop,t._volume=e._volume,t._rate=e._rate,t._seek=0,t._rateSeek=0,t._paused=!0,t._ended=!0,t._sprite="__default",t._id=++n._counter,t},_errorListener:function(){var t=this;t._parent._emit("loaderror",t._id,t._node.error?t._node.error.code:0),t._node.removeEventListener("error",t._errorFn,!1)},_loadListener:function(){var t=this,e=t._parent;e._duration=Math.ceil(10*t._node.duration)/10,0===Object.keys(e._sprite).length&&(e._sprite={__default:[0,1e3*e._duration]}),"loaded"!==e._state&&(e._state="loaded",e._emit("load"),e._loadQueue()),t._node.removeEventListener(n._canPlayEvent,t._loadFn,!1)},_endListener:function(){var t=this,e=t._parent;e._duration===1/0&&(e._duration=Math.ceil(10*t._node.duration)/10,e._sprite.__default[1]===1/0&&(e._sprite.__default[1]=1e3*e._duration),e._ended(t)),t._node.removeEventListener("ended",t._endFn,!1)}};var s={},a=function(t){var e=t._src;if(s[e])return t._duration=s[e].duration,void l(t);if(/^data:[^;]+;base64,/.test(e)){for(var n=atob(e.split(",")[1]),i=new Uint8Array(n.length),r=0;r<n.length;++r)i[r]=n.charCodeAt(r);c(i.buffer,t)}else{var a=new XMLHttpRequest;a.open(t._xhr.method,e,!0),a.withCredentials=t._xhr.withCredentials,a.responseType="arraybuffer",t._xhr.headers&&Object.keys(t._xhr.headers).forEach((function(e){a.setRequestHeader(e,t._xhr.headers[e])})),a.onload=function(){var e=(a.status+"")[0];"0"===e||"2"===e||"3"===e?c(a.response,t):t._emit("loaderror",null,"Failed loading audio file with status: "+a.status+".")},a.onerror=function(){t._webAudio&&(t._html5=!0,t._webAudio=!1,t._sounds=[],delete s[e],t.load())},o(a)}},o=function(t){try{t.send()}catch(e){t.onerror()}},c=function(t,e){var i=function(){e._emit("loaderror",null,"Decoding audio data failed.")},r=function(t){t&&e._sounds.length>0?(s[e._src]=t,l(e,t)):i()};"undefined"!=typeof Promise&&1===n.ctx.decodeAudioData.length?n.ctx.decodeAudioData(t).then(r).catch(i):n.ctx.decodeAudioData(t,r,i)},l=function(t,e){e&&!t._duration&&(t._duration=e.duration),0===Object.keys(t._sprite).length&&(t._sprite={__default:[0,1e3*t._duration]}),"loaded"!==t._state&&(t._state="loaded",t._emit("load"),t._loadQueue())},h=function(){if(n.usingWebAudio){try{"undefined"!=typeof AudioContext?n.ctx=new AudioContext:"undefined"!=typeof webkitAudioContext?n.ctx=new webkitAudioContext:n.usingWebAudio=!1}catch(t){n.usingWebAudio=!1}n.ctx||(n.usingWebAudio=!1);var t=/iP(hone|od|ad)/.test(n._navigator&&n._navigator.platform),e=n._navigator&&n._navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/),i=e?parseInt(e[1],10):null;if(t&&i&&i<9){var r=/safari/.test(n._navigator&&n._navigator.userAgent.toLowerCase());n._navigator&&!r&&(n.usingWebAudio=!1)}n.usingWebAudio&&(n.masterGain=void 0===n.ctx.createGain?n.ctx.createGainNode():n.ctx.createGain(),n.masterGain.gain.setValueAtTime(n._muted?0:n._volume,n.ctx.currentTime),n.masterGain.connect(n.ctx.destination)),n._setup()}};t.Howler=n,t.Howl=i,void 0!==y?(y.HowlerGlobal=e,y.Howler=n,y.Howl=i,y.Sound=r):"undefined"!=typeof window&&(window.HowlerGlobal=e,window.Howler=n,window.Howl=i,window.Sound=r)}(),function(){var t;HowlerGlobal.prototype._pos=[0,0,0],HowlerGlobal.prototype._orientation=[0,0,-1,0,1,0],HowlerGlobal.prototype.stereo=function(t){var e=this;if(!e.ctx||!e.ctx.listener)return e;for(var n=e._howls.length-1;n>=0;n--)e._howls[n].stereo(t);return e},HowlerGlobal.prototype.pos=function(t,e,n){var i=this;return i.ctx&&i.ctx.listener?(e="number"!=typeof e?i._pos[1]:e,n="number"!=typeof n?i._pos[2]:n,"number"!=typeof t?i._pos:(i._pos=[t,e,n],void 0!==i.ctx.listener.positionX?(i.ctx.listener.positionX.setTargetAtTime(i._pos[0],Howler.ctx.currentTime,.1),i.ctx.listener.positionY.setTargetAtTime(i._pos[1],Howler.ctx.currentTime,.1),i.ctx.listener.positionZ.setTargetAtTime(i._pos[2],Howler.ctx.currentTime,.1)):i.ctx.listener.setPosition(i._pos[0],i._pos[1],i._pos[2]),i)):i},HowlerGlobal.prototype.orientation=function(t,e,n,i,r,s){var a=this;if(!a.ctx||!a.ctx.listener)return a;var o=a._orientation;return e="number"!=typeof e?o[1]:e,n="number"!=typeof n?o[2]:n,i="number"!=typeof i?o[3]:i,r="number"!=typeof r?o[4]:r,s="number"!=typeof s?o[5]:s,"number"!=typeof t?o:(a._orientation=[t,e,n,i,r,s],void 0!==a.ctx.listener.forwardX?(a.ctx.listener.forwardX.setTargetAtTime(t,Howler.ctx.currentTime,.1),a.ctx.listener.forwardY.setTargetAtTime(e,Howler.ctx.currentTime,.1),a.ctx.listener.forwardZ.setTargetAtTime(n,Howler.ctx.currentTime,.1),a.ctx.listener.upX.setTargetAtTime(i,Howler.ctx.currentTime,.1),a.ctx.listener.upY.setTargetAtTime(r,Howler.ctx.currentTime,.1),a.ctx.listener.upZ.setTargetAtTime(s,Howler.ctx.currentTime,.1)):a.ctx.listener.setOrientation(t,e,n,i,r,s),a)},Howl.prototype.init=(t=Howl.prototype.init,function(e){var n=this;return n._orientation=e.orientation||[1,0,0],n._stereo=e.stereo||null,n._pos=e.pos||null,n._pannerAttr={coneInnerAngle:void 0!==e.coneInnerAngle?e.coneInnerAngle:360,coneOuterAngle:void 0!==e.coneOuterAngle?e.coneOuterAngle:360,coneOuterGain:void 0!==e.coneOuterGain?e.coneOuterGain:0,distanceModel:void 0!==e.distanceModel?e.distanceModel:"inverse",maxDistance:void 0!==e.maxDistance?e.maxDistance:1e4,panningModel:void 0!==e.panningModel?e.panningModel:"HRTF",refDistance:void 0!==e.refDistance?e.refDistance:1,rolloffFactor:void 0!==e.rolloffFactor?e.rolloffFactor:1},n._onstereo=e.onstereo?[{fn:e.onstereo}]:[],n._onpos=e.onpos?[{fn:e.onpos}]:[],n._onorientation=e.onorientation?[{fn:e.onorientation}]:[],t.call(this,e)}),Howl.prototype.stereo=function(t,n){var i=this;if(!i._webAudio)return i;if("loaded"!==i._state)return i._queue.push({event:"stereo",action:function(){i.stereo(t,n)}}),i;var r=void 0===Howler.ctx.createStereoPanner?"spatial":"stereo";if(void 0===n){if("number"!=typeof t)return i._stereo;i._stereo=t,i._pos=[t,0,0]}for(var s=i._getSoundIds(n),a=0;a<s.length;a++){var o=i._soundById(s[a]);if(o){if("number"!=typeof t)return o._stereo;o._stereo=t,o._pos=[t,0,0],o._node&&(o._pannerAttr.panningModel="equalpower",o._panner&&o._panner.pan||e(o,r),"spatial"===r?void 0!==o._panner.positionX?(o._panner.positionX.setValueAtTime(t,Howler.ctx.currentTime),o._panner.positionY.setValueAtTime(0,Howler.ctx.currentTime),o._panner.positionZ.setValueAtTime(0,Howler.ctx.currentTime)):o._panner.setPosition(t,0,0):o._panner.pan.setValueAtTime(t,Howler.ctx.currentTime)),i._emit("stereo",o._id)}}return i},Howl.prototype.pos=function(t,n,i,r){var s=this;if(!s._webAudio)return s;if("loaded"!==s._state)return s._queue.push({event:"pos",action:function(){s.pos(t,n,i,r)}}),s;if(n="number"!=typeof n?0:n,i="number"!=typeof i?-.5:i,void 0===r){if("number"!=typeof t)return s._pos;s._pos=[t,n,i]}for(var a=s._getSoundIds(r),o=0;o<a.length;o++){var c=s._soundById(a[o]);if(c){if("number"!=typeof t)return c._pos;c._pos=[t,n,i],c._node&&(c._panner&&!c._panner.pan||e(c,"spatial"),void 0!==c._panner.positionX?(c._panner.positionX.setValueAtTime(t,Howler.ctx.currentTime),c._panner.positionY.setValueAtTime(n,Howler.ctx.currentTime),c._panner.positionZ.setValueAtTime(i,Howler.ctx.currentTime)):c._panner.setPosition(t,n,i)),s._emit("pos",c._id)}}return s},Howl.prototype.orientation=function(t,n,i,r){var s=this;if(!s._webAudio)return s;if("loaded"!==s._state)return s._queue.push({event:"orientation",action:function(){s.orientation(t,n,i,r)}}),s;if(n="number"!=typeof n?s._orientation[1]:n,i="number"!=typeof i?s._orientation[2]:i,void 0===r){if("number"!=typeof t)return s._orientation;s._orientation=[t,n,i]}for(var a=s._getSoundIds(r),o=0;o<a.length;o++){var c=s._soundById(a[o]);if(c){if("number"!=typeof t)return c._orientation;c._orientation=[t,n,i],c._node&&(c._panner||(c._pos||(c._pos=s._pos||[0,0,-.5]),e(c,"spatial")),void 0!==c._panner.orientationX?(c._panner.orientationX.setValueAtTime(t,Howler.ctx.currentTime),c._panner.orientationY.setValueAtTime(n,Howler.ctx.currentTime),c._panner.orientationZ.setValueAtTime(i,Howler.ctx.currentTime)):c._panner.setOrientation(t,n,i)),s._emit("orientation",c._id)}}return s},Howl.prototype.pannerAttr=function(){var t,n,i,r=this,s=arguments;if(!r._webAudio)return r;if(0===s.length)return r._pannerAttr;if(1===s.length){if("object"!=typeof s[0])return(i=r._soundById(parseInt(s[0],10)))?i._pannerAttr:r._pannerAttr;t=s[0],void 0===n&&(t.pannerAttr||(t.pannerAttr={coneInnerAngle:t.coneInnerAngle,coneOuterAngle:t.coneOuterAngle,coneOuterGain:t.coneOuterGain,distanceModel:t.distanceModel,maxDistance:t.maxDistance,refDistance:t.refDistance,rolloffFactor:t.rolloffFactor,panningModel:t.panningModel}),r._pannerAttr={coneInnerAngle:void 0!==t.pannerAttr.coneInnerAngle?t.pannerAttr.coneInnerAngle:r._coneInnerAngle,coneOuterAngle:void 0!==t.pannerAttr.coneOuterAngle?t.pannerAttr.coneOuterAngle:r._coneOuterAngle,coneOuterGain:void 0!==t.pannerAttr.coneOuterGain?t.pannerAttr.coneOuterGain:r._coneOuterGain,distanceModel:void 0!==t.pannerAttr.distanceModel?t.pannerAttr.distanceModel:r._distanceModel,maxDistance:void 0!==t.pannerAttr.maxDistance?t.pannerAttr.maxDistance:r._maxDistance,refDistance:void 0!==t.pannerAttr.refDistance?t.pannerAttr.refDistance:r._refDistance,rolloffFactor:void 0!==t.pannerAttr.rolloffFactor?t.pannerAttr.rolloffFactor:r._rolloffFactor,panningModel:void 0!==t.pannerAttr.panningModel?t.pannerAttr.panningModel:r._panningModel})}else 2===s.length&&(t=s[0],n=parseInt(s[1],10));for(var a=r._getSoundIds(n),o=0;o<a.length;o++)if(i=r._soundById(a[o])){var c=i._pannerAttr;c={coneInnerAngle:void 0!==t.coneInnerAngle?t.coneInnerAngle:c.coneInnerAngle,coneOuterAngle:void 0!==t.coneOuterAngle?t.coneOuterAngle:c.coneOuterAngle,coneOuterGain:void 0!==t.coneOuterGain?t.coneOuterGain:c.coneOuterGain,distanceModel:void 0!==t.distanceModel?t.distanceModel:c.distanceModel,maxDistance:void 0!==t.maxDistance?t.maxDistance:c.maxDistance,refDistance:void 0!==t.refDistance?t.refDistance:c.refDistance,rolloffFactor:void 0!==t.rolloffFactor?t.rolloffFactor:c.rolloffFactor,panningModel:void 0!==t.panningModel?t.panningModel:c.panningModel};var l=i._panner;l||(i._pos||(i._pos=r._pos||[0,0,-.5]),e(i,"spatial"),l=i._panner),l.coneInnerAngle=c.coneInnerAngle,l.coneOuterAngle=c.coneOuterAngle,l.coneOuterGain=c.coneOuterGain,l.distanceModel=c.distanceModel,l.maxDistance=c.maxDistance,l.refDistance=c.refDistance,l.rolloffFactor=c.rolloffFactor,l.panningModel=c.panningModel}return r},Sound.prototype.init=function(t){return function(){var e=this,n=e._parent;e._orientation=n._orientation,e._stereo=n._stereo,e._pos=n._pos,e._pannerAttr=n._pannerAttr,t.call(this),e._stereo?n.stereo(e._stereo):e._pos&&n.pos(e._pos[0],e._pos[1],e._pos[2],e._id)}}(Sound.prototype.init),Sound.prototype.reset=function(t){return function(){var e=this,n=e._parent;return e._orientation=n._orientation,e._stereo=n._stereo,e._pos=n._pos,e._pannerAttr=n._pannerAttr,e._stereo?n.stereo(e._stereo):e._pos?n.pos(e._pos[0],e._pos[1],e._pos[2],e._id):e._panner&&(e._panner.disconnect(0),e._panner=void 0,n._refreshBuffer(e)),t.call(this)}}(Sound.prototype.reset);var e=function(t,e){"spatial"===(e=e||"spatial")?(t._panner=Howler.ctx.createPanner(),t._panner.coneInnerAngle=t._pannerAttr.coneInnerAngle,t._panner.coneOuterAngle=t._pannerAttr.coneOuterAngle,t._panner.coneOuterGain=t._pannerAttr.coneOuterGain,t._panner.distanceModel=t._pannerAttr.distanceModel,t._panner.maxDistance=t._pannerAttr.maxDistance,t._panner.refDistance=t._pannerAttr.refDistance,t._panner.rolloffFactor=t._pannerAttr.rolloffFactor,t._panner.panningModel=t._pannerAttr.panningModel,void 0!==t._panner.positionX?(t._panner.positionX.setValueAtTime(t._pos[0],Howler.ctx.currentTime),t._panner.positionY.setValueAtTime(t._pos[1],Howler.ctx.currentTime),t._panner.positionZ.setValueAtTime(t._pos[2],Howler.ctx.currentTime)):t._panner.setPosition(t._pos[0],t._pos[1],t._pos[2]),void 0!==t._panner.orientationX?(t._panner.orientationX.setValueAtTime(t._orientation[0],Howler.ctx.currentTime),t._panner.orientationY.setValueAtTime(t._orientation[1],Howler.ctx.currentTime),t._panner.orientationZ.setValueAtTime(t._orientation[2],Howler.ctx.currentTime)):t._panner.setOrientation(t._orientation[0],t._orientation[1],t._orientation[2])):(t._panner=Howler.ctx.createStereoPanner(),t._panner.pan.setValueAtTime(t._stereo,Howler.ctx.currentTime)),t._panner.connect(t._node),t._paused||t._parent.pause(t._id,!0).play(t._id,!0)}}()}(yD);class bD extends _{url="";audio=null;static VOLUMN=1;static MUTED=!1;constructor(t){super(),t&&(this.url=t,this.setUrl(t))}async setUrl(t){return this.isPlaying()&&this.pause(),this.url=t,new Promise((e=>{const n=new yD.Howl({src:t,loop:!1,preload:!0,volume:bD.VOLUMN,format:["wav"],mute:bD.MUTED,onload:()=>{e(!0),this.emit("onload");const t=Howler.ctx;if(bD.VOLUMN>1){const e=t.createGain();n._sounds[0]._node.connect(e),e.connect(t.destination),n.gainNode=e,n.gainNode.gain.value=bD.VOLUMN}},onplay:()=>{this.emit("onplay")},onstop:()=>{this.emit("onstop")},onend:()=>{this.emit("onend")},onplayerror:(t,n)=>{e(!1),this.emit("onplayerror")}});this.audio=n}))}getUrl(){return this.url}async play(){return this.audio?.play(),Promise.resolve(!0)}async restart(){return this.reset(),this.play()}pause(){this.audio?.pause()}seek(t){this.audio?.seek(t)}load(){this.audio?.load()}reset(){this.audio?.seek(0)}isLoaded(){return"loaded"===this.audio?.state()}isPlaying(){return!!this.audio?.playing()}getDuration(){return this.audio.duration()}setVolume(t){bD.VOLUMN=t,this.audio?.volume(t)}getVolume(){return this.audio.volume()}destroy(){this.url="",this.audio?.pause()}mute(t=!0){this.audio&&this.audio.mute(t)}}const xD=bD;var wD=new bD;var ED=new class{fps;run_count;time_begin_ms;process_begin_time;target_wait_ms;log_timestamp;trace_name;constructor(t=20,e=""){this.fps=t,this.run_count=0,this.time_begin_ms=0,this.process_begin_time=0,this.target_wait_ms=1e3/t,this.log_timestamp=0,this.trace_name=e}init(t,e){this.fps=t,this.run_count=0,this.time_begin_ms=Date.now(),this.process_begin_time=0,this.target_wait_ms=1e3/t,this.trace_name=e}terminate(){}begin(){return this.process_begin_time=Date.now(),this.process_begin_time}end(){let t=Date.now(),e=t>this.process_begin_time?t-this.process_begin_time:0,n=this.target_wait_ms>e?this.target_wait_ms-e:2,i=t>this.time_begin_ms?Math.floor((t-this.time_begin_ms+this.target_wait_ms/2)/this.target_wait_ms):0;i>this.run_count?n=0:i<this.run_count&&(n+=this.target_wait_ms/2),n>2*this.target_wait_ms&&(n=2*this.target_wait_ms);if(Math.abs(i-this.run_count)>5){let t=Date.now();t-this.log_timestamp>1e4&&(this.log_timestamp=t),i>this.run_count?this.run_count++:n=this.target_wait_ms/2}else this.run_count++;return n}}(30,"");var CD=function(){this.__data__=[],this.size=0};var SD=function(t,e){return t===e||t!=t&&e!=e},MD=SD;var ID=function(t,e){for(var n=t.length;n--;)if(MD(t[n][0],e))return n;return-1},TD=ID,BD=Array.prototype.splice;var RD=ID;var DD=ID;var LD=ID;var PD=CD,kD=function(t){var e=this.__data__,n=TD(e,t);return!(n<0)&&(n==e.length-1?e.pop():BD.call(e,n,1),--this.size,!0)},OD=function(t){var e=this.__data__,n=RD(e,t);return n<0?void 0:e[n][1]},UD=function(t){return DD(this.__data__,t)>-1},ND=function(t,e){var n=this.__data__,i=LD(n,t);return i<0?(++this.size,n.push([t,e])):n[i][1]=e,this};function FD(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var i=t[e];this.set(i[0],i[1])}}FD.prototype.clear=PD,FD.prototype.delete=kD,FD.prototype.get=OD,FD.prototype.has=UD,FD.prototype.set=ND;var QD=FD,zD=QD;var GD=function(){this.__data__=new zD,this.size=0};var HD=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n};var VD=function(t){return this.__data__.get(t)};var jD=function(t){return this.__data__.has(t)},WD="object"==typeof y&&y&&y.Object===Object&&y,qD=WD,YD="object"==typeof self&&self&&self.Object===Object&&self,XD=qD||YD||Function("return this")(),JD=XD.Symbol,KD=JD,ZD=Object.prototype,$D=ZD.hasOwnProperty,tL=ZD.toString,eL=KD?KD.toStringTag:void 0;var nL=function(t){var e=$D.call(t,eL),n=t[eL];try{t[eL]=void 0;var i=!0}catch(t){}var r=tL.call(t);return i&&(e?t[eL]=n:delete t[eL]),r},iL=Object.prototype.toString;var rL=nL,sL=function(t){return iL.call(t)},aL=JD?JD.toStringTag:void 0;var oL=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":aL&&aL in Object(t)?rL(t):sL(t)};var cL=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)},lL=oL,hL=cL;var uL=function(t){if(!hL(t))return!1;var e=lL(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e},dL=XD["__core-js_shared__"],pL=function(){var t=/[^.]+$/.exec(dL&&dL.keys&&dL.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();var fL=function(t){return!!pL&&pL in t},AL=Function.prototype.toString;var gL=function(t){if(null!=t){try{return AL.call(t)}catch(t){}try{return t+""}catch(t){}}return""},mL=uL,_L=fL,vL=cL,yL=gL,bL=/^\[object .+?Constructor\]$/,xL=Function.prototype,wL=Object.prototype,EL=xL.toString,CL=wL.hasOwnProperty,SL=RegExp("^"+EL.call(CL).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var ML=function(t){return!(!vL(t)||_L(t))&&(mL(t)?SL:bL).test(yL(t))},IL=function(t,e){return null==t?void 0:t[e]};var TL=function(t,e){var n=IL(t,e);return ML(n)?n:void 0},BL=TL(XD,"Map"),RL=TL(Object,"create"),DL=RL;var LL=function(){this.__data__=DL?DL(null):{},this.size=0};var PL=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},kL=RL,OL=Object.prototype.hasOwnProperty;var UL=function(t){var e=this.__data__;if(kL){var n=e[t];return"__lodash_hash_undefined__"===n?void 0:n}return OL.call(e,t)?e[t]:void 0},NL=RL,FL=Object.prototype.hasOwnProperty;var QL=RL;var zL=LL,GL=PL,HL=UL,VL=function(t){var e=this.__data__;return NL?void 0!==e[t]:FL.call(e,t)},jL=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=QL&&void 0===e?"__lodash_hash_undefined__":e,this};function WL(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var i=t[e];this.set(i[0],i[1])}}WL.prototype.clear=zL,WL.prototype.delete=GL,WL.prototype.get=HL,WL.prototype.has=VL,WL.prototype.set=jL;var qL=WL,YL=QD,XL=BL;var JL=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t};var KL=function(t,e){var n=t.__data__;return JL(e)?n["string"==typeof e?"string":"hash"]:n.map},ZL=KL;var $L=KL;var tP=KL;var eP=KL;var nP=function(){this.size=0,this.__data__={hash:new qL,map:new(XL||YL),string:new qL}},iP=function(t){var e=ZL(this,t).delete(t);return this.size-=e?1:0,e},rP=function(t){return $L(this,t).get(t)},sP=function(t){return tP(this,t).has(t)},aP=function(t,e){var n=eP(this,t),i=n.size;return n.set(t,e),this.size+=n.size==i?0:1,this};function oP(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var i=t[e];this.set(i[0],i[1])}}oP.prototype.clear=nP,oP.prototype.delete=iP,oP.prototype.get=rP,oP.prototype.has=sP,oP.prototype.set=aP;var cP=QD,lP=BL,hP=oP;var uP=QD,dP=GD,pP=HD,fP=VD,AP=jD,gP=function(t,e){var n=this.__data__;if(n instanceof cP){var i=n.__data__;if(!lP||i.length<199)return i.push([t,e]),this.size=++n.size,this;n=this.__data__=new hP(i)}return n.set(t,e),this.size=n.size,this};function mP(t){var e=this.__data__=new uP(t);this.size=e.size}mP.prototype.clear=dP,mP.prototype.delete=pP,mP.prototype.get=fP,mP.prototype.has=AP,mP.prototype.set=gP;var _P=mP,vP=TL,yP=function(){try{var t=vP(Object,"defineProperty");return t({},"",{}),t}catch(t){}}(),bP=yP,xP=bP;var wP=function(t,e,n){"__proto__"==e&&xP?xP(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n},EP=wP,CP=SD;var SP=function(t,e,n){(void 0!==n&&!CP(t[e],n)||void 0===n&&!(e in t))&&EP(t,e,n)};var MP=function(t){return function(e,n,i){for(var r=-1,s=Object(e),a=i(e),o=a.length;o--;){var c=a[t?o:++r];if(!1===n(s[c],c,s))break}return e}}(),IP={exports:{}};!function(t,e){var n=XD,i=e&&!e.nodeType&&e,r=i&&t&&!t.nodeType&&t,s=r&&r.exports===i?n.Buffer:void 0,a=s?s.allocUnsafe:void 0;t.exports=function(t,e){if(e)return t.slice();var n=t.length,i=a?a(n):new t.constructor(n);return t.copy(i),i}}(IP,IP.exports);var TP=IP.exports,BP=XD.Uint8Array;var RP=function(t){var e=new t.constructor(t.byteLength);return new BP(e).set(new BP(t)),e};var DP=function(t,e){var n=e?RP(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)};var LP=function(t,e){var n=-1,i=t.length;for(e||(e=Array(i));++n<i;)e[n]=t[n];return e},PP=cL,kP=Object.create,OP=function(){function t(){}return function(e){if(!PP(e))return{};if(kP)return kP(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}();var UP=function(t,e){return function(n){return t(e(n))}},NP=UP(Object.getPrototypeOf,Object),FP=Object.prototype;var QP=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||FP)},zP=OP,GP=NP,HP=QP;var VP=function(t){return"function"!=typeof t.constructor||HP(t)?{}:zP(GP(t))};var jP=function(t){return null!=t&&"object"==typeof t},WP=oL,qP=jP;var YP=function(t){return qP(t)&&"[object Arguments]"==WP(t)},XP=jP,JP=Object.prototype,KP=JP.hasOwnProperty,ZP=JP.propertyIsEnumerable,$P=YP(function(){return arguments}())?YP:function(t){return XP(t)&&KP.call(t,"callee")&&!ZP.call(t,"callee")},tk=Array.isArray;var ek=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991},nk=uL,ik=ek;var rk=function(t){return null!=t&&ik(t.length)&&!nk(t)},sk=rk,ak=jP;var ok=function(t){return ak(t)&&sk(t)},ck={exports:{}};var lk=function(){return!1};!function(t,e){var n=XD,i=lk,r=e&&!e.nodeType&&e,s=r&&t&&!t.nodeType&&t,a=s&&s.exports===r?n.Buffer:void 0,o=(a?a.isBuffer:void 0)||i;t.exports=o}(ck,ck.exports);var hk=ck.exports,uk=oL,dk=NP,pk=jP,fk=Function.prototype,Ak=Object.prototype,gk=fk.toString,mk=Ak.hasOwnProperty,_k=gk.call(Object);var vk=function(t){if(!pk(t)||"[object Object]"!=uk(t))return!1;var e=dk(t);if(null===e)return!0;var n=mk.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&gk.call(n)==_k},yk=oL,bk=ek,xk=jP,wk={};wk["[object Float32Array]"]=wk["[object Float64Array]"]=wk["[object Int8Array]"]=wk["[object Int16Array]"]=wk["[object Int32Array]"]=wk["[object Uint8Array]"]=wk["[object Uint8ClampedArray]"]=wk["[object Uint16Array]"]=wk["[object Uint32Array]"]=!0,wk["[object Arguments]"]=wk["[object Array]"]=wk["[object ArrayBuffer]"]=wk["[object Boolean]"]=wk["[object DataView]"]=wk["[object Date]"]=wk["[object Error]"]=wk["[object Function]"]=wk["[object Map]"]=wk["[object Number]"]=wk["[object Object]"]=wk["[object RegExp]"]=wk["[object Set]"]=wk["[object String]"]=wk["[object WeakMap]"]=!1;var Ek=function(t){return xk(t)&&bk(t.length)&&!!wk[yk(t)]};var Ck=function(t){return function(e){return t(e)}},Sk={exports:{}};!function(t,e){var n=WD,i=e&&!e.nodeType&&e,r=i&&t&&!t.nodeType&&t,s=r&&r.exports===i&&n.process,a=function(){try{var t=r&&r.require&&r.require("util").types;return t||s&&s.binding&&s.binding("util")}catch(t){}}();t.exports=a}(Sk,Sk.exports);var Mk=Sk.exports,Ik=Ek,Tk=Ck,Bk=Mk&&Mk.isTypedArray,Rk=Bk?Tk(Bk):Ik;var Dk=function(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]},Lk=wP,Pk=SD,kk=Object.prototype.hasOwnProperty;var Ok=function(t,e,n){var i=t[e];kk.call(t,e)&&Pk(i,n)&&(void 0!==n||e in t)||Lk(t,e,n)},Uk=wP;var Nk=function(t,e,n,i){var r=!n;n||(n={});for(var s=-1,a=e.length;++s<a;){var o=e[s],c=i?i(n[o],t[o],o,n,t):void 0;void 0===c&&(c=t[o]),r?Uk(n,o,c):Ok(n,o,c)}return n};var Fk=function(t,e){for(var n=-1,i=Array(t);++n<t;)i[n]=e(n);return i},Qk=/^(?:0|[1-9]\d*)$/;var zk=function(t,e){var n=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==n||"symbol"!=n&&Qk.test(t))&&t>-1&&t%1==0&&t<e},Gk=Fk,Hk=$P,Vk=tk,jk=hk,Wk=zk,qk=Rk,Yk=Object.prototype.hasOwnProperty;var Xk=function(t,e){var n=Vk(t),i=!n&&Hk(t),r=!n&&!i&&jk(t),s=!n&&!i&&!r&&qk(t),a=n||i||r||s,o=a?Gk(t.length,String):[],c=o.length;for(var l in t)!e&&!Yk.call(t,l)||a&&("length"==l||r&&("offset"==l||"parent"==l)||s&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||Wk(l,c))||o.push(l);return o};var Jk=cL,Kk=QP,Zk=function(t){var e=[];if(null!=t)for(var n in Object(t))e.push(n);return e},$k=Object.prototype.hasOwnProperty;var tO=Xk,eO=function(t){if(!Jk(t))return Zk(t);var e=Kk(t),n=[];for(var i in t)("constructor"!=i||!e&&$k.call(t,i))&&n.push(i);return n},nO=rk;var iO=function(t){return nO(t)?tO(t,!0):eO(t)},rO=Nk,sO=iO;var aO=SP,oO=TP,cO=DP,lO=LP,hO=VP,uO=$P,dO=tk,pO=ok,fO=hk,AO=uL,gO=cL,mO=vk,_O=Rk,vO=Dk,yO=function(t){return rO(t,sO(t))};var bO=_P,xO=SP,wO=MP,EO=function(t,e,n,i,r,s,a){var o=vO(t,n),c=vO(e,n),l=a.get(c);if(l)aO(t,n,l);else{var h=s?s(o,c,n+"",t,e,a):void 0,u=void 0===h;if(u){var d=dO(c),p=!d&&fO(c),f=!d&&!p&&_O(c);h=c,d||p||f?dO(o)?h=o:pO(o)?h=lO(o):p?(u=!1,h=oO(c,!0)):f?(u=!1,h=cO(c,!0)):h=[]:mO(c)||uO(c)?(h=o,uO(o)?h=yO(o):gO(o)&&!AO(o)||(h=hO(c))):u=!1}u&&(a.set(c,h),r(h,c,i,s,a),a.delete(c)),aO(t,n,h)}},CO=cL,SO=iO,MO=Dk;var IO=function t(e,n,i,r,s){e!==n&&wO(n,(function(a,o){if(s||(s=new bO),CO(a))EO(e,n,o,i,t,r,s);else{var c=r?r(MO(e,o),a,o+"",e,n,s):void 0;void 0===c&&(c=a),xO(e,o,c)}}),SO)};var TO=function(t){return t};var BO=function(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)},RO=BO,DO=Math.max;var LO=function(t,e,n){return e=DO(void 0===e?t.length-1:e,0),function(){for(var i=arguments,r=-1,s=DO(i.length-e,0),a=Array(s);++r<s;)a[r]=i[e+r];r=-1;for(var o=Array(e+1);++r<e;)o[r]=i[r];return o[e]=n(a),RO(t,this,o)}};var PO=function(t){return function(){return t}},kO=bP,OO=kO?function(t,e){return kO(t,"toString",{configurable:!0,enumerable:!1,value:PO(e),writable:!0})}:TO,UO=OO,NO=Date.now;var FO=function(t){var e=0,n=0;return function(){var i=NO(),r=16-(i-n);if(n=i,r>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(void 0,arguments)}},QO=FO(UO),zO=TO,GO=LO,HO=QO;var VO=function(t,e){return HO(GO(t,e,zO),t+"")},jO=SD,WO=rk,qO=zk,YO=cL;var XO=VO,JO=function(t,e,n){if(!YO(n))return!1;var i=typeof e;return!!("number"==i?WO(n)&&qO(e,n.length):"string"==i&&e in n)&&jO(n[e],t)};var KO=function(t){return XO((function(e,n){var i=-1,r=n.length,s=r>1?n[r-1]:void 0,a=r>2?n[2]:void 0;for(s=t.length>3&&"function"==typeof s?(r--,s):void 0,a&&JO(n[0],n[1],a)&&(s=r<3?void 0:s,r=1),e=Object(e);++i<r;){var o=n[i];o&&t(e,o,i,s)}return e}))},ZO=IO,$O=b(KO((function(t,e,n){ZO(t,e,n)}))),tU={exports:{}};!function(t){!function(e){var n="object"==typeof window&&!!window.document,i=n?window:Object;!function(t,e){var n=function(){},i=function(t){return"number"==typeof t},r=function(t){return JSON.stringify(t)},s=function(t){return new D(t)},a=s.LM="2025-01-11 09:28",o="https://github.com/xiangyuecn/Recorder",c="Recorder",l="getUserMedia",h="srcSampleRate",u="sampleRate",d="bitRate",p="catch",f=t[c];if(f&&f.LM==a)return void f.CLog(f.i18n.$T("K8zP::重复导入{1}",0,c),3);s.IsOpen=function(){var t=s.Stream;if(t){var e=I(t)[0];if(e){var n=e.readyState;return"live"==n||n==e.LIVE}}return!1},s.BufferSize=4096,s.Destroy=function(){for(var t in T(c+" Destroy"),S(),A)A[t]()};var A={};s.BindDestroy=function(t,e){A[t]=e},s.Support=function(){if(!e)return!1;var t=navigator.mediaDevices||{};return t[l]||(t=navigator)[l]||(t[l]=t.webkitGetUserMedia||t.mozGetUserMedia||t.msGetUserMedia),!!t[l]&&(s.Scope=t,!!s.GetContext())},s.GetContext=function(t){if(!e)return null;var n=window.AudioContext;if(n||(n=window.webkitAudioContext),!n)return null;var i=s.Ctx,r=0;return i||(i=s.Ctx=new n,r=1,s.NewCtxs=s.NewCtxs||[],s.BindDestroy("Ctx",(function(){var t=s.Ctx;t&&t.close&&(g(t),s.Ctx=0);var e=s.NewCtxs;s.NewCtxs=[];for(var n=0;n<e.length;n++)g(e[n])}))),t&&i.close&&(r||(i._useC||g(i),i=new n),i._useC=1,s.NewCtxs.push(i)),i},s.CloseNewCtx=function(t){if(t&&t.close){g(t);for(var e=s.NewCtxs||[],n=e.length,i=0;i<e.length;i++)if(e[i]==t){e.splice(i,1);break}T(F("mSxV::剩{1}个GetContext未close",0,n+"-1="+e.length),e.length?3:0)}};var g=function(t){if(t&&t.close&&!t._isC&&(t._isC=1,"closed"!=t.state))try{t.close()}catch(t){T("ctx close err",1,t)}},m=s.ResumeCtx=function(t,e,n,i){var r=0,s=0,a=0,o=0,c="EventListener",l="ResumeCtx ",h=function(e,l){s&&u(),r||(r=1,e&&i(e,o),l&&n(o)),l&&(!t._LsSC&&t["add"+c]&&t["add"+c]("statechange",d),t._LsSC=1,a=1)},u=function(t){if(!t||!s){s=t?1:0;for(var e=["focus","mousedown","mouseup","touchstart","touchend"],n=0;n<e.length;n++)window[(t?"add":"remove")+c](e[n],d,!0)}},d=function(){var n=t.state,i=_(n);if(!r&&!e(i?++o:o))return h();i?(a&&T(l+"sc "+n,3),u(1),t.resume().then((function(){a&&T(l+"sc "+t.state),h(0,1)}))[p]((function(e){T(l+"error",1,e),_(t.state)||h(e.message||"error")}))):"closed"==n?(a&&!t._isC&&T(l+"sc "+n,1),h("ctx closed")):h(0,1)};d()},_=s.CtxSpEnd=function(t){return"suspended"==t||"interrupted"==t},v=function(t){var e=t.state,n="ctx.state="+e;return _(e)&&(n+=F("nMIy::(注意:ctx不是running状态,rec.open和start至少要有一个在用户操作(触摸、点击等)时进行调用,否则将在rec.start时尝试进行ctx.resume,可能会产生兼容性问题(仅iOS),请参阅文档中runningContext配置)")),n},y="ConnectEnableWebM";s[y]=!0;var b="ConnectEnableWorklet";s[b]=!1;var x=function(t){var e=t.BufferSize||s.BufferSize,n=t.Stream,i=n._c,a=i[u],o={},l=I(n)[0],h=null,d="";if(l&&l.getSettings){var f=(h=l.getSettings())[u];f&&f!=a&&(d=F("eS8i::Stream的采样率{1}不等于{2},将进行采样率转换(注意:音质不会变好甚至可能变差),主要在移动端未禁用回声消除时会产生此现象,浏览器有回声消除时可能只会返回16k采样率的音频数据,",0,f,a))}n._ts=h,T(d+"Stream TrackSet: "+r(h),d?3:0);var A,g,_,v=function(t){var e=n._m=i.createMediaStreamSource(n),r=i.destination,s="createMediaStreamDestination";i[s]&&(r=n._d=i[s]()),e.connect(t),t.connect(r)},x="",w=n._call,S=function(t,e){for(var n in w){if(e!=a){o.index=0;var i=(o=s.SampleData([t],e,a,o,{_sum:1})).data,r=o._sum}else{o={};for(var c=t.length,l=(i=new Int16Array(c),r=0,0);l<c;l++){var h=Math.max(-1,Math.min(1,t[l]));h=h<0?32768*h:32767*h,i[l]=h,r+=Math.abs(h)}}for(var u in w)w[u](i,r);return}},M="ScriptProcessor",B="audioWorklet",R=c+" "+B,D="RecProc",P="MediaRecorder",k=P+".WebM.PCM",O=i.createScriptProcessor||i.createJavaScriptNode,U=F("ZGlf::。由于{1}内部1秒375次回调,在移动端可能会有性能问题导致回调丢失录音变短,PC端无影响,暂不建议开启{1}。",0,B),Q=function(){g=n.isWorklet=!1,E(n),T(F("7TU0::Connect采用老的{1},",0,M)+N.get(s[b]?F("JwCL::但已设置{1}尝试启用{2}",2):F("VGjB::可设置{1}尝试启用{2}",2),[c+"."+b+"=true",B])+x+U,3);var t=n._p=O.call(i,e,1,1);v(t),t.onaudioprocess=function(t){var e=t.inputBuffer.getChannelData(0);S(e,a)}},z=function(){A=n.isWebM=!1,C(n),g=n.isWorklet=!O||s[b];var t=window.AudioWorkletNode;if(g&&i[B]&&t){var r=function(){var t=function(t){return t.toString().replace(/^function|DEL_/g,"").replace(/\$RA/g,R)},e="class "+D+" extends AudioWorkletProcessor{";return e+="constructor "+t((function(t){DEL_super(t);var e=this,n=t.processorOptions.bufferSize;e.bufferSize=n,e.buffer=new Float32Array(2*n),e.pos=0,e.port.onmessage=function(t){t.data.kill&&(e.kill=!0,$C.log("$RA kill call"))},$C.log("$RA .ctor call",t)})),e+="process "+t((function(t,e,n){var i=this,r=i.bufferSize,s=i.buffer,a=i.pos;if((t=(t[0]||[])[0]||[]).length){s.set(t,a);var o=~~((a+=t.length)/r)*r;if(o){this.port.postMessage({val:s.slice(0,o)});var c=s.subarray(o,a);(s=new Float32Array(2*r)).set(c),a=c.length,i.buffer=s}i.pos=a}return!i.kill})),e=(e+='}try{registerProcessor("'+D+'", '+D+')}catch(e){$C.error("'+R+' Reg Error",e)}').replace(/\$C\./g,"console."),"data:text/javascript;base64,"+btoa(unescape(encodeURIComponent(e)))},o=function(){return g&&n._na},l=n._na=function(){""!==_&&(clearTimeout(_),_=setTimeout((function(){_=0,o()&&(T(F("MxX1::{1}未返回任何音频,恢复使用{2}",0,B,M),3),O&&Q())}),500))},h=function(){if(o()){var r=n._n=new t(i,D,{processorOptions:{bufferSize:e}});v(r),r.port.onmessage=function(t){_&&(clearTimeout(_),_=""),o()?S(t.data.val,a):g||T(F("XUap::{1}多余回调",0,B),3)},T(F("yOta::Connect采用{1},设置{2}可恢复老式{3}",0,B,c+"."+b+"=false",M)+x+U,3)}},u=function(){if(o())if(i[D])h();else{var t=r();i[B].addModule(t).then((function(t){o()&&(i[D]=1,h(),_&&l())}))[p]((function(t){T(B+".addModule Error",1,t),o()&&Q()}))}};m(i,(function(){return o()}),u,u)}else Q()};(function(){var t=window[P],i="ondataavailable",r="audio/webm; codecs=pcm";A=n.isWebM=s[y];var a=t&&i in t.prototype&&t.isTypeSupported(r);if(x=a?"":F("VwPd::(此浏览器不支持{1})",0,k),A&&a){var o=function(){return A&&n._ra};n._ra=function(){""!==_&&(clearTimeout(_),_=setTimeout((function(){o()&&(T(F("vHnb::{1}未返回任何音频,降级使用{2}",0,P,B),3),z())}),500))};var l=Object.assign({mimeType:r},s.ConnectWebMOptions),h=n._r=new t(n,l),u=n._rd={};h[i]=function(t){var e=new FileReader;e.onloadend=function(){if(o()){var t=L(new Uint8Array(e.result),u);if(!t)return;if(-1==t)return void z();_&&(clearTimeout(_),_=""),S(t,u.webmSR)}else A||T(F("O9P7::{1}多余回调",0,P),3)},e.readAsArrayBuffer(t.data)};try{h.start(~~(e/48)),T(F("LMEm::Connect采用{1},设置{2}可恢复使用{3}或老式{4}",0,k,c+"."+y+"=false",B,M))}catch(t){T("mr start err",1,t),z()}}else z()})()},w=function(t){t._na&&t._na(),t._ra&&t._ra()},E=function(t){t._na=null,t._n&&(t._n.port.postMessage({kill:!0}),t._n.disconnect(),t._n=null)},C=function(t){if(t._ra=null,t._r){try{t._r.stop()}catch(t){T("mr stop err",1,t)}t._r=null}},S=function(t){var e=(t=t||s)==s,n=t.Stream;n&&(n._m&&(n._m.disconnect(),n._m=null),!n._RC&&n._c&&s.CloseNewCtx(n._c),n._RC=null,n._c=null,n._d&&(M(n._d.stream),n._d=null),n._p&&(n._p.disconnect(),n._p.onaudioprocess=n._p=null),E(n),C(n),e&&M(n)),t.Stream=0},M=s.StopS_=function(t){for(var e=I(t),n=0;n<e.length;n++){var i=e[n];i.stop&&i.stop()}t.stop&&t.stop()},I=function(t){var e=0,n=0,i=[];t.getAudioTracks&&(e=t.getAudioTracks(),n=t.getVideoTracks()),e||(e=t.audioTracks,n=t.videoTracks);for(var r=0,s=e?e.length:0;r<s;r++)i.push(e[r]);for(r=0,s=n?n.length:0;r<s;r++)i.push(n[r]);return i};s.SampleData=function(t,e,n,i,r){var a="SampleData";i||(i={});var o,c=i.index||0,l=i.offset||0,h=i.raisePrev||0,u=i.filter;(u&&u.fn&&(u.sr&&u.sr!=e||u.srn&&u.srn!=n)&&(u=null,T(F("d48C::{1}的filter采样率变了,重设滤波",0,a),3)),u)||(u=n<=e?{fn:(o=n>3*e/4?0:n/2*3/4)?s.IIRFilter(!0,e,o):0}:{fn:(o=e>3*n/4?0:e/2*3/4)?s.IIRFilter(!0,n,o):0});u.sr=e,u.srn=n;var d=u.fn,p=i.frameNext||[];r||(r={});var f=r.frameSize||1;r.frameType&&(f="mp3"==r.frameType?1152:1);var A=r._sum,g=0,m=t.length;c>m+1&&T(F("tlbC::{1}似乎传入了未重置chunk {2}",0,a,c+">"+m),3);for(var _=0,v=c;v<m;v++)_+=t[v].length;var y=e/n;if(y>1)_=Math.max(0,_-Math.floor(l)),_=Math.floor(_/y);else if(y<1){var b=1/y;_=Math.floor(_*b)}_+=p.length;var x=new Int16Array(_),w=0;for(v=0;v<p.length;v++)x[w]=p[v],w++;for(;c<m;c++){var E=t[c],C=E instanceof Float32Array,S=(v=l,E.length),M=d&&d.Embed,I=0,B=0,R=0,D=0;if(y<1){for(var L=w+v,P=h,k=0;k<S;k++){var O=E[k];C&&(O=(O=Math.max(-1,Math.min(1,O)))<0?32768*O:32767*O);var U=Math.floor(L);L+=b;for(var N=Math.floor(L),Q=(O-P)/(N-U),z=1;U<N;U++,z++){var G=Math.floor(P+z*Q);M?(R=G,D=M.b0*R+M.b1*M.x1+M.b0*M.x2-M.a1*M.y1-M.a2*M.y2,M.x2=M.x1,M.x1=R,M.y2=M.y1,M.y1=D,G=D):G=d?d(G):G,G>32767?G=32767:G<-32768&&(G=-32768),A&&(g+=Math.abs(G)),x[U]=G,w++}P=h=O,v+=b}l=v%1}else{k=0;for(var H=0;k<S;k++,H++){if(H<S){O=E[H];C&&(O=(O=Math.max(-1,Math.min(1,O)))<0?32768*O:32767*O),M?(R=O,D=M.b0*R+M.b1*M.x1+M.b0*M.x2-M.a1*M.y1-M.a2*M.y2,M.x2=M.x1,M.x1=R,M.y2=M.y1,M.y1=D):D=d?d(O):O}if(I=B,B=D,0!=H){var V=Math.floor(v);if(k==V){var j=I+((Math.ceil(v)<S?B:I)-I)*(v-V);j>32767?j=32767:j<-32768&&(j=-32768),A&&(g+=Math.abs(j)),x[w]=j,w++,v+=y}}else k--}l=Math.max(0,v-S)}}y<1&&w+1==_&&(_--,x=new Int16Array(x.buffer.slice(0,2*_))),w-1!=_&&w!=_&&T(a+" idx:"+w+" != size:"+_,3),p=null;var W=_%f;if(W>0){var q=2*(_-W);p=new Int16Array(x.buffer.slice(q)),x=new Int16Array(x.buffer.slice(0,q))}var Y={index:c,offset:l,raisePrev:h,filter:u,frameNext:p,sampleRate:n,data:x};return A&&(Y._sum=g),Y},s.IIRFilter=function(t,e,n){var i=2*Math.PI*n/e,r=Math.sin(i),s=Math.cos(i),a=r/2,o=1+a,c=-2*s/o,l=(1-a)/o;if(t)var h=(1-s)/2/o,u=(1-s)/o;else h=(1+s)/2/o,u=-(1+s)/o;var d=0,p=0,f=0,A=0,g=0,m=function(t){return f=h*t+u*d+h*p-c*A-l*g,p=d,d=t,g=A,A=f,f};return m.Embed={x1:0,x2:0,y1:0,y2:0,b0:h,b1:u,a1:c,a2:l},m},s.PowerLevel=function(t,e){var n=t/e||0;return n<1251?Math.round(n/1250*10):Math.round(Math.min(100,Math.max(0,100*(1+Math.log(n/1e4)/Math.log(10)))))},s.PowerDBFS=function(t){var e=Math.max(.1,t||0),n=32767;return e=Math.min(e,n),e=20*Math.log(e/n)/Math.log(10),Math.max(-100,Math.round(e))},s.CLog=function(t,e){if("object"==typeof console){var n=new Date,r=("0"+n.getMinutes()).substr(-2)+":"+("0"+n.getSeconds()).substr(-2)+"."+("00"+n.getMilliseconds()).substr(-3),a=this&&this.envIn&&this.envCheck&&this.id,o=["["+r+" "+c+(a?":"+a:"")+"]"+t],l=arguments,h=s.CLog,u=2,d=h.log||console.log;for(i(e)?d=1==e?h.error||console.error:3==e?h.warn||console.warn:d:u=1;u<l.length;u++)o.push(l[u]);B?d&&d("[IsLoser]"+o[0],o.length>1?o:""):d.apply(console,o)}};var T=function(){s.CLog.apply(this,arguments)},B=!0;try{B=!console.log.apply}catch(t){}var R=0;function D(t){var e=this;e.id=++R,Q();var r={type:"mp3",onProcess:n};for(var s in t)r[s]=t[s];e.set=r;var a=r[d],o=r[u];(a&&!i(a)||o&&!i(o))&&e.CLog(F.G("IllegalArgs-1",[F("VtS4::{1}和{2}必须是数值",0,u,d)]),1,t),r[d]=+a||16,r[u]=+o||16e3,e.state=0,e._S=9,e.Sync={O:9,C:9}}s.Sync={O:9,C:9},s.prototype=D.prototype={CLog:T,_streamStore:function(){return this.set.sourceStream?this:s},_streamGet:function(){return this._streamStore().Stream},_streamCtx:function(){var t=this._streamGet();return t&&t._c},open:function(t,i){var c=this,h=c.set,d=c._streamStore(),f=0;t=t||n;var A=function(t,e){e=!!e,c.CLog(F("5tWi::录音open失败:")+t+",isUserNotAllow:"+e,1),f&&s.CloseNewCtx(f),i&&i(t,e)};c._streamTag=l;var g=function(){c.CLog("open ok, id:"+c.id+" stream:"+c._streamTag),t(),c._SO=0},m=d.Sync,_=++m.O,y=m.C;c._O=c._O_=_,c._SO=c._S;var b=function(){if(y!=m.C||!c._O){var t=F("dFm8::open被取消");return _==m.O?c.close():t=F("VtJO::open被中断"),A(t),!0}};if(e){var w=c.envCheck({envName:"H5",canProcess:!0});if(w)A(F("A5bm::不能录音:")+w);else{var E,C=function(){(E=h.runningContext)||(E=f=s.GetContext(!0))};if(h.sourceStream){if(c._streamTag="set.sourceStream",!s.GetContext())return void A(F("1iU7::不支持此浏览器从流中获取录音"));C(),S(d);var M=c.Stream=h.sourceStream;M._c=E,M._RC=h.runningContext,M._call={};try{x(d)}catch(t){return S(d),void A(F("BTW2::从流中打开录音失败:")+t.message)}g()}else{var I=function(t,e){try{window.top.a}catch(t){return void A(F("Nclz::无权录音(跨域,请尝试给iframe添加麦克风访问策略,如{1})",0,'allow="camera;microphone"'))}T(1,t)&&(/Found/i.test(t)?A(e+F("jBa9::,无可用麦克风")):A(e))},T=function(t,e){if(/Permission|Allow/i.test(e))t&&A(F("gyO5::用户拒绝了录音权限"),!0);else{if(!1!==window.isSecureContext)return 1;t&&A(F("oWNo::浏览器禁止不安全页面录音,可开启https解决"))}};if(s.IsOpen())g();else if(s.Support()){C();var B,R,D=function(t){setTimeout((function(){t._call={};var e=s.Stream;e&&(S(),t._call=e._call),s.Stream=t,t._c=E,t._RC=h.runningContext,b()||(s.IsOpen()?(e&&c.CLog(F("upb8::发现同时多次调用open"),1),x(d),g()):A(F("Q1GA::录音功能无效:无音频流")))}),100)},L=function(t){var e=t.name||t.message||t.code+":"+t,n="";1==P&&T(0,e)&&(n=F("KxE2::,将尝试禁用回声消除后重试"));var i=F("xEQR::请求录音权限错误"),r=F("bDOG::无法录音:");c.CLog(i+n+"|"+t,n||R?3:1,t),n?(B=e,R=t,k(1)):R?(c.CLog(i+"|"+R,1,R),I(B,r+R)):I(e,r+t)},P=0,k=function(t){P++;var e="audioTrackSet",n="autoGainControl",i="echoCancellation",d="noiseSuppression",f=e+":{"+i+","+d+","+n+"}",A=JSON.parse(r(h[e]||!0));c.CLog("open... "+P+" "+e+":"+r(A)),t&&("object"!=typeof A&&(A={}),A[n]=!1,A[i]=!1,A[d]=!1),A[u]&&c.CLog(F("IjL3::注意:已配置{1}参数,可能会出现浏览器不能正确选用麦克风、移动端无法启用回声消除等现象",0,e+"."+u),3);var g={audio:A,video:h.videoTrackSet||!1};try{var m=s.Scope[l](g,D,L)}catch(t){c.CLog(l,3,t),g={audio:!0,video:!1},m=s.Scope[l](g,D,L)}c.CLog(l+"("+r(g)+") "+v(E)+F("RiWe::,未配置 {1} 时浏览器可能会自动启用回声消除,移动端未禁用回声消除时可能会降低系统播放音量(关闭录音后可恢复)和仅提供16k采样率的音频流(不需要回声消除时可明确配置成禁用来获得48k高音质的流),请参阅文档中{2}配置",0,f,e)+"("+o+") LM:"+a+" UA:"+navigator.userAgent),m&&m.then&&m.then(D)[p](L)};k()}else I("",F("COxc::此浏览器不支持录音"))}}}else A(F.G("NonBrowser-1",["open"])+F("EMJq::,可尝试使用RecordApp解决方案")+"("+o+"/tree/master/app-support-sample)")},close:function(t){t=t||n;var e=this,i=e._streamStore();e._stop();var r=" stream:"+e._streamTag,s=i.Sync;if(e._O=0,e._O_!=s.O)return e.CLog(F("hWVz::close被忽略(因为同时open了多个rec,只有最后一个会真正close)")+r,3),void t();s.C++,S(i),e.CLog("close,"+r),t()},mock:function(t,e){var n=this;return n._stop(),n.isMock=1,n.mockEnvInfo=null,n.buffers=[t],n.recSize=t.length,n._setSrcSR(e),n._streamTag="mock",n},_setSrcSR:function(t){var e=this,n=e.set,i=n[u];i>t?n[u]=t:i=0,e[h]=t,e.CLog(h+": "+t+" set."+u+": "+n[u]+(i?" "+F("UHvm::忽略")+": "+i:""),i?3:0)},envCheck:function(t){var e,n=this,i=n.set,r="CPU_BE";if(e||s[r]||"function"!=typeof Int8Array||new Int8Array(new Int32Array([1]).buffer)[0]||(Q(r),e=F("Essp::不支持{1}架构",0,r)),!e){var a=i.type,o=n[a+"_envCheck"];i.takeoffEncodeChunk&&(o?t.canProcess||(e=F("7uMV::{1}环境不支持实时处理",0,t.envName)):e=F("2XBl::{1}类型不支持设置takeoffEncodeChunk",0,a)+(n[a]?"":F("LG7e::(未加载编码器)"))),!e&&o&&(e=n[a+"_envCheck"](t,i))}return e||""},envStart:function(t,e){var n=this,i=n.set;if(n.isMock=t?1:0,n.mockEnvInfo=t,n.buffers=[],n.recSize=0,t&&(n._streamTag="env$"+t.envName),n.state=1,n.envInLast=0,n.envInFirst=0,n.envInFix=0,n.envInFixTs=[],n._setSrcSR(e),n.engineCtx=0,n[i.type+"_start"]){var r=n.engineCtx=n[i.type+"_start"](i);r&&(r.pcmDatas=[],r.pcmSize=0)}},envResume:function(){this.envInFixTs=[]},envIn:function(t,e){var n=this,i=n.set,r=n.engineCtx;if(1==n.state){var a=n[h],o=t.length,c=s.PowerLevel(e,o),l=n.buffers,d=l.length;l.push(t);var p=l,f=d,A=Date.now(),g=Math.round(o/a*1e3);n.envInLast=A,1==n.buffers.length&&(n.envInFirst=A-g);var m=n.envInFixTs;m.splice(0,0,{t:A,d:g});for(var _=A,v=0,y=0;y<m.length;y++){var b=m[y];if(A-b.t>3e3){m.length=y;break}_=b.t,v+=b.d}var x=m[1],w=A-_;if(w-v>w/3&&(x&&w>1e3||m.length>=6)){var E=A-x.t-g;if(E>g/5){var C=!i.disableEnvInFix;if(n.CLog("["+A+"]"+N.get(F(C?"4Kfd::补偿{1}ms":"bM5i::未补偿{1}ms",1),[E]),3),n.envInFix+=E,C){var S=new Int16Array(E*a/1e3);o+=S.length,l.push(S)}}}var M=n.recSize,I=o,T=M+I;if(n.recSize=T,r){var B=s.SampleData(l,a,i[u],r.chunkInfo);r.chunkInfo=B,T=(M=r.pcmSize)+(I=B.data.length),r.pcmSize=T,l=r.pcmDatas,d=l.length,l.push(B.data),a=B[u]}var R=Math.round(T/a*1e3),D=l.length,L=p.length,P=function(){for(var t=k?0:-I,e=null==l[0],s=d;s<D;s++){var a=l[s];null==a?e=1:(t+=a.length,r&&a.length&&n[i.type+"_encode"](r,a))}if(e&&r){s=f;for(p[0]&&(s=0);s<L;s++)p[s]=null}e&&(t=k?I:0,l[0]=null),r?r.pcmSize+=t:n.recSize+=t},k=0,O="rec.set.onProcess";try{k=!0===(k=i.onProcess(l,c,R,a,d,P))}catch(t){}var U=Date.now()-A;if(U>10&&n.envInFirst-A>1e3&&n.CLog(O+F("2ghS::低性能,耗时{1}ms",0,U),3),k){var Q=0;for(y=d;y<D;y++)null==l[y]?Q=1:l[y]=new Int16Array(0);Q?n.CLog(F("ufqH::未进入异步前不能清除buffers"),3):r?r.pcmSize-=I:n.recSize-=I}else P()}else n.state||n.CLog("envIn at state=0",3)},start:function(){var t=this,e=1;if(t.set.sourceStream?t.Stream||(e=0):s.IsOpen()||(e=0),e){var n=t._streamCtx();if(t.CLog(F("kLDN::start 开始录音,")+v(n)+" stream:"+t._streamTag),t._stop(),t.envStart(null,n[u]),t.state=3,t._SO&&t._SO+1!=t._S)t.CLog(F("Bp2y::start被中断"),3);else{t._SO=0;var i=function(){3==t.state&&(t.state=1,t.resume())},r="AudioContext resume: ";t._streamGet()._call[t.id]=function(){t.CLog(r+n.state+"|stream ok"),i()},m(n,(function(e){return e&&t.CLog(r+"wait..."),3==t.state}),(function(e){e&&t.CLog(r+n.state),i()}),(function(e){t.CLog(r+n.state+F("upkE::,可能无法录音:")+e,1),i()}))}}else t.CLog(F("6WmN::start失败:未open"),1)},pause:function(){var t=this,e=t._streamGet();t.state&&(t.state=2,t.CLog("pause"),e&&delete e._call[t.id])},resume:function(){var t=this,e=t._streamGet(),n="resume",i=n+"(wait ctx)";if(3==t.state)t.CLog(i);else if(t.state){t.state=1,t.CLog(n),t.envResume(),e&&(e._call[t.id]=function(e,n){1==t.state&&t.envIn(e,n)},w(e));var r=t._streamCtx();r&&m(r,(function(e){return e&&t.CLog(i+"..."),1==t.state}),(function(n){n&&t.CLog(i+r.state),w(e)}),(function(e){t.CLog(i+r.state+"[err]"+e,1)}))}},_stop:function(t){var e=this,n=e.set;e.isMock||e._S++,e.state&&(e.pause(),e.state=0),!t&&e[n.type+"_stop"]&&(e[n.type+"_stop"](e.engineCtx),e.engineCtx=0)},stop:function(t,e,n){var i,r=this,l=r.set,d=r.envInLast-r.envInFirst,p=d&&r.buffers.length;r.CLog(F("Xq4s::stop 和start时差:")+(d?d+"ms "+F("3CQP::补偿:")+r.envInFix+"ms envIn:"+p+" fps:"+(p/d*1e3).toFixed(1):"-")+" stream:"+r._streamTag+" ("+o+") LM:"+a);var f=function(){r._stop(),n&&r.close()},A=function(t){r.CLog(F("u8JG::结束录音失败:")+t,1),e&&e(t),f()},g=function(e,n,a){var o="blob",h="arraybuffer",u="dataType",d="DefaultDataType",p=r[u]||s[d]||o,g=u+"="+p,m=e instanceof ArrayBuffer,_=0,v=m?e.byteLength:e.size;if(p==h?m||(_=1):p==o?"function"!=typeof Blob?_=F.G("NonBrowser-1",[g])+F("1skY::,请设置{1}",0,c+"."+d+'="'+h+'"'):(m&&(e=new Blob([e],{type:n})),e instanceof Blob||(_=1),n=e.type||n):_=F.G("NotSupport-1",[g]),r.CLog(F("Wv7l::结束录音 编码花{1}ms 音频时长{2}ms 文件大小{3}b",0,Date.now()-i,a,v)+" "+g+","+n),_)A(1!=_?_:F("Vkbd::{1}编码器返回的不是{2}",0,l.type,p)+", "+g);else{if(l.takeoffEncodeChunk)r.CLog(F("QWnr::启用takeoffEncodeChunk后stop返回的blob长度为0不提供音频数据"),3);else if(v<Math.max(50,a/5))return void A(F("Sz2H::生成的{1}无效",0,l.type));t&&t(e,a,n),f()}};if(!r.isMock){var m=3==r.state;if(!r.state||m)return void A(F("wf9t::未开始录音")+(m?F("Dl2c::,开始录音前无用户交互导致AudioContext未运行"):""))}r._stop(!0);var _=r.recSize;if(_)if(r[l.type]){if(r.isMock){var v=r.envCheck(r.mockEnvInfo||{envName:"mock",canProcess:!1});if(v)return void A(F("AxOH::录音错误:")+v)}var y=r.engineCtx;if(r[l.type+"_complete"]&&y){var b=Math.round(y.pcmSize/l[u]*1e3);return i=Date.now(),void r[l.type+"_complete"](y,(function(t,e){g(t,e,b)}),A)}if(i=Date.now(),r.buffers[0]){var x=s.SampleData(r.buffers,r[h],l[u]);l[u]=x[u];var w=x.data;b=Math.round(w.length/l[u]*1e3);r.CLog(F("CxeT::采样:{1} 花:{2}ms",0,_+"->"+w.length,Date.now()-i)),setTimeout((function(){i=Date.now(),r[l.type](w,(function(t,e){g(t,e,b)}),(function(t){A(t)}))}))}else A(F("xkKd::音频buffers被释放"))}else A(F("xGuI::未加载{1}编码器,请尝试到{2}的src/engine内找到{1}的编码器并加载",0,l.type,c));else A(F("Ltz3::未采集到录音"))}};var L=function(t,e){e.pos||(e.pos=[0],e.tracks={},e.bytes=[]);var n=e.tracks,i=[e.pos[0]],r=function(){e.pos[0]=i[0]},s=e.bytes.length,a=new Uint8Array(s+t.length);if(a.set(e.bytes),a.set(t,s),e.bytes=a,!e._ht){if(O(a,i),U(a,i),!P(O(a,i),[24,83,128,103]))return;for(O(a,i);i[0]<a.length;){var o=O(a,i),c=U(a,i),l=[0],h=0;if(!c)return;if(P(o,[22,84,174,107])){for(;l[0]<c.length;){var d=O(c,l),p=U(c,l),f=[0],A={channels:0,sampleRate:0};if(P(d,[174]))for(;f[0]<p.length;){var g=O(p,f),m=U(p,f),_=[0];if(P(g,[215])){var v=k(m);A.number=v,n[v]=A}else if(P(g,[131])){1==(v=k(m))?A.type="video":2==v?(A.type="audio",h||(e.track0=A),A.idx=h++):A.type="Type-"+v}else if(P(g,[134])){for(var y="",b=0;b<m.length;b++)y+=String.fromCharCode(m[b]);A.codec=y}else if(P(g,[225]))for(;_[0]<m.length;){var x=O(m,_),w=U(m,_);if(P(x,[181])){v=0;var E=new Uint8Array(w.reverse()).buffer;4==w.length?v=new Float32Array(E)[0]:8==w.length?v=new Float64Array(E)[0]:T("WebM Track !Float",1,w),A[u]=Math.round(v)}else P(x,[98,100])?A.bitDepth=k(w):P(x,[159])&&(A.channels=k(w))}}}e._ht=1,T("WebM Tracks",n),r();break}}}var C=e.track0;if(C){var S=C[u];if(e.webmSR=S,16==C.bitDepth&&/FLOAT/i.test(C.codec)&&(C.bitDepth=32,T("WebM 16->32 bit",3)),S<8e3||32!=C.bitDepth||C.channels<1||!/(\b|_)PCM\b/i.test(C.codec))return e.bytes=[],e.bad||T("WebM Track Unexpected",3,e),e.bad=1,-1;for(var M=[],I=0;i[0]<a.length;){d=O(a,i);if(!(p=U(a,i)))break;if(P(d,[163])){var B=15&p[0];if(!(A=n[B]))return T("WebM !Track"+B,1,n),-1;if(0===A.idx){var R=new Uint8Array(p.length-4);for(b=4;b<p.length;b++)R[b-4]=p[b];M.push(R),I+=R.length}}r()}if(I){var D=new Uint8Array(a.length-e.pos[0]);D.set(a.subarray(e.pos[0])),e.bytes=D,e.pos[0]=0;R=new Uint8Array(I),b=0;for(var L=0;b<M.length;b++)R.set(M[b],L),L+=M[b].length;E=new Float32Array(R.buffer);if(C.channels>1){var N=[];for(b=0;b<E.length;)N.push(E[b]),b+=C.channels;E=new Float32Array(N)}return E}}},P=function(t,e){if(!t||t.length!=e.length)return!1;if(1==t.length)return t[0]==e[0];for(var n=0;n<t.length;n++)if(t[n]!=e[n])return!1;return!0},k=function(t){for(var e="",n=0;n<t.length;n++){var i=t[n];e+=(i<16?"0":"")+i.toString(16)}return parseInt(e,16)||0},O=function(t,e,n){var i=e[0];if(!(i>=t.length)){var r=("0000000"+t[i].toString(2)).substr(-8),s=/^(0*1)(\d*)$/.exec(r);if(s){var a=s[1].length,o=[];if(!(i+a>t.length)){for(var c=0;c<a;c++)o[c]=t[i],i++;return n&&(o[0]=parseInt(s[2]||"0",2)),e[0]=i,o}}}},U=function(t,e){var n=O(t,e,1);if(n){var i=k(n),r=e[0],s=[];if(i<2147483647){if(r+i>t.length)return;for(var a=0;a<i;a++)s[a]=t[r],r++}return e[0]=r,s}},N=s.i18n={lang:"zh-CN",alias:{"zh-CN":"zh","en-US":"en"},locales:{},data:{},put:function(t,e){var n=c+".i18n.put: ",i=t.overwrite;i=null==i||i;var r=t.lang;if(!(r=N.alias[r]||r))throw new Error(n+"set.lang?");var s=N.locales[r];s||(s={},N.locales[r]=s);for(var a,o=/^([\w\-]+):/,l=0;l<e.length;l++){var h=e[l];if(a=o.exec(h)){var u=a[1];h=h.substr(u.length+1);!i&&s[u]||(s[u]=h)}else T(n+"'key:'? "+h,3,t)}},get:function(){return N.v_G.apply(null,arguments)},v_G:function(t,e,n){e=e||[],n=n||N.lang,n=N.alias[n]||n;var i=N.locales[n],r=i&&i[t]||"";return r||"zh"==n?(N.lastLang=n,"=Empty"==r?"":r.replace(/\{(\d+)(\!?)\}/g,(function(n,i,s){return n=e[(i=+i||0)-1],(i<1||i>e.length)&&(n="{?}",T("i18n["+t+"] no {"+i+"}: "+r,3)),s?"":n}))):"en"==n?N.v_G(t,e,"zh"):N.v_G(t,e,"en")},$T:function(){return N.v_T.apply(null,arguments)},v_T:function(){for(var t,e=arguments,n="",r=[],s=0,a=c+".i18n.$T:",o=/^([\w\-]*):/,l=0;l<e.length;l++){var h=e[l];if(0==l){if(!(n=(t=o.exec(h))&&t[1]))throw new Error(a+"0 'key:'?");h=h.substr(n.length+1)}if(-1===s)r.push(h);else{if(s)throw new Error(a+" bad args");if(0===h)s=-1;else if(i(h)){if(h<1)throw new Error(a+" bad args");s=h}else{var u=1==l?"en":l?"":"zh";if((t=o.exec(h))&&(u=t[1]||u,h=h.substr(t[1].length+1)),!t||!u)throw new Error(a+l+" 'lang:'?");N.put({lang:u,overwrite:!1},[n+":"+h])}}}return n?s>0?n:N.v_G(n,r):""}},F=N.$T;F.G=N.get,F("NonBrowser-1::非浏览器环境,不支持{1}",1),F("IllegalArgs-1::参数错误:{1}",1),F("NeedImport-2::调用{1}需要先导入{2}",2),F("NotSupport-1::不支持:{1}",1),s.TrafficImgUrl="//ia.51.la/go1?id=20469973&pvFlag=1";var Q=s.Traffic=function(t){if(e){t=t?"/"+c+"/Report/"+t:"";var n=s.TrafficImgUrl;if(n){var i=s.Traffic,r=/^(https?:..[^\/#]*\/?)[^#]*/i.exec(location.href)||[],a=r[1]||"http://file/",o=(r[0]||a)+t;if(0==n.indexOf("//")&&(n=/^https:/i.test(o)?"https:"+n:"http:"+n),t&&(n=n+"&cu="+encodeURIComponent(a+t)),!i[o])i[o]=1,(new Image).src=n,T("Traffic Analysis Image: "+(t||c+".TrafficImgUrl="+s.TrafficImgUrl))}}};f&&(T(F("8HO5::覆盖导入{1}",0,c),1),f.Destroy());t[c]=s}(i,n),t.exports&&(t.exports=i.Recorder)}()}(tU);var eU=b(tU.exports);!function(t){var e="object"==typeof window&&!!window.document,n=(e?window:Object).Recorder,i=n.i18n;!function(t,e,n,i){t.prototype.enc_pcm={stable:!0,fast:!0,getTestMsg:function(){return n("fWsN::pcm为未封装的原始音频数据,pcm音频文件无法直接播放,可用Recorder.pcm2wav()转码成wav播放;支持位数8位、16位(填在比特率里面),采样率取值无限制")}};var r=function(e){var i=e.bitRate,r=8==i?8:16;i!=r&&t.CLog(n("uMUJ::PCM Info: 不支持{1}位,已更新成{2}位",0,i,r),3),e.bitRate=r};t.prototype.pcm=function(t,e,n){var i=this.set;r(i),e(s(t,i.bitRate).buffer,"audio/pcm")};var s=function(t,e){if(8==e)for(var n=t.length,i=new Uint8Array(n),r=0;r<n;r++){var s=128+(t[r]>>8);i[r]=s}else{t=new Int16Array(t);i=new Uint8Array(t.buffer)}return i};t.pcm2wav=function(e,i,r){e.blob||(e={blob:e});var s=e.blob,a=e.sampleRate||16e3,o=e.bitRate||16;if(e.sampleRate&&e.bitRate||t.CLog(n("KmRz::pcm2wav必须提供sampleRate和bitRate"),3),t.prototype.wav){var c=function(e,n){var s;if(8==o){var c=new Uint8Array(e);s=new Int16Array(c.length);for(var l=0;l<c.length;l++)s[l]=c[l]-128<<8}else s=new Int16Array(e);var h=t({type:"wav",sampleRate:a,bitRate:o});n&&(h.dataType="arraybuffer"),h.mock(s,a).stop((function(t,e,n){i(t,e,n)}),r)};if(s instanceof ArrayBuffer)c(s,1);else{var l=new FileReader;l.onloadend=function(){c(l.result)},l.readAsArrayBuffer(s)}}else r(n.G("NeedImport-2",["pcm2wav","src/engine/wav.js"]))},t.prototype.pcm_envCheck=function(t,e){return""},t.prototype.pcm_start=function(t){return r(t),{set:t,memory:new Uint8Array(5e5),mOffset:0}};var a=function(t,e){var n=e.length;if(t.mOffset+n>t.memory.length){var i=new Uint8Array(t.memory.length+Math.max(5e5,n));i.set(t.memory.subarray(0,t.mOffset)),t.memory=i}t.memory.set(e,t.mOffset),t.mOffset+=n};t.prototype.pcm_stop=function(t){t&&t.memory&&(t.memory=null)},t.prototype.pcm_encode=function(t,e){if(t&&t.memory){var n=t.set,i=s(e,n.bitRate);n.takeoffEncodeChunk?n.takeoffEncodeChunk(i):a(t,i)}},t.prototype.pcm_complete=function(t,e,i,r){t&&t.memory?(r&&this.pcm_stop(t),e(t.memory.buffer.slice(0,t.mOffset),"audio/pcm")):i(n("sDkA::pcm编码器未start"))}}(n,0,i.$T)}();class nU{url;ws=null;callback=null;isDestroyed=!1;constructor(t){this.url=t}connect(t={}){return new Promise(((e,n)=>{const i=new WebSocket(this.url);this.ws=i,i.onopen=()=>{t.onopen&&t.onopen(),e()},i.onerror=e=>{t.onerror&&t.onerror(e),n(e)},i.onclose=e=>{this.isDestroyed||setTimeout((()=>{this.connect(t)}),200),t.onclose&&t.onclose(e),n(e)},i.onmessage=e=>{t.onmessage&&t.onmessage(),this.callback&&this.callback(JSON.parse(e.data))}}))}send(t){if(this.ws&&this.ws.readyState===WebSocket.OPEN){let e=t;return"[object Object]"===Object.prototype.toString.call(t)&&(e=JSON.stringify(t)),this.ws.send(e),Promise.resolve()}return Promise.reject(new Error("WebSocket is not connected"))}close(){this.ws&&this.ws.close()}onMessage(t){this.callback=t}isReady(){return!!this.ws&&this.ws.readyState===WebSocket.OPEN}destroy(){this.isDestroyed=!0,this.ws&&(this.ws.close(),this.ws=null),this.callback=null}}var iU="data:audio/wav;base64,UklGRkYAAABXQVZFZm10IBAAAAABAAEARKwAAIhYAQACABAATElTVBoAAABJTkZPSVNGVA0AAABMYXZmNjEuMS4xMDAAAGRhdGEAAAAA";let rU=class extends _{recorder;socket=null;audioBuffer=new Int16Array;Recorder=eU;mediaStream=null;firstRequestPermision=!0;constructor(){super(),eU.TrafficImgUrl="",this.recorder=eU({debug:!1,type:"pcm",bitRate:16,sampleRate:16e3,onProcess:this.onProcess}),this.connectSocket()}start(t=""){const e={token:t,action:"speech_to_text",chunk_size:new Array(5,10,5),wav_name:"h5",is_speaking:!0,chunk_interval:10,itn:!1,mode:"2pass",hotwords:JSON.stringify({})};return this.socket.send(e),this.open()}stop(){this.recorder.stop();const t={chunk_size:new Array(5,10,5),wav_name:"h5",is_speaking:!1,chunk_interval:10,mode:"2pass"};return this.socket.send(t),this.close()}async closeRecording(){return this.mediaStream&&(this.mediaStream.getTracks().forEach((t=>t.stop())),this.mediaStream=null),eU.IsOpen()?this.recorder.close():Promise.resolve(!0)}async requestRecorderPermission(){return new Promise((t=>{if(eU.IsOpen())return t({code:0,data:{isUserNotAllow:!1},msg:"success"});this.recorder.open((()=>{if(this.firstRequestPermision){this.firstRequestPermision=!1;const t=new xD;t.setUrl(iU).then((()=>{t.play()}))}t({code:0,data:{isUserNotAllow:!1},msg:"success"})}))}))}isOpen(){return eU.IsOpen()}resume(){this.isOpen()&&this.recorder.resume()}connectSocket(){const t=CT.getItem(MT);"WebSocket"in window?(this.socket||(this.socket=new nU(t)),this.socket.connect().then((()=>{})).catch((t=>{})),this.socket.onMessage((t=>{t.is_final&&(t.text=t.text.replace(/[,,。.!!??;;]$/,"")),this.emit("message",t)}))):this.emit("error",{message:"当前浏览器不支持 WebSocket"})}onProcess=(t,e,n,i,r,s)=>{const a=t[t.length-1],o=new Array(a),c=eU.SampleData(o,i,16e3).data;this.audioBuffer=Int16Array.from([...this.audioBuffer,...c]);for(;this.audioBuffer.length>=960;){const t=this.audioBuffer.slice(0,960);this.audioBuffer=this.audioBuffer.slice(960,this.audioBuffer.length),this.socket&&this.socket.isReady()&&this.socket.send(t)}};async open(){return new Promise((t=>{if(eU.IsOpen())return this.recorder.start(),t({code:0,data:{isUserNotAllow:!1},msg:"success"});this.recorder.open((()=>(this.recorder.start(),t({code:0,data:{isUserNotAllow:!1},msg:"success"}))),((e,n)=>t({code:-1,data:{isUserNotAllow:n},msg:e})))}))}close(){return new Promise((t=>{this.recorder.close((()=>t({code:0,data:null,msg:"success"})))}))}destroy(){this.socket&&(this.socket.destroy(),this.socket=null)}};const sU=class{list=[];isExecute=!1;runList=[];constructor(){}add(t){if("[object AsyncFunction]"!==Object.prototype.toString.call(t))throw new Error("Task mast be AsyncFunction.");this.list.push(t),this.isExecute||this.execute()}execute(){if(this.isExecute=!0,this.list.length>0){const t=this.list.shift();this.runList.push({task:t}),t().then((()=>{this.runList.findIndex((e=>e.task===t))>=0&&this.execute()}))}else this.isExecute=!1}clear(){this.runList=[],this.list=[],this.isExecute=!1}hasRuning(){return this.list.length>0||this.isExecute}};class aU{constructor(){this._preprocessing=!1}split(t,e=20){const n=/(?:[!?。!?:])\s*/g,i=t.split(n),r=t.match(n)||[],s=[];let a="";for(let t=0;t<i.length;t++){const n=i[t],o=r[t]||"";a+=n+o;const c=a.length+n.length+o.length;this._preprocessing&&c>16?(this._preprocessing=!1,s.push(a.slice(0,8)),s.push(a.slice(8)),a=""):c>=e&&(s.push(a),a="")}let o=t;for(const t of s)o=o.replace(t,"",1);return o&&s.push(o),s}}class oU{callback;pushCallback;buffer="";triggerCharacters=[".","!","?","。","!","?","\n"];minLength=6;messages=[];startPushed=!1;constructor(t,e){this.buffer="",this.startPushed=!1,this.callback=t,this.pushCallback=e}processMessage(t){if(this.messages.push(t),"message_end"===t.event)return this.buffer+=t.answer||"",void this.pushMessage(this.buffer,{isEnd:!0,type:"message"});if(!t||!t.answer)return;if(this.buffer+=t.answer,this.checkAndDoAction())return;if(this.buffer.length<this.minLength)return;const e=this.includeIndex(t.answer);if(e>=0){let n=this.buffer;const i=t.answer.length,r=this.buffer;i>1&&(n=this.buffer.substring(0,this.buffer.length-i+e+1)),this.pushMessage(n,{isEnd:!1,type:"message"}),i>1&&(this.buffer+=r.substring(r.length-i+e+1))}}includeIndex(t){return t.split("").findIndex((t=>this.triggerCharacters.includes(t)))}pushMessage(t,e){this.callback(t,e),this.buffer="",this.startPushed&&this.executePushCallback()}checkAndDoAction(){return/^\[#?"?”?.*#?"?“?\]\n?/.test(this.buffer)?(this.pushMessage(this.buffer.replace(/^\[#?"?”?(.*?)"?“?#?\]\n?/,"$1"),{isEnd:!1,type:"action"}),this.messages=[],!0):!(!this.buffer.startsWith("[#")&&!this.buffer.startsWith('["'))}executePushCallback(){this.startPushed=!0;const t=[...this.messages];0!==t.length&&(this.messages=[],this.pushCallback({code:0,msg:"success",data:t}))}}class cU extends _{recorder;socket=null;audioBuffer=new Int16Array;Recorder=eU;firstRequestPermision=!0;isSending=!1;timeout=null;config={level:15};BUFFER_SIZE=8e3;receiveTimeout=null;waitTime=800;constructor(t){super(),this.config=t,this.waitTime=t.waitTime||800,eU.TrafficImgUrl="",this.recorder=eU({debug:!1,type:"pcm",bitRate:16,sampleRate:16e3,audioTrackSet:{noiseSuppression:!0,echoCancellation:!0,autoGainControl:!0,channelCount:1},onProcess:this.onProcess}),this.connectSocket()}start(){if(this.socket&&this.socket.isReady()){const t={token:this.config.token,action:"speech_to_text",chunk_size:new Array(5,10,5),wav_name:"h5",is_speaking:!0,chunk_interval:10,itn:!1,mode:"2pass",hotwords:JSON.stringify({})};this.socket.send(t),this.isSending=!0,this.emit(bT.RECORDER_START)}}stop(){if(this.socket&&this.socket.isReady()){const t={chunk_size:new Array(5,10,5),wav_name:"h5",is_speaking:!1,chunk_interval:10,mode:"2pass"};this.socket.send(t),this.isSending=!1,this.emit(bT.RECORDER_STOP)}}async closeRecording(){return eU.IsOpen()?this.recorder.close():Promise.resolve(!0)}async requestRecorderPermission(){return new Promise((t=>{if(eU.IsOpen())return t({code:0,data:{isUserNotAllow:!1},msg:"success"});this.recorder.open((()=>{if(this.firstRequestPermision){this.firstRequestPermision=!1;const t=new xD;t.setUrl(iU).then((()=>{t.play()}))}t({code:0,data:{isUserNotAllow:!1},msg:"success"})}))}))}isOpen(){return eU.IsOpen()}resume(){this.isOpen()&&this.recorder.resume()}connectSocket(){const t=CT.getItem(MT);"WebSocket"in window?(this.socket||(this.socket=new nU(t)),this.socket.connect({onopen:()=>{},onclose:t=>{this.isSending=!1},onerror:t=>{this.isSending=!1}}).then((()=>{})).catch((t=>{})),this.socket.onMessage((t=>{t.text&&(t.is_final&&(t.text=vD(t.text)),this.emit(bT.ASRTEXT,t))}))):this.emit(bT.HUMAN_ERROR,{message:"当前浏览器不支持 WebSocket"})}onProcess=(t,e,n,i,r,s)=>{const a=t[t.length-1],o=new Array(a),c=eU.SampleData(o,i,16e3).data;this.addAudioBuffer(c),this.dealAudioData(e,this.config.level)};computeAudioEnergy(t){if(0===t.length)return 0;let e=0;for(let n=0;n<t.length;n++){const i=Math.abs(t[n]);i>e&&(e=i)}return Math.min(9,Math.floor(e/32767*9))}addAudioBuffer(t){const e=new Int16Array([...this.audioBuffer,...t]);e.length>this.BUFFER_SIZE?this.audioBuffer=e.subarray(e.length-this.BUFFER_SIZE):this.audioBuffer=e}dealAudioData(t,e=3){const n=()=>{for(;this.audioBuffer.length>=960;){const t=this.audioBuffer.slice(0,960);this.audioBuffer=this.audioBuffer.slice(960,this.audioBuffer.length),this.sendMessage(t)}};t>e?(this.receiveTimeout&&clearTimeout(this.receiveTimeout),this.receiveTimeout=setTimeout((()=>{this.receiveTimeout=null,this.stop()}),this.waitTime),n()):this.isSending&&n()}checkAudioActivityByRMS(t,e=.01){let n=0;for(let e=0;e<t.length;e++)n+=t[e]*t[e];return Math.sqrt(n/t.length)/32768>e}async openRecording(){return new Promise((t=>{if(eU.IsOpen())return this.recorder.start(),t({code:0,data:{isUserNotAllow:!1},msg:"success"});this.recorder.open((()=>(this.recorder.start(),t({code:0,data:{isUserNotAllow:!1},msg:"success"}))),((e,n)=>t({code:-1,data:{isUserNotAllow:n},msg:e})))}))}sendMessage(t){this.socket&&this.socket.isReady()&&(this.isSending||this.start(),this.emit(bT.RECORDER_SENDING,t),this.socket.send(t))}}function lU(t){return Array.isArray?Array.isArray(t):"[object Array]"===_U(t)}const hU=1/0;function uU(t){return null==t?"":function(t){if("string"==typeof t)return t;let e=t+"";return"0"==e&&1/t==-hU?"-0":e}(t)}function dU(t){return"string"==typeof t}function pU(t){return"number"==typeof t}function fU(t){return!0===t||!1===t||function(t){return AU(t)&&null!==t}(t)&&"[object Boolean]"==_U(t)}function AU(t){return"object"==typeof t}function gU(t){return null!=t}function mU(t){return!t.trim().length}function _U(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}const vU=t=>`Missing ${t} property in key`,yU=t=>`Property 'weight' in key '${t}' must be a positive integer`,bU=Object.prototype.hasOwnProperty;class xU{constructor(t){this._keys=[],this._keyMap={};let e=0;t.forEach((t=>{let n=wU(t);this._keys.push(n),this._keyMap[n.id]=n,e+=n.weight})),this._keys.forEach((t=>{t.weight/=e}))}get(t){return this._keyMap[t]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function wU(t){let e=null,n=null,i=null,r=1,s=null;if(dU(t)||lU(t))i=t,e=EU(t),n=CU(t);else{if(!bU.call(t,"name"))throw new Error(vU("name"));const a=t.name;if(i=a,bU.call(t,"weight")&&(r=t.weight,r<=0))throw new Error(yU(a));e=EU(a),n=CU(a),s=t.getFn}return{path:e,id:n,weight:r,src:i,getFn:s}}function EU(t){return lU(t)?t:t.split(".")}function CU(t){return lU(t)?t.join("."):t}var SU={isCaseSensitive:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(t,e)=>t.score===e.score?t.idx<e.idx?-1:1:t.score<e.score?-1:1,includeMatches:!1,findAllMatches:!1,minMatchCharLength:1,location:0,threshold:.6,distance:100,...{useExtendedSearch:!1,getFn:function(t,e){let n=[],i=!1;const r=(t,e,s)=>{if(gU(t))if(e[s]){const a=t[e[s]];if(!gU(a))return;if(s===e.length-1&&(dU(a)||pU(a)||fU(a)))n.push(uU(a));else if(lU(a)){i=!0;for(let t=0,n=a.length;t<n;t+=1)r(a[t],e,s+1)}else e.length&&r(a,e,s+1)}else n.push(t)};return r(t,dU(e)?e.split("."):e,0),i?n:n[0]},ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1}};const MU=/[^ ]+/g;class IU{constructor({getFn:t=SU.getFn,fieldNormWeight:e=SU.fieldNormWeight}={}){this.norm=function(t=1,e=3){const n=new Map,i=Math.pow(10,e);return{get(e){const r=e.match(MU).length;if(n.has(r))return n.get(r);const s=1/Math.pow(r,.5*t),a=parseFloat(Math.round(s*i)/i);return n.set(r,a),a},clear(){n.clear()}}}(e,3),this.getFn=t,this.isCreated=!1,this.setIndexRecords()}setSources(t=[]){this.docs=t}setIndexRecords(t=[]){this.records=t}setKeys(t=[]){this.keys=t,this._keysMap={},t.forEach(((t,e)=>{this._keysMap[t.id]=e}))}create(){!this.isCreated&&this.docs.length&&(this.isCreated=!0,dU(this.docs[0])?this.docs.forEach(((t,e)=>{this._addString(t,e)})):this.docs.forEach(((t,e)=>{this._addObject(t,e)})),this.norm.clear())}add(t){const e=this.size();dU(t)?this._addString(t,e):this._addObject(t,e)}removeAt(t){this.records.splice(t,1);for(let e=t,n=this.size();e<n;e+=1)this.records[e].i-=1}getValueForItemAtKeyId(t,e){return t[this._keysMap[e]]}size(){return this.records.length}_addString(t,e){if(!gU(t)||mU(t))return;let n={v:t,i:e,n:this.norm.get(t)};this.records.push(n)}_addObject(t,e){let n={i:e,$:{}};this.keys.forEach(((e,i)=>{let r=e.getFn?e.getFn(t):this.getFn(t,e.path);if(gU(r))if(lU(r)){let t=[];const e=[{nestedArrIndex:-1,value:r}];for(;e.length;){const{nestedArrIndex:n,value:i}=e.pop();if(gU(i))if(dU(i)&&!mU(i)){let e={v:i,i:n,n:this.norm.get(i)};t.push(e)}else lU(i)&&i.forEach(((t,n)=>{e.push({nestedArrIndex:n,value:t})}))}n.$[i]=t}else if(dU(r)&&!mU(r)){let t={v:r,n:this.norm.get(r)};n.$[i]=t}})),this.records.push(n)}toJSON(){return{keys:this.keys,records:this.records}}}function TU(t,e,{getFn:n=SU.getFn,fieldNormWeight:i=SU.fieldNormWeight}={}){const r=new IU({getFn:n,fieldNormWeight:i});return r.setKeys(t.map(wU)),r.setSources(e),r.create(),r}function BU(t,{errors:e=0,currentLocation:n=0,expectedLocation:i=0,distance:r=SU.distance,ignoreLocation:s=SU.ignoreLocation}={}){const a=e/t.length;if(s)return a;const o=Math.abs(i-n);return r?a+o/r:o?1:a}const RU=32;function DU(t,e,n,{location:i=SU.location,distance:r=SU.distance,threshold:s=SU.threshold,findAllMatches:a=SU.findAllMatches,minMatchCharLength:o=SU.minMatchCharLength,includeMatches:c=SU.includeMatches,ignoreLocation:l=SU.ignoreLocation}={}){if(e.length>RU)throw new Error(`Pattern length exceeds max of ${RU}.`);const h=e.length,u=t.length,d=Math.max(0,Math.min(i,u));let p=s,f=d;const A=o>1||c,g=A?Array(u):[];let m;for(;(m=t.indexOf(e,f))>-1;){let t=BU(e,{currentLocation:m,expectedLocation:d,distance:r,ignoreLocation:l});if(p=Math.min(t,p),f=m+h,A){let t=0;for(;t<h;)g[m+t]=1,t+=1}}f=-1;let _=[],v=1,y=h+u;const b=1<<h-1;for(let i=0;i<h;i+=1){let s=0,o=y;for(;s<o;){BU(e,{errors:i,currentLocation:d+o,expectedLocation:d,distance:r,ignoreLocation:l})<=p?s=o:y=o,o=Math.floor((y-s)/2+s)}y=o;let c=Math.max(1,d-o+1),m=a?u:Math.min(d+o,u)+h,x=Array(m+2);x[m+1]=(1<<i)-1;for(let s=m;s>=c;s-=1){let a=s-1,o=n[t.charAt(a)];if(A&&(g[a]=+!!o),x[s]=(x[s+1]<<1|1)&o,i&&(x[s]|=(_[s+1]|_[s])<<1|1|_[s+1]),x[s]&b&&(v=BU(e,{errors:i,currentLocation:a,expectedLocation:d,distance:r,ignoreLocation:l}),v<=p)){if(p=v,f=a,f<=d)break;c=Math.max(1,2*d-f)}}if(BU(e,{errors:i+1,currentLocation:d,expectedLocation:d,distance:r,ignoreLocation:l})>p)break;_=x}const x={isMatch:f>=0,score:Math.max(.001,v)};if(A){const t=function(t=[],e=SU.minMatchCharLength){let n=[],i=-1,r=-1,s=0;for(let a=t.length;s<a;s+=1){let a=t[s];a&&-1===i?i=s:a||-1===i||(r=s-1,r-i+1>=e&&n.push([i,r]),i=-1)}return t[s-1]&&s-i>=e&&n.push([i,s-1]),n}(g,o);t.length?c&&(x.indices=t):x.isMatch=!1}return x}function LU(t){let e={};for(let n=0,i=t.length;n<i;n+=1){const r=t.charAt(n);e[r]=(e[r]||0)|1<<i-n-1}return e}class PU{constructor(t,{location:e=SU.location,threshold:n=SU.threshold,distance:i=SU.distance,includeMatches:r=SU.includeMatches,findAllMatches:s=SU.findAllMatches,minMatchCharLength:a=SU.minMatchCharLength,isCaseSensitive:o=SU.isCaseSensitive,ignoreLocation:c=SU.ignoreLocation}={}){if(this.options={location:e,threshold:n,distance:i,includeMatches:r,findAllMatches:s,minMatchCharLength:a,isCaseSensitive:o,ignoreLocation:c},this.pattern=o?t:t.toLowerCase(),this.chunks=[],!this.pattern.length)return;const l=(t,e)=>{this.chunks.push({pattern:t,alphabet:LU(t),startIndex:e})},h=this.pattern.length;if(h>RU){let t=0;const e=h%RU,n=h-e;for(;t<n;)l(this.pattern.substr(t,RU),t),t+=RU;if(e){const t=h-RU;l(this.pattern.substr(t),t)}}else l(this.pattern,0)}searchIn(t){const{isCaseSensitive:e,includeMatches:n}=this.options;if(e||(t=t.toLowerCase()),this.pattern===t){let e={isMatch:!0,score:0};return n&&(e.indices=[[0,t.length-1]]),e}const{location:i,distance:r,threshold:s,findAllMatches:a,minMatchCharLength:o,ignoreLocation:c}=this.options;let l=[],h=0,u=!1;this.chunks.forEach((({pattern:e,alphabet:d,startIndex:p})=>{const{isMatch:f,score:A,indices:g}=DU(t,e,d,{location:i+p,distance:r,threshold:s,findAllMatches:a,minMatchCharLength:o,includeMatches:n,ignoreLocation:c});f&&(u=!0),h+=A,f&&g&&(l=[...l,...g])}));let d={isMatch:u,score:u?h/this.chunks.length:1};return u&&n&&(d.indices=l),d}}class kU{constructor(t){this.pattern=t}static isMultiMatch(t){return OU(t,this.multiRegex)}static isSingleMatch(t){return OU(t,this.singleRegex)}search(){}}function OU(t,e){const n=t.match(e);return n?n[1]:null}class UU extends kU{constructor(t,{location:e=SU.location,threshold:n=SU.threshold,distance:i=SU.distance,includeMatches:r=SU.includeMatches,findAllMatches:s=SU.findAllMatches,minMatchCharLength:a=SU.minMatchCharLength,isCaseSensitive:o=SU.isCaseSensitive,ignoreLocation:c=SU.ignoreLocation}={}){super(t),this._bitapSearch=new PU(t,{location:e,threshold:n,distance:i,includeMatches:r,findAllMatches:s,minMatchCharLength:a,isCaseSensitive:o,ignoreLocation:c})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(t){return this._bitapSearch.searchIn(t)}}class NU extends kU{constructor(t){super(t)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(t){let e,n=0;const i=[],r=this.pattern.length;for(;(e=t.indexOf(this.pattern,n))>-1;)n=e+r,i.push([e,n-1]);const s=!!i.length;return{isMatch:s,score:s?0:1,indices:i}}}const FU=[class extends kU{constructor(t){super(t)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(t){const e=t===this.pattern;return{isMatch:e,score:e?0:1,indices:[0,this.pattern.length-1]}}},NU,class extends kU{constructor(t){super(t)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(t){const e=t.startsWith(this.pattern);return{isMatch:e,score:e?0:1,indices:[0,this.pattern.length-1]}}},class extends kU{constructor(t){super(t)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(t){const e=!t.startsWith(this.pattern);return{isMatch:e,score:e?0:1,indices:[0,t.length-1]}}},class extends kU{constructor(t){super(t)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(t){const e=!t.endsWith(this.pattern);return{isMatch:e,score:e?0:1,indices:[0,t.length-1]}}},class extends kU{constructor(t){super(t)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(t){const e=t.endsWith(this.pattern);return{isMatch:e,score:e?0:1,indices:[t.length-this.pattern.length,t.length-1]}}},class extends kU{constructor(t){super(t)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(t){const e=-1===t.indexOf(this.pattern);return{isMatch:e,score:e?0:1,indices:[0,t.length-1]}}},UU],QU=FU.length,zU=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/;const GU=new Set([UU.type,NU.type]);class HU{constructor(t,{isCaseSensitive:e=SU.isCaseSensitive,includeMatches:n=SU.includeMatches,minMatchCharLength:i=SU.minMatchCharLength,ignoreLocation:r=SU.ignoreLocation,findAllMatches:s=SU.findAllMatches,location:a=SU.location,threshold:o=SU.threshold,distance:c=SU.distance}={}){this.query=null,this.options={isCaseSensitive:e,includeMatches:n,minMatchCharLength:i,findAllMatches:s,ignoreLocation:r,location:a,threshold:o,distance:c},this.pattern=e?t:t.toLowerCase(),this.query=function(t,e={}){return t.split("|").map((t=>{let n=t.trim().split(zU).filter((t=>t&&!!t.trim())),i=[];for(let t=0,r=n.length;t<r;t+=1){const r=n[t];let s=!1,a=-1;for(;!s&&++a<QU;){const t=FU[a];let n=t.isMultiMatch(r);n&&(i.push(new t(n,e)),s=!0)}if(!s)for(a=-1;++a<QU;){const t=FU[a];let n=t.isSingleMatch(r);if(n){i.push(new t(n,e));break}}}return i}))}(this.pattern,this.options)}static condition(t,e){return e.useExtendedSearch}searchIn(t){const e=this.query;if(!e)return{isMatch:!1,score:1};const{includeMatches:n,isCaseSensitive:i}=this.options;t=i?t:t.toLowerCase();let r=0,s=[],a=0;for(let i=0,o=e.length;i<o;i+=1){const o=e[i];s.length=0,r=0;for(let e=0,i=o.length;e<i;e+=1){const i=o[e],{isMatch:c,indices:l,score:h}=i.search(t);if(!c){a=0,r=0,s.length=0;break}if(r+=1,a+=h,n){const t=i.constructor.type;GU.has(t)?s=[...s,...l]:s.push(l)}}if(r){let t={isMatch:!0,score:a/r};return n&&(t.indices=s),t}}return{isMatch:!1,score:1}}}const VU=[];function jU(t,e){for(let n=0,i=VU.length;n<i;n+=1){let i=VU[n];if(i.condition(t,e))return new i(t,e)}return new PU(t,e)}const WU="$and",qU="$or",YU="$path",XU="$val",JU=t=>!(!t[WU]&&!t[qU]),KU=t=>({[WU]:Object.keys(t).map((e=>({[e]:t[e]})))});function ZU(t,e,{auto:n=!0}={}){const i=t=>{let r=Object.keys(t);const s=(t=>!!t[YU])(t);if(!s&&r.length>1&&!JU(t))return i(KU(t));if((t=>!lU(t)&&AU(t)&&!JU(t))(t)){const i=s?t[YU]:r[0],a=s?t[XU]:t[i];if(!dU(a))throw new Error((t=>`Invalid value for key ${t}`)(i));const o={keyId:CU(i),pattern:a};return n&&(o.searcher=jU(a,e)),o}let a={children:[],operator:r[0]};return r.forEach((e=>{const n=t[e];lU(n)&&n.forEach((t=>{a.children.push(i(t))}))})),a};return JU(t)||(t=KU(t)),i(t)}function $U(t,e){const n=t.matches;e.matches=[],gU(n)&&n.forEach((t=>{if(!gU(t.indices)||!t.indices.length)return;const{indices:n,value:i}=t;let r={indices:n,value:i};t.key&&(r.key=t.key.src),t.idx>-1&&(r.refIndex=t.idx),e.matches.push(r)}))}function tN(t,e){e.score=t.score}class eN{constructor(t,e={},n){this.options={...SU,...e},this.options.useExtendedSearch,this._keyStore=new xU(this.options.keys),this.setCollection(t,n)}setCollection(t,e){if(this._docs=t,e&&!(e instanceof IU))throw new Error("Incorrect 'index' type");this._myIndex=e||TU(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(t){gU(t)&&(this._docs.push(t),this._myIndex.add(t))}remove(t=()=>!1){const e=[];for(let n=0,i=this._docs.length;n<i;n+=1){const r=this._docs[n];t(r,n)&&(this.removeAt(n),n-=1,i-=1,e.push(r))}return e}removeAt(t){this._docs.splice(t,1),this._myIndex.removeAt(t)}getIndex(){return this._myIndex}search(t,{limit:e=-1}={}){const{includeMatches:n,includeScore:i,shouldSort:r,sortFn:s,ignoreFieldNorm:a}=this.options;let o=dU(t)?dU(this._docs[0])?this._searchStringList(t):this._searchObjectList(t):this._searchLogical(t);return function(t,{ignoreFieldNorm:e=SU.ignoreFieldNorm}){t.forEach((t=>{let n=1;t.matches.forEach((({key:t,norm:i,score:r})=>{const s=t?t.weight:null;n*=Math.pow(0===r&&s?Number.EPSILON:r,(s||1)*(e?1:i))})),t.score=n}))}(o,{ignoreFieldNorm:a}),r&&o.sort(s),pU(e)&&e>-1&&(o=o.slice(0,e)),function(t,e,{includeMatches:n=SU.includeMatches,includeScore:i=SU.includeScore}={}){const r=[];return n&&r.push($U),i&&r.push(tN),t.map((t=>{const{idx:n}=t,i={item:e[n],refIndex:n};return r.length&&r.forEach((e=>{e(t,i)})),i}))}(o,this._docs,{includeMatches:n,includeScore:i})}_searchStringList(t){const e=jU(t,this.options),{records:n}=this._myIndex,i=[];return n.forEach((({v:t,i:n,n:r})=>{if(!gU(t))return;const{isMatch:s,score:a,indices:o}=e.searchIn(t);s&&i.push({item:t,idx:n,matches:[{score:a,value:t,norm:r,indices:o}]})})),i}_searchLogical(t){const e=ZU(t,this.options),n=(t,e,i)=>{if(!t.children){const{keyId:n,searcher:r}=t,s=this._findMatches({key:this._keyStore.get(n),value:this._myIndex.getValueForItemAtKeyId(e,n),searcher:r});return s&&s.length?[{idx:i,item:e,matches:s}]:[]}const r=[];for(let s=0,a=t.children.length;s<a;s+=1){const a=t.children[s],o=n(a,e,i);if(o.length)r.push(...o);else if(t.operator===WU)return[]}return r},i=this._myIndex.records,r={},s=[];return i.forEach((({$:t,i:i})=>{if(gU(t)){let a=n(e,t,i);a.length&&(r[i]||(r[i]={idx:i,item:t,matches:[]},s.push(r[i])),a.forEach((({matches:t})=>{r[i].matches.push(...t)})))}})),s}_searchObjectList(t){const e=jU(t,this.options),{keys:n,records:i}=this._myIndex,r=[];return i.forEach((({$:t,i:i})=>{if(!gU(t))return;let s=[];n.forEach(((n,i)=>{s.push(...this._findMatches({key:n,value:t[i],searcher:e}))})),s.length&&r.push({idx:i,item:t,matches:s})})),r}_findMatches({key:t,value:e,searcher:n}){if(!gU(e))return[];let i=[];if(lU(e))e.forEach((({v:e,i:r,n:s})=>{if(!gU(e))return;const{isMatch:a,score:o,indices:c}=n.searchIn(e);a&&i.push({score:o,key:t,value:e,idx:r,norm:s,indices:c})}));else{const{v:r,n:s}=e,{isMatch:a,score:o,indices:c}=n.searchIn(r);a&&i.push({score:o,key:t,value:r,norm:s,indices:c})}return i}}eN.version="7.0.0",eN.createIndex=TU,eN.parseIndex=function(t,{getFn:e=SU.getFn,fieldNormWeight:n=SU.fieldNormWeight}={}){const{keys:i,records:r}=t,s=new IU({getFn:e,fieldNormWeight:n});return s.setKeys(i),s.setIndexRecords(r),s},eN.config=SU,eN.parseQuery=ZU,function(...t){VU.push(...t)}(HU);class nN{fuse;phrases=[];constructor(t,e){const n={includeScore:!0,threshold:.3,keys:["phrase"],...e};this.phrases=t,this.fuse=new eN(t.map((t=>({phrase:t}))),n)}fuzzyMatch(t){return this.fuse.search(t).map((t=>t.item.phrase))}accurateMatching(t,e=1e-4){let n="";if(this.phrases.forEach((e=>{t.indexOf(e)>=0&&(n=e)})),n)return[n];return this.fuse.search(t).filter((t=>t.score&&t.score<e)).map((t=>t.item.phrase))}}var iN;!function(t){t.SLEEP="SLEEP",t.LISTENING="LISTENING",t.RECORDING="RECORDING",t.PROCESSING="PROCESSING",t.SPEAKING="SPEAKING"}(iN||(iN={}));var rN,sN,aN=new class extends _{isInitialized=!1;recorder;wakeFuse;exitFuse;interruptFuse;config={};currentState=iN.SLEEP;isWake=!1;lastRecordTime=Date.now();EXIT_TIME=18e4;taskInterval;onAnyEvent=null;keepActive=!1;constructor(){super()}async initialize(t){return this.config={...t},this.wakeFuse=new nN(t.wakeWords,{threshold:1e-4}),this.exitFuse=new nN(t.exitWords,{threshold:1e-4}),this.interruptFuse=new nN(t.interruptWorlds,{threshold:1e-4}),this.currentState=iN.SLEEP,this.recorder=new cU({token:t.gatewayToken,level:t.level,waitTime:t.waitTime}),this.EXIT_TIME=t.exitTime,this.keepActive=t.keepActive,this.onAnyEvent=(t,e)=>{switch(this.emit(String(t),e),t){case bT.ASRTEXT:if(e.is_final){if(this.keepActive)return this.emit(bT.VOICE2TEXT,e);const t=vD(e.text,!1);if(this.wakeWordDetection(t))return this.onWakeDetected();if(this.exitWordDetection(t))return this.onSleepDetected();if(this.interruptWordDetection(t))return this.onInterruptDetected();this.emit(bT.VOICE2TEXT,e)}break;case bT.RECORDER_SENDING:this.lastRecordTime=Date.now();break;case bT.RECORDER_START:this.isWake&&this.emit(bT.WAKE_RECORDER_START);break;case bT.RECORDER_STOP:this.isWake&&!this.keepActive&&this.emit(bT.WAKE_RECORDER_STOP)}},this.recorder.onAny(this.onAnyEvent),await this.recorder.openRecording(),this.keepActive&&this.onWakeDetected(),Promise.resolve()}wakeWordDetection(t){return this.wakeFuse.accurateMatching(t).length>0}exitWordDetection(t){return this.exitFuse.accurateMatching(t).length>0}interruptWordDetection(t){return this.interruptFuse.accurateMatching(t).length>0}onWakeDetected(){this.isWake=!0,this.emit(bT.VOICE_WAKE),this.keepActive||(this.taskInterval&&clearInterval(this.taskInterval),this.taskInterval=setInterval((()=>{Date.now()-this.lastRecordTime>this.EXIT_TIME&&(this.isWake=!1,clearInterval(this.taskInterval),this.emit(bT.VOICE_SLEEP))}),1e3))}onSleepDetected(){this.emit(bT.VOICE_SLEEP),this.isWake=!1,this.taskInterval&&clearInterval(this.taskInterval)}onInterruptDetected(){this.emit(bT.VOICE_INTERRUPT)}destroy(){this.taskInterval&&clearInterval(this.taskInterval),this.offAny(this.onAnyEvent)}};!function(t){t.DISCONNECTED="disconnected",t.CONNECTING="connecting",t.CONNECTED="connected",t.RECONNECTING="reconnecting",t.ERROR="error"}(rN||(rN={})),function(t){t.IDLE="idle",t.PLAYING="playing",t.PAUSED="paused",t.STOPPED="stopped"}(sN||(sN={}));class oN{constructor(t){this.ws=null,this.state=rN.DISCONNECTED,this.reconnectAttempts=0,this.reconnectTimer=null,this.config=t,this.maxReconnectAttempts=t.reconnectAttempts||5,this.reconnectDelay=t.reconnectDelay||3e3}connect(){return new Promise(((t,e)=>{if(this.state!==rN.CONNECTED){this.state=rN.CONNECTING;try{this.ws=new WebSocket(this.config.url),this.ws.binaryType="arraybuffer",this.ws.onopen=()=>{this.state=rN.CONNECTED,this.reconnectAttempts=0,this.sendAuthToken(),this.onConnectHandler?.(),t()},this.ws.onmessage=t=>{this.handleMessage(t.data)},this.ws.onclose=t=>{this.state=rN.DISCONNECTED,this.onDisconnectHandler?.(),!t.wasClean&&this.shouldReconnect()&&this.scheduleReconnect()},this.ws.onerror=t=>{this.state=rN.ERROR;const n=new Error(`WebSocket error: ${t}`);this.onErrorHandler?.(n),e(n)}}catch(t){this.state=rN.ERROR;const n=t instanceof Error?t:new Error("Unknown WebSocket error");this.onErrorHandler?.(n),e(n)}}else t()}))}disconnect(){this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.ws&&(this.ws.close(1e3,"Client disconnect"),this.ws=null),this.state=rN.DISCONNECTED}sendTTS(t,e){if(this.state!==rN.CONNECTED||!this.ws)throw new Error("WebSocket is not connected");const n={type:"tts",content:t,...e};this.ws.send(JSON.stringify(n))}getState(){return this.state}isConnected(){return this.state===rN.CONNECTED}onMessage(t){this.onMessageHandler=t}onConnect(t){this.onConnectHandler=t}onDisconnect(t){this.onDisconnectHandler=t}onError(t){this.onErrorHandler=t}sendAuthToken(){if(this.ws&&this.config.jwtToken){const t={type:"auth",token:this.config.jwtToken};this.ws.send(JSON.stringify(t))}}handleMessage(t){this.onMessageHandler?.(t)}shouldReconnect(){return this.reconnectAttempts<this.maxReconnectAttempts}scheduleReconnect(){this.reconnectTimer&&clearTimeout(this.reconnectTimer),this.state=rN.RECONNECTING,this.reconnectAttempts++,this.reconnectTimer=setTimeout((()=>{this.connect().catch((t=>{this.shouldReconnect()&&this.scheduleReconnect()}))}),this.reconnectDelay)}sendMessage(t,e={}){if(this.state!==rN.CONNECTED||!this.ws)return;const n={type:t,...e};this.ws.send(JSON.stringify(n))}}let cN=class{constructor(t={}){this.audioContext=null,this.audioWorkletNode=null,this.state=sN.IDLE,this.isInitialized=!1,this.config={sampleRate:t.sampleRate||16e3,channels:t.channels||1,bufferSize:t.bufferSize||4096,...t}}async initialize(t=!1){if(!this.isInitialized)try{if(this.audioContext=new(window.AudioContext||window.webkitAudioContext)({sampleRate:this.config.sampleRate}),"suspended"===this.audioContext.state){if(!t)return void(this.isInitialized=!0);await this.audioContext.resume()}await this.completeInitialization()}catch(t){const e=t instanceof Error?t:new Error("Failed to initialize audio");throw this.onErrorHandler?.(e),e}}async completeInitialization(){if(!this.audioContext)throw new Error("AudioContext not created");const t=this.createProcessorBlobUrl();await this.audioContext.audioWorklet.addModule(t),this.audioWorkletNode=new AudioWorkletNode(this.audioContext,"pcm-audio-processor",{numberOfInputs:0,numberOfOutputs:1,outputChannelCount:[this.config.channels||1]}),this.audioWorkletNode.port.onmessage=t=>{this.handleWorkletMessage(t.data)},this.audioWorkletNode.connect(this.audioContext.destination),this.isInitialized=!0}async ensureFullyInitialized(){if(this.audioContext){if("suspended"===this.audioContext.state)try{await this.audioContext.resume()}catch(t){throw new Error("AudioContext could not be resumed. User interaction may be required.")}this.audioWorkletNode||await this.completeInitialization()}else await this.initialize(!0)}async playAudio(t){if(await this.ensureFullyInitialized(),!this.audioWorkletNode)throw new Error("AudioWorklet not initialized");this.audioWorkletNode.port.postMessage({type:"audio-data",payload:t}),this.state!==sN.PLAYING&&(this.audioWorkletNode.port.postMessage({type:"play"}),this.state=sN.PLAYING)}async appendAudio(t){if(await this.ensureFullyInitialized(),!this.audioWorkletNode)throw new Error("AudioWorklet not initialized");this.audioWorkletNode.port.postMessage({type:"append-audio-data",payload:t}),this.state!==sN.PLAYING&&(this.audioWorkletNode.port.postMessage({type:"play"}),this.state=sN.PLAYING)}stopPlayback(){this.audioWorkletNode&&(this.audioWorkletNode.port.postMessage({type:"stop"}),this.state=sN.STOPPED)}clearBuffer(){this.audioWorkletNode&&(this.audioWorkletNode.port.postMessage({type:"clear"}),this.state=sN.IDLE)}async getStats(){return this.audioWorkletNode?new Promise((t=>{const e=n=>{"stats"===n.data.type&&(this.audioWorkletNode?.port.removeEventListener("message",e),t(n.data.payload))};this.audioWorkletNode&&(this.audioWorkletNode.port.addEventListener("message",e),this.audioWorkletNode.port.postMessage({type:"get-stats"}))})):null}getState(){return this.state}isPlaying(){return this.state===sN.PLAYING}async enableAudio(){this.audioContext?"suspended"===this.audioContext.state&&await this.audioContext.resume():await this.initialize(!0)}isAudioEnabled(){return"running"===this.audioContext?.state}async dispose(){this.stopPlayback(),this.audioWorkletNode&&(this.audioWorkletNode.disconnect(),this.audioWorkletNode=null),this.audioContext&&(await this.audioContext.close(),this.audioContext=null),this.isInitialized=!1,this.state=sN.IDLE}onPlaybackStarted(t){this.onPlaybackStartedHandler=t}onPlaybackEnded(t){this.onPlaybackEndedHandler=t}onPlaybackStopped(t){this.onPlaybackStoppedHandler=t}onError(t){this.onErrorHandler=t}handleWorkletMessage(t){const{type:e,payload:n}=t;switch(e){case"playback-started":this.state=sN.PLAYING,this.onPlaybackStartedHandler?.();break;case"playback-ended":this.state=sN.IDLE,this.onPlaybackEndedHandler?.();break;case"playback-stopped":this.state=sN.STOPPED,this.onPlaybackStoppedHandler?.();break;case"buffer-cleared":this.state=sN.IDLE;break;case"error":this.onErrorHandler?.(new Error(n.message))}}createProcessorBlobUrl(){const t=this.getProcessorCode(),e=new Blob([t],{type:"application/javascript"});return URL.createObjectURL(e)}getProcessorCode(){return"\n// AudioWorklet processor for PCM audio playback\nclass PCMAudioProcessor extends AudioWorkletProcessor {\n constructor() {\n super();\n \n this.audioBuffer = [];\n this.bufferSize = 0;\n this.maxBufferSize = 16000 * 5; // Increased to 5 seconds for better streaming\n this.minBufferSize = 16000 * 0.05; // Reduced to 50ms for faster start\n \n this.isPlaying = false;\n this.shouldStop = false;\n this.currentPosition = 0;\n \n this.targetLatency = 0.1;\n this.maxLatency = 0.3;\n this.playbackRate = 1.0;\n this.smoothingFactor = 0.95;\n \n this.underrunCount = 0;\n this.lastBufferCheck = 0;\n \n this.port.onmessage = (event) => {\n this.handleMessage(event.data);\n };\n }\n\n handleMessage(data) {\n const { type, payload } = data;\n\n switch (type) {\n case 'audio-data':\n this.addAudioData(payload, true); // Replace existing buffer\n break;\n case 'append-audio-data':\n this.addAudioData(payload, false); // Append to existing buffer\n break;\n case 'play':\n this.startPlayback();\n break;\n case 'stop':\n this.stopPlayback();\n break;\n case 'clear':\n this.clearBuffer();\n break;\n case 'get-stats':\n this.sendStats();\n break;\n }\n }\n\n addAudioData(pcmData, replaceBuffer = false) {\n let audioData;\n if (pcmData instanceof ArrayBuffer) {\n const int16Array = new Int16Array(pcmData);\n audioData = new Float32Array(int16Array.length);\n\n for (let i = 0; i < int16Array.length; i++) {\n audioData[i] = int16Array[i] / 32768.0;\n }\n } else {\n audioData = new Float32Array(pcmData);\n }\n\n if (replaceBuffer) {\n // Replace existing buffer (for new TTS requests)\n this.audioBuffer = [...audioData];\n this.currentPosition = 0;\n } else {\n // Append to existing buffer (for streaming audio)\n this.audioBuffer.push(...audioData);\n }\n\n this.bufferSize = this.audioBuffer.length;\n\n // Trim buffer if it gets too large, but be more conservative\n if (this.bufferSize > this.maxBufferSize) {\n const excess = this.bufferSize - this.maxBufferSize;\n // Only remove from the beginning if we have played past that point\n const safeRemoveCount = Math.min(excess, Math.floor(this.currentPosition));\n if (safeRemoveCount > 0) {\n this.audioBuffer.splice(0, safeRemoveCount);\n this.bufferSize = this.audioBuffer.length;\n this.currentPosition -= safeRemoveCount;\n }\n }\n\n // Auto-start playback if we have enough data and not currently playing\n if (!this.isPlaying && this.bufferSize >= this.minBufferSize) {\n this.startPlayback();\n }\n }\n\n startPlayback() {\n this.isPlaying = true;\n this.shouldStop = false;\n this.port.postMessage({ type: 'playback-started' });\n }\n\n stopPlayback() {\n this.isPlaying = false;\n this.shouldStop = true;\n this.port.postMessage({ type: 'playback-stopped' });\n }\n\n clearBuffer() {\n this.audioBuffer = [];\n this.bufferSize = 0;\n this.currentPosition = 0;\n this.isPlaying = false;\n this.shouldStop = true;\n this.port.postMessage({ type: 'buffer-cleared' });\n }\n\n sendStats() {\n const stats = {\n bufferSize: this.bufferSize,\n currentPosition: this.currentPosition,\n isPlaying: this.isPlaying,\n underrunCount: this.underrunCount,\n playbackRate: this.playbackRate,\n bufferedDuration: this.bufferSize / 16000\n };\n \n this.port.postMessage({ type: 'stats', payload: stats });\n }\n\n process(inputs, outputs, parameters) {\n const output = outputs[0];\n const outputChannel = output[0];\n const frameCount = outputChannel.length;\n \n if (!this.isPlaying || this.shouldStop || this.bufferSize === 0) {\n outputChannel.fill(0);\n return true;\n }\n \n this.adjustPlaybackRate();\n \n let samplesWritten = 0;\n for (let i = 0; i < frameCount; i++) {\n if (this.currentPosition >= this.bufferSize) {\n if (samplesWritten === 0) {\n this.underrunCount++;\n }\n outputChannel[i] = 0;\n } else {\n const sampleIndex = Math.floor(this.currentPosition);\n const fraction = this.currentPosition - sampleIndex;\n \n let sample = this.audioBuffer[sampleIndex];\n if (sampleIndex + 1 < this.bufferSize && fraction > 0) {\n const nextSample = this.audioBuffer[sampleIndex + 1];\n sample = sample * (1 - fraction) + nextSample * fraction;\n }\n \n outputChannel[i] = sample;\n this.currentPosition += this.playbackRate;\n samplesWritten++;\n }\n }\n \n // Clean up consumed samples more frequently for streaming\n if (this.currentPosition > this.minBufferSize && this.currentPosition > this.bufferSize * 0.3) {\n const samplesToRemove = Math.floor(this.currentPosition * 0.8); // Keep some overlap\n if (samplesToRemove > 0) {\n this.audioBuffer.splice(0, samplesToRemove);\n this.bufferSize = this.audioBuffer.length;\n this.currentPosition -= samplesToRemove;\n }\n }\n \n if (this.currentPosition >= this.bufferSize && this.bufferSize > 0) {\n this.isPlaying = false;\n this.port.postMessage({ type: 'playback-ended' });\n }\n \n return true;\n }\n\n adjustPlaybackRate() {\n const currentTime = currentFrame / sampleRate;\n \n if (currentTime - this.lastBufferCheck < 0.1) {\n return;\n }\n \n this.lastBufferCheck = currentTime;\n \n const currentLatency = (this.bufferSize - this.currentPosition) / 16000;\n \n let targetRate = 1.0;\n \n if (currentLatency > this.maxLatency) {\n targetRate = 1.05;\n } else if (currentLatency < this.targetLatency * 0.5) {\n targetRate = 0.98;\n }\n \n this.playbackRate = this.playbackRate * this.smoothingFactor + \n targetRate * (1 - this.smoothingFactor);\n \n this.playbackRate = Math.max(0.9, Math.min(1.1, this.playbackRate));\n }\n}\n\nregisterProcessor('pcm-audio-processor', PCMAudioProcessor);\n "}};const lN="1000",hN="1010";class uN{constructor(t,e,n){this.textCallback=t,this.bsCallback=e,this.audioCallback=n}setTextCallback(t){this.textCallback=t}setBSCallback(t){this.bsCallback=t}parseMessage(t){return t instanceof ArrayBuffer?{type:"audio-buffer",data:t}:"string"==typeof t?this.parseStringMessage(t):{type:"unknown",data:t}}handleMessage(t){const e=this.parseMessage(t);switch(e.type){case"audio-buffer":this.audioCallback&&t instanceof ArrayBuffer&&this.audioCallback(t);break;case"text":this.textCallback&&"string"==typeof e.data&&this.textCallback(e.data);break;case"bs-data":this.bsCallback&&"string"==typeof e.data&&this.bsCallback(e.data);break;case"bs-end":this.bsCallback&&this.bsCallback("bs-end")}}parseStringMessage(t){if(t.length<4)return{type:"text",data:t};const e=t.substring(0,4),n=t.substring(4);switch(e){case lN:return{type:"text",data:n};case hN:return{type:"bs-data",data:n};case"1011":return{type:"bs-end",data:n};case"1020":return{type:"audio-rate",data:n};default:return{type:"text",data:t}}}static isAudioData(t){return t instanceof ArrayBuffer}static isTextMessage(t){return t.length>=4&&t.substring(0,4)===lN}static isBSMessage(t){return t.length>=4&&t.substring(0,4)===hN}}class dN{constructor(t){this.audioManager=null,this.isInitialized=!1,this.isReceivingAudioStream=!1,this.ttsListener=t=>{},this.config=t,this.wsManager=new oN(t.websocket),t.audio&&t.audio.disabled||(this.audioManager=new cN(t.audio)),this.messageParser=new uN(t.onTextMessage,t.onBSMessage,t.onAudioMessage),this.setupEventHandlers()}async initialize(){if(!this.isInitialized)try{this.audioManager&&await this.audioManager.initialize(),await this.wsManager.connect(),this.isInitialized=!0}catch(t){const e=t instanceof Error?t:new Error("Initialization failed");throw this.config.onError?.(e),e}}async tts(t,e,n={}){if(this.isInitialized||await this.initialize(),!this.wsManager.isConnected())throw new Error("WebSocket is not connected");n.listener&&(this.ttsListener=n.listener);try{this.audioManager&&(this.audioManager.stopPlayback(),this.audioManager.clearBuffer()),this.isReceivingAudioStream=!1,this.wsManager.sendTTS(t,e)}catch(t){const e=t instanceof Error?t:new Error("TTS request failed");throw this.config.onError?.(e),e}}stop(){this.wsManager.sendMessage("tts-stop")}disconnect(){this.wsManager.disconnect()}async dispose(){this.disconnect(),this.audioManager&&await this.audioManager.dispose(),this.isInitialized=!1}setTextCallback(t){this.messageParser.setTextCallback(t)}setBSCallback(t){this.messageParser.setBSCallback(t)}getConnectionState(){return this.wsManager.getState()}getAudioState(){return this.audioManager?this.audioManager.getState():sN.IDLE}isConnected(){return this.wsManager.isConnected()}isPlaying(){return!!this.audioManager&&this.audioManager.isPlaying()}async getAudioStats(){return this.audioManager?await this.audioManager.getStats():null}async enableAudio(){if(!this.audioManager)return Promise.resolve();await this.audioManager.enableAudio()}isAudioEnabled(){return!!this.audioManager&&this.audioManager.isAudioEnabled()}setupEventHandlers(){this.wsManager.onMessage((t=>{this.handleWebSocketMessage(t)})),this.wsManager.onConnect((()=>{this.config.onConnect?.()})),this.wsManager.onDisconnect((()=>{this.config.onDisconnect?.()})),this.wsManager.onError((t=>{this.config.onError?.(t)})),this.audioManager&&(this.audioManager.onPlaybackStarted((()=>{})),this.audioManager.onPlaybackEnded((()=>{})),this.audioManager.onPlaybackStopped((()=>{})),this.audioManager.onError((t=>{this.config.onError?.(t)})))}async handleWebSocketMessage(t){try{const e=this.messageParser.parseMessage(t);switch(this.ttsListener({type:e.type,data:e.data}),e.type){case"audio-buffer":e.data instanceof ArrayBuffer&&this.audioManager&&(this.isReceivingAudioStream?await this.audioManager.appendAudio(e.data):(this.isReceivingAudioStream=!0,await this.audioManager.playAudio(e.data))),this.messageParser.handleMessage(t);break;case"text":case"bs-data":case"bs-end":this.messageParser.handleMessage(t)}}catch(t){const e=t instanceof Error?t:new Error("Message handling failed");this.config.onError?.(e)}}}var pN;!function(t){t.IDLE="idle",t.PLAYING="playing",t.PAUSED="paused",t.STOPPED="stopped"}(pN||(pN={}));class fN{audioContext=null;audioWorkletNode=null;state=pN.IDLE;config;isInitialized=!1;onPlaybackStartedHandler;onPlaybackEndedHandler;onPlaybackStoppedHandler;onErrorHandler;constructor(t={}){this.config={sampleRate:t.sampleRate||24e3,channels:t.channels||1,bufferSize:t.bufferSize||4096,...t}}async setRate(t){this.config.sampleRate=t,await this.dispose(),await this.initialize()}async initialize(t=!1){if(!this.isInitialized)try{if(this.audioContext=new(window.AudioContext||window.webkitAudioContext)({sampleRate:this.config.sampleRate}),"suspended"===this.audioContext.state){if(!t)return void(this.isInitialized=!0);await this.audioContext.resume()}await this.completeInitialization()}catch(t){const e=t instanceof Error?t:new Error("Failed to initialize audio");throw this.onErrorHandler?.(e),e}}async completeInitialization(){if(!this.audioContext)throw new Error("AudioContext not created");const t=this.createProcessorBlobUrl();await this.audioContext.audioWorklet.addModule(t),this.audioWorkletNode=new AudioWorkletNode(this.audioContext,"pcm-audio-processor",{numberOfInputs:0,numberOfOutputs:1,outputChannelCount:[this.config.channels||1]}),this.audioWorkletNode.port.onmessage=t=>{this.handleWorkletMessage(t.data)},this.audioWorkletNode.connect(this.audioContext.destination),this.isInitialized=!0}async ensureFullyInitialized(){if(this.audioContext){if("suspended"===this.audioContext.state)try{await this.audioContext.resume()}catch(t){throw new Error("AudioContext could not be resumed. User interaction may be required.")}this.audioWorkletNode||await this.completeInitialization()}else await this.initialize(!0)}async playAudio(t){if(await this.ensureFullyInitialized(),!this.audioWorkletNode)throw new Error("AudioWorklet not initialized");this.audioWorkletNode.port.postMessage({type:"audio-data",payload:t}),this.state!==pN.PLAYING&&(this.audioWorkletNode.port.postMessage({type:"play"}),this.state=pN.PLAYING)}async appendAudio(t){if(await this.ensureFullyInitialized(),!this.audioWorkletNode)throw new Error("AudioWorklet not initialized");this.audioWorkletNode.port.postMessage({type:"append-audio-data",payload:t}),this.state!==pN.PLAYING&&(this.audioWorkletNode.port.postMessage({type:"play"}),this.state=pN.PLAYING)}stopPlayback(){this.audioWorkletNode&&(this.audioWorkletNode.port.postMessage({type:"stop"}),this.state=pN.STOPPED)}clearBuffer(){this.audioWorkletNode&&(this.audioWorkletNode.port.postMessage({type:"clear"}),this.state=pN.IDLE)}async getStats(){return this.audioWorkletNode?new Promise((t=>{const e=n=>{"stats"===n.data.type&&(this.audioWorkletNode?.port.removeEventListener("message",e),t(n.data.payload))};this.audioWorkletNode&&(this.audioWorkletNode.port.addEventListener("message",e),this.audioWorkletNode.port.postMessage({type:"get-stats"}))})):null}getState(){return this.state}isPlaying(){return this.state===pN.PLAYING}async enableAudio(){this.audioContext?"suspended"===this.audioContext.state&&await this.audioContext.resume():await this.initialize(!0)}isAudioEnabled(){return"running"===this.audioContext?.state}async dispose(){this.stopPlayback(),this.audioWorkletNode&&(this.audioWorkletNode.disconnect(),this.audioWorkletNode=null),this.audioContext&&(await this.audioContext.close(),this.audioContext=null),this.isInitialized=!1,this.state=pN.IDLE}onPlaybackStarted(t){this.onPlaybackStartedHandler=t}onPlaybackEnded(t){this.onPlaybackEndedHandler=t}onPlaybackStopped(t){this.onPlaybackStoppedHandler=t}onError(t){this.onErrorHandler=t}handleWorkletMessage(t){const{type:e,payload:n}=t;switch(e){case"playback-started":this.state=pN.PLAYING,this.onPlaybackStartedHandler?.();break;case"playback-ended":this.state=pN.IDLE,this.onPlaybackEndedHandler?.();break;case"playback-stopped":this.state=pN.STOPPED,this.onPlaybackStoppedHandler?.();break;case"buffer-cleared":this.state=pN.IDLE;break;case"error":this.onErrorHandler?.(new Error(n.message))}}createProcessorBlobUrl(){const t=this.getProcessorCode(),e=new Blob([t],{type:"application/javascript"});return URL.createObjectURL(e)}getProcessorCode(){return"\n// AudioWorklet processor for PCM audio playback\nclass PCMAudioProcessor extends AudioWorkletProcessor {\n constructor() {\n super();\n \n this.audioBuffer = [];\n this.bufferSize = 0;\n this.maxBufferSize = 16000 * 5; // Increased to 5 seconds for better streaming\n this.minBufferSize = 16000 * 0.05; // Reduced to 50ms for faster start\n \n this.isPlaying = false;\n this.shouldStop = false;\n this.currentPosition = 0;\n \n this.targetLatency = 0.1;\n this.maxLatency = 0.3;\n this.playbackRate = 1.0;\n this.smoothingFactor = 0.95;\n \n this.underrunCount = 0;\n this.lastBufferCheck = 0;\n \n this.port.onmessage = (event) => {\n this.handleMessage(event.data);\n };\n }\n\n handleMessage(data) {\n const { type, payload } = data;\n\n switch (type) {\n case 'audio-data':\n this.addAudioData(payload, true); // Replace existing buffer\n break;\n case 'append-audio-data':\n this.addAudioData(payload, false); // Append to existing buffer\n break;\n case 'play':\n this.startPlayback();\n break;\n case 'stop':\n this.stopPlayback();\n break;\n case 'clear':\n this.clearBuffer();\n break;\n case 'get-stats':\n this.sendStats();\n break;\n }\n }\n\n addAudioData(pcmData, replaceBuffer = false) {\n let audioData;\n if (pcmData instanceof ArrayBuffer) {\n const int16Array = new Int16Array(pcmData);\n audioData = new Float32Array(int16Array.length);\n\n for (let i = 0; i < int16Array.length; i++) {\n audioData[i] = int16Array[i] / 32768.0;\n }\n } else {\n audioData = new Float32Array(pcmData);\n }\n\n if (replaceBuffer) {\n // Replace existing buffer (for new TTS requests)\n this.audioBuffer = [...audioData];\n this.currentPosition = 0;\n } else {\n // Append to existing buffer (for streaming audio)\n this.audioBuffer.push(...audioData);\n }\n\n this.bufferSize = this.audioBuffer.length;\n\n // Trim buffer if it gets too large, but be more conservative\n if (this.bufferSize > this.maxBufferSize) {\n const excess = this.bufferSize - this.maxBufferSize;\n // Only remove from the beginning if we have played past that point\n const safeRemoveCount = Math.min(excess, Math.floor(this.currentPosition));\n if (safeRemoveCount > 0) {\n this.audioBuffer.splice(0, safeRemoveCount);\n this.bufferSize = this.audioBuffer.length;\n this.currentPosition -= safeRemoveCount;\n }\n }\n\n // Auto-start playback if we have enough data and not currently playing\n if (!this.isPlaying && this.bufferSize >= this.minBufferSize) {\n this.startPlayback();\n }\n }\n\n startPlayback() {\n this.isPlaying = true;\n this.shouldStop = false;\n this.port.postMessage({ type: 'playback-started' });\n }\n\n stopPlayback() {\n this.isPlaying = false;\n this.shouldStop = true;\n this.port.postMessage({ type: 'playback-stopped' });\n }\n\n clearBuffer() {\n this.audioBuffer = [];\n this.bufferSize = 0;\n this.currentPosition = 0;\n this.isPlaying = false;\n this.shouldStop = true;\n this.port.postMessage({ type: 'buffer-cleared' });\n }\n\n sendStats() {\n const stats = {\n bufferSize: this.bufferSize,\n currentPosition: this.currentPosition,\n isPlaying: this.isPlaying,\n underrunCount: this.underrunCount,\n playbackRate: this.playbackRate,\n bufferedDuration: this.bufferSize / 16000\n };\n \n this.port.postMessage({ type: 'stats', payload: stats });\n }\n\n process(inputs, outputs, parameters) {\n const output = outputs[0];\n const outputChannel = output[0];\n const frameCount = outputChannel.length;\n \n if (!this.isPlaying || this.shouldStop || this.bufferSize === 0) {\n outputChannel.fill(0);\n return true;\n }\n \n this.adjustPlaybackRate();\n \n let samplesWritten = 0;\n for (let i = 0; i < frameCount; i++) {\n if (this.currentPosition >= this.bufferSize) {\n if (samplesWritten === 0) {\n this.underrunCount++;\n }\n outputChannel[i] = 0;\n } else {\n const sampleIndex = Math.floor(this.currentPosition);\n const fraction = this.currentPosition - sampleIndex;\n \n let sample = this.audioBuffer[sampleIndex];\n if (sampleIndex + 1 < this.bufferSize && fraction > 0) {\n const nextSample = this.audioBuffer[sampleIndex + 1];\n sample = sample * (1 - fraction) + nextSample * fraction;\n }\n \n outputChannel[i] = sample;\n this.currentPosition += this.playbackRate;\n samplesWritten++;\n }\n }\n \n // Clean up consumed samples more frequently for streaming\n if (this.currentPosition > this.minBufferSize && this.currentPosition > this.bufferSize * 0.3) {\n const samplesToRemove = Math.floor(this.currentPosition * 0.8); // Keep some overlap\n if (samplesToRemove > 0) {\n this.audioBuffer.splice(0, samplesToRemove);\n this.bufferSize = this.audioBuffer.length;\n this.currentPosition -= samplesToRemove;\n }\n }\n \n if (this.currentPosition >= this.bufferSize && this.bufferSize > 0) {\n this.isPlaying = false;\n this.port.postMessage({ type: 'playback-ended' });\n }\n \n return true;\n }\n\n adjustPlaybackRate() {\n const currentTime = currentFrame / sampleRate;\n \n if (currentTime - this.lastBufferCheck < 0.1) {\n return;\n }\n \n this.lastBufferCheck = currentTime;\n \n const currentLatency = (this.bufferSize - this.currentPosition) / 16000;\n \n let targetRate = 1.0;\n \n if (currentLatency > this.maxLatency) {\n targetRate = 1.05;\n } else if (currentLatency < this.targetLatency * 0.5) {\n targetRate = 0.98;\n }\n \n this.playbackRate = this.playbackRate * this.smoothingFactor + \n targetRate * (1 - this.smoothingFactor);\n \n this.playbackRate = Math.max(0.9, Math.min(1.1, this.playbackRate));\n }\n}\n\nregisterProcessor('pcm-audio-processor', PCMAudioProcessor);\n "}}class AN extends _{blendShapes=[];audioBuffer=[];playInfo={shapes:[],audios:[],duration:0,rate:16e3,content:""};fps=30;isPlaying=!1;isInited=!1;time=0;idx=0;playShapeFn=(t,e)=>{};audioManager;constructor(t={},e){super(),this.playShapeFn=e,this.fps=t.fps||30,this.time=Math.ceil(1e3/this.fps),this.audioManager=new fN({}),this.audioManager.initialize()}checkStartPlay(){return!this.isPlaying&&(!!this.isInited||!(0===this.audioBuffer.length||this.blendShapes.length<15))}addShapes(t){t.forEach((t=>{this.blendShapes.push(t),this.playInfo.shapes.push(t)})),this.checkStartPlay()&&this.play()}addBinaryAudio(t){this.audioBuffer.push(t),this.playInfo.audios.push(t)}async clear(){this.isPlaying=!1,this.blendShapes=[],this.audioBuffer=[],this.idx=0,this.isInited=!1,this.playInfo={shapes:[],audios:[],duration:0,rate:16e3,content:""},await this.audioManager.stopPlayback(),await this.audioManager.clearBuffer()}async appendAudio(){for(;this.audioBuffer.length>0;){const t=this.mergeArrayBuffers(this.audioBuffer,3);await this.audioManager.appendAudio(t)}}async play(){if(this.isPlaying=!0,0===this.blendShapes.length)return this.isPlaying=!1,void this.emit("playend");const t=this.isInited;if(this.isInited=!0,this.audioBuffer.length>0){if(!t){const[t]=this.audioBuffer.splice(0,1);await this.audioManager.playAudio(t)}this.appendAudio()}const[e]=this.blendShapes.splice(0,1);e&&this.playShapeFn(e,this.idx++),setTimeout((()=>{this.play()}),this.time)}getPlayInfo(){const t=Math.ceil(this.playInfo.shapes.length/this.fps*1e3);return this.playInfo.duration=t,this.playInfo}async setAudioRate(t){this.playInfo.rate=t}mergeArrayBuffers(t,e=1){const n=t.splice(0,e),i=n.reduce(((t,e)=>t+e.byteLength),0),r=new Uint8Array(i);let s=0;for(const t of n)r.set(new Uint8Array(t),s),s+=t.byteLength;return r.buffer}}class gN extends _{name;core=null;config;loading;audio;container="";recorder=null;voiceCallback=null;status;probeTimeout=null;callbackTimeout=null;mutilAudios=[];exeSequence=new sU;fetchSequence=new sU;openRecorderTimeout=null;onAnyEvent=null;characterData=null;isNotRender=!1;mode="nomal";ttsclient=null;framePlayer=null;voiceInter=aN;constructor(t){if(super(),!t.token)throw new Error("Invalid configuration");this.status="init",this.name="QuanTeHuman",this.isNotRender=!0,t.container&&(this.container=t.container,t.isNotRender=!0,this.isNotRender=!1),this.audio=wD,this.config=$O({container:"",characterId:"",audio:{volumn:1},server:{api:"https://ai.quantekeji.com/platform-api",wss:"wss://ai.quantekeji.com/beta/aigc-ws/",questionApiParams:{model:"quan",stream:!1,sentence:!0,max_tokens:256,temperature:.95,sse:!0},text2SpeachApiParams:{role:"xiaoxiao",speed:1,sn:10,model:"paddle2",viseme:"a2f",smooth_method:1,smooth_interations:5}},modelConfig:{name:"quante",camera:{fov:50},orbitControls:{minPolarAngle:0,maxPolarAngle:Math.PI}},loading:"",loadingDestory:!0,options:{fps:30},mode:"nomal",voiceModeConfig:{level:15},isNotRender:!0,debug:!1},t),this.mode=this.config.mode,xD.VOLUMN=this.config.audio.volumn,this.initStorage(),"nomal"===this.mode&&(this.recorder=new rU,this.recorder.on("message",this.dealVoice2Text.bind(this))),this.framePlayer=new AN({fps:this.config.options.fps},((t,e)=>{this.core.playByShapes(t,e)})),this.refreshGatewayToken().then((()=>{this.initTTSClient()}))}async refreshGatewayToken(){return(async()=>dD.get("/human-auth/gateway/token",{}))().then((t=>(0===t.code&&CT.setItem(TT,t.data),t)))}initTTSClient(){const t=CT.getItem(TT);if(!t)throw new Error("Gateway token is null!");this.ttsclient=new dN({websocket:{url:"wss://ai.quantekeji.com/aigc_v2/v2/ws_conn",jwtToken:t},audio:{disabled:!0},onError:t=>{},onConnect:()=>{},onDisconnect:()=>{}})}async setCharacterData(t){const e=await(n=t,dD.get(`/human-auth/characters/${n}`,{}));var n;if(0!==e.code)throw new Error(e.msg);return this.characterData=e.data,!0}async setCharacter(t,e={}){if(!t)return!1;const n=e.loading||this.config.loading;if(n&&(this.loading&&this.loading.destroy(),this.loading=new ET(n,this)),await this.setCharacterData(t),!this.characterData)return!1;this.config.modelConfig=this.characterData.configuration,this.config=$O(this.config,{modelConfig:this.characterData.configuration},e),this.config.modelConfig.name&&(window[this.config.modelConfig.name]=this),this.core&&(this.core.destroy(),this.core.offAny(this.onAnyEvent),this.core=null,this.onAnyEvent=null),this.core=new yT(this.container,{...this.config.modelConfig,debug:this.config.debug}),this.onAnyEvent=(t,e)=>{this.emit(String(t),e)},this.core.onAny(this.onAnyEvent);const i=[...this.characterData.aposes,...this.characterData.animations];return this.isNotRender||(this.characterData.scene&&this.characterData.scene.path&&("glb"===this.characterData.scene.type?Ts([{bundle:this.characterData.scene.path,name:this.characterData.scene.name,type:"apose",enabled:"T",code:this.characterData.scene.id,id:this.characterData.scene.id}]).then((t=>{this.core?.changeBundle(t[0])})):"video"===this.characterData.scene.type?this.core?.setVideoBackground(this.characterData.scene.path):"picture"===this.characterData.scene.type?this.core?.loadCubeBackground(this.characterData.scene.pictures):"background"===this.characterData.scene.type?this.core?.setBackgroundColorOrGradient(this.characterData.scene.background):this.core.setBackground(this.characterData.scene.path)),"F"===this.characterData.animationEnabled&&this.core.muteAction(!0)),Ts(i,(t=>{this.emit(bT.HUMAN_LOAD_PROGRESS,{code:"download",progress:t,total:Math.floor(.99*t)})})).then((t=>this.core.loadBundles(t,(t=>{this.emit(bT.HUMAN_LOAD_PROGRESS,{code:"loaded",progress:t,total:Math.floor(99+.01*t)})})))).then((()=>(this.status="ready",this.emit(bT.HUMAN_READY),this.loading&&this.config.loadingDestory&&setTimeout((()=>{this.loading.destroy()}),500),this.isNotRender||e.isNotRender||this.startRender(),!0))).catch((t=>!1))}async speak(t,e,n={}){return await this.stop(),new Promise((n=>{this._textToSpeech(t,(t=>{e&&e(t)})).then((t=>{n(t)}))}))}async _speak(t,e,n={}){this.status="prepare2play";const i=new aU,r=!1===n.split?[t]:i.split(t).filter((t=>!!t));let s=0,a=r.length;return r.forEach((t=>{(e=>{this.fetchSequence.add((async()=>gD(this.characterData.id,{content:t,viseme:"a2f3d"}).then((async t=>{if(0===t.code){const n=this.createAudio();await n.setUrl(t.data.url),this.mutilAudios.push(n);const i=mD(t.data.blend_shapes,52);this.exeSequence.add((async()=>this.play({shapes:i,audio:n}).then((()=>{a===e&&this.core&&this.core.initIdle()}))))}})).then((t=>t)).catch((t=>!1))))})(++s)})),!0}async askCommand(t,e){this.characterData||e({code:99,msg:"接口数据异常",data:[]});const n=new oU((async(n,i)=>{if("action"===i.type&&t.commandType){const i=n.split(",").filter((e=>e.startsWith(t.commandType)));i.length>0&&(e({code:0,msg:"success",data:i}),this.emit(bT.HUMAN_ACTION_PENDING,i))}else;}),(()=>{}));AD(this.characterData.id,{...t,language:this.characterData?.language},(t=>{if(0===t.code){if("error"===t.data.event)return e({code:98,msg:t.data.message??"接口数据异常",data:[]});n.processMessage(t.data)}else e({code:t.code,msg:t.msg??"接口数据异常",data:[]})})).catch((t=>{}))}async ask(t,e){await this.stop();const n=new aU;let i=0,r=i;const s=[],a=[],o=t.reqId||_D(16);let c=!1;return new Promise((l=>{const h=new oU((async(t,e)=>{if(!this.ttsclient)return void l({code:1,msg:"ttsclient is null!",data:{reqId:o,playInfos:s,errorInfos:a}});if(c=e.isEnd,t||!e.isEnd||this.fetchSequence.hasRuning()||this.exeSequence.hasRuning()||h.executePushCallback(),"action"===e.type)return void this.emit(bT.HUMAN_ACTION_PENDING,t.split(","));const u=t.trim().replace("\n","").replace(/[,|,|.|。]$/,"");n.split(u).filter((t=>!!t)).forEach((t=>{(e=>{this.fetchSequence.add((async()=>gD(this.characterData.id,{content:t,viseme:"a2f3d"}).then((async n=>{if(0===n.code){if(!n.data.blend_shapes||0===n.data.blend_shapes.length)return r--,!1;const i=this.createAudio();await i.setUrl(n.data.url),this.mutilAudios.push(i);const u=mD(n.data.blend_shapes,52);s.push({url:n.data.url,shapes:u,duration:n.data.duration,content:t}),this.exeSequence.add((async()=>(h.executePushCallback(),this.play({shapes:u,audio:i}).then((()=>{r<=e&&(this.core?.initIdle(),c&&l({code:0,msg:"success",data:{reqId:o,playInfos:s,errorInfos:a}}))})))))}})).catch((e=>{a.push({errorMessage:e.message,content:t})}))))})(++i)})),e.isEnd&&(r=i)}),e);AD(this.characterData.id,{...t,language:this.characterData?.language},(t=>{if(0===t.code){if("error"===t.data.event)return e({code:98,msg:t.data.message??"接口数据异常",data:[]});h.processMessage(t.data)}else e({code:t.code,msg:t.msg??"接口数据异常",data:[]})})).catch((t=>{}))}))}async _textToSpeech(t,e,n={unclear:!1}){n.unclear||await(this.framePlayer?.clear());let i=t;return this.characterData&&this.characterData.pronunciations&&this.characterData.pronunciations.length>0&&this.characterData.pronunciations.forEach((t=>{i=i.replace(new RegExp(t.source,"g"),t.target)})),new Promise((t=>{let n=!1;this.framePlayer?.on("playend",(()=>{if(n){const e=this.framePlayer.getPlayInfo();t(e)}})),this.ttsclient.tts(i,{role:this.characterData?.timbre.value},{listener:({type:t,data:i})=>{switch(t){case"audio-rate":this.framePlayer.setAudioRate(parseInt(`${i}`,10));break;case"audio-buffer":this.framePlayer.addBinaryAudio(i);break;case"bs-data":const t=JSON.parse(i||"[]");this.framePlayer.addShapes(t);break;case"bs-end":n=!0,e&&e({event:"bs-end"})}}})}))}async askStream(t,e){if(!this.ttsclient)return Promise.reject("ttsclient is null!");await this.stop();const n=t.reqId||_D(16),i=new aU,r=[];let s=0,a=0;return new Promise((o=>{const c=new oU((async(t,e)=>{if(!this.ttsclient)return void o({code:1,msg:"ttsclient is null!",data:{reqId:n,playInfos:[],errorInfos:r}});if(e.isEnd,t||!e.isEnd||this.fetchSequence.hasRuning()||this.exeSequence.hasRuning()||c.executePushCallback(),"action"===e.type)return void this.emit(bT.HUMAN_ACTION_PENDING,t.split(","));const l=t.trim().replace("\n","");i.split(l).filter((t=>!!t)).forEach((t=>{(e=>{this.fetchSequence.add((async()=>new Promise((i=>{this._textToSpeech(t,(({event:t})=>{"bs-end"===t&&i(!0)}),{unclear:!0}).then((t=>{0!==a&&e===a&&o({code:0,msg:"success",data:{reqId:n,playInfos:[t],errorInfos:r}})}))}))))})(++s)})),1===s&&c.executePushCallback(),e.isEnd&&(a=s)}),e);AD(this.characterData.id,{...t,language:this.characterData?.language},(t=>{if(0===t.code){if("error"===t.data.event)return e({code:98,msg:t.data.message??"接口数据异常",data:[]});c.processMessage(t.data)}else e({code:t.code,msg:t.msg??"接口数据异常",data:[]})})).catch((t=>{}))}))}initBlendShapes(){}probeTimePlay(t,e=[],n){if(this.callbackTimeout&&clearTimeout(this.callbackTimeout),e.length>t){ED.begin(),this.core&&this.core.playByShapes(e[t],t);const i=ED.end();this.probeTimeout=setTimeout((()=>{this.probeTimePlay(t+1,e,n)}),i),this.callbackTimeout=setTimeout((()=>{n&&n({break:!0})}),i+100)}else this.initBlendShapes(),n&&n()}async speakByAudioShapes(t,e){return await this.stop(),this.status="prepare2play",new Promise((n=>{let i=0;const r=e=>{i++,i===t.length&&(n(e),this.core&&this.core.initIdle())};t.forEach(((t,n)=>{this.exeSequence.add((async()=>{const i=this.createAudio();return await i.setUrl(t),this.mutilAudios.push(i),this.play({shapes:e[n],audio:i}).then(r)}))}))}))}async speakByAudioStreamShapes(t,e,n){return await this.stop(),this.status="prepare2play",this.framePlayer?(n&&await this.framePlayer.setAudioRate(n),new Promise((n=>{this.framePlayer?.once("playend").then((()=>{this.core.initIdle(),n(!0)})),t.forEach((t=>{this.framePlayer?.addBinaryAudio(t)})),this.framePlayer?.addShapes(e)}))):Promise.reject("player is null!")}createAudio(){const t=new xD,e=()=>{this.emit(bT.AUDIO_PLAY)},n=()=>{this.emit(bT.AUDIO_PAUSE),t.off("onplay",e),t.off("onend",i),t.off("onstop",n)},i=()=>{this.emit(bT.AUDIO_PAUSE),t.off("onplay",e),t.off("onstop",n),t.off("onend",i)};return t.on("onplay",e),t.on("onstop",n),t.on("onend",i),t}async speakByAudio(t,e){if(await this.stop(),!e)throw new Error("shapes is null");return this.status="prepare2play",await this.audio.setUrl(t),this.play({shapes:e,audio:this.audio}).then((()=>!0))}async setRecorderStatus(t){"nomal"===this.config.mode&&(this.openRecorderTimeout&&clearTimeout(this.openRecorderTimeout),"open"!==t||["prepare2play","playing"].includes(this.status)?this.recorder.closeRecording():this.openRecorderTimeout=setTimeout((()=>{this.recorder.requestRecorderPermission()}),500))}play=async({shapes:t,audio:e})=>(await this.setRecorderStatus("close"),this.status="playing",e.isLoaded()?e.play():this.emit(bT.HUMAN_ERROR,{code:"playaudio",uri:e.getUrl()}),new Promise((e=>{ED.init(this.config.options?.fps??30,"socket"),this.probeTimePlay(0,t,(t=>{this.status="ready",this.setRecorderStatus("open"),t&&t.break?e(!1):e(!0)}))})));async startVoice2Text(t=()=>{}){return await this.stop(),this.voiceCallback=t,this.status="prepare2play",this.recorder.start(this.characterData.token)}stopVoice2Text(t){return t&&(this.voiceCallback=t),this.recorder.stop().then((t=>t))}async stop(){return this.probeTimeout&&(clearTimeout(this.probeTimeout),this.initBlendShapes()),this.exeSequence.clear(),this.fetchSequence.clear(),this.audio.pause(),this.mutilAudios.forEach((t=>{t.pause()})),this.mutilAudios=[],this.emit(bT.AUDIO_PAUSE),(()=>{for(const[t,e]of Object.entries(fD))e.length>0&&(e.forEach((t=>{try{t instanceof AbortController?t.abort():t instanceof BT?t.close():t.cancel("终止请求")}catch(t){}})),fD[t]=[])})(),this.core?.playAction("idle"),this.core?.initIdle(),this.status="ready",this.framePlayer?.clear(),this.ttsclient&&this.ttsclient.stop(),Promise.resolve(!0)}getStatus(){return this.status}initStorage(){CT.setItem(ST,this.config.token),CT.setItem(MT,this.config.server.wss),CT.setItem(IT,this.config.server.api),dD.setConfig({baseURL:this.config.server.api})}muteAudio(t=!0){xD.MUTED=t,this.audio.mute(t),this.mutilAudios.forEach((e=>{e.mute(t)}))}muteAction(t=!0){this.core.muteAction(t)}dealVoice2Text(t){let e=t;t.is_final&&(e.text=e.text.replace(/([\.|。])$/,"")),this.voiceCallback&&this.voiceCallback(e)}async destroy(){await this.stop(),this.config?.modelConfig?.name&&(window[this.config.modelConfig.name]=null),this.recorder&&(this.recorder.off("message",this.dealVoice2Text.bind(this)),this.recorder.destroy(),this.recorder=null),this.offAny(this.voiceInteractionEmit),this.core&&this.core.destroy()}updateToken(t){this.config.token=t}setAngleView({camera:t}){this.core&&this.core.setAngleView({camera:t})}playAction(t,e={}){return this.core&&this.core.playAction(t,e),Promise.resolve()}getModelInfo(){return this.core?this.core.getModelInfo():null}async openVoiceInteraction(t){return await aN.initialize({asrEndpoint:this.config.server.wss,wakeWords:t.wakeWords||[],exitWords:t.exitWords||["关闭","退出"],interruptWorlds:t.interruptWorlds||[],sampleRate:t.sampleRate||24e3,gatewayToken:this.characterData.token,level:t.level||15,exitTime:t.exitTime||18e4,keepActive:this.config.voiceModeConfig?.keepActive||!1,waitTime:t.waitTime}),aN.onAny(this.voiceInteractionEmit.bind(this)),!0}voiceInteractionEmit(t,e){if(!this.config.voiceModeConfig?.keepActive)return t===bT.VOICE_SLEEP||t===bT.VOICE_INTERRUPT?(this.stop(),void this.emit(t,e)):void(t!==bT.VOICE_WAKE&&(this.exeSequence.hasRuning()||this.fetchSequence.hasRuning()||[...fD.apiAsk,...fD.apiText2Speech,...fD.fetchFloat32Array].length>0)||this.emit(t,e));this.emit(t,e)}offlineRender(t){this.core&&(this.core.destroy(),this.core.offAny(this.onAnyEvent),this.core=null,this.onAnyEvent=null),this.core=new yT(this.container,this.config.modelConfig),this.onAnyEvent=(t,e)=>{this.emit(String(t),e)},this.core.onAny(this.onAnyEvent);return Ts(t,(t=>{this.emit(bT.HUMAN_LOAD_PROGRESS,{code:"download",progress:t,total:Math.floor(.99*t)})})).then((t=>this.core.loadBundles(t,(t=>{this.emit(bT.HUMAN_LOAD_PROGRESS,{code:"loaded",progress:t,total:Math.floor(99+.01*t)})})))).then((()=>(this.status="ready",this.emit(bT.HUMAN_READY),this.loading&&this.config.loadingDestory&&setTimeout((()=>{this.loading.destroy()}),500),this.isNotRender||this.core.animate.call(this.core),!0))).catch((t=>!1))}startRender(){return this.core?(this.core.startRender(),Promise.resolve(!0)):Promise.reject("未初始化渲染对象")}stopRender(){return this.core?(this.core.stopRender(),Promise.resolve(!0)):Promise.reject("未初始化渲染对象")}async closeRecorder(){return"voice"===this.config.mode?aN.recorder.closeRecording().then((()=>!0)):this.recorder.close().then((()=>!0))}async openRecorder(){return"voice"===this.config.mode?aN.recorder.openRecording():this.recorder.open()}}export{bT as EmitEvent,gN as default};
|