diff --git a/404.html b/404.html index ee42ed8bff2..13985416404 100644 --- a/404.html +++ b/404.html @@ -14,8 +14,8 @@ - - + +
"},this.getStyleTags=function(){return e.sealed?C(2):e._emitSheetCSS()},this.getStyleElement=function(){var t;if(e.sealed)return C(2);var i=((t={})[A]="",t["data-styled-version"]="5.3.11",t.dangerouslySetInnerHTML={__html:e.instance.toString()},t),n=F();return n&&(i.nonce=n),[r.createElement("style",g({},i,{key:"sc-0-0"}))]},this.seal=function(){e.sealed=!0},this.instance=new q({isServer:!0}),this.sealed=!1}var t=e.prototype;t.collectStyles=function(e){return this.sealed?C(2):r.createElement(ce,{sheet:this.instance},e)},t.interleaveWithNodeStream=function(e){return C(3)}}();const ze=Le;var ke=function(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e},Ne=242.776657104492,Fe=Be(Ue||(Ue=ke(["\n 12.5% {\n stroke-dasharray: ","px, ","px;\n stroke-dashoffset: -","px;\n }\n 43.75% {\n stroke-dasharray: ","px, ","px;\n stroke-dashoffset: -","px;\n }\n 100% {\n stroke-dasharray: ","px, ","px;\n stroke-dashoffset: -","px;\n }\n"],["\n 12.5% {\n stroke-dasharray: ","px, ","px;\n stroke-dashoffset: -","px;\n }\n 43.75% {\n stroke-dasharray: ","px, ","px;\n stroke-dashoffset: -","px;\n }\n 100% {\n stroke-dasharray: ","px, ","px;\n stroke-dashoffset: -","px;\n }\n"])),.14*Ne,Ne,.11*Ne,.35*Ne,Ne,.35*Ne,.01*Ne,Ne,.99*Ne);ze.path(Ve||(Ve=ke(["\n stroke-dasharray: ","px, ",";\n stroke-dashoffset: 0;\n animation: "," ","s linear infinite;\n"],["\n stroke-dasharray: ","px, ",";\n stroke-dashoffset: 0;\n animation: "," ","s linear infinite;\n"])),.01*Ne,Ne,Fe,1.6);var Ue,Ve;var je=function(e){return{display:e?"flex":"none"}},Ge=function(){return Ge=Object.assign||function(e){for(var t,i=1,r=arguments.length;i0&&void 0!==arguments[0]?arguments[0]:{};if(void 0!==i[e])return i[e];if(e&&e.indexOf(".")>0){for(var r=e.split("."),n=r.length,s=i[r[0]],a=1;null!=s&&a{"use strict";var i,r=Symbol.for("react.element"),n=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),l=Symbol.for("react.provider"),h=Symbol.for("react.context"),c=Symbol.for("react.server_context"),d=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),p=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),g=Symbol.for("react.offscreen");function v(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case r:switch(e=e.type){case s:case o:case a:case u:case p:return e;default:switch(e=e&&e.$$typeof){case c:case h:case d:case m:case f:case l:return e;default:return t}}case n:return t}}}i=Symbol.for("react.module.reference"),t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===s||e===o||e===a||e===u||e===p||e===g||"object"==typeof e&&null!==e&&(e.$$typeof===m||e.$$typeof===f||e.$$typeof===l||e.$$typeof===h||e.$$typeof===d||e.$$typeof===i||void 0!==e.getModuleId)},t.typeOf=v},53634:(e,t,i)=>{"use strict";e.exports=i(68107)},69041:(e,t,i)=>{"use strict";i.d(t,{Z:()=>xV});var r=i(67294),n=Object.create,s=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,l=Object.getPrototypeOf,h=Object.prototype.hasOwnProperty,c=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),d=(e,t,i)=>(i=null!=e?n(l(e)):{},((e,t,i,r)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let n of o(t))!h.call(e,n)&&n!==i&&s(e,n,{get:()=>t[n],enumerable:!(r=a(t,n))||r.enumerable});return e})(!t&&e&&e.__esModule?i:s(i,"default",{value:e,enumerable:!0}),e)),u=(e,t,i)=>(((e,t,i)=>{t in e?s(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i})(e,"symbol"!=typeof t?t+"":t,i),i),p=c(((e,t)=>{!function(i,r){"object"==typeof e?t.exports=r():"function"==typeof define&&define.amd?define(r):i.Alea=r()}(e,(function(){return e.importState=function(t){var i=new e;return i.importState(t),i},e;function e(){return function(e){var t=0,i=0,r=0,n=1;0==e.length&&(e=[+new Date]);var s=function(){var e=4022871197,t=function(t){t=t.toString();for(var i=0;i>>0,e=(r*=e)>>>0,e+=4294967296*(r-=e)}return 2.3283064365386963e-10*(e>>>0)};return t.version="Mash 0.9",t}();t=s(" "),i=s(" "),r=s(" ");for(var a=0;a{!function(i,r){"object"==typeof e&&typeof t<"u"?r(e):"function"==typeof define&&define.amd?define(["exports"],r):r((i=typeof globalThis<"u"?globalThis:i||self).SVDJS={})}(e,(function(e){e.SVD=function(e,t,i,r,n){if(t=void 0===t||t,i=void 0===i||i,n=1e-64/(r=r||Math.pow(2,-52)),!e)throw new TypeError("Matrix a is not defined");var s,a,o,l,h,c,d,u,p,f,m,g,v=e[0].length,y=e.length;if(y{!function(i,r){"object"==typeof e&&typeof t<"u"?t.exports=r():"function"==typeof define&&define.amd?define(r):(i=i||self).TinyQueue=r()}(e,(function(){var e=function(e,i){if(void 0===e&&(e=[]),void 0===i&&(i=t),this.data=e,this.length=this.data.length,this.compare=i,this.length>0)for(var r=(this.length>>1)-1;r>=0;r--)this._down(r)};function t(e,t){return et?1:0}return e.prototype.push=function(e){this.data.push(e),this.length++,this._up(this.length-1)},e.prototype.pop=function(){if(0!==this.length){var e=this.data[0],t=this.data.pop();return this.length--,this.length>0&&(this.data[0]=t,this._down(0)),e}},e.prototype.peek=function(){return this.data[0]},e.prototype._up=function(e){for(var t=this.data,i=this.compare,r=t[e];e>0;){var n=e-1>>1,s=t[n];if(i(r,s)>=0)break;t[e]=s,e=n}t[e]=r},e.prototype._down=function(e){for(var t=this.data,i=this.compare,r=this.length>>1,n=t[e];e=0)break;t[e]=a,e=s}t[e]=n},e}))})),g=c(((e,t)=>{var i=m();function r(e,t,r){t=t||1;for(var a,o,l,h,c=0;cl)&&(l=d[0]),(!c||d[1]>h)&&(h=d[1])}var u=l-a,p=h-o,f=Math.min(u,p),m=f/2;if(0===f){var g=[a,o];return g.distance=0,g}for(var v=new i(void 0,n),y=a;yb.d&&(b=w);for(var _=v.length;v.length;){var S=v.pop();S.d>b.d&&(b=S,r&&console.log("found best %d after %d probes",Math.round(1e4*S.d)/1e4,_)),!(S.max-b.d<=t)&&(m=S.h/2,v.push(new s(S.x-m,S.y-m,m,e)),v.push(new s(S.x+m,S.y-m,m,e)),v.push(new s(S.x-m,S.y+m,m,e)),v.push(new s(S.x+m,S.y+m,m,e)),_+=4)}r&&(console.log("num probes: "+_),console.log("best distance: "+b.d));var A=[b.x,b.y];return A.distance=b.d,A}function n(e,t){return t.max-e.max}function s(e,t,i,r){this.x=e,this.y=t,this.h=i,this.d=function(e,t,i){for(var r=!1,n=1/0,s=0;st!=u[1]>t&&e<(u[0]-d[0])*(t-d[1])/(u[1]-d[1])+d[0]&&(r=!r),n=Math.min(n,a(e,t,d,u))}return 0===n?0:(r?1:-1)*Math.sqrt(n)}(e,t,r),this.max=this.d+this.h*Math.SQRT2}function a(e,t,i,r){var n=i[0],s=i[1],a=r[0]-n,o=r[1]-s;if(0!==a||0!==o){var l=((e-n)*a+(t-s)*o)/(a*a+o*o);l>1?(n=r[0],s=r[1]):l>0&&(n+=a*l,s+=o*l)}return(a=e-n)*a+(o=t-s)*o}i.default&&(i=i.default),t.exports=r,t.exports.default=r})),v=c(((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(e){if(null===e||!0===e||!1===e)return NaN;var t=Number(e);return isNaN(t)?t:t<0?Math.ceil(t):Math.floor(t)},t.exports=e.default})),y=c(((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(e){var t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),e.getTime()-t.getTime()},t.exports=e.default})),x=c((e=>{!function(){var t=function(){this.init()};t.prototype={init:function(){var e=this||i;return e._counter=1e3,e._html5AudioPool=[],e.html5PoolSize=10,e._codecs={},e._howls=[],e._muted=!1,e._volume=1,e._canPlayEvent="canplaythrough",e._navigator=typeof window<"u"&&window.navigator?window.navigator:null,e.masterGain=null,e.noAudio=!1,e.usingWebAudio=!0,e.autoSuspend=!0,e.ctx=null,e.autoUnlock=!0,e._setup(),e},volume:function(e){var t=this||i;if(e=parseFloat(e),t.ctx||c(),typeof e<"u"&&e>=0&&e<=1){if(t._volume=e,t._muted)return t;t.usingWebAudio&&t.masterGain.gain.setValueAtTime(e,i.ctx.currentTime);for(var r=0;r=0;t--)e._howls[t].unload();return e.usingWebAudio&&e.ctx&&typeof e.ctx.close<"u"&&(e.ctx.close(),e.ctx=null,c()),e},codecs:function(e){return(this||i)._codecs[e.replace(/^x-/,"")]},_setup:function(){var e=this||i;if(e.state=e.ctx&&e.ctx.state||"suspended",e._autoSuspend(),!e.usingWebAudio)if(typeof Audio<"u")try{typeof(new Audio).oncanplaythrough>"u"&&(e._canPlayEvent="canplay")}catch{e.noAudio=!0}else e.noAudio=!0;try{(new Audio).muted&&(e.noAudio=!0)}catch{}return e.noAudio||e._setupCodecs(),e},_setupCodecs:function(){var e=this||i,t=null;try{t=typeof Audio<"u"?new Audio:null}catch{return e}if(!t||"function"!=typeof t.canPlayType)return e;var r=t.canPlayType("audio/mpeg;").replace(/^no$/,""),n=e._navigator?e._navigator.userAgent:"",s=n.match(/OPR\/([0-6].)/g),a=s&&parseInt(s[0].split("/")[1],10)<33,o=-1!==n.indexOf("Safari")&&-1===n.indexOf("Chrome"),l=n.match(/Version\/(.*?) /),h=o&&l&&parseInt(l[1],10)<15;return e._codecs={mp3:!(a||!r&&!t.canPlayType("audio/mp3;").replace(/^no$/,"")),mpeg:!!r,opus:!!t.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/,""),ogg:!!t.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),oga:!!t.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),wav:!!(t.canPlayType('audio/wav; codecs="1"')||t.canPlayType("audio/wav")).replace(/^no$/,""),aac:!!t.canPlayType("audio/aac;").replace(/^no$/,""),caf:!!t.canPlayType("audio/x-caf;").replace(/^no$/,""),m4a:!!(t.canPlayType("audio/x-m4a;")||t.canPlayType("audio/m4a;")||t.canPlayType("audio/aac;")).replace(/^no$/,""),m4b:!!(t.canPlayType("audio/x-m4b;")||t.canPlayType("audio/m4b;")||t.canPlayType("audio/aac;")).replace(/^no$/,""),mp4:!!(t.canPlayType("audio/x-mp4;")||t.canPlayType("audio/mp4;")||t.canPlayType("audio/aac;")).replace(/^no$/,""),weba:!(h||!t.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),webm:!(h||!t.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),dolby:!!t.canPlayType('audio/mp4; codecs="ec-3"').replace(/^no$/,""),flac:!!(t.canPlayType("audio/x-flac;")||t.canPlayType("audio/flac;")).replace(/^no$/,"")},e},_unlockAudio:function(){var e=this||i;if(!e._audioUnlocked&&e.ctx){e._audioUnlocked=!1,e.autoUnlock=!1,!e._mobileUnloaded&&44100!==e.ctx.sampleRate&&(e._mobileUnloaded=!0,e.unload()),e._scratchBuffer=e.ctx.createBuffer(1,1,22050);var t=function(i){for(;e._html5AudioPool.length"u"?l.noteOn(0):l.start(0),"function"==typeof e.ctx.resume&&e.ctx.resume(),l.onended=function(){l.disconnect(0),e._audioUnlocked=!0,document.removeEventListener("touchstart",t,!0),document.removeEventListener("touchend",t,!0),document.removeEventListener("click",t,!0),document.removeEventListener("keydown",t,!0);for(var i=0;i"u")&&i.usingWebAudio){for(var t=0;t"u")&&i.usingWebAudio)return"running"===e.state&&"interrupted"!==e.ctx.state&&e._suspendTimer?(clearTimeout(e._suspendTimer),e._suspendTimer=null):"suspended"===e.state||"running"===e.state&&"interrupted"===e.ctx.state?(e.ctx.resume().then((function(){e.state="running";for(var t=0;t"u"&&(e="__default",!r._playLock)){for(var s=0,a=0;a0?o._seek:r._sprite[e][0]/1e3),c=Math.max(0,(r._sprite[e][0]+r._sprite[e][1])/1e3-h),d=1e3*c/Math.abs(o._rate),u=r._sprite[e][0]/1e3,p=(r._sprite[e][0]+r._sprite[e][1])/1e3;o._sprite=e,o._ended=!1;var f=function(){o._paused=!1,o._seek=h,o._start=u,o._stop=p,o._loop=!(!o._loop&&!r._sprite[e][2])};if(!(h>=p)){var m=o._node;if(r._webAudio){var g=function(){r._playLock=!1,f(),r._refreshBuffer(o);var e=o._muted||r._muted?0:o._volume;m.gain.setValueAtTime(e,i.ctx.currentTime),o._playStart=i.ctx.currentTime,typeof m.bufferSource.start>"u"?o._loop?m.bufferSource.noteGrainOn(0,h,86400):m.bufferSource.noteGrainOn(0,h,c):o._loop?m.bufferSource.start(0,h,86400):m.bufferSource.start(0,h,c),d!==1/0&&(r._endTimers[o._id]=setTimeout(r._ended.bind(r,o),d)),t||setTimeout((function(){r._emit("play",o._id),r._loadQueue()}),0)};"running"===i.state&&"interrupted"!==i.ctx.state?g():(r._playLock=!0,r.once("resume",g),r._clearTimer(o._id))}else{var v=function(){m.currentTime=h,m.muted=o._muted||r._muted||i._muted||m.muted,m.volume=o._volume*i.volume(),m.playbackRate=o._rate;try{var n=m.play();if(n&&typeof Promise<"u"&&(n instanceof Promise||"function"==typeof n.then)?(r._playLock=!0,f(),n.then((function(){r._playLock=!1,m._unlocked=!0,t?r._loadQueue():r._emit("play",o._id)})).catch((function(){r._playLock=!1,r._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}))):t||(r._playLock=!1,f(),r._emit("play",o._id)),m.playbackRate=o._rate,m.paused)return void r._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"!==e||o._loop?r._endTimers[o._id]=setTimeout(r._ended.bind(r,o),d):(r._endTimers[o._id]=function(){r._ended(o),m.removeEventListener("ended",r._endTimers[o._id],!1)},m.addEventListener("ended",r._endTimers[o._id],!1))}catch(s){r._emit("playerror",o._id,s)}};"data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA"===m.src&&(m.src=r._src,m.load());var y=window&&window.ejecta||!m.readyState&&i._navigator.isCocoonJS;if(m.readyState>=3||y)v();else{r._playLock=!0,r._state="loading";var x=function(){r._state="loaded",v(),m.removeEventListener(i._canPlayEvent,x,!1)};m.addEventListener(i._canPlayEvent,x,!1),r._clearTimer(o._id)}}return o._id}r._ended(o)},pause:function(e){var t=this;if("loaded"!==t._state||t._playLock)return t._queue.push({event:"pause",action:function(){t.pause(e)}}),t;for(var i=t._getSoundIds(e),r=0;r"u"?n._node.bufferSource.noteOff(0):n._node.bufferSource.stop(0),t._cleanBuffer(n._node)}else(!isNaN(n._node.duration)||n._node.duration===1/0)&&n._node.pause();arguments[1]||t._emit("pause",n?n._id:null)}return t},stop:function(e,t){var i=this;if("loaded"!==i._state||i._playLock)return i._queue.push({event:"stop",action:function(){i.stop(e)}}),i;for(var r=i._getSoundIds(e),n=0;n"u"?s._node.bufferSource.noteOff(0):s._node.bufferSource.stop(0),i._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&&i._clearSound(s._node))),t||i._emit("stop",s._id))}return i},mute:function(e,t){var r=this;if("loaded"!==r._state||r._playLock)return r._queue.push({event:"mute",action:function(){r.mute(e,t)}}),r;if(typeof t>"u"){if("boolean"!=typeof e)return r._muted;r._muted=e}for(var n=r._getSoundIds(t),s=0;s"u"?n._getSoundIds().indexOf(s[0])>=0?t=parseInt(s[0],10):e=parseFloat(s[0]):s.length>=2&&(e=parseFloat(s[0]),t=parseInt(s[1],10));if(!(typeof e<"u"&&e>=0&&e<=1))return(r=t?n._soundById(t):n._sounds[0])?r._volume:0;if("loaded"!==n._state||n._playLock)return n._queue.push({event:"volume",action:function(){n.volume.apply(n,s)}}),n;typeof t>"u"&&(n._volume=e),t=n._getSoundIds(t);for(var a=0;a"u")}}return s},_startFadeInterval:function(e,t,i,r,n,s){var a=this,o=t,l=i-t,h=Math.abs(l/.01),c=Math.max(4,h>0?r/h:r),d=Date.now();e._fadeTo=i,e._interval=setInterval((function(){var n=(Date.now()-d)/r;d=Date.now(),o+=l*n,o=Math.round(100*o)/100,o=l<0?Math.max(i,o):Math.min(i,o),a._webAudio?e._volume=o:a.volume(o,e._id,!0),s&&(a._volume=o),(it&&o>=i)&&(clearInterval(e._interval),e._interval=null,e._fadeTo=null,a.volume(i,e._id),a._emit("fade",e._id))}),c)},_stopFade:function(e){var t=this,r=t._soundById(e);return r&&r._interval&&(t._webAudio&&r._node.gain.cancelScheduledValues(i.ctx.currentTime),clearInterval(r._interval),r._interval=null,t.volume(r._fadeTo,e),r._fadeTo=null,t._emit("fade",e)),t},loop:function(){var e,t,i,r=this,n=arguments;if(0===n.length)return r._loop;if(1===n.length){if("boolean"!=typeof n[0])return!!(i=r._soundById(parseInt(n[0],10)))&&i._loop;e=n[0],r._loop=e}else 2===n.length&&(e=n[0],t=parseInt(n[1],10));for(var s=r._getSoundIds(t),a=0;a=0?t=parseInt(s[0],10):e=parseFloat(s[0])}else 2===s.length&&(e=parseFloat(s[0]),t=parseInt(s[1],10));if("number"!=typeof e)return(r=n._soundById(t))?r._rate:n._rate;if("loaded"!==n._state||n._playLock)return n._queue.push({event:"rate",action:function(){n.rate.apply(n,s)}}),n;typeof t>"u"&&(n._rate=e),t=n._getSoundIds(t);for(var a=0;a=0?t=parseInt(n[0],10):r._sounds.length&&(t=r._sounds[0]._id,e=parseFloat(n[0]))}else 2===n.length&&(e=parseFloat(n[0]),t=parseInt(n[1],10));if(typeof t>"u")return 0;if("number"==typeof e&&("loaded"!==r._state||r._playLock))return r._queue.push({event:"seek",action:function(){r.seek.apply(r,n)}}),r;var s=r._soundById(t);if(s){if(!("number"==typeof e&&e>=0)){if(r._webAudio){var a=r.playing(t)?i.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 l=r.playing(t);l&&r.pause(t,!0),s._seek=e,s._ended=!1,r._clearTimer(t),!r._webAudio&&s._node&&!isNaN(s._node.duration)&&(s._node.currentTime=e);var h=function(){l&&r.play(t,!0),r._emit("seek",t)};if(l&&!r._webAudio){var c=function(){r._playLock?setTimeout(c,0):h()};setTimeout(c,0)}else h()}return r},playing:function(e){var t=this;if("number"==typeof e){var i=t._soundById(e);return!!i&&!i._paused}for(var r=0;r=0&&i._howls.splice(n,1);var a=!0;for(r=0;r=0){a=!1;break}return s&&a&&delete s[e._src],i.noAudio=!1,e._state="unloaded",e._sounds=[],e=null,null},on:function(e,t,i,r){var n=this["_on"+e];return"function"==typeof t&&n.push(r?{id:i,fn:t,once:r}:{id:i,fn:t}),this},off:function(e,t,i){var r=this,n=r["_on"+e],s=0;if("number"==typeof t&&(i=t,t=null),t||i)for(s=0;s=0;s--)(!n[s].id||n[s].id===t||"load"===e)&&(setTimeout(function(e){e.call(this,t,i)}.bind(r,n[s].fn),0),n[s].once&&r.off(e,n[s].fn,n[s].id));return r._loadQueue(e),r},_loadQueue:function(e){var t=this;if(t._queue.length>0){var i=t._queue[0];i.event===e&&(t._queue.shift(),t._loadQueue()),e||i.action()}return t},_ended:function(e){var t=this,r=e._sprite;if(!t._webAudio&&e._node&&!e._node.paused&&!e._node.ended&&e._node.currentTime=0;r--){if(i<=t)return;e._sounds[r]._ended&&(e._webAudio&&e._sounds[r]._node&&e._sounds[r]._node.disconnect(0),e._sounds.splice(r,1),i--)}}},_getSoundIds:function(e){if(typeof e>"u"){for(var t=[],i=0;i=0;if(i._scratchBuffer&&e.bufferSource&&(e.bufferSource.onended=null,e.bufferSource.disconnect(0),t))try{e.bufferSource.buffer=i._scratchBuffer}catch{}return e.bufferSource=null,this},_clearSound:function(e){/MSIE |Trident\//.test(i._navigator&&i._navigator.userAgent)||(e.src="data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA")}};var n=function(e){this._parent=e,this.init()};n.prototype={init:function(){var e=this,t=e._parent;return e._muted=t._muted,e._loop=t._loop,e._volume=t._volume,e._rate=t._rate,e._seek=0,e._paused=!0,e._ended=!0,e._sprite="__default",e._id=++i._counter,t._sounds.push(e),e.create(),e},create:function(){var e=this,t=e._parent,r=i._muted||e._muted||e._parent._muted?0:e._volume;return t._webAudio?(e._node=typeof i.ctx.createGain>"u"?i.ctx.createGainNode():i.ctx.createGain(),e._node.gain.setValueAtTime(r,i.ctx.currentTime),e._node.paused=!0,e._node.connect(i.masterGain)):i.noAudio||(e._node=i._obtainHtml5Audio(),e._errorFn=e._errorListener.bind(e),e._node.addEventListener("error",e._errorFn,!1),e._loadFn=e._loadListener.bind(e),e._node.addEventListener(i._canPlayEvent,e._loadFn,!1),e._endFn=e._endListener.bind(e),e._node.addEventListener("ended",e._endFn,!1),e._node.src=t._src,e._node.preload=!0===t._preload?"auto":t._preload,e._node.volume=r*i.volume(),e._node.load()),e},reset:function(){var e=this,t=e._parent;return e._muted=t._muted,e._loop=t._loop,e._volume=t._volume,e._rate=t._rate,e._seek=0,e._rateSeek=0,e._paused=!0,e._ended=!0,e._sprite="__default",e._id=++i._counter,e},_errorListener:function(){var e=this;e._parent._emit("loaderror",e._id,e._node.error?e._node.error.code:0),e._node.removeEventListener("error",e._errorFn,!1)},_loadListener:function(){var e=this,t=e._parent;t._duration=Math.ceil(10*e._node.duration)/10,0===Object.keys(t._sprite).length&&(t._sprite={__default:[0,1e3*t._duration]}),"loaded"!==t._state&&(t._state="loaded",t._emit("load"),t._loadQueue()),e._node.removeEventListener(i._canPlayEvent,e._loadFn,!1)},_endListener:function(){var e=this,t=e._parent;t._duration===1/0&&(t._duration=Math.ceil(10*e._node.duration)/10,t._sprite.__default[1]===1/0&&(t._sprite.__default[1]=1e3*t._duration),t._ended(e)),e._node.removeEventListener("ended",e._endFn,!1)}};var s={},a=function(e){var t=e._src;if(s[t])return e._duration=s[t].duration,void h(e);if(/^data:[^;]+;base64,/.test(t)){for(var i=atob(t.split(",")[1]),r=new Uint8Array(i.length),n=0;n0?(s[t._src]=e,h(t,e)):r()};typeof Promise<"u"&&1===i.ctx.decodeAudioData.length?i.ctx.decodeAudioData(e).then(n).catch(r):i.ctx.decodeAudioData(e,n,r)},h=function(e,t){t&&!e._duration&&(e._duration=t.duration),0===Object.keys(e._sprite).length&&(e._sprite={__default:[0,1e3*e._duration]}),"loaded"!==e._state&&(e._state="loaded",e._emit("load"),e._loadQueue())},c=function(){if(i.usingWebAudio){try{typeof AudioContext<"u"?i.ctx=new AudioContext:typeof webkitAudioContext<"u"?i.ctx=new webkitAudioContext:i.usingWebAudio=!1}catch{i.usingWebAudio=!1}i.ctx||(i.usingWebAudio=!1);var e=/iP(hone|od|ad)/.test(i._navigator&&i._navigator.platform),t=i._navigator&&i._navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/),r=t?parseInt(t[1],10):null;if(e&&r&&r<9){var n=/safari/.test(i._navigator&&i._navigator.userAgent.toLowerCase());i._navigator&&!n&&(i.usingWebAudio=!1)}i.usingWebAudio&&(i.masterGain=typeof i.ctx.createGain>"u"?i.ctx.createGainNode():i.ctx.createGain(),i.masterGain.gain.setValueAtTime(i._muted?0:i._volume,i.ctx.currentTime),i.masterGain.connect(i.ctx.destination)),i._setup()}};"function"==typeof define&&define.amd&&define([],(function(){return{Howler:i,Howl:r}})),typeof e<"u"&&(e.Howler=i,e.Howl=r),typeof global<"u"?(global.HowlerGlobal=t,global.Howler=i,global.Howl=r,global.Sound=n):typeof window<"u"&&(window.HowlerGlobal=t,window.Howler=i,window.Howl=r,window.Sound=n)}(),function(){var e;HowlerGlobal.prototype._pos=[0,0,0],HowlerGlobal.prototype._orientation=[0,0,-1,0,1,0],HowlerGlobal.prototype.stereo=function(e){var t=this;if(!t.ctx||!t.ctx.listener)return t;for(var i=t._howls.length-1;i>=0;i--)t._howls[i].stereo(e);return t},HowlerGlobal.prototype.pos=function(e,t,i){var r=this;return r.ctx&&r.ctx.listener?(t="number"!=typeof t?r._pos[1]:t,i="number"!=typeof i?r._pos[2]:i,"number"!=typeof e?r._pos:(r._pos=[e,t,i],typeof r.ctx.listener.positionX<"u"?(r.ctx.listener.positionX.setTargetAtTime(r._pos[0],Howler.ctx.currentTime,.1),r.ctx.listener.positionY.setTargetAtTime(r._pos[1],Howler.ctx.currentTime,.1),r.ctx.listener.positionZ.setTargetAtTime(r._pos[2],Howler.ctx.currentTime,.1)):r.ctx.listener.setPosition(r._pos[0],r._pos[1],r._pos[2]),r)):r},HowlerGlobal.prototype.orientation=function(e,t,i,r,n,s){var a=this;if(!a.ctx||!a.ctx.listener)return a;var o=a._orientation;return t="number"!=typeof t?o[1]:t,i="number"!=typeof i?o[2]:i,r="number"!=typeof r?o[3]:r,n="number"!=typeof n?o[4]:n,s="number"!=typeof s?o[5]:s,"number"!=typeof e?o:(a._orientation=[e,t,i,r,n,s],typeof a.ctx.listener.forwardX<"u"?(a.ctx.listener.forwardX.setTargetAtTime(e,Howler.ctx.currentTime,.1),a.ctx.listener.forwardY.setTargetAtTime(t,Howler.ctx.currentTime,.1),a.ctx.listener.forwardZ.setTargetAtTime(i,Howler.ctx.currentTime,.1),a.ctx.listener.upX.setTargetAtTime(r,Howler.ctx.currentTime,.1),a.ctx.listener.upY.setTargetAtTime(n,Howler.ctx.currentTime,.1),a.ctx.listener.upZ.setTargetAtTime(s,Howler.ctx.currentTime,.1)):a.ctx.listener.setOrientation(e,t,i,r,n,s),a)},Howl.prototype.init=(e=Howl.prototype.init,function(t){var i=this;return i._orientation=t.orientation||[1,0,0],i._stereo=t.stereo||null,i._pos=t.pos||null,i._pannerAttr={coneInnerAngle:typeof t.coneInnerAngle<"u"?t.coneInnerAngle:360,coneOuterAngle:typeof t.coneOuterAngle<"u"?t.coneOuterAngle:360,coneOuterGain:typeof t.coneOuterGain<"u"?t.coneOuterGain:0,distanceModel:typeof t.distanceModel<"u"?t.distanceModel:"inverse",maxDistance:typeof t.maxDistance<"u"?t.maxDistance:1e4,panningModel:typeof t.panningModel<"u"?t.panningModel:"HRTF",refDistance:typeof t.refDistance<"u"?t.refDistance:1,rolloffFactor:typeof t.rolloffFactor<"u"?t.rolloffFactor:1},i._onstereo=t.onstereo?[{fn:t.onstereo}]:[],i._onpos=t.onpos?[{fn:t.onpos}]:[],i._onorientation=t.onorientation?[{fn:t.onorientation}]:[],e.call(this,t)}),Howl.prototype.stereo=function(e,i){var r=this;if(!r._webAudio)return r;if("loaded"!==r._state)return r._queue.push({event:"stereo",action:function(){r.stereo(e,i)}}),r;var n=typeof Howler.ctx.createStereoPanner>"u"?"spatial":"stereo";if(typeof i>"u"){if("number"!=typeof e)return r._stereo;r._stereo=e,r._pos=[e,0,0]}for(var s=r._getSoundIds(i),a=0;a"u"){if("number"!=typeof e)return s._pos;s._pos=[e,i,r]}for(var a=s._getSoundIds(n),o=0;o"u"){if("number"!=typeof e)return s._orientation;s._orientation=[e,i,r]}for(var a=s._getSoundIds(n),o=0;o"u"&&(e.pannerAttr||(e.pannerAttr={coneInnerAngle:e.coneInnerAngle,coneOuterAngle:e.coneOuterAngle,coneOuterGain:e.coneOuterGain,distanceModel:e.distanceModel,maxDistance:e.maxDistance,refDistance:e.refDistance,rolloffFactor:e.rolloffFactor,panningModel:e.panningModel}),n._pannerAttr={coneInnerAngle:typeof e.pannerAttr.coneInnerAngle<"u"?e.pannerAttr.coneInnerAngle:n._coneInnerAngle,coneOuterAngle:typeof e.pannerAttr.coneOuterAngle<"u"?e.pannerAttr.coneOuterAngle:n._coneOuterAngle,coneOuterGain:typeof e.pannerAttr.coneOuterGain<"u"?e.pannerAttr.coneOuterGain:n._coneOuterGain,distanceModel:typeof e.pannerAttr.distanceModel<"u"?e.pannerAttr.distanceModel:n._distanceModel,maxDistance:typeof e.pannerAttr.maxDistance<"u"?e.pannerAttr.maxDistance:n._maxDistance,refDistance:typeof e.pannerAttr.refDistance<"u"?e.pannerAttr.refDistance:n._refDistance,rolloffFactor:typeof e.pannerAttr.rolloffFactor<"u"?e.pannerAttr.rolloffFactor:n._rolloffFactor,panningModel:typeof e.pannerAttr.panningModel<"u"?e.pannerAttr.panningModel:n._panningModel})}else 2===s.length&&(e=s[0],i=parseInt(s[1],10));for(var a=n._getSoundIds(i),o=0;o{t.exports=function(e){for(var t=new Array(e),i=0;i{function i(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}t.exports=function(e){return null!=e&&(i(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&i(e.slice(0,0))}(e)||!!e._isBuffer)}})),_=c(((e,t)=>{var i=b(),r=w(),n=typeof Float64Array<"u";function s(e,t){return e[0]-t[0]}function a(){var e,t=this.stride,i=new Array(t.length);for(e=0;eMath.abs(this.stride[1]))?[1,0]:[0,1]}})"):3===t&&s.push("var s0=Math.abs(this.stride[0]),s1=Math.abs(this.stride[1]),s2=Math.abs(this.stride[2]);if(s0>s1){if(s1>s2){return [2,1,0];}else if(s0>s2){return [1,2,0];}else{return [1,0,2];}}else if(s0>s2){return [2,0,1];}else if(s2>s1){return [0,1,2];}else{return [0,2,1];}}})")):s.push("ORDER})")),s.push("proto.set=function "+r+"_set("+h.join(",")+",v){"),n?s.push("return this.data.set("+c+",v)}"):s.push("return this.data["+c+"]=v}"),s.push("proto.get=function "+r+"_get("+h.join(",")+"){"),n?s.push("return this.data.get("+c+")}"):s.push("return this.data["+c+"]}"),s.push("proto.index=function "+r+"_index(",h.join(),"){return "+c+"}"),s.push("proto.hi=function "+r+"_hi("+h.join(",")+"){return new "+r+"(this.data,"+o.map((function(e){return["(typeof i",e,"!=='number'||i",e,"<0)?this.shape[",e,"]:i",e,"|0"].join("")})).join(",")+","+o.map((function(e){return"this.stride["+e+"]"})).join(",")+",this.offset)}");var p=o.map((function(e){return"a"+e+"=this.shape["+e+"]"})),f=o.map((function(e){return"c"+e+"=this.stride["+e+"]"}));s.push("proto.lo=function "+r+"_lo("+h.join(",")+"){var b=this.offset,d=0,"+p.join(",")+","+f.join(","));for(var m=0;m=0){d=i"+m+"|0;b+=c"+m+"*d;a"+m+"-=d}");s.push("return new "+r+"(this.data,"+o.map((function(e){return"a"+e})).join(",")+","+o.map((function(e){return"c"+e})).join(",")+",b)}"),s.push("proto.step=function "+r+"_step("+h.join(",")+"){var "+o.map((function(e){return"a"+e+"=this.shape["+e+"]"})).join(",")+","+o.map((function(e){return"b"+e+"=this.stride["+e+"]"})).join(",")+",c=this.offset,d=0,ceil=Math.ceil");for(m=0;m=0){c=(c+this.stride["+m+"]*i"+m+")|0}else{a.push(this.shape["+m+"]);b.push(this.stride["+m+"])}");return s.push("var ctor=CTOR_LIST[a.length+1];return ctor(this.data,a,b,c)}"),s.push("return function construct_"+r+"(data,shape,stride,offset){return new "+r+"(data,"+o.map((function(e){return"shape["+e+"]"})).join(",")+","+o.map((function(e){return"stride["+e+"]"})).join(",")+",offset)}"),new Function("CTOR_LIST","ORDER",s.join("\n"))(l[e],a)}var l={float32:[],float64:[],int8:[],int16:[],int32:[],uint8:[],uint16:[],uint32:[],array:[],uint8_clamped:[],bigint64:[],biguint64:[],buffer:[],generic:[]};t.exports=function(e,t,i,s){if(void 0===e)return(0,l.array[0])([]);"number"==typeof e&&(e=[e]),void 0===t&&(t=[e.length]);var a=t.length;if(void 0===i){i=new Array(a);for(var h=a-1,c=1;h>=0;--h)i[h]=c,c*=t[h]}if(void 0===s){s=0;for(h=0;h{t.exports=function(e,t,i){return 0===e.length?e:t?(i||e.sort(t),function(e,t){for(var i=1,r=e.length,n=e[0],s=e[0],a=1;a{var i=S();function r(e,t,i){var r,n,s=e.length,a=t.arrayArgs.length,o=t.indexArgs.length>0,l=[],h=[],c=0,d=0;for(r=0;r0&&l.push("var "+h.join(",")),r=s-1;r>=0;--r)c=e[r],l.push(["for(i",r,"=0;i",r,"0&&l.push(["index[",d,"]-=s",d].join("")),l.push(["++index[",c,"]"].join(""))),l.push("}")}return l.join("\n")}function n(e,t,i){for(var r=e.body,n=[],s=[],a=0;a0&&(i=i&&t[r]===t[r-1])}return i?t[0]:t.join("")}t.exports=function(e,t){for(var a=t[1].length-Math.abs(e.arrayBlockIndices[0])|0,o=new Array(e.arrayArgs.length),l=new Array(e.arrayArgs.length),h=0;h0&&x.push("shape=SS.slice(0)"),e.indexArgs.length>0){var b=new Array(a);for(h=0;h0&&y.push("var "+x.join(",")),h=0;h3&&y.push(n(e.pre,e,l));var A=n(e.body,e,l),M=function(e){for(var t=0,i=e[0].length;t0,h=[],c=0;c0;){"].join("")),h.push(["if(j",c,"<",o,"){"].join("")),h.push(["s",t[c],"=j",c].join("")),h.push(["j",c,"=0"].join("")),h.push(["}else{s",t[c],"=",o].join("")),h.push(["j",c,"-=",o,"}"].join("")),l&&h.push(["index[",t[c],"]=j",c].join(""));for(c=0;c3&&y.push(n(e.post,e,l)),e.debug&&console.log("-----Generated cwise routine for ",t,":\n"+y.join("\n")+"\n----------");var E=[e.funcName||"unnamed","_cwise_loop_",o[0].join("s"),"m",M,s(l)].join("");return new Function(["function ",E,"(",v.join(","),"){",y.join("\n"),"} return ",E].join(""))()}})),M=c(((e,t)=>{var i=A();t.exports=function(e){var t=["'use strict'","var CACHED={}"],r=[],n=e.funcName+"_cwise_thunk";t.push(["return function ",n,"(",e.shimArgs.join(","),"){"].join(""));for(var s=[],a=[],o=[["array",e.arrayArgs[0],".shape.slice(",Math.max(0,e.arrayBlockIndices[0]),e.arrayBlockIndices[0]<0?","+e.arrayBlockIndices[0]+")":")"].join("")],l=[],h=[],c=0;c0&&(l.push("array"+e.arrayArgs[0]+".shape.length===array"+d+".shape.length+"+(Math.abs(e.arrayBlockIndices[0])-Math.abs(e.arrayBlockIndices[c]))),h.push("array"+e.arrayArgs[0]+".shape[shapeIndex+"+Math.max(0,e.arrayBlockIndices[0])+"]===array"+d+".shape[shapeIndex+"+Math.max(0,e.arrayBlockIndices[c])+"]"))}for(e.arrayArgs.length>1&&(t.push("if (!("+l.join(" && ")+")) throw new Error('cwise: Arrays do not all have the same dimensionality!')"),t.push("for(var shapeIndex=array"+e.arrayArgs[0]+".shape.length-"+Math.abs(e.arrayBlockIndices[0])+"; shapeIndex--\x3e0;) {"),t.push("if (!("+h.join(" && ")+")) throw new Error('cwise: Arrays do not all have the same shape!')"),t.push("}")),c=0;c{var i=M();function r(){this.argTypes=[],this.shimArgs=[],this.arrayArgs=[],this.arrayBlockIndices=[],this.scalarArgs=[],this.offsetArgs=[],this.offsetArgIndex=[],this.indexArgs=[],this.shapeArgs=[],this.funcName="",this.pre=null,this.body=null,this.post=null,this.debug=!1}t.exports=function(e){var t=new r;t.pre=e.pre,t.body=e.body,t.post=e.post;var n=e.args.slice(0);t.argTypes=n;for(var s=0;s0)throw new Error("cwise: pre() block may not reference array args");if(s0)throw new Error("cwise: post() block may not reference array args")}else if("scalar"===a)t.scalarArgs.push(s),t.shimArgs.push("scalar"+s);else if("index"===a){if(t.indexArgs.push(s),s0)throw new Error("cwise: pre() block may not reference array index");if(s0)throw new Error("cwise: post() block may not reference array index")}else if("shape"===a){if(t.shapeArgs.push(s),sn.length)throw new Error("cwise: Too many arguments in pre() block");if(t.body.args.length>n.length)throw new Error("cwise: Too many arguments in body() block");if(t.post.args.length>n.length)throw new Error("cwise: Too many arguments in post() block");return t.debug=!!e.printCode||!!e.debug,t.funcName=e.funcName||"cwise",t.blockSize=e.blockSize||64,i(t)}})),C=c((e=>{var t=E(),i={body:"",args:[],thisVars:[],localVars:[]};function r(e){if(!e)return i;for(var t=0;t>",rrshift:">>>"};!function(){for(var t in s){var i=s[t];e[t]=n({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+i+"c"},funcName:t}),e[t+"eq"]=n({args:["array","array"],body:{args:["a","b"],body:"a"+i+"=b"},rvalue:!0,funcName:t+"eq"}),e[t+"s"]=n({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+i+"s"},funcName:t+"s"}),e[t+"seq"]=n({args:["array","scalar"],body:{args:["a","s"],body:"a"+i+"=s"},rvalue:!0,funcName:t+"seq"})}}();var a={not:"!",bnot:"~",neg:"-",recip:"1.0/"};!function(){for(var t in a){var i=a[t];e[t]=n({args:["array","array"],body:{args:["a","b"],body:"a="+i+"b"},funcName:t}),e[t+"eq"]=n({args:["array"],body:{args:["a"],body:"a="+i+"a"},rvalue:!0,count:2,funcName:t+"eq"})}}();var o={and:"&&",or:"||",eq:"===",neq:"!==",lt:"<",gt:">",leq:"<=",geq:">="};!function(){for(var t in o){var i=o[t];e[t]=n({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+i+"c"},funcName:t}),e[t+"s"]=n({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+i+"s"},funcName:t+"s"}),e[t+"eq"]=n({args:["array","array"],body:{args:["a","b"],body:"a=a"+i+"b"},rvalue:!0,count:2,funcName:t+"eq"}),e[t+"seq"]=n({args:["array","scalar"],body:{args:["a","s"],body:"a=a"+i+"s"},rvalue:!0,count:2,funcName:t+"seq"})}}();var l=["abs","acos","asin","atan","ceil","cos","exp","floor","log","round","sin","sqrt","tan"];!function(){for(var t=0;tthis_s){this_s=-a}else if(a>this_s){this_s=a}",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norminf"}),e.norm1=t({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:3}],body:"this_s+=a<0?-a:a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norm1"}),e.sup=t({args:["array"],pre:{body:"this_h=-Infinity",args:[],thisVars:["this_h"],localVars:[]},body:{body:"if(_inline_1_arg0_>this_h)this_h=_inline_1_arg0_",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_h"],localVars:[]},post:{body:"return this_h",args:[],thisVars:["this_h"],localVars:[]}}),e.inf=t({args:["array"],pre:{body:"this_h=Infinity",args:[],thisVars:["this_h"],localVars:[]},body:{body:"if(_inline_1_arg0_this_v){this_v=_inline_1_arg1_;for(var _inline_1_k=0;_inline_1_k<_inline_1_arg0_.length;++_inline_1_k){this_i[_inline_1_k]=_inline_1_arg0_[_inline_1_k]}}}",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2},{name:"_inline_1_arg1_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_i","this_v"],localVars:["_inline_1_k"]},post:{body:"{return this_i}",args:[],thisVars:["this_i"],localVars:[]}}),e.random=n({args:["array"],pre:{args:[],body:"this_f=Math.random",thisVars:["this_f"]},body:{args:["a"],body:"a=this_f()",thisVars:["this_f"]},funcName:"random"}),e.assign=n({args:["array","array"],body:{args:["a","b"],body:"a=b"},funcName:"assign"}),e.assigns=n({args:["array","scalar"],body:{args:["a","b"],body:"a=b"},funcName:"assigns"}),e.equals=t({args:["array","array"],pre:i,body:{args:[{name:"x",lvalue:!1,rvalue:!0,count:1},{name:"y",lvalue:!1,rvalue:!0,count:1}],body:"if(x!==y){return false}",localVars:[],thisVars:[]},post:{args:[],localVars:[],thisVars:[],body:"return true"},funcName:"equals"})})),T=c(((e,t)=>{t.exports=function(e,t){for(var i=e.split("."),r=t.split("."),n=0;n<3;n++){var s=Number(i[n]),a=Number(r[n]);if(s>a)return 1;if(a>s)return-1;if(!isNaN(s)&&isNaN(a))return 1;if(isNaN(s)&&!isNaN(a))return-1}return 0}})),D="149",P=0,I=1,O=2,R=3,L=0,B=1,z=2,k=1,N=2,F=3,U=0,V=1,j=2,G=0,H=1,W=2,q=3,Y=4,X=5,Q=100,Z=101,K=102,J=103,$=104,ee=200,te=201,ie=202,re=203,ne=204,se=205,ae=206,oe=207,le=208,he=209,ce=210,de=0,ue=1,pe=2,fe=3,me=4,ge=5,ve=6,ye=7,xe=0,be=1,we=2,_e=0,Se=1,Ae=2,Me=3,Ee=4,Ce=5,Te=301,De=302,Pe=303,Ie=304,Oe=306,Re=1e3,Le=1001,Be=1002,ze=1003,ke=1004,Ne=1005,Fe=1006,Ue=1007,Ve=1008,je=1009,Ge=1010,He=1011,We=1012,qe=1013,Ye=1014,Xe=1015,Qe=1016,Ze=1017,Ke=1018,Je=1020,$e=1021,et=1023,tt=1024,it=1025,rt=1026,nt=1027,st=1028,at=1029,ot=1030,lt=1031,ht=1033,ct=33776,dt=33777,ut=33778,pt=33779,ft=35840,mt=35841,gt=35842,vt=35843,yt=36196,xt=37492,bt=37496,wt=37808,_t=37809,St=37810,At=37811,Mt=37812,Et=37813,Ct=37814,Tt=37815,Dt=37816,Pt=37817,It=37818,Ot=37819,Rt=37820,Lt=37821,Bt=36492,zt=36283,kt=36284,Nt=36285,Ft=36286,Ut=2202,Vt=2300,jt=2301,Gt=2302,Ht=2400,Wt=2401,qt=2402,Yt=2500,Xt=3e3,Qt=3001,Zt=3200,Kt=3201,Jt=0,$t=1,ei="srgb",ti="srgb-linear",ii=7680,ri=35044,ni="300 es",si=1035,ai=class{addEventListener(e,t){void 0===this._listeners&&(this._listeners={});let i=this._listeners;void 0===i[e]&&(i[e]=[]),-1===i[e].indexOf(t)&&i[e].push(t)}hasEventListener(e,t){if(void 0===this._listeners)return!1;let i=this._listeners;return void 0!==i[e]&&-1!==i[e].indexOf(t)}removeEventListener(e,t){if(void 0===this._listeners)return;let i=this._listeners[e];if(void 0!==i){let e=i.indexOf(t);-1!==e&&i.splice(e,1)}}dispatchEvent(e){if(void 0===this._listeners)return;let t=this._listeners[e.type];if(void 0!==t){e.target=this;let i=t.slice(0);for(let t=0,r=i.length;t>8&255]+oi[e>>16&255]+oi[e>>24&255]+"-"+oi[255&t]+oi[t>>8&255]+"-"+oi[t>>16&15|64]+oi[t>>24&255]+"-"+oi[63&i|128]+oi[i>>8&255]+"-"+oi[i>>16&255]+oi[i>>24&255]+oi[255&r]+oi[r>>8&255]+oi[r>>16&255]+oi[r>>24&255]).toLowerCase()}function ui(e,t,i){return Math.max(t,Math.min(i,e))}function pi(e,t){return(e%t+t)%t}function fi(e,t,i){return(1-i)*e+i*t}function mi(e){return 0==(e&e-1)&&0!==e}function gi(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))}function vi(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))}function yi(e,t){switch(t.constructor){case Float32Array:return e;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw new Error("Invalid component type.")}}function xi(e,t){switch(t.constructor){case Float32Array:return e;case Uint16Array:return Math.round(65535*e);case Uint8Array:return Math.round(255*e);case Int16Array:return Math.round(32767*e);case Int8Array:return Math.round(127*e);default:throw new Error("Invalid component type.")}}var bi=Object.freeze({__proto__:null,DEG2RAD:hi,RAD2DEG:ci,ceilPowerOfTwo:gi,clamp:ui,damp:function(e,t,i,r){return fi(e,t,1-Math.exp(-i*r))},degToRad:function(e){return e*hi},denormalize:yi,euclideanModulo:pi,floorPowerOfTwo:vi,generateUUID:di,inverseLerp:function(e,t,i){return e!==t?(i-e)/(t-e):0},isPowerOfTwo:mi,lerp:fi,mapLinear:function(e,t,i,r,n){return r+(e-t)*(n-r)/(i-t)},normalize:xi,pingpong:function(e,t=1){return t-Math.abs(pi(e,2*t)-t)},radToDeg:function(e){return e*ci},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},seededRandom:function(e){void 0!==e&&(li=e);let t=li+=1831565813;return t=Math.imul(t^t>>>15,1|t),t^=t+Math.imul(t^t>>>7,61|t),((t^t>>>14)>>>0)/4294967296},setQuaternionFromProperEuler:function(e,t,i,r,n){let s=Math.cos,a=Math.sin,o=s(i/2),l=a(i/2),h=s((t+r)/2),c=a((t+r)/2),d=s((t-r)/2),u=a((t-r)/2),p=s((r-t)/2),f=a((r-t)/2);switch(n){case"XYX":e.set(o*c,l*d,l*u,o*h);break;case"YZY":e.set(l*u,o*c,l*d,o*h);break;case"ZXZ":e.set(l*d,l*u,o*c,o*h);break;case"XZX":e.set(o*c,l*f,l*p,o*h);break;case"YXY":e.set(l*p,o*c,l*f,o*h);break;case"ZYZ":e.set(l*f,l*p,o*c,o*h);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+n)}},smootherstep:function(e,t,i){return e<=t?0:e>=i?1:(e=(e-t)/(i-t))*e*e*(e*(6*e-15)+10)},smoothstep:function(e,t,i){return e<=t?0:e>=i?1:(e=(e-t)/(i-t))*e*(3-2*e)}}),wi=class{constructor(e=0,t=0){wi.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,i=this.y,r=e.elements;return this.x=r[0]*t+r[3]*i+r[6],this.y=r[1]*t+r[4]*i+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){let i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}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=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.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}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,i=this.y-e.y;return t*t+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let i=Math.cos(t),r=Math.sin(t),n=this.x-e.x,s=this.y-e.y;return this.x=n*i-s*r+e.x,this.y=n*r+s*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},_i=class{constructor(){_i.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1]}set(e,t,i,r,n,s,a,o,l){let h=this.elements;return h[0]=e,h[1]=r,h[2]=a,h[3]=t,h[4]=n,h[5]=o,h[6]=i,h[7]=s,h[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],this}extractBasis(e,t,i){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let i=e.elements,r=t.elements,n=this.elements,s=i[0],a=i[3],o=i[6],l=i[1],h=i[4],c=i[7],d=i[2],u=i[5],p=i[8],f=r[0],m=r[3],g=r[6],v=r[1],y=r[4],x=r[7],b=r[2],w=r[5],_=r[8];return n[0]=s*f+a*v+o*b,n[3]=s*m+a*y+o*w,n[6]=s*g+a*x+o*_,n[1]=l*f+h*v+c*b,n[4]=l*m+h*y+c*w,n[7]=l*g+h*x+c*_,n[2]=d*f+u*v+p*b,n[5]=d*m+u*y+p*w,n[8]=d*g+u*x+p*_,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){let e=this.elements,t=e[0],i=e[1],r=e[2],n=e[3],s=e[4],a=e[5],o=e[6],l=e[7],h=e[8];return t*s*h-t*a*l-i*n*h+i*a*o+r*n*l-r*s*o}invert(){let e=this.elements,t=e[0],i=e[1],r=e[2],n=e[3],s=e[4],a=e[5],o=e[6],l=e[7],h=e[8],c=h*s-a*l,d=a*o-h*n,u=l*n-s*o,p=t*c+i*d+r*u;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);let f=1/p;return e[0]=c*f,e[1]=(r*l-h*i)*f,e[2]=(a*i-r*s)*f,e[3]=d*f,e[4]=(h*t-r*o)*f,e[5]=(r*n-a*t)*f,e[6]=u*f,e[7]=(i*o-l*t)*f,e[8]=(s*t-i*n)*f,this}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,i,r,n,s,a){let o=Math.cos(n),l=Math.sin(n);return this.set(i*o,i*l,-i*(o*s+l*a)+s+e,-r*l,r*o,-r*(-l*s+o*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(Si.makeScale(e,t)),this}rotate(e){return this.premultiply(Si.makeRotation(-e)),this}translate(e,t){return this.premultiply(Si.makeTranslation(e,t)),this}makeTranslation(e,t){return this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){let t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,i,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){let t=this.elements,i=e.elements;for(let r=0;r<9;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<9;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){let i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e}clone(){return(new this.constructor).fromArray(this.elements)}},Si=new _i;function Ai(e){for(let t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}var Mi={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function Ei(e,t){return new Mi[e](t)}function Ci(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}function Ti(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function Di(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}var Pi={[ei]:{[ti]:Ti},[ti]:{[ei]:Di}},Ii={legacyMode:!0,get workingColorSpace(){return ti},set workingColorSpace(e){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(e,t,i){if(this.legacyMode||t===i||!t||!i)return e;if(Pi[t]&&void 0!==Pi[t][i]){let r=Pi[t][i];return e.r=r(e.r),e.g=r(e.g),e.b=r(e.b),e}throw new Error("Unsupported color space conversion.")},fromWorkingColorSpace:function(e,t){return this.convert(e,this.workingColorSpace,t)},toWorkingColorSpace:function(e,t){return this.convert(e,t,this.workingColorSpace)}},Oi={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},Ri={r:0,g:0,b:0},Li={h:0,s:0,l:0},Bi={h:0,s:0,l:0};function zi(e,t,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?e+6*(t-e)*i:i<.5?t:i<2/3?e+6*(t-e)*(2/3-i):e}function ki(e,t){return t.r=e.r,t.g=e.g,t.b=e.b,t}var Ni=class{constructor(e,t,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,void 0===t&&void 0===i?this.set(e):this.setRGB(e,t,i)}set(e){return e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e),this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=ei){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,Ii.toWorkingColorSpace(this,t),this}setRGB(e,t,i,r=Ii.workingColorSpace){return this.r=e,this.g=t,this.b=i,Ii.toWorkingColorSpace(this,r),this}setHSL(e,t,i,r=Ii.workingColorSpace){if(e=pi(e,1),t=ui(t,0,1),i=ui(i,0,1),0===t)this.r=this.g=this.b=i;else{let r=i<=.5?i*(1+t):i+t-i*t,n=2*i-r;this.r=zi(n,r,e+1/3),this.g=zi(n,r,e),this.b=zi(n,r,e-1/3)}return Ii.toWorkingColorSpace(this,r),this}setStyle(e,t=ei){function i(t){void 0!==t&&parseFloat(t)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(e)){let e,n=r[1],s=r[2];switch(n){case"rgb":case"rgba":if(e=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return this.r=Math.min(255,parseInt(e[1],10))/255,this.g=Math.min(255,parseInt(e[2],10))/255,this.b=Math.min(255,parseInt(e[3],10))/255,Ii.toWorkingColorSpace(this,t),i(e[4]),this;if(e=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return this.r=Math.min(100,parseInt(e[1],10))/100,this.g=Math.min(100,parseInt(e[2],10))/100,this.b=Math.min(100,parseInt(e[3],10))/100,Ii.toWorkingColorSpace(this,t),i(e[4]),this;break;case"hsl":case"hsla":if(e=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s)){let r=parseFloat(e[1])/360,n=parseFloat(e[2])/100,s=parseFloat(e[3])/100;return i(e[4]),this.setHSL(r,n,s,t)}}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){let e=r[1],i=e.length;if(3===i)return this.r=parseInt(e.charAt(0)+e.charAt(0),16)/255,this.g=parseInt(e.charAt(1)+e.charAt(1),16)/255,this.b=parseInt(e.charAt(2)+e.charAt(2),16)/255,Ii.toWorkingColorSpace(this,t),this;if(6===i)return this.r=parseInt(e.charAt(0)+e.charAt(1),16)/255,this.g=parseInt(e.charAt(2)+e.charAt(3),16)/255,this.b=parseInt(e.charAt(4)+e.charAt(5),16)/255,Ii.toWorkingColorSpace(this,t),this}return e&&e.length>0?this.setColorName(e,t):this}setColorName(e,t=ei){let i=Oi[e.toLowerCase()];return void 0!==i?this.setHex(i,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Ti(e.r),this.g=Ti(e.g),this.b=Ti(e.b),this}copyLinearToSRGB(e){return this.r=Di(e.r),this.g=Di(e.g),this.b=Di(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=ei){return Ii.fromWorkingColorSpace(ki(this,Ri),e),ui(255*Ri.r,0,255)<<16^ui(255*Ri.g,0,255)<<8^ui(255*Ri.b,0,255)<<0}getHexString(e=ei){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Ii.workingColorSpace){Ii.fromWorkingColorSpace(ki(this,Ri),t);let i,r,n=Ri.r,s=Ri.g,a=Ri.b,o=Math.max(n,s,a),l=Math.min(n,s,a),h=(l+o)/2;if(l===o)i=0,r=0;else{let e=o-l;switch(r=h<=.5?e/(o+l):e/(2-o-l),o){case n:i=(s-a)/e+(s"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{void 0===Fi&&(Fi=Ci("canvas")),Fi.width=e.width,Fi.height=e.height;let i=Fi.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),t=Fi}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){let t=Ci("canvas");t.width=e.width,t.height=e.height;let i=t.getContext("2d");i.drawImage(e,0,0,e.width,e.height);let r=i.getImageData(0,0,e.width,e.height),n=r.data;for(let e=0;e0&&(i.userData=this.userData),t||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(300!==this.mapping)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Re:e.x=e.x-Math.floor(e.x);break;case Le:e.x=e.x<0?0:1;break;case Be:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case Re:e.y=e.y-Math.floor(e.y);break;case Le:e.y=e.y<0?0:1;break;case Be:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){!0===e&&(this.version++,this.source.needsUpdate=!0)}};Hi.DEFAULT_IMAGE=null,Hi.DEFAULT_MAPPING=300,Hi.DEFAULT_ANISOTROPY=1;var Wi=class{constructor(e=0,t=0,i=0,r=1){Wi.prototype.isVector4=!0,this.x=e,this.y=t,this.z=i,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,i,r){return this.x=e,this.y=t,this.z=i,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let t=this.x,i=this.y,r=this.z,n=this.w,s=e.elements;return this.x=s[0]*t+s[4]*i+s[8]*r+s[12]*n,this.y=s[1]*t+s[5]*i+s[9]*r+s[13]*n,this.z=s[2]*t+s[6]*i+s[10]*r+s[14]*n,this.w=s[3]*t+s[7]*i+s[11]*r+s[15]*n,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,i,r,n,s=e.elements,a=s[0],o=s[4],l=s[8],h=s[1],c=s[5],d=s[9],u=s[2],p=s[6],f=s[10];if(Math.abs(o-h)<.01&&Math.abs(l-u)<.01&&Math.abs(d-p)<.01){if(Math.abs(o+h)<.1&&Math.abs(l+u)<.1&&Math.abs(d+p)<.1&&Math.abs(a+c+f-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;let e=(a+1)/2,s=(c+1)/2,m=(f+1)/2,g=(o+h)/4,v=(l+u)/4,y=(d+p)/4;return e>s&&e>m?e<.01?(i=0,r=.707106781,n=.707106781):(i=Math.sqrt(e),r=g/i,n=v/i):s>m?s<.01?(i=.707106781,r=0,n=.707106781):(r=Math.sqrt(s),i=g/r,n=y/r):m<.01?(i=.707106781,r=.707106781,n=0):(n=Math.sqrt(m),i=v/n,r=y/n),this.set(i,r,n,t),this}let m=Math.sqrt((p-d)*(p-d)+(l-u)*(l-u)+(h-o)*(h-o));return Math.abs(m)<.001&&(m=1),this.x=(p-d)/m,this.y=(l-u)/m,this.z=(h-o)/m,this.w=Math.acos((a+c+f-1)/2),this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){let i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}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=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.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(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this.w=e.w+(t.w-e.w)*i,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),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}},qi=class extends ai{constructor(e=1,t=1,i={}){super(),this.isWebGLRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new Wi(0,0,e,t),this.scissorTest=!1,this.viewport=new Wi(0,0,e,t);let r={width:e,height:t,depth:1};this.texture=new Hi(r,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.encoding),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=void 0!==i.generateMipmaps&&i.generateMipmaps,this.texture.internalFormat=void 0!==i.internalFormat?i.internalFormat:null,this.texture.minFilter=void 0!==i.minFilter?i.minFilter:Fe,this.depthBuffer=void 0===i.depthBuffer||i.depthBuffer,this.stencilBuffer=void 0!==i.stencilBuffer&&i.stencilBuffer,this.depthTexture=void 0!==i.depthTexture?i.depthTexture:null,this.samples=void 0!==i.samples?i.samples:0}setSize(e,t,i=1){(this.width!==e||this.height!==t||this.depth!==i)&&(this.width=e,this.height=t,this.depth=i,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=i,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return(new this.constructor).copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.texture.isRenderTargetTexture=!0;let t=Object.assign({},e.texture.image);return this.texture.source=new Vi(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,null!==e.depthTexture&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}},Yi=class extends Hi{constructor(e=null,t=1,i=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=ze,this.minFilter=ze,this.wrapR=Le,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}},Xi=class extends qi{constructor(e=1,t=1,i=1,r={}){super(e,t,r),this.isWebGLMultipleRenderTargets=!0;let n=this.texture;this.texture=[];for(let s=0;s=0?1:-1,r=1-t*t;if(r>Number.EPSILON){let n=Math.sqrt(r),s=Math.atan2(n,t*i);e=Math.sin(e*s)/n,a=Math.sin(a*s)/n}let n=a*i;if(o=o*e+d*n,l=l*e+u*n,h=h*e+p*n,c=c*e+f*n,e===1-a){let e=1/Math.sqrt(o*o+l*l+h*h+c*c);o*=e,l*=e,h*=e,c*=e}}e[t]=o,e[t+1]=l,e[t+2]=h,e[t+3]=c}static multiplyQuaternionsFlat(e,t,i,r,n,s){let a=i[r],o=i[r+1],l=i[r+2],h=i[r+3],c=n[s],d=n[s+1],u=n[s+2],p=n[s+3];return e[t]=a*p+h*c+o*u-l*d,e[t+1]=o*p+h*d+l*c-a*u,e[t+2]=l*p+h*u+a*d-o*c,e[t+3]=h*p-a*c-o*d-l*u,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,i,r){return this._x=e,this._y=t,this._z=i,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t){let i=e._x,r=e._y,n=e._z,s=e._order,a=Math.cos,o=Math.sin,l=a(i/2),h=a(r/2),c=a(n/2),d=o(i/2),u=o(r/2),p=o(n/2);switch(s){case"XYZ":this._x=d*h*c+l*u*p,this._y=l*u*c-d*h*p,this._z=l*h*p+d*u*c,this._w=l*h*c-d*u*p;break;case"YXZ":this._x=d*h*c+l*u*p,this._y=l*u*c-d*h*p,this._z=l*h*p-d*u*c,this._w=l*h*c+d*u*p;break;case"ZXY":this._x=d*h*c-l*u*p,this._y=l*u*c+d*h*p,this._z=l*h*p+d*u*c,this._w=l*h*c-d*u*p;break;case"ZYX":this._x=d*h*c-l*u*p,this._y=l*u*c+d*h*p,this._z=l*h*p-d*u*c,this._w=l*h*c+d*u*p;break;case"YZX":this._x=d*h*c+l*u*p,this._y=l*u*c+d*h*p,this._z=l*h*p-d*u*c,this._w=l*h*c-d*u*p;break;case"XZY":this._x=d*h*c-l*u*p,this._y=l*u*c-d*h*p,this._z=l*h*p+d*u*c,this._w=l*h*c+d*u*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+s)}return!1!==t&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let i=t/2,r=Math.sin(i);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,i=t[0],r=t[4],n=t[8],s=t[1],a=t[5],o=t[9],l=t[2],h=t[6],c=t[10],d=i+a+c;if(d>0){let e=.5/Math.sqrt(d+1);this._w=.25/e,this._x=(h-o)*e,this._y=(n-l)*e,this._z=(s-r)*e}else if(i>a&&i>c){let e=2*Math.sqrt(1+i-a-c);this._w=(h-o)/e,this._x=.25*e,this._y=(r+s)/e,this._z=(n+l)/e}else if(a>c){let e=2*Math.sqrt(1+a-i-c);this._w=(n-l)/e,this._x=(r+s)/e,this._y=.25*e,this._z=(o+h)/e}else{let e=2*Math.sqrt(1+c-i-a);this._w=(s-r)/e,this._x=(n+l)/e,this._y=(o+h)/e,this._z=.25*e}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return iMath.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(ui(this.dot(e),-1,1)))}rotateTowards(e,t){let i=this.angleTo(e);if(0===i)return this;let r=Math.min(1,t/i);return this.slerp(e,r),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(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._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 e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let i=e._x,r=e._y,n=e._z,s=e._w,a=t._x,o=t._y,l=t._z,h=t._w;return this._x=i*h+s*a+r*l-n*o,this._y=r*h+s*o+n*a-i*l,this._z=n*h+s*l+i*o-r*a,this._w=s*h-i*a-r*o-n*l,this._onChangeCallback(),this}slerp(e,t){if(0===t)return this;if(1===t)return this.copy(e);let i=this._x,r=this._y,n=this._z,s=this._w,a=s*e._w+i*e._x+r*e._y+n*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=s,this._x=i,this._y=r,this._z=n,this;let o=1-a*a;if(o<=Number.EPSILON){let e=1-t;return this._w=e*s+t*this._w,this._x=e*i+t*this._x,this._y=e*r+t*this._y,this._z=e*n+t*this._z,this.normalize(),this._onChangeCallback(),this}let l=Math.sqrt(o),h=Math.atan2(l,a),c=Math.sin((1-t)*h)/l,d=Math.sin(t*h)/l;return this._w=s*c+this._w*d,this._x=i*c+this._x*d,this._y=r*c+this._y*d,this._z=n*c+this._z*d,this._onChangeCallback(),this}slerpQuaternions(e,t,i){return this.copy(e).slerp(t,i)}random(){let e=Math.random(),t=Math.sqrt(1-e),i=Math.sqrt(e),r=2*Math.PI*Math.random(),n=2*Math.PI*Math.random();return this.set(t*Math.cos(r),i*Math.sin(n),i*Math.cos(n),t*Math.sin(r))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},Zi=class{constructor(e=0,t=0,i=0){Zi.prototype.isVector3=!0,this.x=e,this.y=t,this.z=i}set(e,t,i){return void 0===i&&(i=this.z),this.x=e,this.y=t,this.z=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(Ji.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Ji.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,i=this.y,r=this.z,n=e.elements;return this.x=n[0]*t+n[3]*i+n[6]*r,this.y=n[1]*t+n[4]*i+n[7]*r,this.z=n[2]*t+n[5]*i+n[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,i=this.y,r=this.z,n=e.elements,s=1/(n[3]*t+n[7]*i+n[11]*r+n[15]);return this.x=(n[0]*t+n[4]*i+n[8]*r+n[12])*s,this.y=(n[1]*t+n[5]*i+n[9]*r+n[13])*s,this.z=(n[2]*t+n[6]*i+n[10]*r+n[14])*s,this}applyQuaternion(e){let t=this.x,i=this.y,r=this.z,n=e.x,s=e.y,a=e.z,o=e.w,l=o*t+s*r-a*i,h=o*i+a*t-n*r,c=o*r+n*i-s*t,d=-n*t-s*i-a*r;return this.x=l*o+d*-n+h*-a-c*-s,this.y=h*o+d*-s+c*-n-l*-a,this.z=c*o+d*-a+l*-s-h*-n,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,i=this.y,r=this.z,n=e.elements;return this.x=n[0]*t+n[4]*i+n[8]*r,this.y=n[1]*t+n[5]*i+n[9]*r,this.z=n[2]*t+n[6]*i+n[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){let i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}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=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.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(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let i=e.x,r=e.y,n=e.z,s=t.x,a=t.y,o=t.z;return this.x=r*o-n*a,this.y=n*s-i*o,this.z=i*a-r*s,this}projectOnVector(e){let t=e.lengthSq();if(0===t)return this.set(0,0,0);let i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return Ki.copy(this).projectOnVector(e),this.sub(Ki)}reflect(e){return this.sub(Ki.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;let i=this.dot(e)/t;return Math.acos(ui(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,i=this.y-e.y,r=this.z-e.z;return t*t+i*i+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,i){let r=Math.sin(t)*e;return this.x=r*Math.sin(i),this.y=Math.cos(t)*e,this.z=r*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,i){return this.x=e*Math.sin(t),this.y=i,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,4*t)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,3*t)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=2*(Math.random()-.5),t=Math.random()*Math.PI*2,i=Math.sqrt(1-e**2);return this.x=i*Math.cos(t),this.y=i*Math.sin(t),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}},Ki=new Zi,Ji=new Qi,$i=class{constructor(e=new Zi(1/0,1/0,1/0),t=new Zi(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){let t=1/0,i=1/0,r=1/0,n=-1/0,s=-1/0,a=-1/0;for(let o=0,l=e.length;on&&(n=l),h>s&&(s=h),c>a&&(a=c)}return this.min.set(t,i,r),this.max.set(n,s,a),this}setFromBufferAttribute(e){let t=1/0,i=1/0,r=1/0,n=-1/0,s=-1/0,a=-1/0;for(let o=0,l=e.count;on&&(n=l),h>s&&(s=h),c>a&&(a=c)}return this.min.set(t,i,r),this.max.set(n,s,a),this}setFromPoints(e){this.makeEmpty();for(let t=0,i=e.length;tthis.max.x||e.ythis.max.y||e.zthis.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.xthis.max.x||e.max.ythis.max.y||e.max.zthis.max.z)}intersectsSphere(e){return this.clampPoint(e.center,tr),tr.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,i;return e.normal.x>0?(t=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),t<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(hr),cr.subVectors(this.max,hr),rr.subVectors(e.a,hr),nr.subVectors(e.b,hr),sr.subVectors(e.c,hr),ar.subVectors(nr,rr),or.subVectors(sr,nr),lr.subVectors(rr,sr);let t=[0,-ar.z,ar.y,0,-or.z,or.y,0,-lr.z,lr.y,ar.z,0,-ar.x,or.z,0,-or.x,lr.z,0,-lr.x,-ar.y,ar.x,0,-or.y,or.x,0,-lr.y,lr.x,0];return!(!pr(t,rr,nr,sr,cr)||(t=[1,0,0,0,1,0,0,0,1],!pr(t,rr,nr,sr,cr)))&&(dr.crossVectors(ar,or),t=[dr.x,dr.y,dr.z],pr(t,rr,nr,sr,cr))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return tr.copy(e).clamp(this.min,this.max).sub(e).length()}getBoundingSphere(e){return this.getCenter(e.center),e.radius=.5*this.getSize(tr).length(),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()||(er[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),er[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),er[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),er[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),er[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),er[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),er[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),er[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(er)),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}},er=[new Zi,new Zi,new Zi,new Zi,new Zi,new Zi,new Zi,new Zi],tr=new Zi,ir=new $i,rr=new Zi,nr=new Zi,sr=new Zi,ar=new Zi,or=new Zi,lr=new Zi,hr=new Zi,cr=new Zi,dr=new Zi,ur=new Zi;function pr(e,t,i,r,n){for(let s=0,a=e.length-3;s<=a;s+=3){ur.fromArray(e,s);let a=n.x*Math.abs(ur.x)+n.y*Math.abs(ur.y)+n.z*Math.abs(ur.z),o=t.dot(ur),l=i.dot(ur),h=r.dot(ur);if(Math.max(-Math.max(o,l,h),Math.min(o,l,h))>a)return!1}return!0}var fr=new $i,mr=new Zi,gr=new Zi,vr=class{constructor(e=new Zi,t=-1){this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let i=this.center;void 0!==t?i.copy(t):fr.setFromPoints(e).getCenter(i);let r=0;for(let n=0,s=e.length;nthis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;mr.subVectors(e,this.center);let t=mr.lengthSq();if(t>this.radius*this.radius){let e=Math.sqrt(t),i=.5*(e-this.radius);this.center.addScaledVector(mr,i/e),this.radius+=i}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(!0===this.center.equals(e.center)?this.radius=Math.max(this.radius,e.radius):(gr.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(mr.copy(e.center).add(gr)),this.expandByPoint(mr.copy(e.center).sub(gr))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return(new this.constructor).copy(this)}},yr=new Zi,xr=new Zi,br=new Zi,wr=new Zi,_r=new Zi,Sr=new Zi,Ar=new Zi,Mr=class{constructor(e=new Zi,t=new Zi(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.direction).multiplyScalar(e).add(this.origin)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,yr)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let i=t.dot(this.direction);return i<0?t.copy(this.origin):t.copy(this.direction).multiplyScalar(i).add(this.origin)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=yr.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(yr.copy(this.direction).multiplyScalar(t).add(this.origin),yr.distanceToSquared(e))}distanceSqToSegment(e,t,i,r){xr.copy(e).add(t).multiplyScalar(.5),br.copy(t).sub(e).normalize(),wr.copy(this.origin).sub(xr);let n,s,a,o,l=.5*e.distanceTo(t),h=-this.direction.dot(br),c=wr.dot(this.direction),d=-wr.dot(br),u=wr.lengthSq(),p=Math.abs(1-h*h);if(p>0)if(n=h*d-c,s=h*c-d,o=l*p,n>=0)if(s>=-o)if(s<=o){let e=1/p;n*=e,s*=e,a=n*(n+h*s+2*c)+s*(h*n+s+2*d)+u}else s=l,n=Math.max(0,-(h*s+c)),a=-n*n+s*(s+2*d)+u;else s=-l,n=Math.max(0,-(h*s+c)),a=-n*n+s*(s+2*d)+u;else s<=-o?(n=Math.max(0,-(-h*l+c)),s=n>0?-l:Math.min(Math.max(-l,-d),l),a=-n*n+s*(s+2*d)+u):s<=o?(n=0,s=Math.min(Math.max(-l,-d),l),a=s*(s+2*d)+u):(n=Math.max(0,-(h*l+c)),s=n>0?l:Math.min(Math.max(-l,-d),l),a=-n*n+s*(s+2*d)+u);else s=h>0?-l:l,n=Math.max(0,-(h*s+c)),a=-n*n+s*(s+2*d)+u;return i&&i.copy(this.direction).multiplyScalar(n).add(this.origin),r&&r.copy(br).multiplyScalar(s).add(xr),a}intersectSphere(e,t){yr.subVectors(e.center,this.origin);let i=yr.dot(this.direction),r=yr.dot(yr)-i*i,n=e.radius*e.radius;if(r>n)return null;let s=Math.sqrt(n-r),a=i-s,o=i+s;return a<0&&o<0?null:a<0?this.at(o,t):this.at(a,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;let i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null}intersectPlane(e,t){let i=this.distanceToPlane(e);return null===i?null:this.at(i,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return 0===t||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let i,r,n,s,a,o,l=1/this.direction.x,h=1/this.direction.y,c=1/this.direction.z,d=this.origin;return l>=0?(i=(e.min.x-d.x)*l,r=(e.max.x-d.x)*l):(i=(e.max.x-d.x)*l,r=(e.min.x-d.x)*l),h>=0?(n=(e.min.y-d.y)*h,s=(e.max.y-d.y)*h):(n=(e.max.y-d.y)*h,s=(e.min.y-d.y)*h),i>s||n>r||((n>i||isNaN(i))&&(i=n),(s=0?(a=(e.min.z-d.z)*c,o=(e.max.z-d.z)*c):(a=(e.max.z-d.z)*c,o=(e.min.z-d.z)*c),i>o||a>r)||((a>i||i!=i)&&(i=a),(o=0?i:r,t)}intersectsBox(e){return null!==this.intersectBox(e,yr)}intersectTriangle(e,t,i,r,n){_r.subVectors(t,e),Sr.subVectors(i,e),Ar.crossVectors(_r,Sr);let s,a=this.direction.dot(Ar);if(a>0){if(r)return null;s=1}else{if(!(a<0))return null;s=-1,a=-a}wr.subVectors(this.origin,e);let o=s*this.direction.dot(Sr.crossVectors(wr,Sr));if(o<0)return null;let l=s*this.direction.dot(_r.cross(wr));if(l<0||o+l>a)return null;let h=-s*wr.dot(Ar);return h<0?null:this.at(h/a,n)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}},Er=class{constructor(){Er.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}set(e,t,i,r,n,s,a,o,l,h,c,d,u,p,f,m){let g=this.elements;return g[0]=e,g[4]=t,g[8]=i,g[12]=r,g[1]=n,g[5]=s,g[9]=a,g[13]=o,g[2]=l,g[6]=h,g[10]=c,g[14]=d,g[3]=u,g[7]=p,g[11]=f,g[15]=m,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 Er).fromArray(this.elements)}copy(e){let t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],this}copyPosition(e){let t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,i){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this}extractRotation(e){let t=this.elements,i=e.elements,r=1/Cr.setFromMatrixColumn(e,0).length(),n=1/Cr.setFromMatrixColumn(e,1).length(),s=1/Cr.setFromMatrixColumn(e,2).length();return t[0]=i[0]*r,t[1]=i[1]*r,t[2]=i[2]*r,t[3]=0,t[4]=i[4]*n,t[5]=i[5]*n,t[6]=i[6]*n,t[7]=0,t[8]=i[8]*s,t[9]=i[9]*s,t[10]=i[10]*s,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){let t=this.elements,i=e.x,r=e.y,n=e.z,s=Math.cos(i),a=Math.sin(i),o=Math.cos(r),l=Math.sin(r),h=Math.cos(n),c=Math.sin(n);if("XYZ"===e.order){let e=s*h,i=s*c,r=a*h,n=a*c;t[0]=o*h,t[4]=-o*c,t[8]=l,t[1]=i+r*l,t[5]=e-n*l,t[9]=-a*o,t[2]=n-e*l,t[6]=r+i*l,t[10]=s*o}else if("YXZ"===e.order){let e=o*h,i=o*c,r=l*h,n=l*c;t[0]=e+n*a,t[4]=r*a-i,t[8]=s*l,t[1]=s*c,t[5]=s*h,t[9]=-a,t[2]=i*a-r,t[6]=n+e*a,t[10]=s*o}else if("ZXY"===e.order){let e=o*h,i=o*c,r=l*h,n=l*c;t[0]=e-n*a,t[4]=-s*c,t[8]=r+i*a,t[1]=i+r*a,t[5]=s*h,t[9]=n-e*a,t[2]=-s*l,t[6]=a,t[10]=s*o}else if("ZYX"===e.order){let e=s*h,i=s*c,r=a*h,n=a*c;t[0]=o*h,t[4]=r*l-i,t[8]=e*l+n,t[1]=o*c,t[5]=n*l+e,t[9]=i*l-r,t[2]=-l,t[6]=a*o,t[10]=s*o}else if("YZX"===e.order){let e=s*o,i=s*l,r=a*o,n=a*l;t[0]=o*h,t[4]=n-e*c,t[8]=r*c+i,t[1]=c,t[5]=s*h,t[9]=-a*h,t[2]=-l*h,t[6]=i*c+r,t[10]=e-n*c}else if("XZY"===e.order){let e=s*o,i=s*l,r=a*o,n=a*l;t[0]=o*h,t[4]=-c,t[8]=l*h,t[1]=e*c+n,t[5]=s*h,t[9]=i*c-r,t[2]=r*c-i,t[6]=a*h,t[10]=n*c+e}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(Dr,e,Pr)}lookAt(e,t,i){let r=this.elements;return Rr.subVectors(e,t),0===Rr.lengthSq()&&(Rr.z=1),Rr.normalize(),Ir.crossVectors(i,Rr),0===Ir.lengthSq()&&(1===Math.abs(i.z)?Rr.x+=1e-4:Rr.z+=1e-4,Rr.normalize(),Ir.crossVectors(i,Rr)),Ir.normalize(),Or.crossVectors(Rr,Ir),r[0]=Ir.x,r[4]=Or.x,r[8]=Rr.x,r[1]=Ir.y,r[5]=Or.y,r[9]=Rr.y,r[2]=Ir.z,r[6]=Or.z,r[10]=Rr.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let i=e.elements,r=t.elements,n=this.elements,s=i[0],a=i[4],o=i[8],l=i[12],h=i[1],c=i[5],d=i[9],u=i[13],p=i[2],f=i[6],m=i[10],g=i[14],v=i[3],y=i[7],x=i[11],b=i[15],w=r[0],_=r[4],S=r[8],A=r[12],M=r[1],E=r[5],C=r[9],T=r[13],D=r[2],P=r[6],I=r[10],O=r[14],R=r[3],L=r[7],B=r[11],z=r[15];return n[0]=s*w+a*M+o*D+l*R,n[4]=s*_+a*E+o*P+l*L,n[8]=s*S+a*C+o*I+l*B,n[12]=s*A+a*T+o*O+l*z,n[1]=h*w+c*M+d*D+u*R,n[5]=h*_+c*E+d*P+u*L,n[9]=h*S+c*C+d*I+u*B,n[13]=h*A+c*T+d*O+u*z,n[2]=p*w+f*M+m*D+g*R,n[6]=p*_+f*E+m*P+g*L,n[10]=p*S+f*C+m*I+g*B,n[14]=p*A+f*T+m*O+g*z,n[3]=v*w+y*M+x*D+b*R,n[7]=v*_+y*E+x*P+b*L,n[11]=v*S+y*C+x*I+b*B,n[15]=v*A+y*T+x*O+b*z,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){let e=this.elements,t=e[0],i=e[4],r=e[8],n=e[12],s=e[1],a=e[5],o=e[9],l=e[13],h=e[2],c=e[6],d=e[10],u=e[14];return e[3]*(+n*o*c-r*l*c-n*a*d+i*l*d+r*a*u-i*o*u)+e[7]*(+t*o*u-t*l*d+n*s*d-r*s*u+r*l*h-n*o*h)+e[11]*(+t*l*c-t*a*u-n*s*c+i*s*u+n*a*h-i*l*h)+e[15]*(-r*a*h-t*o*c+t*a*d+r*s*c-i*s*d+i*o*h)}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(e,t,i){let r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=i),this}invert(){let e=this.elements,t=e[0],i=e[1],r=e[2],n=e[3],s=e[4],a=e[5],o=e[6],l=e[7],h=e[8],c=e[9],d=e[10],u=e[11],p=e[12],f=e[13],m=e[14],g=e[15],v=c*m*l-f*d*l+f*o*u-a*m*u-c*o*g+a*d*g,y=p*d*l-h*m*l-p*o*u+s*m*u+h*o*g-s*d*g,x=h*f*l-p*c*l+p*a*u-s*f*u-h*a*g+s*c*g,b=p*c*o-h*f*o-p*a*d+s*f*d+h*a*m-s*c*m,w=t*v+i*y+r*x+n*b;if(0===w)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let _=1/w;return e[0]=v*_,e[1]=(f*d*n-c*m*n-f*r*u+i*m*u+c*r*g-i*d*g)*_,e[2]=(a*m*n-f*o*n+f*r*l-i*m*l-a*r*g+i*o*g)*_,e[3]=(c*o*n-a*d*n-c*r*l+i*d*l+a*r*u-i*o*u)*_,e[4]=y*_,e[5]=(h*m*n-p*d*n+p*r*u-t*m*u-h*r*g+t*d*g)*_,e[6]=(p*o*n-s*m*n-p*r*l+t*m*l+s*r*g-t*o*g)*_,e[7]=(s*d*n-h*o*n+h*r*l-t*d*l-s*r*u+t*o*u)*_,e[8]=x*_,e[9]=(p*c*n-h*f*n-p*i*u+t*f*u+h*i*g-t*c*g)*_,e[10]=(s*f*n-p*a*n+p*i*l-t*f*l-s*i*g+t*a*g)*_,e[11]=(h*a*n-s*c*n-h*i*l+t*c*l+s*i*u-t*a*u)*_,e[12]=b*_,e[13]=(h*f*r-p*c*r+p*i*d-t*f*d-h*i*m+t*c*m)*_,e[14]=(p*a*r-s*f*r-p*i*o+t*f*o+s*i*m-t*a*m)*_,e[15]=(s*c*r-h*a*r+h*i*o-t*c*o-s*i*d+t*a*d)*_,this}scale(e){let t=this.elements,i=e.x,r=e.y,n=e.z;return t[0]*=i,t[4]*=r,t[8]*=n,t[1]*=i,t[5]*=r,t[9]*=n,t[2]*=i,t[6]*=r,t[10]*=n,t[3]*=i,t[7]*=r,t[11]*=n,this}getMaxScaleOnAxis(){let e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,i,r))}makeTranslation(e,t,i){return this.set(1,0,0,e,0,1,0,t,0,0,1,i,0,0,0,1),this}makeRotationX(e){let t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let i=Math.cos(t),r=Math.sin(t),n=1-i,s=e.x,a=e.y,o=e.z,l=n*s,h=n*a;return this.set(l*s+i,l*a-r*o,l*o+r*a,0,l*a+r*o,h*a+i,h*o-r*s,0,l*o-r*a,h*o+r*s,n*o*o+i,0,0,0,0,1),this}makeScale(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,t,i,r,n,s){return this.set(1,i,n,0,e,1,s,0,t,r,1,0,0,0,0,1),this}compose(e,t,i){let r=this.elements,n=t._x,s=t._y,a=t._z,o=t._w,l=n+n,h=s+s,c=a+a,d=n*l,u=n*h,p=n*c,f=s*h,m=s*c,g=a*c,v=o*l,y=o*h,x=o*c,b=i.x,w=i.y,_=i.z;return r[0]=(1-(f+g))*b,r[1]=(u+x)*b,r[2]=(p-y)*b,r[3]=0,r[4]=(u-x)*w,r[5]=(1-(d+g))*w,r[6]=(m+v)*w,r[7]=0,r[8]=(p+y)*_,r[9]=(m-v)*_,r[10]=(1-(d+f))*_,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,i){let r=this.elements,n=Cr.set(r[0],r[1],r[2]).length(),s=Cr.set(r[4],r[5],r[6]).length(),a=Cr.set(r[8],r[9],r[10]).length();this.determinant()<0&&(n=-n),e.x=r[12],e.y=r[13],e.z=r[14],Tr.copy(this);let o=1/n,l=1/s,h=1/a;return Tr.elements[0]*=o,Tr.elements[1]*=o,Tr.elements[2]*=o,Tr.elements[4]*=l,Tr.elements[5]*=l,Tr.elements[6]*=l,Tr.elements[8]*=h,Tr.elements[9]*=h,Tr.elements[10]*=h,t.setFromRotationMatrix(Tr),i.x=n,i.y=s,i.z=a,this}makePerspective(e,t,i,r,n,s){let a=this.elements,o=2*n/(t-e),l=2*n/(i-r),h=(t+e)/(t-e),c=(i+r)/(i-r),d=-(s+n)/(s-n),u=-2*s*n/(s-n);return a[0]=o,a[4]=0,a[8]=h,a[12]=0,a[1]=0,a[5]=l,a[9]=c,a[13]=0,a[2]=0,a[6]=0,a[10]=d,a[14]=u,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this}makeOrthographic(e,t,i,r,n,s){let a=this.elements,o=1/(t-e),l=1/(i-r),h=1/(s-n),c=(t+e)*o,d=(i+r)*l,u=(s+n)*h;return a[0]=2*o,a[4]=0,a[8]=0,a[12]=-c,a[1]=0,a[5]=2*l,a[9]=0,a[13]=-d,a[2]=0,a[6]=0,a[10]=-2*h,a[14]=-u,a[3]=0,a[7]=0,a[11]=0,a[15]=1,this}equals(e){let t=this.elements,i=e.elements;for(let r=0;r<16;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<16;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){let i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e}},Cr=new Zi,Tr=new Er,Dr=new Zi(0,0,0),Pr=new Zi(1,1,1),Ir=new Zi,Or=new Zi,Rr=new Zi,Lr=new Er,Br=new Qi,zr=class{constructor(e=0,t=0,i=0,r=zr.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=i,this._order=r}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,i,r=this._order){return this._x=e,this._y=t,this._z=i,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,i=!0){let r=e.elements,n=r[0],s=r[4],a=r[8],o=r[1],l=r[5],h=r[9],c=r[2],d=r[6],u=r[10];switch(t){case"XYZ":this._y=Math.asin(ui(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-h,u),this._z=Math.atan2(-s,n)):(this._x=Math.atan2(d,l),this._z=0);break;case"YXZ":this._x=Math.asin(-ui(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(a,u),this._z=Math.atan2(o,l)):(this._y=Math.atan2(-c,n),this._z=0);break;case"ZXY":this._x=Math.asin(ui(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-c,u),this._z=Math.atan2(-s,l)):(this._y=0,this._z=Math.atan2(o,n));break;case"ZYX":this._y=Math.asin(-ui(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(d,u),this._z=Math.atan2(o,n)):(this._x=0,this._z=Math.atan2(-s,l));break;case"YZX":this._z=Math.asin(ui(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-h,l),this._y=Math.atan2(-c,n)):(this._x=0,this._y=Math.atan2(a,u));break;case"XZY":this._z=Math.asin(-ui(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(d,l),this._y=Math.atan2(a,n)):(this._x=Math.atan2(-h,u),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,!0===i&&this._onChangeCallback(),this}setFromQuaternion(e,t,i){return Lr.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Lr,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Br.setFromEuler(this),this.setFromQuaternion(Br,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};zr.DEFAULT_ORDER="XYZ";var kr=class{constructor(){this.mask=1}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<1){for(let e=0;e1){for(let e=0;e0&&(i=i.concat(n))}return i}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Gr,e,Hr),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Gr,Wr,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);let t=this.children;for(let i=0,r=t.length;i0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),!1===this.matrixAutoUpdate&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(r.instanceColor=this.instanceColor.toJSON())),this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=n(e.geometries,this.geometry);let t=this.geometry.parameters;if(void 0!==t&&void 0!==t.shapes){let i=t.shapes;if(Array.isArray(i))for(let t=0,r=i.length;t0){r.children=[];for(let t=0;t0){r.animations=[];for(let t=0;t0&&(i.geometries=t),r.length>0&&(i.materials=r),n.length>0&&(i.textures=n),a.length>0&&(i.images=a),o.length>0&&(i.shapes=o),l.length>0&&(i.skeletons=l),h.length>0&&(i.animations=h),c.length>0&&(i.nodes=c)}return i.object=r,i;function s(e){let t=[];for(let i in e){let r=e[i];delete r.metadata,t.push(r)}return t}}clone(e){return(new this.constructor).copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(let i=0;i0?r.multiplyScalar(1/Math.sqrt(n)):r.set(0,0,0)}static getBarycoord(e,t,i,r,n){Jr.subVectors(r,t),$r.subVectors(i,t),en.subVectors(e,t);let s=Jr.dot(Jr),a=Jr.dot($r),o=Jr.dot(en),l=$r.dot($r),h=$r.dot(en),c=s*l-a*a;if(0===c)return n.set(-2,-1,-1);let d=1/c,u=(l*o-a*h)*d,p=(s*h-a*o)*d;return n.set(1-u-p,p,u)}static containsPoint(e,t,i,r){return this.getBarycoord(e,t,i,r,tn),tn.x>=0&&tn.y>=0&&tn.x+tn.y<=1}static getUV(e,t,i,r,n,s,a,o){return this.getBarycoord(e,t,i,r,tn),o.set(0,0),o.addScaledVector(n,tn.x),o.addScaledVector(s,tn.y),o.addScaledVector(a,tn.z),o}static isFrontFacing(e,t,i,r){return Jr.subVectors(i,t),$r.subVectors(e,t),Jr.cross($r).dot(r)<0}set(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this}setFromPointsAndIndices(e,t,i,r){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,i,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,i),this.c.fromBufferAttribute(e,r),this}clone(){return(new this.constructor).copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Jr.subVectors(this.c,this.b),$r.subVectors(this.a,this.b),.5*Jr.cross($r).length()}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return hn.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return hn.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,i,r,n){return hn.getUV(e,this.a,this.b,this.c,t,i,r,n)}containsPoint(e){return hn.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return hn.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let i,r,n=this.a,s=this.b,a=this.c;rn.subVectors(s,n),nn.subVectors(a,n),an.subVectors(e,n);let o=rn.dot(an),l=nn.dot(an);if(o<=0&&l<=0)return t.copy(n);on.subVectors(e,s);let h=rn.dot(on),c=nn.dot(on);if(h>=0&&c<=h)return t.copy(s);let d=o*c-h*l;if(d<=0&&o>=0&&h<=0)return i=o/(o-h),t.copy(n).addScaledVector(rn,i);ln.subVectors(e,a);let u=rn.dot(ln),p=nn.dot(ln);if(p>=0&&u<=p)return t.copy(a);let f=u*l-o*p;if(f<=0&&l>=0&&p<=0)return r=l/(l-p),t.copy(n).addScaledVector(nn,r);let m=h*p-u*c;if(m<=0&&c-h>=0&&u-p>=0)return sn.subVectors(a,s),r=(c-h)/(c-h+(u-p)),t.copy(s).addScaledVector(sn,r);let g=1/(m+f+d);return i=f*g,r=d*g,t.copy(n).addScaledVector(rn,i).addScaledVector(nn,r)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},cn=0,dn=class extends ai{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:cn++}),this.uuid=di(),this.name="",this.type="Material",this.blending=H,this.side=U,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=ne,this.blendDst=se,this.blendEquation=Q,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=fe,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=ii,this.stencilZFail=ii,this.stencilZPass=ii,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(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(void 0!==e)for(let t in e){let i=e[t];if(void 0===i){console.warn("THREE.Material: '"+t+"' parameter is undefined.");continue}let r=this[t];void 0!==r?r&&r.isColor?r.set(i):r&&r.isVector3&&i&&i.isVector3?r.copy(i):this[t]=i:console.warn("THREE."+this.type+": '"+t+"' is not a property of this material.")}}toJSON(e){let t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});let i={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function r(e){let t=[];for(let i in e){let r=e[i];delete r.metadata,t.push(r)}return t}if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),void 0!==this.roughness&&(i.roughness=this.roughness),void 0!==this.metalness&&(i.metalness=this.metalness),void 0!==this.sheen&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(i.shininess=this.shininess),void 0!==this.clearcoat&&(i.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),void 0!==this.iridescence&&(i.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(i.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,void 0!==this.combine&&(i.combine=this.combine)),void 0!==this.envMapIntensity&&(i.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(i.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.transmission&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),void 0!==this.thickness&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(i.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(i.size=this.size),null!==this.shadowSide&&(i.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==H&&(i.blending=this.blending),this.side!==U&&(i.side=this.side),this.vertexColors&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),!0===this.transparent&&(i.transparent=this.transparent),i.depthFunc=this.depthFunc,i.depthTest=this.depthTest,i.depthWrite=this.depthWrite,i.colorWrite=this.colorWrite,i.stencilWrite=this.stencilWrite,i.stencilWriteMask=this.stencilWriteMask,i.stencilFunc=this.stencilFunc,i.stencilRef=this.stencilRef,i.stencilFuncMask=this.stencilFuncMask,i.stencilFail=this.stencilFail,i.stencilZFail=this.stencilZFail,i.stencilZPass=this.stencilZPass,void 0!==this.rotation&&0!==this.rotation&&(i.rotation=this.rotation),!0===this.polygonOffset&&(i.polygonOffset=!0),0!==this.polygonOffsetFactor&&(i.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(i.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(i.linewidth=this.linewidth),void 0!==this.dashSize&&(i.dashSize=this.dashSize),void 0!==this.gapSize&&(i.gapSize=this.gapSize),void 0!==this.scale&&(i.scale=this.scale),!0===this.dithering&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),!0===this.alphaToCoverage&&(i.alphaToCoverage=this.alphaToCoverage),!0===this.premultipliedAlpha&&(i.premultipliedAlpha=this.premultipliedAlpha),!0===this.forceSinglePass&&(i.forceSinglePass=this.forceSinglePass),!0===this.wireframe&&(i.wireframe=this.wireframe),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(i.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(i.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(i.flatShading=this.flatShading),!1===this.visible&&(i.visible=!1),!1===this.toneMapped&&(i.toneMapped=!1),!1===this.fog&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData),t){let t=r(e.textures),n=r(e.images);t.length>0&&(i.textures=t),n.length>0&&(i.images=n)}return i}clone(){return(new this.constructor).copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,i=null;if(null!==t){let e=t.length;i=new Array(e);for(let r=0;r!==e;++r)i[r]=t[r].clone()}return this.clippingPlanes=i,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){!0===e&&this.version++}},un=class extends dn{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Ni(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.combine=xe,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}},pn=new Zi,fn=new wi,mn=class{constructor(e,t,i=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=void 0!==e?e.length/t:0,this.normalized=i,this.usage=ri,this.updateRange={offset:0,count:-1},this.version=0}onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this}copyAt(e,t,i){e*=this.itemSize,i*=t.itemSize;for(let r=0,n=this.itemSize;r0&&(e.userData=this.userData),void 0!==this.parameters){let t=this.parameters;for(let i in t)void 0!==t[i]&&(e[i]=t[i]);return e}e.data={attributes:{}};let t=this.index;null!==t&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let i=this.attributes;for(let o in i){let t=i[o];e.data.attributes[o]=t.toJSON(e.data)}let r={},n=!1;for(let o in this.morphAttributes){let t=this.morphAttributes[o],i=[];for(let r=0,n=t.length;r0&&(r[o]=i,n=!0)}n&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);let s=this.groups;s.length>0&&(e.data.groups=JSON.parse(JSON.stringify(s)));let a=this.boundingSphere;return null!==a&&(e.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),e}clone(){return(new this.constructor).copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let i=e.index;null!==i&&this.setIndex(i.clone(t));let r=e.attributes;for(let l in r){let e=r[l];this.setAttribute(l,e.clone(t))}let n=e.morphAttributes;for(let l in n){let e=[],i=n[l];for(let r=0,n=i.length;r0){let i=e[t[0]];if(void 0!==i){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=i.length;ei.far?null:{distance:h,point:Fn.clone(),object:e}}(e,t,i,r,Pn,In,On,Nn);if(h){n&&(Bn.fromBufferAttribute(n,a),zn.fromBufferAttribute(n,o),kn.fromBufferAttribute(n,l),h.uv=hn.getUV(Nn,Pn,In,On,Bn,zn,kn,new wi)),s&&(Bn.fromBufferAttribute(s,a),zn.fromBufferAttribute(s,o),kn.fromBufferAttribute(s,l),h.uv2=hn.getUV(Nn,Pn,In,On,Bn,zn,kn,new wi));let e={a:a,b:o,c:l,normal:new Zi,materialIndex:0};hn.getNormal(Pn,In,On,e.normal),h.face=e}return h}var jn=class extends En{constructor(e=1,t=1,i=1,r=1,n=1,s=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:r,heightSegments:n,depthSegments:s};let a=this;r=Math.floor(r),n=Math.floor(n),s=Math.floor(s);let o=[],l=[],h=[],c=[],d=0,u=0;function p(e,t,i,r,n,s,p,f,m,g,v){let y=s/m,x=p/g,b=s/2,w=p/2,_=f/2,S=m+1,A=g+1,M=0,E=0,C=new Zi;for(let a=0;a0?1:-1,h.push(C.x,C.y,C.z),c.push(o/m),c.push(1-a/g),M+=1}}for(let a=0;a0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;let i={};for(let r in this.extensions)!0===this.extensions[r]&&(i[r]=!0);return Object.keys(i).length>0&&(t.extensions=i),t}},Xn=class extends Kr{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Er,this.projectionMatrix=new Er,this.projectionMatrixInverse=new Er}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return(new this.constructor).copy(this)}},Qn=class extends Xn{constructor(e=50,t=1,i=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=i,this.far=r,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=null===e.view?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){let t=.5*this.getFilmHeight()/e;this.fov=2*ci*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(.5*hi*this.fov);return.5*this.getFilmHeight()/e}getEffectiveFOV(){return 2*ci*Math.atan(Math.tan(.5*hi*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(e,t,i,r,n,s){this.aspect=e/t,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=r,this.view.width=n,this.view.height=s,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=this.near,t=e*Math.tan(.5*hi*this.fov)/this.zoom,i=2*t,r=this.aspect*i,n=-.5*r,s=this.view;if(null!==this.view&&this.view.enabled){let e=s.fullWidth,a=s.fullHeight;n+=s.offsetX*r/e,t-=s.offsetY*i/a,r*=s.width/e,i*=s.height/a}let a=this.filmOffset;0!==a&&(n+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(n,n+r,t,t-i,e,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,null!==this.view&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}},Zn=-90,Kn=class extends Kr{constructor(e,t,i){super(),this.type="CubeCamera",this.renderTarget=i;let r=new Qn(Zn,1,e,t);r.layers=this.layers,r.up.set(0,1,0),r.lookAt(1,0,0),this.add(r);let n=new Qn(Zn,1,e,t);n.layers=this.layers,n.up.set(0,1,0),n.lookAt(-1,0,0),this.add(n);let s=new Qn(Zn,1,e,t);s.layers=this.layers,s.up.set(0,0,-1),s.lookAt(0,1,0),this.add(s);let a=new Qn(Zn,1,e,t);a.layers=this.layers,a.up.set(0,0,1),a.lookAt(0,-1,0),this.add(a);let o=new Qn(Zn,1,e,t);o.layers=this.layers,o.up.set(0,1,0),o.lookAt(0,0,1),this.add(o);let l=new Qn(Zn,1,e,t);l.layers=this.layers,l.up.set(0,1,0),l.lookAt(0,0,-1),this.add(l)}update(e,t){null===this.parent&&this.updateMatrixWorld();let i=this.renderTarget,[r,n,s,a,o,l]=this.children,h=e.getRenderTarget(),c=e.toneMapping,d=e.xr.enabled;e.toneMapping=_e,e.xr.enabled=!1;let u=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,e.setRenderTarget(i,0),e.render(t,r),e.setRenderTarget(i,1),e.render(t,n),e.setRenderTarget(i,2),e.render(t,s),e.setRenderTarget(i,3),e.render(t,a),e.setRenderTarget(i,4),e.render(t,o),i.texture.generateMipmaps=u,e.setRenderTarget(i,5),e.render(t,l),e.setRenderTarget(h),e.toneMapping=c,e.xr.enabled=d,i.texture.needsPMREMUpdate=!0}},Jn=class extends Hi{constructor(e,t,i,r,n,s,a,o,l,h){super(e=void 0!==e?e:[],t=void 0!==t?t:Te,i,r,n,s,a,o,l,h),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}},$n=class extends qi{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;let i={width:e,height:e,depth:1},r=[i,i,i,i,i,i];this.texture=new Jn(r,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.encoding),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=void 0!==t.generateMipmaps&&t.generateMipmaps,this.texture.minFilter=void 0!==t.minFilter?t.minFilter:Fe}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.encoding=t.encoding,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;let i={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 \n\t\t\t\t\t#include \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 \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"},r=new jn(5,5,5),n=new Yn({name:"CubemapFromEquirect",uniforms:Gn(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:V,blending:G});n.uniforms.tEquirect.value=t;let s=new Un(r,n),a=t.minFilter;return t.minFilter===Ve&&(t.minFilter=Fe),new Kn(1,10,this).update(e,s),t.minFilter=a,s.geometry.dispose(),s.material.dispose(),this}clear(e,t,i,r){let n=e.getRenderTarget();for(let s=0;s<6;s++)e.setRenderTarget(this,s),e.clear(t,i,r);e.setRenderTarget(n)}},es=new Zi,ts=new Zi,is=new _i,rs=class{constructor(e=new Zi(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,i,r){return this.normal.set(e,t,i),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,i){let r=es.subVectors(i,t).cross(ts.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){let e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)}intersectLine(e,t){let i=e.delta(es),r=this.normal.dot(i);if(0===r)return 0===this.distanceToPoint(e.start)?t.copy(e.start):null;let n=-(e.start.dot(this.normal)+this.constant)/r;return n<0||n>1?null:t.copy(i).multiplyScalar(n).add(e.start)}intersectsLine(e){let t=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return t<0&&i>0||i<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){let i=t||is.getNormalMatrix(e),r=this.coplanarPoint(es).applyMatrix4(e),n=this.normal.applyMatrix3(i).normalize();return this.constant=-r.dot(n),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return(new this.constructor).copy(this)}},ns=new vr,ss=new Zi,as=class{constructor(e=new rs,t=new rs,i=new rs,r=new rs,n=new rs,s=new rs){this.planes=[e,t,i,r,n,s]}set(e,t,i,r,n,s){let a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(i),a[3].copy(r),a[4].copy(n),a[5].copy(s),this}copy(e){let t=this.planes;for(let i=0;i<6;i++)t[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e){let t=this.planes,i=e.elements,r=i[0],n=i[1],s=i[2],a=i[3],o=i[4],l=i[5],h=i[6],c=i[7],d=i[8],u=i[9],p=i[10],f=i[11],m=i[12],g=i[13],v=i[14],y=i[15];return t[0].setComponents(a-r,c-o,f-d,y-m).normalize(),t[1].setComponents(a+r,c+o,f+d,y+m).normalize(),t[2].setComponents(a+n,c+l,f+u,y+g).normalize(),t[3].setComponents(a-n,c-l,f-u,y-g).normalize(),t[4].setComponents(a-s,c-h,f-p,y-v).normalize(),t[5].setComponents(a+s,c+h,f+p,y+v).normalize(),this}intersectsObject(e){let t=e.geometry;return null===t.boundingSphere&&t.computeBoundingSphere(),ns.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(ns)}intersectsSprite(e){return ns.center.set(0,0,0),ns.radius=.7071067811865476,ns.applyMatrix4(e.matrixWorld),this.intersectsSphere(ns)}intersectsSphere(e){let t=this.planes,i=e.center,r=-e.radius;for(let n=0;n<6;n++)if(t[n].distanceToPoint(i)0?e.max.x:e.min.x,ss.y=r.normal.y>0?e.max.y:e.min.y,ss.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(ss)<0)return!1}return!0}containsPoint(e){let t=this.planes;for(let i=0;i<6;i++)if(t[i].distanceToPoint(e)<0)return!1;return!0}clone(){return(new this.constructor).copy(this)}};function os(){let e=null,t=!1,i=null,r=null;function n(t,s){i(t,s),r=e.requestAnimationFrame(n)}return{start:function(){!0!==t&&null!==i&&(r=e.requestAnimationFrame(n),t=!0)},stop:function(){e.cancelAnimationFrame(r),t=!1},setAnimationLoop:function(e){i=e},setContext:function(t){e=t}}}function ls(e,t){let i=t.isWebGL2,r=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),r.get(e)},remove:function(t){t.isInterleavedBufferAttribute&&(t=t.data);let i=r.get(t);i&&(e.deleteBuffer(i.buffer),r.delete(t))},update:function(t,n){if(t.isGLBufferAttribute){let e=r.get(t);return void((!e||e.version 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif",iridescence_fragment:"#ifdef USE_IRIDESCENCE\n\tconst mat3 XYZ_TO_REC709 = mat3(\n\t\t 3.2404542, -0.9692660, 0.0556434,\n\t\t-1.5371385, 1.8760108, -0.2040259,\n\t\t-0.4985314, 0.0415560, 1.0572252\n\t);\n\tvec3 Fresnel0ToIor( vec3 fresnel0 ) {\n\t\tvec3 sqrtF0 = sqrt( fresnel0 );\n\t\treturn ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n\t}\n\tvec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n\t}\n\tfloat IorToFresnel0( float transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n\t}\n\tvec3 evalSensitivity( float OPD, vec3 shift ) {\n\t\tfloat phase = 2.0 * PI * OPD * 1.0e-9;\n\t\tvec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\n\t\tvec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\n\t\tvec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\n\t\tvec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\n\t\txyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );\n\t\txyz /= 1.0685e-7;\n\t\tvec3 rgb = XYZ_TO_REC709 * xyz;\n\t\treturn rgb;\n\t}\n\tvec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n\t\tvec3 I;\n\t\tfloat iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n\t\tfloat sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n\t\tfloat cosTheta2Sq = 1.0 - sinTheta2Sq;\n\t\tif ( cosTheta2Sq < 0.0 ) {\n\t\t\t return vec3( 1.0 );\n\t\t}\n\t\tfloat cosTheta2 = sqrt( cosTheta2Sq );\n\t\tfloat R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\n\t\tfloat R12 = F_Schlick( R0, 1.0, cosTheta1 );\n\t\tfloat R21 = R12;\n\t\tfloat T121 = 1.0 - R12;\n\t\tfloat phi12 = 0.0;\n\t\tif ( iridescenceIOR < outsideIOR ) phi12 = PI;\n\t\tfloat phi21 = PI - phi12;\n\t\tvec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );\t\tvec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\n\t\tvec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\n\t\tvec3 phi23 = vec3( 0.0 );\n\t\tif ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\n\t\tif ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\n\t\tif ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\n\t\tfloat OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n\t\tvec3 phi = vec3( phi21 ) + phi23;\n\t\tvec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\n\t\tvec3 r123 = sqrt( R123 );\n\t\tvec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\n\t\tvec3 C0 = R12 + Rs;\n\t\tI = C0;\n\t\tvec3 Cm = Rs - T121;\n\t\tfor ( int m = 1; m <= 2; ++ m ) {\n\t\t\tCm *= r123;\n\t\t\tvec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\n\t\t\tI += Cm * Sm;\n\t\t}\n\t\treturn max( I, vec3( 0.0 ) );\n\t}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\t\tvec3 vSigmaX = dFdx( surf_pos.xyz );\n\t\tvec3 vSigmaY = dFdy( surf_pos.xyz );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#pragma unroll_loop_end\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\tif ( clipped ) discard;\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvarying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat luminance( const in vec3 rgb ) {\n\tconst vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );\n\treturn dot( weights, rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\thighp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\t\t#ifdef texture2DGradEXT\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n\t\t#else\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\t\t#endif\n\t}\n\t#define cubeUV_r0 1.0\n\t#define cubeUV_v0 0.339\n\t#define cubeUV_m0 - 2.0\n\t#define cubeUV_r1 0.8\n\t#define cubeUV_v1 0.276\n\t#define cubeUV_m1 - 1.0\n\t#define cubeUV_r4 0.4\n\t#define cubeUV_v4 0.046\n\t#define cubeUV_m4 2.0\n\t#define cubeUV_r5 0.305\n\t#define cubeUV_v5 0.016\n\t#define cubeUV_m5 3.0\n\t#define cubeUV_r6 0.21\n\t#define cubeUV_v6 0.0038\n\t#define cubeUV_m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= cubeUV_r1 ) {\n\t\t\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n\t\t} else if ( roughness >= cubeUV_r4 ) {\n\t\t\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n\t\t} else if ( roughness >= cubeUV_r5 ) {\n\t\t\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n\t\t} else if ( roughness >= cubeUV_r6 ) {\n\t\t\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n\tmat3 m = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n\ttransformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",encodings_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",encodings_pars_fragment:"vec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#if defined( USE_ENVMAP )\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#if defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#if defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 reflectVec = reflect( - viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tvFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\t#else\n\t\tvec2 fw = fwidth( coord ) * 0.5;\n\t\treturn mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n\t#endif\n}",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\treflectedLight.indirectDiffuse += lightMapIrradiance;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_fragment:"LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;",lights_lambert_pars_fragment:"varying vec3 vViewPosition;\nstruct LambertMaterial {\n\tvec3 diffuseColor;\n\tfloat specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Lambert\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Lambert",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\t#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tif ( cutoffDistance > 0.0 ) {\n\t\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\t}\n\t\treturn distanceFalloff;\n\t#else\n\t\tif ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\t\treturn pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t\t}\n\t\treturn 1.0;\n\t#endif\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\tmaterial.ior = ior;\n\t#ifdef SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULARINTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vUv ).a;\n\t\t#endif\n\t\t#ifdef USE_SPECULARCOLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vUv ).rgb;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_IRIDESCENCE\n\tmaterial.iridescence = iridescence;\n\tmaterial.iridescenceIOR = iridescenceIOR;\n\t#ifdef USE_IRIDESCENCEMAP\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vUv ).r;\n\t#endif\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vUv ).g + iridescenceThicknessMinimum;\n\t#else\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\n\t#endif\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEENCOLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEENROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vUv ).a;\n\t#endif\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\t#ifdef IOR\n\t\tfloat ior;\n\t#endif\n\t#ifdef USE_TRANSMISSION\n\t\tfloat transmission;\n\t\tfloat transmissionAlpha;\n\t\tfloat thickness;\n\t\tfloat attenuationDistance;\n\t\tvec3 attenuationColor;\n\t#endif\n};\nvec3 clearcoatSpecular = vec3( 0.0 );\nvec3 sheenSpecular = vec3( 0.0 );\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\t#ifdef USE_IRIDESCENCE\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\t#else\n\t\tvec3 Fr = specularColor;\n\t#endif\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecular += ccIrradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\treflectedLight.directSpecular += irradiance * BRDF_GGX_Iridescence( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness );\n\t#else\n\t\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.roughness );\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\t#ifdef USE_IRIDESCENCE\n\t\tcomputeMultiscatteringIridescence( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n\t#else\n\t\tcomputeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\t#endif\n\tvec3 totalScattering = singleScattering + multiScattering;\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef USE_CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n\tfloat dotNVi = saturate( dot( normal, geometry.viewDir ) );\n\tif ( material.iridescenceThickness == 0.0 ) {\n\t\tmaterial.iridescence = 0.0;\n\t} else {\n\t\tmaterial.iridescence = saturate( material.iridescence );\n\t}\n\tif ( material.iridescence > 0.0 ) {\n\t\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\t\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n\t}\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tvec4 spotColor;\n\tvec3 spotLightCoord;\n\tbool inSpotLightMap;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometry, directLight );\n\t\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n\t\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n\t\t#else\n\t\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#endif\n\t\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n\t\t\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n\t\t\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n\t\t\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n\t\t\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n\t\t#endif\n\t\t#undef SPOT_LIGHT_MAP_INDEX\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry.normal );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getIBLIrradiance( geometry.normal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness );\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t\tvarying float vIsPerspective;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 sampledDiffuseColor = texture2D( map, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n#endif\n#ifdef USE_MAP\n\tdiffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tuniform mat3 uvTransform;\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphcolor_vertex:"#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )\n\tvColor *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t#if defined( USE_COLOR_ALPHA )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n\t\t#elif defined( USE_COLOR )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n\t\t#endif\n\t}\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n\t\t}\n\t#else\n\t\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\t\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\t\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\t\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n\t#endif\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t\tuniform sampler2DArray morphTargetsTexture;\n\t\tuniform ivec2 morphTargetsTextureSize;\n\t\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n\t\t\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n\t\t\tint y = texelIndex / morphTargetsTextureSize.x;\n\t\t\tint x = texelIndex - y * morphTargetsTextureSize.x;\n\t\t\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\n\t\t\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\n\t\t}\n\t#else\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\tuniform float morphTargetInfluences[ 8 ];\n\t\t#else\n\t\t\tuniform float morphTargetInfluences[ 4 ];\n\t\t#endif\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n\t\t}\n\t#else\n\t\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\t\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\t\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\t\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\t\t\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\t\t\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\t\t\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t\t#endif\n\t#endif\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = dFdx( vViewPosition );\n\tvec3 fdy = dFdy( vViewPosition );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\t#ifdef USE_TANGENT\n\t\tvec3 tangent = normalize( vTangent );\n\t\tvec3 bitangent = normalize( vBitangent );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\ttangent = tangent * faceDirection;\n\t\t\tbitangent = bitangent * faceDirection;\n\t\t#endif\n\t\t#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\t\t#endif\n\t#endif\n#endif\nvec3 geometryNormal = normal;",normal_fragment_maps:"#ifdef OBJECTSPACE_NORMALMAP\n\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( TANGENTSPACE_NORMALMAP )\n\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\t#ifdef USE_TANGENT\n\t\tnormal = normalize( vTBN * mapN );\n\t#else\n\t\tnormal = perturbNormal2Arb( - vViewPosition, normal, mapN, faceDirection );\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det );\n\t\treturn normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\t#ifdef USE_TANGENT\n\t\tclearcoatNormal = normalize( vTBN * clearcoatMapN );\n\t#else\n\t\tclearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN, faceDirection );\n\t#endif\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif",iridescence_pars_fragment:"#ifdef USE_IRIDESCENCEMAP\n\tuniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform sampler2D iridescenceThicknessMap;\n#endif",output_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha + 0.1;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec2 packDepthToRG( in highp float v ) {\n\treturn packDepthToRGBA( v ).yx;\n}\nfloat unpackRGToDepth( const in highp vec2 v ) {\n\treturn unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#if NUM_SPOT_LIGHT_COORDS > 0\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif",shadowmap_pars_vertex:"#if NUM_SPOT_LIGHT_COORDS > 0\n uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\tvec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition;\n\t\t#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t\tshadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n\t\t#endif\n\t\tvSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\tuniform highp sampler2D boneTexture;\n\tuniform int boneTextureSize;\n\tmat4 getBoneMatrix( const in float i ) {\n\t\tfloat j = i * 4.0;\n\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\ty = dy * ( y + 0.5 );\n\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\treturn bone;\n\t}\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n\tmaterial.transmission = transmission;\n\tmaterial.transmissionAlpha = 1.0;\n\tmaterial.thickness = thickness;\n\tmaterial.attenuationDistance = attenuationDistance;\n\tmaterial.attenuationColor = attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tmaterial.transmission *= texture2D( transmissionMap, vUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tmaterial.thickness *= texture2D( thicknessMap, vUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmission = getIBLVolumeRefraction(\n\t\tn, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness,\n\t\tmaterial.attenuationColor, material.attenuationDistance );\n\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmission.a, material.transmission );\n\ttotalDiffuse = mix( totalDiffuse, transmission.rgb, material.transmission );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\t#ifdef texture2DLodEXT\n\t\t\treturn texture2DLodEXT( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n\t\t#else\n\t\t\treturn texture2D( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n\t\t#endif\n\t}\n\tvec3 applyVolumeAttenuation( const in vec3 radiance, const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( isinf( attenuationDistance ) ) {\n\t\t\treturn radiance;\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance * radiance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\trefractionCoords += 1.0;\n\t\trefractionCoords /= 2.0;\n\t\tvec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\tvec3 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a );\n\t}\n#endif",uv_pars_fragment:"#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#ifdef USE_UV\n\t#ifdef UVS_VERTEX_ONLY\n\t\tvec2 vUv;\n\t#else\n\t\tvarying vec2 vUv;\n\t#endif\n\tuniform mat3 uvTransform;\n#endif",uv_vertex:"#ifdef USE_UV\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n\tuniform mat3 uv2Transform;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\ttexColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include \n\t#include \n}",backgroundCube_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n\tgl_Position.z = gl_Position.w;\n}",backgroundCube_frag:"#ifdef ENVMAP_TYPE_CUBE\n\tuniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n\tuniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 texColor = textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 texColor = textureCubeUV( envMap, vWorldDirection, backgroundBlurriness );\n\t#else\n\t\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include \n\t#include \n}",cube_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n\tgl_Position.z = gl_Position.w;\n}",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n\tgl_FragColor = texColor;\n\tgl_FragColor.a *= opacity;\n\t#include \n\t#include \n}",depth_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvWorldPosition = worldPosition.xyz;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main () {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include \n\t#include \n\t#include \n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\t#include \n\t#include \n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshbasic_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include \n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n\t#include \n}",meshlambert_frag:"#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t#else\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULARINTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n\t#ifdef USE_SPECULARCOLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEENCOLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEENROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include \n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",points_vert:"uniform float size;\nuniform float scale;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",shadow_vert:"#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include \n\t#include \n\t#include \n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include \n\t#include \n\t#include \n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n}"},ds={common:{diffuse:{value:new Ni(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new _i},uv2Transform:{value:new _i},alphaMap:{value:null},alphaTest:{value:0}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new wi(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Ni(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 Ni(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new _i}},sprite:{diffuse:{value:new Ni(16777215)},opacity:{value:1},center:{value:new wi(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new _i}}},us={basic:{uniforms:Hn([ds.common,ds.specularmap,ds.envmap,ds.aomap,ds.lightmap,ds.fog]),vertexShader:cs.meshbasic_vert,fragmentShader:cs.meshbasic_frag},lambert:{uniforms:Hn([ds.common,ds.specularmap,ds.envmap,ds.aomap,ds.lightmap,ds.emissivemap,ds.bumpmap,ds.normalmap,ds.displacementmap,ds.fog,ds.lights,{emissive:{value:new Ni(0)}}]),vertexShader:cs.meshlambert_vert,fragmentShader:cs.meshlambert_frag},phong:{uniforms:Hn([ds.common,ds.specularmap,ds.envmap,ds.aomap,ds.lightmap,ds.emissivemap,ds.bumpmap,ds.normalmap,ds.displacementmap,ds.fog,ds.lights,{emissive:{value:new Ni(0)},specular:{value:new Ni(1118481)},shininess:{value:30}}]),vertexShader:cs.meshphong_vert,fragmentShader:cs.meshphong_frag},standard:{uniforms:Hn([ds.common,ds.envmap,ds.aomap,ds.lightmap,ds.emissivemap,ds.bumpmap,ds.normalmap,ds.displacementmap,ds.roughnessmap,ds.metalnessmap,ds.fog,ds.lights,{emissive:{value:new Ni(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:cs.meshphysical_vert,fragmentShader:cs.meshphysical_frag},toon:{uniforms:Hn([ds.common,ds.aomap,ds.lightmap,ds.emissivemap,ds.bumpmap,ds.normalmap,ds.displacementmap,ds.gradientmap,ds.fog,ds.lights,{emissive:{value:new Ni(0)}}]),vertexShader:cs.meshtoon_vert,fragmentShader:cs.meshtoon_frag},matcap:{uniforms:Hn([ds.common,ds.bumpmap,ds.normalmap,ds.displacementmap,ds.fog,{matcap:{value:null}}]),vertexShader:cs.meshmatcap_vert,fragmentShader:cs.meshmatcap_frag},points:{uniforms:Hn([ds.points,ds.fog]),vertexShader:cs.points_vert,fragmentShader:cs.points_frag},dashed:{uniforms:Hn([ds.common,ds.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:cs.linedashed_vert,fragmentShader:cs.linedashed_frag},depth:{uniforms:Hn([ds.common,ds.displacementmap]),vertexShader:cs.depth_vert,fragmentShader:cs.depth_frag},normal:{uniforms:Hn([ds.common,ds.bumpmap,ds.normalmap,ds.displacementmap,{opacity:{value:1}}]),vertexShader:cs.meshnormal_vert,fragmentShader:cs.meshnormal_frag},sprite:{uniforms:Hn([ds.sprite,ds.fog]),vertexShader:cs.sprite_vert,fragmentShader:cs.sprite_frag},background:{uniforms:{uvTransform:{value:new _i},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:cs.background_vert,fragmentShader:cs.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:cs.backgroundCube_vert,fragmentShader:cs.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:cs.cube_vert,fragmentShader:cs.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:cs.equirect_vert,fragmentShader:cs.equirect_frag},distanceRGBA:{uniforms:Hn([ds.common,ds.displacementmap,{referencePosition:{value:new Zi},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:cs.distanceRGBA_vert,fragmentShader:cs.distanceRGBA_frag},shadow:{uniforms:Hn([ds.lights,ds.fog,{color:{value:new Ni(0)},opacity:{value:1}}]),vertexShader:cs.shadow_vert,fragmentShader:cs.shadow_frag}};us.physical={uniforms:Hn([us.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new wi(1,1)},clearcoatNormalMap:{value:null},iridescence:{value:0},iridescenceMap:{value:null},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},sheen:{value:0},sheenColor:{value:new Ni(0)},sheenColorMap:{value:null},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},transmission:{value:0},transmissionMap:{value:null},transmissionSamplerSize:{value:new wi},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:0},attenuationColor:{value:new Ni(0)},specularIntensity:{value:1},specularIntensityMap:{value:null},specularColor:{value:new Ni(1,1,1)},specularColorMap:{value:null}}]),vertexShader:cs.meshphysical_vert,fragmentShader:cs.meshphysical_frag};var ps={r:0,b:0,g:0};function fs(e,t,i,r,n,s,a){let o,l,h=new Ni(0),c=!0===s?0:1,d=null,u=0,p=null;function f(t,i){t.getRGB(ps,Wn(e)),r.buffers.color.setClear(ps.r,ps.g,ps.b,i,a)}return{getClearColor:function(){return h},setClearColor:function(e,t=1){h.set(e),c=t,f(h,c)},getClearAlpha:function(){return c},setClearAlpha:function(e){c=e,f(h,c)},render:function(r,s){let a=!1,m=!0===s.isScene?s.background:null;m&&m.isTexture&&(m=(s.backgroundBlurriness>0?i:t).get(m));let g=e.xr,v=g.getSession&&g.getSession();v&&"additive"===v.environmentBlendMode&&(m=null),null===m?f(h,c):m&&m.isColor&&(f(m,1),a=!0),(e.autoClear||a)&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),m&&(m.isCubeTexture||m.mapping===Oe)?(void 0===l&&(l=new Un(new jn(1,1,1),new Yn({name:"BackgroundCubeMaterial",uniforms:Gn(us.backgroundCube.uniforms),vertexShader:us.backgroundCube.vertexShader,fragmentShader:us.backgroundCube.fragmentShader,side:V,depthTest:!1,depthWrite:!1,fog:!1})),l.geometry.deleteAttribute("normal"),l.geometry.deleteAttribute("uv"),l.onBeforeRender=function(e,t,i){this.matrixWorld.copyPosition(i.matrixWorld)},Object.defineProperty(l.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(l)),l.material.uniforms.envMap.value=m,l.material.uniforms.flipEnvMap.value=m.isCubeTexture&&!1===m.isRenderTargetTexture?-1:1,l.material.uniforms.backgroundBlurriness.value=s.backgroundBlurriness,l.material.uniforms.backgroundIntensity.value=s.backgroundIntensity,l.material.toneMapped=m.encoding!==Qt,(d!==m||u!==m.version||p!==e.toneMapping)&&(l.material.needsUpdate=!0,d=m,u=m.version,p=e.toneMapping),l.layers.enableAll(),r.unshift(l,l.geometry,l.material,0,0,null)):m&&m.isTexture&&(void 0===o&&(o=new Un(new hs(2,2),new Yn({name:"BackgroundMaterial",uniforms:Gn(us.background.uniforms),vertexShader:us.background.vertexShader,fragmentShader:us.background.fragmentShader,side:U,depthTest:!1,depthWrite:!1,fog:!1})),o.geometry.deleteAttribute("normal"),Object.defineProperty(o.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(o)),o.material.uniforms.t2D.value=m,o.material.uniforms.backgroundIntensity.value=s.backgroundIntensity,o.material.toneMapped=m.encoding!==Qt,!0===m.matrixAutoUpdate&&m.updateMatrix(),o.material.uniforms.uvTransform.value.copy(m.matrix),(d!==m||u!==m.version||p!==e.toneMapping)&&(o.material.needsUpdate=!0,d=m,u=m.version,p=e.toneMapping),o.layers.enableAll(),r.unshift(o,o.geometry,o.material,0,0,null))}}}function ms(e,t,i,r){let n=e.getParameter(34921),s=r.isWebGL2?null:t.get("OES_vertex_array_object"),a=r.isWebGL2||null!==s,o={},l=p(null),h=l,c=!1;function d(t){return r.isWebGL2?e.bindVertexArray(t):s.bindVertexArrayOES(t)}function u(t){return r.isWebGL2?e.deleteVertexArray(t):s.deleteVertexArrayOES(t)}function p(e){let t=[],i=[],r=[];for(let s=0;s=0){let t=n[l],i=s[l];if(void 0===i&&("instanceMatrix"===l&&e.instanceMatrix&&(i=e.instanceMatrix),"instanceColor"===l&&e.instanceColor&&(i=e.instanceColor)),void 0===t||t.attribute!==i||i&&t.data!==i.data)return!0;a++}return h.attributesNum!==a||h.index!==r}(n,x,u,b),w&&function(e,t,i,r){let n={},s=t.attributes,a=0,o=i.getAttributes();for(let l in o)if(o[l].location>=0){let t=s[l];void 0===t&&("instanceMatrix"===l&&e.instanceMatrix&&(t=e.instanceMatrix),"instanceColor"===l&&e.instanceColor&&(t=e.instanceColor));let i={};i.attribute=t,t&&t.data&&(i.data=t.data),n[l]=i,a++}h.attributes=n,h.attributesNum=a,h.index=r}(n,x,u,b)}else{let e=!0===l.wireframe;(h.geometry!==x.id||h.program!==u.id||h.wireframe!==e)&&(h.geometry=x.id,h.program=u.id,h.wireframe=e,w=!0)}null!==b&&i.update(b,34963),(w||c)&&(c=!1,function(n,s,a,o){if(!1===r.isWebGL2&&(n.isInstancedMesh||o.isInstancedBufferGeometry)&&null===t.get("ANGLE_instanced_arrays"))return;f();let l=o.attributes,h=a.getAttributes(),c=s.defaultAttributeValues;for(let t in h){let r=h[t];if(r.location>=0){let s=l[t];if(void 0===s&&("instanceMatrix"===t&&n.instanceMatrix&&(s=n.instanceMatrix),"instanceColor"===t&&n.instanceColor&&(s=n.instanceColor)),void 0!==s){let t=s.normalized,a=s.itemSize,l=i.get(s);if(void 0===l)continue;let h=l.buffer,c=l.type,d=l.bytesPerElement;if(s.isInterleavedBufferAttribute){let i=s.data,l=i.stride,u=s.offset;if(i.isInstancedInterleavedBuffer){for(let e=0;e0&&e.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(35633,36337).precision>0&&e.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}let s=typeof WebGL2RenderingContext<"u"&&e instanceof WebGL2RenderingContext,a=void 0!==i.precision?i.precision:"highp",o=n(a);o!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",o,"instead."),a=o);let l=s||t.has("WEBGL_draw_buffers"),h=!0===i.logarithmicDepthBuffer,c=e.getParameter(34930),d=e.getParameter(35660),u=e.getParameter(3379),p=e.getParameter(34076),f=e.getParameter(34921),m=e.getParameter(36347),g=e.getParameter(36348),v=e.getParameter(36349),y=d>0,x=s||t.has("OES_texture_float");return{isWebGL2:s,drawBuffers:l,getMaxAnisotropy:function(){if(void 0!==r)return r;if(!0===t.has("EXT_texture_filter_anisotropic")){let i=t.get("EXT_texture_filter_anisotropic");r=e.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r},getMaxPrecision:n,precision:a,logarithmicDepthBuffer:h,maxTextures:c,maxVertexTextures:d,maxTextureSize:u,maxCubemapSize:p,maxAttributes:f,maxVertexUniforms:m,maxVaryings:g,maxFragmentUniforms:v,vertexTextures:y,floatFragmentTextures:x,floatVertexTextures:y&&x,maxSamples:s?e.getParameter(36183):0}}function ys(e){let t=this,i=null,r=0,n=!1,s=!1,a=new rs,o=new _i,l={value:null,needsUpdate:!1};function h(e,i,r,n){let s=null!==e?e.length:0,h=null;if(0!==s){if(h=l.value,!0!==n||null===h){let t=r+4*s,n=i.matrixWorldInverse;o.getNormalMatrix(n),(null===h||h.length0),t.numPlanes=r,t.numIntersection=0);else{let e=s?0:r,t=4*e,n=f.clippingState||null;l.value=n,n=h(d,o,t,c);for(let r=0;r!==t;++r)n[r]=i[r];f.clippingState=n,this.numIntersection=u?this.numPlanes:0,this.numPlanes+=e}}}function xs(e){let t=new WeakMap;function i(e,t){return t===Pe?e.mapping=Te:t===Ie&&(e.mapping=De),e}function r(e){let i=e.target;i.removeEventListener("dispose",r);let n=t.get(i);void 0!==n&&(t.delete(i),n.dispose())}return{get:function(n){if(n&&n.isTexture&&!1===n.isRenderTargetTexture){let s=n.mapping;if(s===Pe||s===Ie){if(t.has(n)){return i(t.get(n).texture,n.mapping)}{let s=n.image;if(s&&s.height>0){let a=new $n(s.height/2);return a.fromEquirectangularTexture(e,n),t.set(n,a),n.addEventListener("dispose",r),i(a.texture,n.mapping)}return null}}}return n},dispose:function(){t=new WeakMap}}}var bs=class extends Xn{constructor(e=-1,t=1,i=1,r=-1,n=.1,s=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=i,this.bottom=r,this.near=n,this.far=s,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=null===e.view?null:Object.assign({},e.view),this}setViewOffset(e,t,i,r,n,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=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=r,this.view.width=n,this.view.height=s,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,r=(this.top+this.bottom)/2,n=i-e,s=i+e,a=r+t,o=r-t;if(null!==this.view&&this.view.enabled){let e=(this.right-this.left)/this.view.fullWidth/this.zoom,t=(this.top-this.bottom)/this.view.fullHeight/this.zoom;n+=e*this.view.offsetX,s=n+e*this.view.width,a-=t*this.view.offsetY,o=a-t*this.view.height}this.projectionMatrix.makeOrthographic(n,s,a,o,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,null!==this.view&&(t.object.view=Object.assign({},this.view)),t}},ws=[.125,.215,.35,.446,.526,.582],_s=20,Ss=new bs,As=new Ni,Ms=null,Es=(1+Math.sqrt(5))/2,Cs=1/Es,Ts=[new Zi(1,1,1),new Zi(-1,1,1),new Zi(1,1,-1),new Zi(-1,1,-1),new Zi(0,Es,Cs),new Zi(0,Es,-Cs),new Zi(Cs,0,Es),new Zi(-Cs,0,Es),new Zi(Es,Cs,0),new Zi(-Es,Cs,0)],Ds=class{constructor(e){this._renderer=e,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(e,t=0,i=.1,r=100){Ms=this._renderer.getRenderTarget(),this._setSize(256);let n=this._allocateTargets();return n.depthBuffer=!0,this._sceneToCubeUV(e,i,r,n),t>0&&this._blur(n,0,0,t),this._applyPMREM(n),this._cleanup(n),n}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=Rs(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=Os(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let e=0;ee-4?o=ws[a-e+4-1]:0===a&&(o=0),r.push(o);let l=1/(s-2),h=-l,c=1+l,d=[h,h,c,h,c,c,h,h,c,c,h,c],u=6,p=6,f=3,m=2,g=1,v=new Float32Array(f*p*u),y=new Float32Array(m*p*u),x=new Float32Array(g*p*u);for(let e=0;e2?0:-1,r=[t,i,0,t+2/3,i,0,t+2/3,i+1,0,t,i,0,t+2/3,i+1,0,t,i+1,0];v.set(r,f*p*e),y.set(d,m*p*e);let n=[e,e,e,e,e,e];x.set(n,g*p*e)}let b=new En;b.setAttribute("position",new mn(v,f)),b.setAttribute("uv",new mn(y,m)),b.setAttribute("faceIndex",new mn(x,g)),t.push(b),n>4&&n--}return{lodPlanes:t,sizeLods:i,sigmas:r}}(r)),this._blurMaterial=function(e,t,i){let r=new Float32Array(_s),n=new Zi(0,1,0);return new Yn({name:"SphericalGaussianBlur",defines:{n:_s,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/i,CUBEUV_MAX_MIP:`${e}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:r},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:n}},vertexShader:Ls(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include \n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t",blending:G,depthTest:!1,depthWrite:!1})}(r,e,t)}return r}_compileMaterial(e){let t=new Un(this._lodPlanes[0],e);this._renderer.compile(t,Ss)}_sceneToCubeUV(e,t,i,r){let n=new Qn(90,1,t,i),s=[1,-1,1,1,1,1],a=[1,1,1,-1,-1,-1],o=this._renderer,l=o.autoClear,h=o.toneMapping;o.getClearColor(As),o.toneMapping=_e,o.autoClear=!1;let c=new un({name:"PMREM.Background",side:V,depthWrite:!1,depthTest:!1}),d=new Un(new jn,c),u=!1,p=e.background;p?p.isColor&&(c.color.copy(p),e.background=null,u=!0):(c.color.copy(As),u=!0);for(let f=0;f<6;f++){let t=f%3;0===t?(n.up.set(0,s[f],0),n.lookAt(a[f],0,0)):1===t?(n.up.set(0,0,s[f]),n.lookAt(0,a[f],0)):(n.up.set(0,s[f],0),n.lookAt(0,0,a[f]));let i=this._cubeSize;Is(r,t*i,f>2?i:0,i,i),o.setRenderTarget(r),u&&o.render(d,n),o.render(e,n)}d.geometry.dispose(),d.material.dispose(),o.toneMapping=h,o.autoClear=l,e.background=p}_textureToCubeUV(e,t){let i=this._renderer,r=e.mapping===Te||e.mapping===De;r?(null===this._cubemapMaterial&&(this._cubemapMaterial=Rs()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===e.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=Os());let n=r?this._cubemapMaterial:this._equirectMaterial,s=new Un(this._lodPlanes[0],n);n.uniforms.envMap.value=e;let a=this._cubeSize;Is(t,0,0,3*a,2*a),i.setRenderTarget(t),i.render(s,Ss)}_applyPMREM(e){let t=this._renderer,i=t.autoClear;t.autoClear=!1;for(let r=1;r_s&&console.warn(`sigmaRadians, ${n}, is too large and will clip, as it requested ${f} samples when the maximum is set to 20`);let m=[],g=0;for(let x=0;x<_s;++x){let e=x/p,t=Math.exp(-e*e/2);m.push(t),0===x?g+=t:xv-4?r-v+4:0),4*(this._cubeSize-y),3*y,2*y),o.setRenderTarget(t),o.render(h,Ss)}};function Ps(e,t,i){let r=new qi(e,t,i);return r.texture.mapping=Oe,r.texture.name="PMREM.cubeUv",r.scissorTest=!0,r}function Is(e,t,i,r,n){e.viewport.set(t,i,r,n),e.scissor.set(t,i,r,n)}function Os(){return new Yn({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Ls(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\n\t\t\t#include \n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tgl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\n\n\t\t\t}\n\t\t",blending:G,depthTest:!1,depthWrite:!1})}function Rs(){return new Yn({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Ls(),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:G,depthTest:!1,depthWrite:!1})}function Ls(){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 Bs(e){let t=new WeakMap,i=null;function r(e){let i=e.target;i.removeEventListener("dispose",r);let n=t.get(i);void 0!==n&&(t.delete(i),n.dispose())}return{get:function(n){if(n&&n.isTexture){let s=n.mapping,a=s===Pe||s===Ie,o=s===Te||s===De;if(a||o){if(n.isRenderTargetTexture&&!0===n.needsPMREMUpdate){n.needsPMREMUpdate=!1;let r=t.get(n);return null===i&&(i=new Ds(e)),r=a?i.fromEquirectangular(n,r):i.fromCubemap(n,r),t.set(n,r),r.texture}if(t.has(n))return t.get(n).texture;{let s=n.image;if(a&&s&&s.height>0||o&&s&&function(e){let t=0,i=6;for(let r=0;rt.maxTextureSize&&(m=Math.ceil(f/t.maxTextureSize),f=t.maxTextureSize);let g=new Float32Array(f*m*4*n),v=new Yi(g,f,m,n);v.type=Xe,v.needsUpdate=!0;let y=4*p;for(let t=0;t0)return e;let n=t*i,s=Xs[n];if(void 0===s&&(s=new Float32Array(n),Xs[n]=s),0!==t){r.toArray(s,0);for(let r=1,n=0;r!==t;++r)n+=i,e[r].toArray(s,n)}return s}function ea(e,t){if(e.length!==t.length)return!1;for(let i=0,r=e.length;i":" "} ${e}: ${i[a]}`)}return r.join("\n")}(e.getShaderSource(t),r)}return n}function Ka(e,t){let i=function(e){switch(e){case Xt:return["Linear","( value )"];case Qt:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",e),["Linear","( value )"]}}(t);return"vec4 "+e+"( vec4 value ) { return LinearTo"+i[0]+i[1]+"; }"}function Ja(e,t){let i;switch(t){case Se:i="Linear";break;case Ae:i="Reinhard";break;case Me:i="OptimizedCineon";break;case Ee:i="ACESFilmic";break;case Ce:i="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",t),i="Linear"}return"vec3 "+e+"( vec3 color ) { return "+i+"ToneMapping( color ); }"}function $a(e){return""!==e}function eo(e,t){let i=t.numSpotLightShadows+t.numSpotLightMaps-t.numSpotLightShadowsWithMaps;return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,t.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,i).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,t.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function to(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}var io=/^[ \t]*#include +<([\w\d./]+)>/gm;function ro(e){return e.replace(io,no)}function no(e,t){let i=cs[t];if(void 0===i)throw new Error("Can not resolve #include <"+t+">");return ro(i)}var so=/#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 ao(e){return e.replace(so,oo)}function oo(e,t,i,r){let n="";for(let s=parseInt(t);s0&&(n+="\n"),s=[m,g].filter($a).join("\n"),s.length>0&&(s+="\n")):(n=[lo(i),"#define SHADER_NAME "+i.shaderName,g,i.instancing?"#define USE_INSTANCING":"",i.instancingColor?"#define USE_INSTANCING_COLOR":"",i.supportsVertexTextures?"#define VERTEX_TEXTURES":"",i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp2?"#define FOG_EXP2":"",i.map?"#define USE_MAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+u:"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.normalMap&&i.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",i.normalMap&&i.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",i.clearcoatMap?"#define USE_CLEARCOATMAP":"",i.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",i.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",i.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",i.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",i.displacementMap&&i.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",i.specularColorMap?"#define USE_SPECULARCOLORMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.transmission?"#define USE_TRANSMISSION":"",i.transmissionMap?"#define USE_TRANSMISSIONMAP":"",i.thicknessMap?"#define USE_THICKNESSMAP":"",i.sheenColorMap?"#define USE_SHEENCOLORMAP":"",i.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",i.vertexTangents?"#define USE_TANGENT":"",i.vertexColors?"#define USE_COLOR":"",i.vertexAlphas?"#define USE_COLOR_ALPHA":"",i.vertexUvs?"#define USE_UV":"",i.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",i.flatShading?"#define FLAT_SHADED":"",i.skinning?"#define USE_SKINNING":"",i.morphTargets?"#define USE_MORPHTARGETS":"",i.morphNormals&&!1===i.flatShading?"#define USE_MORPHNORMALS":"",i.morphColors&&i.isWebGL2?"#define USE_MORPHCOLORS":"",i.morphTargetsCount>0&&i.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",i.morphTargetsCount>0&&i.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+i.morphTextureStride:"",i.morphTargetsCount>0&&i.isWebGL2?"#define MORPHTARGETS_COUNT "+i.morphTargetsCount:"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"",i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+c:"",i.sizeAttenuation?"#define USE_SIZEATTENUATION":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",i.logarithmicDepthBuffer&&i.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter($a).join("\n"),s=[m,lo(i),"#define SHADER_NAME "+i.shaderName,g,i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp2?"#define FOG_EXP2":"",i.map?"#define USE_MAP":"",i.matcap?"#define USE_MATCAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+d:"",i.envMap?"#define "+u:"",i.envMap?"#define "+p:"",f?"#define CUBEUV_TEXEL_WIDTH "+f.texelWidth:"",f?"#define CUBEUV_TEXEL_HEIGHT "+f.texelHeight:"",f?"#define CUBEUV_MAX_MIP "+f.maxMip+".0":"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.normalMap&&i.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",i.normalMap&&i.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",i.clearcoat?"#define USE_CLEARCOAT":"",i.clearcoatMap?"#define USE_CLEARCOATMAP":"",i.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",i.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",i.iridescence?"#define USE_IRIDESCENCE":"",i.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",i.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",i.specularColorMap?"#define USE_SPECULARCOLORMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.alphaTest?"#define USE_ALPHATEST":"",i.sheen?"#define USE_SHEEN":"",i.sheenColorMap?"#define USE_SHEENCOLORMAP":"",i.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",i.transmission?"#define USE_TRANSMISSION":"",i.transmissionMap?"#define USE_TRANSMISSIONMAP":"",i.thicknessMap?"#define USE_THICKNESSMAP":"",i.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",i.vertexTangents?"#define USE_TANGENT":"",i.vertexColors||i.instancingColor?"#define USE_COLOR":"",i.vertexAlphas?"#define USE_COLOR_ALPHA":"",i.vertexUvs?"#define USE_UV":"",i.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",i.gradientMap?"#define USE_GRADIENTMAP":"",i.flatShading?"#define FLAT_SHADED":"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"",i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+c:"",i.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",i.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",i.logarithmicDepthBuffer&&i.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",i.toneMapping!==_e?"#define TONE_MAPPING":"",i.toneMapping!==_e?cs.tonemapping_pars_fragment:"",i.toneMapping!==_e?Ja("toneMapping",i.toneMapping):"",i.dithering?"#define DITHERING":"",i.opaque?"#define OPAQUE":"",cs.encodings_pars_fragment,Ka("linearToOutputTexel",i.outputEncoding),i.useDepthPacking?"#define DEPTH_PACKING "+i.depthPacking:"","\n"].filter($a).join("\n")),l=ro(l),l=eo(l,i),l=to(l,i),h=ro(h),h=eo(h,i),h=to(h,i),l=ao(l),h=ao(h),i.isWebGL2&&!0!==i.isRawShaderMaterial&&(y="#version 300 es\n",n=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+n,s=["#define varying in",i.glslVersion===ni?"":"layout(location = 0) out highp vec4 pc_fragColor;",i.glslVersion===ni?"":"#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"+s);let x,b,w=y+s+h,_=Xa(a,35633,y+n+l),S=Xa(a,35632,w);if(a.attachShader(v,_),a.attachShader(v,S),void 0!==i.index0AttributeName?a.bindAttribLocation(v,0,i.index0AttributeName):!0===i.morphTargets&&a.bindAttribLocation(v,0,"position"),a.linkProgram(v),e.debug.checkShaderErrors){let e=a.getProgramInfoLog(v).trim(),t=a.getShaderInfoLog(_).trim(),i=a.getShaderInfoLog(S).trim(),r=!0,o=!0;if(!1===a.getProgramParameter(v,35714)){r=!1;let t=Za(a,_,"vertex"),i=Za(a,S,"fragment");console.error("THREE.WebGLProgram: Shader Error "+a.getError()+" - VALIDATE_STATUS "+a.getProgramParameter(v,35715)+"\n\nProgram Info Log: "+e+"\n"+t+"\n"+i)}else""!==e?console.warn("THREE.WebGLProgram: Program Info Log:",e):(""===t||""===i)&&(o=!1);o&&(this.diagnostics={runnable:r,programLog:e,vertexShader:{log:t,prefix:n},fragmentShader:{log:i,prefix:s}})}return a.deleteShader(_),a.deleteShader(S),this.getUniforms=function(){return void 0===x&&(x=new Ya(a,v)),x},this.getAttributes=function(){return void 0===b&&(b=function(e,t){let i={},r=e.getProgramParameter(t,35721);for(let n=0;n0,O=s.clearcoat>0,R=s.iridescence>0;return{isWebGL2:c,shaderID:_,shaderName:s.type,vertexShader:S,fragmentShader:A,defines:s.defines,customVertexShaderID:M,customFragmentShaderID:E,isRawShaderMaterial:!0===s.isRawShaderMaterial,glslVersion:s.glslVersion,precision:p,instancing:!0===g.isInstancedMesh,instancingColor:!0===g.isInstancedMesh&&null!==g.instanceColor,supportsVertexTextures:u,outputEncoding:null===P?e.outputEncoding:!0===P.isXRRenderTarget?P.texture.encoding:Xt,map:!!s.map,matcap:!!s.matcap,envMap:!!b,envMapMode:b&&b.mapping,envMapCubeUVHeight:w,lightMap:!!s.lightMap,aoMap:!!s.aoMap,emissiveMap:!!s.emissiveMap,bumpMap:!!s.bumpMap,normalMap:!!s.normalMap,objectSpaceNormalMap:s.normalMapType===$t,tangentSpaceNormalMap:s.normalMapType===Jt,decodeVideoTexture:!!s.map&&!0===s.map.isVideoTexture&&s.map.encoding===Qt,clearcoat:O,clearcoatMap:O&&!!s.clearcoatMap,clearcoatRoughnessMap:O&&!!s.clearcoatRoughnessMap,clearcoatNormalMap:O&&!!s.clearcoatNormalMap,iridescence:R,iridescenceMap:R&&!!s.iridescenceMap,iridescenceThicknessMap:R&&!!s.iridescenceThicknessMap,displacementMap:!!s.displacementMap,roughnessMap:!!s.roughnessMap,metalnessMap:!!s.metalnessMap,specularMap:!!s.specularMap,specularIntensityMap:!!s.specularIntensityMap,specularColorMap:!!s.specularColorMap,opaque:!1===s.transparent&&s.blending===H,alphaMap:!!s.alphaMap,alphaTest:I,gradientMap:!!s.gradientMap,sheen:s.sheen>0,sheenColorMap:!!s.sheenColorMap,sheenRoughnessMap:!!s.sheenRoughnessMap,transmission:s.transmission>0,transmissionMap:!!s.transmissionMap,thicknessMap:!!s.thicknessMap,combine:s.combine,vertexTangents:!!s.normalMap&&!!y.attributes.tangent,vertexColors:s.vertexColors,vertexAlphas:!0===s.vertexColors&&!!y.attributes.color&&4===y.attributes.color.itemSize,vertexUvs:!!(s.map||s.bumpMap||s.normalMap||s.specularMap||s.alphaMap||s.emissiveMap||s.roughnessMap||s.metalnessMap||s.clearcoatMap||s.clearcoatRoughnessMap||s.clearcoatNormalMap||s.iridescenceMap||s.iridescenceThicknessMap||s.displacementMap||s.transmissionMap||s.thicknessMap||s.specularIntensityMap||s.specularColorMap||s.sheenColorMap||s.sheenRoughnessMap),uvsVertexOnly:!(s.map||s.bumpMap||s.normalMap||s.specularMap||s.alphaMap||s.emissiveMap||s.roughnessMap||s.metalnessMap||s.clearcoatNormalMap||s.iridescenceMap||s.iridescenceThicknessMap||s.transmission>0||s.transmissionMap||s.thicknessMap||s.specularIntensityMap||s.specularColorMap||s.sheen>0||s.sheenColorMap||s.sheenRoughnessMap||!s.displacementMap),fog:!!v,useFog:!0===s.fog,fogExp2:v&&v.isFogExp2,flatShading:!!s.flatShading,sizeAttenuation:s.sizeAttenuation,logarithmicDepthBuffer:d,skinning:!0===g.isSkinnedMesh,morphTargets:void 0!==y.morphAttributes.position,morphNormals:void 0!==y.morphAttributes.normal,morphColors:void 0!==y.morphAttributes.color,morphTargetsCount:T,morphTextureStride:D,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,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:s.dithering,shadowMapEnabled:e.shadowMap.enabled&&h.length>0,shadowMapType:e.shadowMap.type,toneMapping:s.toneMapped?e.toneMapping:_e,physicallyCorrectLights:e.physicallyCorrectLights,premultipliedAlpha:s.premultipliedAlpha,doubleSided:s.side===j,flipSided:s.side===V,useDepthPacking:!!s.depthPacking,depthPacking:s.depthPacking||0,index0AttributeName:s.index0AttributeName,extensionDerivatives:s.extensions&&s.extensions.derivatives,extensionFragDepth:s.extensions&&s.extensions.fragDepth,extensionDrawBuffers:s.extensions&&s.extensions.drawBuffers,extensionShaderTextureLOD:s.extensions&&s.extensions.shaderTextureLOD,rendererExtensionFragDepth:c||r.has("EXT_frag_depth"),rendererExtensionDrawBuffers:c||r.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:c||r.has("EXT_shader_texture_lod"),customProgramCacheKey:s.customProgramCacheKey()}},getProgramCacheKey:function(t){let i=[];if(t.shaderID?i.push(t.shaderID):(i.push(t.customVertexShaderID),i.push(t.customFragmentShaderID)),void 0!==t.defines)for(let e in t.defines)i.push(e),i.push(t.defines[e]);return!1===t.isRawShaderMaterial&&(function(e,t){e.push(t.precision),e.push(t.outputEncoding),e.push(t.envMapMode),e.push(t.envMapCubeUVHeight),e.push(t.combine),e.push(t.vertexUvs),e.push(t.fogExp2),e.push(t.sizeAttenuation),e.push(t.morphTargetsCount),e.push(t.morphAttributeCount),e.push(t.numDirLights),e.push(t.numPointLights),e.push(t.numSpotLights),e.push(t.numSpotLightMaps),e.push(t.numHemiLights),e.push(t.numRectAreaLights),e.push(t.numDirLightShadows),e.push(t.numPointLightShadows),e.push(t.numSpotLightShadows),e.push(t.numSpotLightShadowsWithMaps),e.push(t.shadowMapType),e.push(t.toneMapping),e.push(t.numClippingPlanes),e.push(t.numClipIntersection),e.push(t.depthPacking)}(i,t),function(e,t){o.disableAll(),t.isWebGL2&&o.enable(0),t.supportsVertexTextures&&o.enable(1),t.instancing&&o.enable(2),t.instancingColor&&o.enable(3),t.map&&o.enable(4),t.matcap&&o.enable(5),t.envMap&&o.enable(6),t.lightMap&&o.enable(7),t.aoMap&&o.enable(8),t.emissiveMap&&o.enable(9),t.bumpMap&&o.enable(10),t.normalMap&&o.enable(11),t.objectSpaceNormalMap&&o.enable(12),t.tangentSpaceNormalMap&&o.enable(13),t.clearcoat&&o.enable(14),t.clearcoatMap&&o.enable(15),t.clearcoatRoughnessMap&&o.enable(16),t.clearcoatNormalMap&&o.enable(17),t.iridescence&&o.enable(18),t.iridescenceMap&&o.enable(19),t.iridescenceThicknessMap&&o.enable(20),t.displacementMap&&o.enable(21),t.specularMap&&o.enable(22),t.roughnessMap&&o.enable(23),t.metalnessMap&&o.enable(24),t.gradientMap&&o.enable(25),t.alphaMap&&o.enable(26),t.alphaTest&&o.enable(27),t.vertexColors&&o.enable(28),t.vertexAlphas&&o.enable(29),t.vertexUvs&&o.enable(30),t.vertexTangents&&o.enable(31),t.uvsVertexOnly&&o.enable(32),e.push(o.mask),o.disableAll(),t.fog&&o.enable(0),t.useFog&&o.enable(1),t.flatShading&&o.enable(2),t.logarithmicDepthBuffer&&o.enable(3),t.skinning&&o.enable(4),t.morphTargets&&o.enable(5),t.morphNormals&&o.enable(6),t.morphColors&&o.enable(7),t.premultipliedAlpha&&o.enable(8),t.shadowMapEnabled&&o.enable(9),t.physicallyCorrectLights&&o.enable(10),t.doubleSided&&o.enable(11),t.flipSided&&o.enable(12),t.useDepthPacking&&o.enable(13),t.dithering&&o.enable(14),t.specularIntensityMap&&o.enable(15),t.specularColorMap&&o.enable(16),t.transmission&&o.enable(17),t.transmissionMap&&o.enable(18),t.thicknessMap&&o.enable(19),t.sheen&&o.enable(20),t.sheenColorMap&&o.enable(21),t.sheenRoughnessMap&&o.enable(22),t.decodeVideoTexture&&o.enable(23),t.opaque&&o.enable(24),e.push(o.mask)}(i,t),i.push(e.outputEncoding)),i.push(t.customProgramCacheKey),i.join()},getUniforms:function(e){let t,i=f[e.type];if(i){let e=us[i];t=qn.clone(e.uniforms)}else t=e.uniforms;return t},acquireProgram:function(t,i){let r;for(let e=0,n=h.length;e0?r.push(c):!0===a.transparent?n.push(c):i.push(c)},unshift:function(e,t,a,o,l,h){let c=s(e,t,a,o,l,h);a.transmission>0?r.unshift(c):!0===a.transparent?n.unshift(c):i.unshift(c)},finish:function(){for(let i=t,r=e.length;i1&&i.sort(e||go),r.length>1&&r.sort(t||vo),n.length>1&&n.sort(t||vo)}}}function xo(){let e=new WeakMap;return{get:function(t,i){let r,n=e.get(t);return void 0===n?(r=new yo,e.set(t,[r])):i>=n.length?(r=new yo,n.push(r)):r=n[i],r},dispose:function(){e=new WeakMap}}}function bo(){let e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];let i;switch(t.type){case"DirectionalLight":i={direction:new Zi,color:new Ni};break;case"SpotLight":i={position:new Zi,direction:new Zi,color:new Ni,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":i={position:new Zi,color:new Ni,distance:0,decay:0};break;case"HemisphereLight":i={direction:new Zi,skyColor:new Ni,groundColor:new Ni};break;case"RectAreaLight":i={color:new Ni,position:new Zi,halfWidth:new Zi,halfHeight:new Zi}}return e[t.id]=i,i}}}var wo=0;function _o(e,t){return(t.castShadow?2:0)-(e.castShadow?2:0)+(t.map?1:0)-(e.map?1:0)}function So(e,t){let i=new bo,r=function(){let e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];let i;switch(t.type){case"DirectionalLight":case"SpotLight":i={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new wi};break;case"PointLight":i={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new wi,shadowCameraNear:1,shadowCameraFar:1e3}}return e[t.id]=i,i}}}(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0};for(let l=0;l<9;l++)n.probe.push(new Zi);let s=new Zi,a=new Er,o=new Er;return{setup:function(s,a){let o=0,l=0,h=0;for(let e=0;e<9;e++)n.probe[e].set(0,0,0);let c=0,d=0,u=0,p=0,f=0,m=0,g=0,v=0,y=0,x=0;s.sort(_o);let b=!0!==a?Math.PI:1;for(let e=0,t=s.length;e0&&(t.isWebGL2||!0===e.has("OES_texture_float_linear")?(n.rectAreaLTC1=ds.LTC_FLOAT_1,n.rectAreaLTC2=ds.LTC_FLOAT_2):!0===e.has("OES_texture_half_float_linear")?(n.rectAreaLTC1=ds.LTC_HALF_1,n.rectAreaLTC2=ds.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),n.ambient[0]=o,n.ambient[1]=l,n.ambient[2]=h;let w=n.hash;(w.directionalLength!==c||w.pointLength!==d||w.spotLength!==u||w.rectAreaLength!==p||w.hemiLength!==f||w.numDirectionalShadows!==m||w.numPointShadows!==g||w.numSpotShadows!==v||w.numSpotMaps!==y)&&(n.directional.length=c,n.spot.length=u,n.rectArea.length=p,n.point.length=d,n.hemi.length=f,n.directionalShadow.length=m,n.directionalShadowMap.length=m,n.pointShadow.length=g,n.pointShadowMap.length=g,n.spotShadow.length=v,n.spotShadowMap.length=v,n.directionalShadowMatrix.length=m,n.pointShadowMatrix.length=g,n.spotLightMatrix.length=v+y-x,n.spotLightMap.length=y,n.numSpotLightShadowsWithMaps=x,w.directionalLength=c,w.pointLength=d,w.spotLength=u,w.rectAreaLength=p,w.hemiLength=f,w.numDirectionalShadows=m,w.numPointShadows=g,w.numSpotShadows=v,w.numSpotMaps=y,n.version=wo++)},setupView:function(e,t){let i=0,r=0,l=0,h=0,c=0,d=t.matrixWorldInverse;for(let u=0,p=e.length;u=a.length?(s=new Ao(e,t),a.push(s)):s=a[n],s},dispose:function(){i=new WeakMap}}}var Eo=class extends dn{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=Zt,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}},Co=class extends dn{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.referencePosition=new Zi,this.nearDistance=1,this.farDistance=1e3,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.referencePosition.copy(e.referencePosition),this.nearDistance=e.nearDistance,this.farDistance=e.farDistance,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}},To="void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",Do="uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include \nvoid main() {\n\tconst float samples = float( VSM_SAMPLES );\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}";function Po(e,t,i){let r=new as,n=new wi,s=new wi,a=new Wi,o=new Eo({depthPacking:Kt}),l=new Co,h={},c=i.maxTextureSize,d={[U]:V,[V]:U,[j]:j},u=new Yn({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new wi},radius:{value:4}},vertexShader:To,fragmentShader:Do}),p=u.clone();p.defines.HORIZONTAL_PASS=1;let f=new En;f.setAttribute("position",new mn(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let m=new Un(f,u),g=this;function v(i,r){let s=t.update(m);u.defines.VSM_SAMPLES!==i.blurSamples&&(u.defines.VSM_SAMPLES=i.blurSamples,p.defines.VSM_SAMPLES=i.blurSamples,u.needsUpdate=!0,p.needsUpdate=!0),null===i.mapPass&&(i.mapPass=new qi(n.x,n.y)),u.uniforms.shadow_pass.value=i.map.texture,u.uniforms.resolution.value=i.mapSize,u.uniforms.radius.value=i.radius,e.setRenderTarget(i.mapPass),e.clear(),e.renderBufferDirect(r,null,s,u,m,null),p.uniforms.shadow_pass.value=i.mapPass.texture,p.uniforms.resolution.value=i.mapSize,p.uniforms.radius.value=i.radius,e.setRenderTarget(i.map),e.clear(),e.renderBufferDirect(r,null,s,p,m,null)}function y(t,i,r,n,s,a){let c=null,u=!0===r.isPointLight?t.customDistanceMaterial:t.customDepthMaterial;if(void 0!==u)c=u;else if(c=!0===r.isPointLight?l:o,e.localClippingEnabled&&!0===i.clipShadows&&Array.isArray(i.clippingPlanes)&&0!==i.clippingPlanes.length||i.displacementMap&&0!==i.displacementScale||i.alphaMap&&i.alphaTest>0||i.map&&i.alphaTest>0){let e=c.uuid,t=i.uuid,r=h[e];void 0===r&&(r={},h[e]=r);let n=r[t];void 0===n&&(n=c.clone(),r[t]=n),c=n}return c.visible=i.visible,c.wireframe=i.wireframe,c.side=a===F?null!==i.shadowSide?i.shadowSide:i.side:null!==i.shadowSide?i.shadowSide:d[i.side],c.alphaMap=i.alphaMap,c.alphaTest=i.alphaTest,c.map=i.map,c.clipShadows=i.clipShadows,c.clippingPlanes=i.clippingPlanes,c.clipIntersection=i.clipIntersection,c.displacementMap=i.displacementMap,c.displacementScale=i.displacementScale,c.displacementBias=i.displacementBias,c.wireframeLinewidth=i.wireframeLinewidth,c.linewidth=i.linewidth,!0===r.isPointLight&&!0===c.isMeshDistanceMaterial&&(c.referencePosition.setFromMatrixPosition(r.matrixWorld),c.nearDistance=n,c.farDistance=s),c}function x(i,n,s,a,o){if(!1===i.visible)return;if(i.layers.test(n.layers)&&(i.isMesh||i.isLine||i.isPoints)&&(i.castShadow||i.receiveShadow&&o===F)&&(!i.frustumCulled||r.intersectsObject(i))){i.modelViewMatrix.multiplyMatrices(s.matrixWorldInverse,i.matrixWorld);let r=t.update(i),n=i.material;if(Array.isArray(n)){let t=r.groups;for(let l=0,h=t.length;lc||n.y>c)&&(n.x>c&&(s.x=Math.floor(c/d.x),n.x=s.x*d.x,h.mapSize.x=s.x),n.y>c&&(s.y=Math.floor(c/d.y),n.y=s.y*d.y,h.mapSize.y=s.y)),null===h.map){let e=this.type!==F?{minFilter:ze,magFilter:ze}:{};h.map=new qi(n.x,n.y,e),h.map.texture.name=l.name+".shadowMap",h.camera.updateProjectionMatrix()}e.setRenderTarget(h.map),e.clear();let f=h.getViewportCount();for(let e=0;e=1):-1!==I.indexOf("OpenGL ES")&&(P=parseFloat(/^OpenGL ES (\d)/.exec(I)[1]),D=P>=2);let O=null,R={},k=e.getParameter(3088),N=e.getParameter(2978),F=(new Wi).fromArray(k),U=(new Wi).fromArray(N);function xe(t,i,r){let n=new Uint8Array(4),s=e.createTexture();e.bindTexture(t,s),e.texParameteri(t,10241,9728),e.texParameteri(t,10240,9728);for(let a=0;a"u")&&/OculusBrowser/g.test(navigator.userAgent),m=new WeakMap,g=new WeakMap,v=!1;try{v=typeof OffscreenCanvas<"u"&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch{}function y(e,t){return v?new OffscreenCanvas(e,t):Ci("canvas")}function x(e,t,i,r){let n=1;if((e.width>r||e.height>r)&&(n=r/Math.max(e.width,e.height)),n<1||!0===t){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){let r=t?vi:Math.floor,s=r(n*e.width),a=r(n*e.height);void 0===o&&(o=y(s,a));let l=i?y(s,a):o;return l.width=s,l.height=a,l.getContext("2d").drawImage(e,0,0,s,a),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+e.width+"x"+e.height+") to ("+s+"x"+a+")."),l}return"data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+e.width+"x"+e.height+")."),e}return e}function b(e){return mi(e.width)&&mi(e.height)}function w(e,t){return e.generateMipmaps&&t&&e.minFilter!==ze&&e.minFilter!==Fe}function _(t){e.generateMipmap(t)}function S(i,r,n,s,a=!1){if(!1===l)return r;if(null!==i){if(void 0!==e[i])return e[i];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+i+"'")}let o=r;return 6403===r&&(5126===n&&(o=33326),5131===n&&(o=33325),5121===n&&(o=33321)),33319===r&&(5126===n&&(o=33328),5131===n&&(o=33327),5121===n&&(o=33323)),6408===r&&(5126===n&&(o=34836),5131===n&&(o=34842),5121===n&&(o=s===Qt&&!1===a?35907:32856),32819===n&&(o=32854),32820===n&&(o=32855)),(33325===o||33326===o||33327===o||33328===o||34842===o||34836===o)&&t.get("EXT_color_buffer_float"),o}function A(e,t,i){return!0===w(e,i)||e.isFramebufferTexture&&e.minFilter!==ze&&e.minFilter!==Fe?Math.log2(Math.max(t.width,t.height))+1:void 0!==e.mipmaps&&e.mipmaps.length>0?e.mipmaps.length:e.isCompressedTexture&&Array.isArray(e.image)?t.mipmaps.length:1}function M(e){return e===ze||e===ke||e===Ne?9728:9729}function E(e){let t=e.target;t.removeEventListener("dispose",E),function(e){let t=r.get(e);if(void 0===t.__webglInit)return;let i=e.source,n=g.get(i);if(n){let r=n[t.__cacheKey];r.usedTimes--,0===r.usedTimes&&T(e),0===Object.keys(n).length&&g.delete(i)}r.remove(e)}(t),t.isVideoTexture&&m.delete(t)}function C(t){let i=t.target;i.removeEventListener("dispose",C),function(t){let i=t.texture,n=r.get(t),s=r.get(i);if(void 0!==s.__webglTexture&&(e.deleteTexture(s.__webglTexture),a.memory.textures--),t.depthTexture&&t.depthTexture.dispose(),t.isWebGLCubeRenderTarget)for(let r=0;r<6;r++)e.deleteFramebuffer(n.__webglFramebuffer[r]),n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer[r]);else{if(e.deleteFramebuffer(n.__webglFramebuffer),n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer),n.__webglMultisampledFramebuffer&&e.deleteFramebuffer(n.__webglMultisampledFramebuffer),n.__webglColorRenderbuffer)for(let t=0;t0&&n.__version!==e.version){let i=e.image;if(null===i)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==i.complete)return void B(n,e,t);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}i.bindTexture(3553,n.__webglTexture,33984+t)}let I={[Re]:10497,[Le]:33071,[Be]:33648},O={[ze]:9728,[ke]:9984,[Ne]:9986,[Fe]:9729,[Ue]:9985,[Ve]:9987};function R(i,s,a){if(a?(e.texParameteri(i,10242,I[s.wrapS]),e.texParameteri(i,10243,I[s.wrapT]),(32879===i||35866===i)&&e.texParameteri(i,32882,I[s.wrapR]),e.texParameteri(i,10240,O[s.magFilter]),e.texParameteri(i,10241,O[s.minFilter])):(e.texParameteri(i,10242,33071),e.texParameteri(i,10243,33071),(32879===i||35866===i)&&e.texParameteri(i,32882,33071),(s.wrapS!==Le||s.wrapT!==Le)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),e.texParameteri(i,10240,M(s.magFilter)),e.texParameteri(i,10241,M(s.minFilter)),s.minFilter!==ze&&s.minFilter!==Fe&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),!0===t.has("EXT_texture_filter_anisotropic")){let a=t.get("EXT_texture_filter_anisotropic");if(s.magFilter===ze||s.minFilter!==Ne&&s.minFilter!==Ve||s.type===Xe&&!1===t.has("OES_texture_float_linear")||!1===l&&s.type===Qe&&!1===t.has("OES_texture_half_float_linear"))return;(s.anisotropy>1||r.get(s).__currentAnisotropy)&&(e.texParameterf(i,a.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(s.anisotropy,n.getMaxAnisotropy())),r.get(s).__currentAnisotropy=s.anisotropy)}}function L(t,i){let r=!1;void 0===t.__webglInit&&(t.__webglInit=!0,i.addEventListener("dispose",E));let n=i.source,s=g.get(n);void 0===s&&(s={},g.set(n,s));let o=function(e){let t=[];return t.push(e.wrapS),t.push(e.wrapT),t.push(e.wrapR||0),t.push(e.magFilter),t.push(e.minFilter),t.push(e.anisotropy),t.push(e.internalFormat),t.push(e.format),t.push(e.type),t.push(e.generateMipmaps),t.push(e.premultiplyAlpha),t.push(e.flipY),t.push(e.unpackAlignment),t.push(e.encoding),t.join()}(i);if(o!==t.__cacheKey){void 0===s[o]&&(s[o]={texture:e.createTexture(),usedTimes:0},a.memory.textures++,r=!0),s[o].usedTimes++;let n=s[t.__cacheKey];void 0!==n&&(s[t.__cacheKey].usedTimes--,0===n.usedTimes&&T(i)),t.__cacheKey=o,t.__webglTexture=s[o].texture}return r}function B(t,n,a){let o=3553;(n.isDataArrayTexture||n.isCompressedArrayTexture)&&(o=35866),n.isData3DTexture&&(o=32879);let h=L(t,n),c=n.source;i.bindTexture(o,t.__webglTexture,33984+a);let u=r.get(c);if(c.version!==u.__version||!0===h){i.activeTexture(33984+a),e.pixelStorei(37440,n.flipY),e.pixelStorei(37441,n.premultiplyAlpha),e.pixelStorei(3317,n.unpackAlignment),e.pixelStorei(37443,0);let t=function(e){return!l&&(e.wrapS!==Le||e.wrapT!==Le||e.minFilter!==ze&&e.minFilter!==Fe)}(n)&&!1===b(n.image),r=x(n.image,t,!1,d);r=V(n,r);let p=b(r)||l,f=s.convert(n.format,n.encoding),m=s.convert(n.type),g=S(n.internalFormat,f,m,n.encoding,n.isVideoTexture);R(o,n,p);let v,y=n.mipmaps,M=l&&!0!==n.isVideoTexture,E=void 0===u.__version||!0===h,C=A(n,r,p);if(n.isDepthTexture)g=6402,l?g=n.type===Xe?36012:n.type===Ye?33190:n.type===Je?35056:33189:n.type===Xe&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),n.format===rt&&6402===g&&n.type!==We&&n.type!==Ye&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),n.type=Ye,m=s.convert(n.type)),n.format===nt&&6402===g&&(g=34041,n.type!==Je&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),n.type=Je,m=s.convert(n.type))),E&&(M?i.texStorage2D(3553,1,g,r.width,r.height):i.texImage2D(3553,0,g,r.width,r.height,0,f,m,null));else if(n.isDataTexture)if(y.length>0&&p){M&&E&&i.texStorage2D(3553,C,g,y[0].width,y[0].height);for(let e=0,t=y.length;e>=1,t>>=1}}else if(y.length>0&&p){M&&E&&i.texStorage2D(3553,C,g,y[0].width,y[0].height);for(let e=0,t=y.length;e=34069&&l<=34074)&&e.framebufferTexture2D(36160,o,l,r.get(a).__webglTexture,0),i.bindFramebuffer(36160,null)}function k(t,i,r){if(e.bindRenderbuffer(36161,t),i.depthBuffer&&!i.stencilBuffer){let n=33189;if(r||U(i)){let t=i.depthTexture;t&&t.isDepthTexture&&(t.type===Xe?n=36012:t.type===Ye&&(n=33190));let r=F(i);U(i)?p.renderbufferStorageMultisampleEXT(36161,r,n,i.width,i.height):e.renderbufferStorageMultisample(36161,r,n,i.width,i.height)}else e.renderbufferStorage(36161,n,i.width,i.height);e.framebufferRenderbuffer(36160,36096,36161,t)}else if(i.depthBuffer&&i.stencilBuffer){let n=F(i);r&&!1===U(i)?e.renderbufferStorageMultisample(36161,n,35056,i.width,i.height):U(i)?p.renderbufferStorageMultisampleEXT(36161,n,35056,i.width,i.height):e.renderbufferStorage(36161,34041,i.width,i.height),e.framebufferRenderbuffer(36160,33306,36161,t)}else{let t=!0===i.isWebGLMultipleRenderTargets?i.texture:[i.texture];for(let n=0;n0&&!0===t.has("WEBGL_multisampled_render_to_texture")&&!1!==i.__useRenderToTexture}function V(e,i){let r=e.encoding,n=e.format,s=e.type;return!0===e.isCompressedTexture||!0===e.isVideoTexture||e.format===si||r!==Xt&&(r===Qt?!1===l?!0===t.has("EXT_sRGB")&&n===et?(e.format=si,e.minFilter=Fe,e.generateMipmaps=!1):i=Ui.sRGBToLinear(i):(n!==et||s!==je)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture encoding:",r)),i}this.allocateTextureUnit=function(){let e=D;return e>=h&&console.warn("THREE.WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+h),D+=1,e},this.resetTextureUnits=function(){D=0},this.setTexture2D=P,this.setTexture2DArray=function(e,t){let n=r.get(e);e.version>0&&n.__version!==e.version?B(n,e,t):i.bindTexture(35866,n.__webglTexture,33984+t)},this.setTexture3D=function(e,t){let n=r.get(e);e.version>0&&n.__version!==e.version?B(n,e,t):i.bindTexture(32879,n.__webglTexture,33984+t)},this.setTextureCube=function(t,n){let a=r.get(t);t.version>0&&a.__version!==t.version?function(t,n,a){if(6!==n.image.length)return;let o=L(t,n),h=n.source;i.bindTexture(34067,t.__webglTexture,33984+a);let d=r.get(h);if(h.version!==d.__version||!0===o){i.activeTexture(33984+a),e.pixelStorei(37440,n.flipY),e.pixelStorei(37441,n.premultiplyAlpha),e.pixelStorei(3317,n.unpackAlignment),e.pixelStorei(37443,0);let t=n.isCompressedTexture||n.image[0].isCompressedTexture,r=n.image[0]&&n.image[0].isDataTexture,u=[];for(let e=0;e<6;e++)u[e]=t||r?r?n.image[e].image:n.image[e]:x(n.image[e],!1,!0,c),u[e]=V(n,u[e]);let p,f=u[0],m=b(f)||l,g=s.convert(n.format,n.encoding),v=s.convert(n.type),y=S(n.internalFormat,g,v,n.encoding),M=l&&!0!==n.isVideoTexture,E=void 0===d.__version||!0===o,C=A(n,f,m);if(R(34067,n,m),t){M&&E&&i.texStorage2D(34067,C,y,f.width,f.height);for(let e=0;e<6;e++){p=u[e].mipmaps;for(let t=0;t0&&C++,i.texStorage2D(34067,C,y,u[0].width,u[0].height));for(let e=0;e<6;e++)if(r){M?i.texSubImage2D(34069+e,0,0,0,u[e].width,u[e].height,g,v,u[e].data):i.texImage2D(34069+e,0,y,u[e].width,u[e].height,0,g,v,u[e].data);for(let t=0;t0&&!1===U(t)){let r=u?o:[o];h.__webglMultisampledFramebuffer=e.createFramebuffer(),h.__webglColorRenderbuffer=[],i.bindFramebuffer(36160,h.__webglMultisampledFramebuffer);for(let i=0;i0&&!1===U(t)){let n=t.isWebGLMultipleRenderTargets?t.texture:[t.texture],s=t.width,a=t.height,o=16384,l=[],h=t.stencilBuffer?33306:36096,c=r.get(t),d=!0===t.isWebGLMultipleRenderTargets;if(d)for(let t=0;to+h?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&a<=o-h&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else null!==o&&e.gripSpace&&(n=t.getPose(e.gripSpace,i),null!==n&&(o.matrix.fromArray(n.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),n.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(n.linearVelocity)):o.hasLinearVelocity=!1,n.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(n.angularVelocity)):o.hasAngularVelocity=!1));null!==a&&(r=t.getPose(e.targetRaySpace,i),null===r&&null!==n&&(r=n),null!==r&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),r.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(r.linearVelocity)):a.hasLinearVelocity=!1,r.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(r.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(zo)))}return null!==a&&(a.visible=null!==r),null!==o&&(o.visible=null!==n),null!==l&&(l.visible=null!==s),this}_getHandJoint(e,t){if(void 0===e.joints[t.jointName]){let i=new Bo;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}},No=class extends Hi{constructor(e,t,i,r,n,s,a,o,l,h){if((h=void 0!==h?h:rt)!==rt&&h!==nt)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===i&&h===rt&&(i=Ye),void 0===i&&h===nt&&(i=Je),super(null,r,n,s,a,o,h,i,l),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=void 0!==a?a:ze,this.minFilter=void 0!==o?o:ze,this.flipY=!1,this.generateMipmaps=!1}},Fo=class extends ai{constructor(e,t){super();let i=this,r=null,n=1,s=null,a="local-floor",o=1,l=null,h=null,c=null,d=null,u=null,p=null,f=t.getContextAttributes(),m=null,g=null,v=[],y=[],x=new Set,b=new Map,w=new Qn;w.layers.enable(1),w.viewport=new Wi;let _=new Qn;_.layers.enable(2),_.viewport=new Wi;let S=[w,_],A=new Lo;A.layers.enable(1),A.layers.enable(2);let M=null,E=null;function C(e){let t=y.indexOf(e.inputSource);if(-1===t)return;let i=v[t];void 0!==i&&i.dispatchEvent({type:e.type,data:e.inputSource})}function T(){r.removeEventListener("select",C),r.removeEventListener("selectstart",C),r.removeEventListener("selectend",C),r.removeEventListener("squeeze",C),r.removeEventListener("squeezestart",C),r.removeEventListener("squeezeend",C),r.removeEventListener("end",T),r.removeEventListener("inputsourceschange",D);for(let e=0;e=0&&(y[r]=null,v[r].disconnect(i))}for(let t=0;t=y.length){y.push(i),r=e;break}if(null===y[e]){y[e]=i,r=e;break}}if(-1===r)break}let n=v[r];n&&n.connect(i)}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(e){let t=v[e];return void 0===t&&(t=new ko,v[e]=t),t.getTargetRaySpace()},this.getControllerGrip=function(e){let t=v[e];return void 0===t&&(t=new ko,v[e]=t),t.getGripSpace()},this.getHand=function(e){let t=v[e];return void 0===t&&(t=new ko,v[e]=t),t.getHandSpace()},this.setFramebufferScaleFactor=function(e){n=e,!0===i.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(e){a=e,!0===i.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||s},this.setReferenceSpace=function(e){l=e},this.getBaseLayer=function(){return null!==d?d:u},this.getBinding=function(){return c},this.getFrame=function(){return p},this.getSession=function(){return r},this.setSession=async function(h){if(r=h,null!==r){if(m=e.getRenderTarget(),r.addEventListener("select",C),r.addEventListener("selectstart",C),r.addEventListener("selectend",C),r.addEventListener("squeeze",C),r.addEventListener("squeezestart",C),r.addEventListener("squeezeend",C),r.addEventListener("end",T),r.addEventListener("inputsourceschange",D),!0!==f.xrCompatible&&await t.makeXRCompatible(),void 0===r.renderState.layers||!1===e.capabilities.isWebGL2){let i={antialias:void 0!==r.renderState.layers||f.antialias,alpha:f.alpha,depth:f.depth,stencil:f.stencil,framebufferScaleFactor:n};u=new XRWebGLLayer(r,t,i),r.updateRenderState({baseLayer:u}),g=new qi(u.framebufferWidth,u.framebufferHeight,{format:et,type:je,encoding:e.outputEncoding,stencilBuffer:f.stencil})}else{let i=null,s=null,a=null;f.depth&&(a=f.stencil?35056:33190,i=f.stencil?nt:rt,s=f.stencil?Je:Ye);let o={colorFormat:32856,depthFormat:a,scaleFactor:n};c=new XRWebGLBinding(r,t),d=c.createProjectionLayer(o),r.updateRenderState({layers:[d]}),g=new qi(d.textureWidth,d.textureHeight,{format:et,type:je,depthTexture:new No(d.textureWidth,d.textureHeight,s,void 0,void 0,void 0,void 0,void 0,void 0,i),stencilBuffer:f.stencil,encoding:e.outputEncoding,samples:f.antialias?4:0}),e.properties.get(g).__ignoreDepthValues=d.ignoreDepthValues}g.isXRRenderTarget=!0,this.setFoveation(o),l=null,s=await r.requestReferenceSpace(a),L.setContext(r),L.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}};let P=new Zi,I=new Zi;function O(e,t){null===t?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}this.updateCamera=function(e){if(null===r)return;A.near=_.near=w.near=e.near,A.far=_.far=w.far=e.far,(M!==A.near||E!==A.far)&&(r.updateRenderState({depthNear:A.near,depthFar:A.far}),M=A.near,E=A.far);let t=e.parent,i=A.cameras;O(A,t);for(let r=0;re&&(b.set(t,t.lastChangedTime),i.dispatchEvent({type:"planechanged",data:t}))}else x.add(t),b.set(t,r.lastChangedTime),i.dispatchEvent({type:"planeadded",data:t})}p=null})),this.setAnimationLoop=function(e){R=e},this.dispose=function(){}}};function Uo(e,t){function i(i,r){i.opacity.value=r.opacity,r.color&&i.diffuse.value.copy(r.color),r.emissive&&i.emissive.value.copy(r.emissive).multiplyScalar(r.emissiveIntensity),r.map&&(i.map.value=r.map),r.alphaMap&&(i.alphaMap.value=r.alphaMap),r.bumpMap&&(i.bumpMap.value=r.bumpMap,i.bumpScale.value=r.bumpScale,r.side===V&&(i.bumpScale.value*=-1)),r.displacementMap&&(i.displacementMap.value=r.displacementMap,i.displacementScale.value=r.displacementScale,i.displacementBias.value=r.displacementBias),r.emissiveMap&&(i.emissiveMap.value=r.emissiveMap),r.normalMap&&(i.normalMap.value=r.normalMap,i.normalScale.value.copy(r.normalScale),r.side===V&&i.normalScale.value.negate()),r.specularMap&&(i.specularMap.value=r.specularMap),r.alphaTest>0&&(i.alphaTest.value=r.alphaTest);let n,s,a=t.get(r).envMap;if(a&&(i.envMap.value=a,i.flipEnvMap.value=a.isCubeTexture&&!1===a.isRenderTargetTexture?-1:1,i.reflectivity.value=r.reflectivity,i.ior.value=r.ior,i.refractionRatio.value=r.refractionRatio),r.lightMap){i.lightMap.value=r.lightMap;let t=!0!==e.physicallyCorrectLights?Math.PI:1;i.lightMapIntensity.value=r.lightMapIntensity*t}r.aoMap&&(i.aoMap.value=r.aoMap,i.aoMapIntensity.value=r.aoMapIntensity),r.map?n=r.map:r.specularMap?n=r.specularMap:r.displacementMap?n=r.displacementMap:r.normalMap?n=r.normalMap:r.bumpMap?n=r.bumpMap:r.roughnessMap?n=r.roughnessMap:r.metalnessMap?n=r.metalnessMap:r.alphaMap?n=r.alphaMap:r.emissiveMap?n=r.emissiveMap:r.clearcoatMap?n=r.clearcoatMap:r.clearcoatNormalMap?n=r.clearcoatNormalMap:r.clearcoatRoughnessMap?n=r.clearcoatRoughnessMap:r.iridescenceMap?n=r.iridescenceMap:r.iridescenceThicknessMap?n=r.iridescenceThicknessMap:r.specularIntensityMap?n=r.specularIntensityMap:r.specularColorMap?n=r.specularColorMap:r.transmissionMap?n=r.transmissionMap:r.thicknessMap?n=r.thicknessMap:r.sheenColorMap?n=r.sheenColorMap:r.sheenRoughnessMap&&(n=r.sheenRoughnessMap),void 0!==n&&(n.isWebGLRenderTarget&&(n=n.texture),!0===n.matrixAutoUpdate&&n.updateMatrix(),i.uvTransform.value.copy(n.matrix)),r.aoMap?s=r.aoMap:r.lightMap&&(s=r.lightMap),void 0!==s&&(s.isWebGLRenderTarget&&(s=s.texture),!0===s.matrixAutoUpdate&&s.updateMatrix(),i.uv2Transform.value.copy(s.matrix))}return{refreshFogUniforms:function(t,i){i.color.getRGB(t.fogColor.value,Wn(e)),i.isFog?(t.fogNear.value=i.near,t.fogFar.value=i.far):i.isFogExp2&&(t.fogDensity.value=i.density)},refreshMaterialUniforms:function(e,r,n,s,a){r.isMeshBasicMaterial||r.isMeshLambertMaterial?i(e,r):r.isMeshToonMaterial?(i(e,r),function(e,t){t.gradientMap&&(e.gradientMap.value=t.gradientMap)}(e,r)):r.isMeshPhongMaterial?(i(e,r),function(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4)}(e,r)):r.isMeshStandardMaterial?(i(e,r),function(e,i){e.roughness.value=i.roughness,e.metalness.value=i.metalness,i.roughnessMap&&(e.roughnessMap.value=i.roughnessMap),i.metalnessMap&&(e.metalnessMap.value=i.metalnessMap),t.get(i).envMap&&(e.envMapIntensity.value=i.envMapIntensity)}(e,r),r.isMeshPhysicalMaterial&&function(e,t,i){e.ior.value=t.ior,t.sheen>0&&(e.sheenColor.value.copy(t.sheenColor).multiplyScalar(t.sheen),e.sheenRoughness.value=t.sheenRoughness,t.sheenColorMap&&(e.sheenColorMap.value=t.sheenColorMap),t.sheenRoughnessMap&&(e.sheenRoughnessMap.value=t.sheenRoughnessMap)),t.clearcoat>0&&(e.clearcoat.value=t.clearcoat,e.clearcoatRoughness.value=t.clearcoatRoughness,t.clearcoatMap&&(e.clearcoatMap.value=t.clearcoatMap),t.clearcoatRoughnessMap&&(e.clearcoatRoughnessMap.value=t.clearcoatRoughnessMap),t.clearcoatNormalMap&&(e.clearcoatNormalScale.value.copy(t.clearcoatNormalScale),e.clearcoatNormalMap.value=t.clearcoatNormalMap,t.side===V&&e.clearcoatNormalScale.value.negate())),t.iridescence>0&&(e.iridescence.value=t.iridescence,e.iridescenceIOR.value=t.iridescenceIOR,e.iridescenceThicknessMinimum.value=t.iridescenceThicknessRange[0],e.iridescenceThicknessMaximum.value=t.iridescenceThicknessRange[1],t.iridescenceMap&&(e.iridescenceMap.value=t.iridescenceMap),t.iridescenceThicknessMap&&(e.iridescenceThicknessMap.value=t.iridescenceThicknessMap)),t.transmission>0&&(e.transmission.value=t.transmission,e.transmissionSamplerMap.value=i.texture,e.transmissionSamplerSize.value.set(i.width,i.height),t.transmissionMap&&(e.transmissionMap.value=t.transmissionMap),e.thickness.value=t.thickness,t.thicknessMap&&(e.thicknessMap.value=t.thicknessMap),e.attenuationDistance.value=t.attenuationDistance,e.attenuationColor.value.copy(t.attenuationColor)),e.specularIntensity.value=t.specularIntensity,e.specularColor.value.copy(t.specularColor),t.specularIntensityMap&&(e.specularIntensityMap.value=t.specularIntensityMap),t.specularColorMap&&(e.specularColorMap.value=t.specularColorMap)}(e,r,a)):r.isMeshMatcapMaterial?(i(e,r),function(e,t){t.matcap&&(e.matcap.value=t.matcap)}(e,r)):r.isMeshDepthMaterial?i(e,r):r.isMeshDistanceMaterial?(i(e,r),function(e,t){e.referencePosition.value.copy(t.referencePosition),e.nearDistance.value=t.nearDistance,e.farDistance.value=t.farDistance}(e,r)):r.isMeshNormalMaterial?i(e,r):r.isLineBasicMaterial?(function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity}(e,r),r.isLineDashedMaterial&&function(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}(e,r)):r.isPointsMaterial?function(e,t,i,r){let n;e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*i,e.scale.value=.5*r,t.map&&(e.map.value=t.map),t.alphaMap&&(e.alphaMap.value=t.alphaMap),t.alphaTest>0&&(e.alphaTest.value=t.alphaTest),t.map?n=t.map:t.alphaMap&&(n=t.alphaMap),void 0!==n&&(!0===n.matrixAutoUpdate&&n.updateMatrix(),e.uvTransform.value.copy(n.matrix))}(e,r,n,s):r.isSpriteMaterial?function(e,t){let i;e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.rotation.value=t.rotation,t.map&&(e.map.value=t.map),t.alphaMap&&(e.alphaMap.value=t.alphaMap),t.alphaTest>0&&(e.alphaTest.value=t.alphaTest),t.map?i=t.map:t.alphaMap&&(i=t.alphaMap),void 0!==i&&(!0===i.matrixAutoUpdate&&i.updateMatrix(),e.uvTransform.value.copy(i.matrix))}(e,r):r.isShadowMaterial?(e.color.value.copy(r.color),e.opacity.value=r.opacity):r.isShaderMaterial&&(r.uniformsNeedUpdate=!1)}}}function Vo(e,t,i,r){let n={},s={},a=[],o=i.isWebGL2?e.getParameter(35375):0;function l(e,t,i){let r=e.value;if(void 0===i[t]){if("number"==typeof r)i[t]=r;else{let e=Array.isArray(r)?r:[r],n=[];for(let t=0;t0){n=i%r,0!==n&&r-n-a.boundary<0&&(i+=r-n,e.__offset=i)}i+=a.storage}n=i%r,n>0&&(i+=r-n),e.__size=i,e.__cache={}}(i),u=function(t){let i=function(){for(let e=0;e0&&function(e,t,i){let r=Y.isWebGL2;null===k&&(k=new qi(1,1,{generateMipmaps:!0,type:q.has("EXT_color_buffer_half_float")?Qe:je,minFilter:Ve,samples:r&&!0===a?4:0})),m.getDrawingBufferSize(F),r?k.setSize(F.x,F.y):k.setSize(vi(F.x),vi(F.y));let n=m.getRenderTarget();m.setRenderTarget(k),m.clear();let s=m.toneMapping;m.toneMapping=_e,Ie(e,t,i),m.toneMapping=s,K.updateMultisampleRenderTarget(k),K.updateRenderTargetMipmap(k),m.setRenderTarget(n)}(n,t,i),r&&X.viewport(_.copy(r)),n.length>0&&Ie(n,t,i),s.length>0&&Ie(s,t,i),o.length>0&&Ie(o,t,i),X.buffers.depth.setTest(!0),X.buffers.depth.setMask(!0),X.buffers.color.setMask(!0),X.setPolygonOffset(!1)}function Ie(e,t,i){let r=!0===t.isScene?t.overrideMaterial:null;for(let n=0,s=e.length;n0?f[f.length-1]:null,p.pop(),d=p.length>0?p[p.length-1]:null},this.getActiveCubeFace=function(){return v},this.getActiveMipmapLevel=function(){return y},this.getRenderTarget=function(){return x},this.setRenderTargetTextures=function(e,t,i){Z.get(e.texture).__webglTexture=t,Z.get(e.depthTexture).__webglTexture=i;let r=Z.get(e);r.__hasExternalTextures=!0,r.__hasExternalTextures&&(r.__autoAllocateDepthBuffer=void 0===i,r.__autoAllocateDepthBuffer||!0===q.has("WEBGL_multisampled_render_to_texture")&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),r.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(e,t){let i=Z.get(e);i.__webglFramebuffer=t,i.__useDefaultFramebuffer=void 0===t},this.setRenderTarget=function(e,t=0,i=0){x=e,v=t,y=i;let r=!0,n=null,s=!1,a=!1;if(e){let i=Z.get(e);void 0!==i.__useDefaultFramebuffer?(X.bindFramebuffer(36160,null),r=!1):void 0===i.__webglFramebuffer?K.setupRenderTarget(e):i.__hasExternalTextures&&K.rebindTextures(e,Z.get(e.texture).__webglTexture,Z.get(e.depthTexture).__webglTexture);let o=e.texture;(o.isData3DTexture||o.isDataArrayTexture||o.isCompressedArrayTexture)&&(a=!0);let l=Z.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(n=l[t],s=!0):n=Y.isWebGL2&&e.samples>0&&!1===K.useMultisampledRTT(e)?Z.get(e).__webglMultisampledFramebuffer:l,_.copy(e.viewport),S.copy(e.scissor),A=e.scissorTest}else _.copy(I).multiplyScalar(C).floor(),S.copy(O).multiplyScalar(C).floor(),A=R;if(X.bindFramebuffer(36160,n)&&Y.drawBuffers&&r&&X.drawBuffers(e,n),X.viewport(_),X.scissor(S),X.setScissorTest(A),s){let r=Z.get(e.texture);ge.framebufferTexture2D(36160,36064,34069+t,r.__webglTexture,i)}else if(a){let r=Z.get(e.texture),n=t||0;ge.framebufferTextureLayer(36160,36064,r.__webglTexture,i||0,n)}b=-1},this.readRenderTargetPixels=function(e,t,i,r,n,s,a){if(!e||!e.isWebGLRenderTarget)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let o=Z.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==a&&(o=o[a]),o){X.bindFramebuffer(36160,o);try{let a=e.texture,o=a.format,l=a.type;if(o!==et&&pe.convert(o)!==ge.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");let h=l===Qe&&(q.has("EXT_color_buffer_half_float")||Y.isWebGL2&&q.has("EXT_color_buffer_float"));if(!(l===je||pe.convert(l)===ge.getParameter(35738)||l===Xe&&(Y.isWebGL2||q.has("OES_texture_float")||q.has("WEBGL_color_buffer_float"))||h))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");t>=0&&t<=e.width-r&&i>=0&&i<=e.height-n&&ge.readPixels(t,i,r,n,pe.convert(o),pe.convert(l),s)}finally{let e=null!==x?Z.get(x).__webglFramebuffer:null;X.bindFramebuffer(36160,e)}}},this.copyFramebufferToTexture=function(e,t,i=0){let r=Math.pow(2,-i),n=Math.floor(t.image.width*r),s=Math.floor(t.image.height*r);K.setTexture2D(t,0),ge.copyTexSubImage2D(3553,i,0,0,e.x,e.y,n,s),X.unbindTexture()},this.copyTextureToTexture=function(e,t,i,r=0){let n=t.image.width,s=t.image.height,a=pe.convert(i.format),o=pe.convert(i.type);K.setTexture2D(i,0),ge.pixelStorei(37440,i.flipY),ge.pixelStorei(37441,i.premultiplyAlpha),ge.pixelStorei(3317,i.unpackAlignment),t.isDataTexture?ge.texSubImage2D(3553,r,e.x,e.y,n,s,a,o,t.image.data):t.isCompressedTexture?ge.compressedTexSubImage2D(3553,r,e.x,e.y,t.mipmaps[0].width,t.mipmaps[0].height,a,t.mipmaps[0].data):ge.texSubImage2D(3553,r,e.x,e.y,a,o,t.image),0===r&&i.generateMipmaps&&ge.generateMipmap(3553),X.unbindTexture()},this.copyTextureToTexture3D=function(e,t,i,r,n=0){if(m.isWebGL1Renderer)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");let s,a=e.max.x-e.min.x+1,o=e.max.y-e.min.y+1,l=e.max.z-e.min.z+1,h=pe.convert(r.format),c=pe.convert(r.type);if(r.isData3DTexture)K.setTexture3D(r,0),s=32879;else{if(!r.isDataArrayTexture)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");K.setTexture2DArray(r,0),s=35866}ge.pixelStorei(37440,r.flipY),ge.pixelStorei(37441,r.premultiplyAlpha),ge.pixelStorei(3317,r.unpackAlignment);let d=ge.getParameter(3314),u=ge.getParameter(32878),p=ge.getParameter(3316),f=ge.getParameter(3315),g=ge.getParameter(32877),v=i.isCompressedTexture?i.mipmaps[0]:i.image;ge.pixelStorei(3314,v.width),ge.pixelStorei(32878,v.height),ge.pixelStorei(3316,e.min.x),ge.pixelStorei(3315,e.min.y),ge.pixelStorei(32877,e.min.z),i.isDataTexture||i.isData3DTexture?ge.texSubImage3D(s,n,t.x,t.y,t.z,a,o,l,h,c,v.data):i.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),ge.compressedTexSubImage3D(s,n,t.x,t.y,t.z,a,o,l,h,v.data)):ge.texSubImage3D(s,n,t.x,t.y,t.z,a,o,l,h,c,v),ge.pixelStorei(3314,d),ge.pixelStorei(32878,u),ge.pixelStorei(3316,p),ge.pixelStorei(3315,f),ge.pixelStorei(32877,g),0===n&&r.generateMipmaps&&ge.generateMipmap(s),X.unbindTexture()},this.initTexture=function(e){e.isCubeTexture?K.setTextureCube(e,0):e.isData3DTexture?K.setTexture3D(e,0):e.isDataArrayTexture||e.isCompressedArrayTexture?K.setTexture2DArray(e,0):K.setTexture2D(e,0),X.unbindTexture()},this.resetState=function(){v=0,y=0,x=null,X.reset(),fe.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}(class extends jo{}).prototype.isWebGL1Renderer=!0;var Go=class{constructor(e,t=1,i=1e3){this.isFog=!0,this.name="",this.color=new Ni(e),this.near=t,this.far=i}clone(){return new Go(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}},Ho=class extends Kr{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),null!==e.background&&(this.background=e.background.clone()),null!==e.environment&&(this.environment=e.environment.clone()),null!==e.fog&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){let t=super.toJSON(e);return null!==this.fog&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),1!==this.backgroundIntensity&&(t.object.backgroundIntensity=this.backgroundIntensity),t}get autoUpdate(){return console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate}set autoUpdate(e){console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate=e}},Wo=class{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=void 0!==e?e.length/t:0,this.usage=ri,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=di()}onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,i){e*=this.stride,i*=t.stride;for(let r=0,n=this.stride;ro)continue;d.applyMatrix4(this.matrixWorld);let s=e.ray.origin.distanceTo(d);se.far||t.push({distance:s,point:c.clone().applyMatrix4(this.matrixWorld),index:i,face:null,faceIndex:null,object:this})}}else{for(let i=Math.max(0,s.start),r=Math.min(f.count,s.start+s.count)-1;io)continue;d.applyMatrix4(this.matrixWorld);let r=e.ray.origin.distanceTo(d);re.far||t.push({distance:r,point:c.clone().applyMatrix4(this.matrixWorld),index:i,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){let e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){let i=e[t[0]];if(void 0!==i){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=i.length;e=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}},dl=class{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){let i=this.getUtoTmapping(e);return this.getPoint(i,t)}getPoints(e=5){let t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return t}getSpacedPoints(e=5){let t=[];for(let i=0;i<=e;i++)t.push(this.getPointAt(i/e));return t}getLength(){let e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;let t,i=[],r=this.getPoint(0),n=0;i.push(0);for(let s=1;s<=e;s++)t=this.getPoint(s/e),n+=t.distanceTo(r),i.push(n),r=t;return this.cacheArcLengths=i,i}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){let i,r=this.getLengths(),n=0,s=r.length;i=t||e*r[s-1];let a,o=0,l=s-1;for(;o<=l;)if(n=Math.floor(o+(l-o)/2),a=r[n]-i,a<0)o=n+1;else{if(!(a>0)){l=n;break}l=n-1}if(n=l,r[n]===i)return n/(s-1);let h=r[n];return(n+(i-h)/(r[n+1]-h))/(s-1)}getTangent(e,t){let i=e-1e-4,r=e+1e-4;i<0&&(i=0),r>1&&(r=1);let n=this.getPoint(i),s=this.getPoint(r),a=t||(n.isVector2?new wi:new Zi);return a.copy(s).sub(n).normalize(),a}getTangentAt(e,t){let i=this.getUtoTmapping(e);return this.getTangent(i,t)}computeFrenetFrames(e,t){let i=new Zi,r=[],n=[],s=[],a=new Zi,o=new Er;for(let u=0;u<=e;u++){let t=u/e;r[u]=this.getTangentAt(t,new Zi)}n[0]=new Zi,s[0]=new Zi;let l=Number.MAX_VALUE,h=Math.abs(r[0].x),c=Math.abs(r[0].y),d=Math.abs(r[0].z);h<=l&&(l=h,i.set(1,0,0)),c<=l&&(l=c,i.set(0,1,0)),d<=l&&i.set(0,0,1),a.crossVectors(r[0],i).normalize(),n[0].crossVectors(r[0],a),s[0].crossVectors(r[0],n[0]);for(let u=1;u<=e;u++){if(n[u]=n[u-1].clone(),s[u]=s[u-1].clone(),a.crossVectors(r[u-1],r[u]),a.length()>Number.EPSILON){a.normalize();let e=Math.acos(ui(r[u-1].dot(r[u]),-1,1));n[u].applyMatrix4(o.makeRotationAxis(a,e))}s[u].crossVectors(r[u],n[u])}if(!0===t){let t=Math.acos(ui(n[0].dot(n[e]),-1,1));t/=e,r[0].dot(a.crossVectors(n[0],n[e]))>0&&(t=-t);for(let i=1;i<=e;i++)n[i].applyMatrix4(o.makeRotationAxis(r[i],t*i)),s[i].crossVectors(r[i],n[i])}return{tangents:r,normals:n,binormals:s}}clone(){return(new this.constructor).copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){let e={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}},ul=class extends dl{constructor(e=0,t=0,i=1,r=1,n=0,s=2*Math.PI,a=!1,o=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=i,this.yRadius=r,this.aStartAngle=n,this.aEndAngle=s,this.aClockwise=a,this.aRotation=o}getPoint(e,t){let i=t||new wi,r=2*Math.PI,n=this.aEndAngle-this.aStartAngle,s=Math.abs(n)r;)n-=r;nr.length-2?r.length-1:s+1],c=r[s>r.length-3?r.length-1:s+2];return i.set(yl(a,o.x,l.x,h.x,c.x),yl(a,o.y,l.y,h.y,c.y)),i}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t0?0:(Math.floor(Math.abs(l)/a)+1)*a:0===h&&l===a-1&&(l=a-2,h=1),this.closed||l>0?i=s[(l-1)%a]:(fl.subVectors(s[0],s[1]).add(s[0]),i=fl);let c=s[l%a],d=s[(l+1)%a];if(this.closed||l+2=i){let e=r[n]-i,s=this.curves[n],a=s.getLength(),o=0===a?0:1-e/a;return s.getPointAt(o,t)}n++}return null}getLength(){let e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;let e=[],t=0;for(let i=0,r=this.curves.length;i1&&!i[i.length-1].equals(i[0])&&i.push(i[0]),i}copy(e){super.copy(e),this.curves=[];for(let t=0,i=e.curves.length;t0){let e=l.getPoint(0);e.equals(this.currentPoint)||this.lineTo(e.x,e.y)}this.curves.push(l);let h=l.getPoint(1);return this.currentPoint.copy(h),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){let e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}},Pl=class extends En{constructor(e=[new wi(0,-.5),new wi(.5,0),new wi(0,.5)],t=12,i=0,r=2*Math.PI){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:i,phiLength:r},t=Math.floor(t),r=ui(r,0,2*Math.PI);let n=[],s=[],a=[],o=[],l=[],h=1/t,c=new Zi,d=new wi,u=new Zi,p=new Zi,f=new Zi,m=0,g=0;for(let v=0;v<=e.length-1;v++)switch(v){case 0:m=e[v+1].x-e[v].x,g=e[v+1].y-e[v].y,u.x=1*g,u.y=-m,u.z=0*g,f.copy(u),u.normalize(),o.push(u.x,u.y,u.z);break;case e.length-1:o.push(f.x,f.y,f.z);break;default:m=e[v+1].x-e[v].x,g=e[v+1].y-e[v].y,u.x=1*g,u.y=-m,u.z=0*g,p.copy(u),u.x+=f.x,u.y+=f.y,u.z+=f.z,u.normalize(),o.push(u.x,u.y,u.z),f.copy(p)}for(let v=0;v<=t;v++){let n=i+v*h*r,u=Math.sin(n),p=Math.cos(n);for(let i=0;i<=e.length-1;i++){c.x=e[i].x*u,c.y=e[i].y,c.z=e[i].x*p,s.push(c.x,c.y,c.z),d.x=v/t,d.y=i/(e.length-1),a.push(d.x,d.y);let r=o[3*i+0]*u,n=o[3*i+1],h=o[3*i+0]*p;l.push(r,n,h)}}for(let v=0;v0&&v(!0),t>0&&v(!1)),this.setIndex(h),this.setAttribute("position",new yn(c,3)),this.setAttribute("normal",new yn(d,3)),this.setAttribute("uv",new yn(u,2))}static fromJSON(e){return new Il(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}},Ol=class extends Il{constructor(e=1,t=1,i=32,r=1,n=!1,s=0,a=2*Math.PI){super(0,e,t,i,r,n,s,a),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:i,heightSegments:r,openEnded:n,thetaStart:s,thetaLength:a}}static fromJSON(e){return new Ol(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}},Rl=class extends En{constructor(e=[],t=[],i=1,r=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:i,detail:r};let n=[],s=[];function a(e,t,i,r){let n=r+1,s=[];for(let a=0;a<=n;a++){s[a]=[];let r=e.clone().lerp(i,a/n),o=t.clone().lerp(i,a/n),l=n-a;for(let e=0;e<=l;e++)s[a][e]=0===e&&a===n?r:r.clone().lerp(o,e/l)}for(let a=0;a.9&&a<.1&&(t<.2&&(s[e+0]+=1),i<.2&&(s[e+2]+=1),r<.2&&(s[e+4]+=1))}}()}(),this.setAttribute("position",new yn(n,3)),this.setAttribute("normal",new yn(n.slice(),3)),this.setAttribute("uv",new yn(s,2)),0===r?this.computeVertexNormals():this.normalizeNormals()}static fromJSON(e){return new Rl(e.vertices,e.indices,e.radius,e.details)}},Ll=class extends Rl{constructor(e=1,t=0){let i=(1+Math.sqrt(5))/2,r=1/i;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,-r,-i,0,-r,i,0,r,-i,0,r,i,-r,-i,0,-r,i,0,r,-i,0,r,i,0,-i,0,-r,i,0,-r,-i,0,r,i,0,r],[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],e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Ll(e.radius,e.detail)}},Bl=class extends Dl{constructor(e){super(e),this.uuid=di(),this.type="Shape",this.holes=[]}getPointsHoles(e){let t=[];for(let i=0,r=this.holes.length;i80*i){r=s=e[0],n=a=e[1];for(let t=i;ts&&(s=o),l>a&&(a=l);h=Math.max(s-r,a-n),h=0!==h?32767/h:0}return Fl(u,p,i,r,n,h,0),p};function kl(e,t,i,r,n){let s,a;if(n===function(e,t,i,r){let n=0;for(let s=t,a=i-r;s0)for(s=t;s=t;s-=r)a=nh(s,e[s],e[s+1],a);return a&&Jl(a,a.next)&&(sh(a),a=a.next),a}function Nl(e,t){if(!e)return e;t||(t=e);let i,r=e;do{if(i=!1,r.steiner||!Jl(r,r.next)&&0!==Kl(r.prev,r,r.next))r=r.next;else{if(sh(r),r=t=r.prev,r===r.next)break;i=!0}}while(i||r!==t);return t}function Fl(e,t,i,r,n,s,a){if(!e)return;!a&&s&&function(e,t,i,r){let n=e;do{0===n.z&&(n.z=Yl(n.x,n.y,t,i,r)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next}while(n!==e);n.prevZ.nextZ=null,n.prevZ=null,function(e){let t,i,r,n,s,a,o,l,h=1;do{for(i=e,e=null,s=null,a=0;i;){for(a++,r=i,o=0,t=0;t0||l>0&&r;)0!==o&&(0===l||!r||i.z<=r.z)?(n=i,i=i.nextZ,o--):(n=r,r=r.nextZ,l--),s?s.nextZ=n:e=n,n.prevZ=s,s=n;i=r}s.nextZ=null,h*=2}while(a>1)}(n)}(e,r,n,s);let o,l,h=e;for(;e.prev!==e.next;)if(o=e.prev,l=e.next,s?Vl(e,r,n,s):Ul(e))t.push(o.i/i|0),t.push(e.i/i|0),t.push(l.i/i|0),sh(e),e=l.next,h=l.next;else if((e=l)===h){a?1===a?Fl(e=jl(Nl(e),t,i),t,i,r,n,s,2):2===a&&Gl(e,t,i,r,n,s):Fl(Nl(e),t,i,r,n,s,1);break}}function Ul(e){let t=e.prev,i=e,r=e.next;if(Kl(t,i,r)>=0)return!1;let n=t.x,s=i.x,a=r.x,o=t.y,l=i.y,h=r.y,c=ns?n>a?n:a:s>a?s:a,p=o>l?o>h?o:h:l>h?l:h,f=r.next;for(;f!==t;){if(f.x>=c&&f.x<=u&&f.y>=d&&f.y<=p&&Ql(n,o,s,l,a,h,f.x,f.y)&&Kl(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function Vl(e,t,i,r){let n=e.prev,s=e,a=e.next;if(Kl(n,s,a)>=0)return!1;let o=n.x,l=s.x,h=a.x,c=n.y,d=s.y,u=a.y,p=ol?o>h?o:h:l>h?l:h,g=c>d?c>u?c:u:d>u?d:u,v=Yl(p,f,t,i,r),y=Yl(m,g,t,i,r),x=e.prevZ,b=e.nextZ;for(;x&&x.z>=v&&b&&b.z<=y;){if(x.x>=p&&x.x<=m&&x.y>=f&&x.y<=g&&x!==n&&x!==a&&Ql(o,c,l,d,h,u,x.x,x.y)&&Kl(x.prev,x,x.next)>=0||(x=x.prevZ,b.x>=p&&b.x<=m&&b.y>=f&&b.y<=g&&b!==n&&b!==a&&Ql(o,c,l,d,h,u,b.x,b.y)&&Kl(b.prev,b,b.next)>=0))return!1;b=b.nextZ}for(;x&&x.z>=v;){if(x.x>=p&&x.x<=m&&x.y>=f&&x.y<=g&&x!==n&&x!==a&&Ql(o,c,l,d,h,u,x.x,x.y)&&Kl(x.prev,x,x.next)>=0)return!1;x=x.prevZ}for(;b&&b.z<=y;){if(b.x>=p&&b.x<=m&&b.y>=f&&b.y<=g&&b!==n&&b!==a&&Ql(o,c,l,d,h,u,b.x,b.y)&&Kl(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function jl(e,t,i){let r=e;do{let n=r.prev,s=r.next.next;!Jl(n,s)&&$l(n,r,r.next,s)&&ih(n,s)&&ih(s,n)&&(t.push(n.i/i|0),t.push(r.i/i|0),t.push(s.i/i|0),sh(r),sh(r.next),r=e=s),r=r.next}while(r!==e);return Nl(r)}function Gl(e,t,i,r,n,s){let a=e;do{let e=a.next.next;for(;e!==a.prev;){if(a.i!==e.i&&Zl(a,e)){let o=rh(a,e);return a=Nl(a,a.next),o=Nl(o,o.next),Fl(a,t,i,r,n,s,0),void Fl(o,t,i,r,n,s,0)}e=e.next}a=a.next}while(a!==e)}function Hl(e,t){return e.x-t.x}function Wl(e,t){let i=function(e,t){let i,r=t,n=-1/0,s=e.x,a=e.y;do{if(a<=r.y&&a>=r.next.y&&r.next.y!==r.y){let e=r.x+(a-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(e<=s&&e>n&&(n=e,i=r.x=r.x&&r.x>=h&&s!==r.x&&Ql(ai.x||r.x===i.x&&ql(i,r)))&&(i=r,d=o)),r=r.next}while(r!==l);return i}(e,t);if(!i)return t;let r=rh(i,e);return Nl(r,r.next),Nl(i,i.next)}function ql(e,t){return Kl(e.prev,e,t.prev)<0&&Kl(t.next,e,e.next)<0}function Yl(e,t,i,r,n){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-i)*n|0)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-r)*n|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function Xl(e){let t=e,i=e;do{(t.x=(e-a)*(s-o)&&(e-a)*(r-o)>=(i-a)*(t-o)&&(i-a)*(s-o)>=(n-a)*(r-o)}function Zl(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){let i=e;do{if(i.i!==e.i&&i.next.i!==e.i&&i.i!==t.i&&i.next.i!==t.i&&$l(i,i.next,e,t))return!0;i=i.next}while(i!==e);return!1}(e,t)&&(ih(e,t)&&ih(t,e)&&function(e,t){let i=e,r=!1,n=(e.x+t.x)/2,s=(e.y+t.y)/2;do{i.y>s!=i.next.y>s&&i.next.y!==i.y&&n<(i.next.x-i.x)*(s-i.y)/(i.next.y-i.y)+i.x&&(r=!r),i=i.next}while(i!==e);return r}(e,t)&&(Kl(e.prev,e,t.prev)||Kl(e,t.prev,t))||Jl(e,t)&&Kl(e.prev,e,e.next)>0&&Kl(t.prev,t,t.next)>0)}function Kl(e,t,i){return(t.y-e.y)*(i.x-t.x)-(t.x-e.x)*(i.y-t.y)}function Jl(e,t){return e.x===t.x&&e.y===t.y}function $l(e,t,i,r){let n=th(Kl(e,t,i)),s=th(Kl(e,t,r)),a=th(Kl(i,r,e)),o=th(Kl(i,r,t));return!!(n!==s&&a!==o||0===n&&eh(e,i,t)||0===s&&eh(e,r,t)||0===a&&eh(i,e,r)||0===o&&eh(i,t,r))}function eh(e,t,i){return t.x<=Math.max(e.x,i.x)&&t.x>=Math.min(e.x,i.x)&&t.y<=Math.max(e.y,i.y)&&t.y>=Math.min(e.y,i.y)}function th(e){return e>0?1:e<0?-1:0}function ih(e,t){return Kl(e.prev,e,e.next)<0?Kl(e,t,e.next)>=0&&Kl(e,e.prev,t)>=0:Kl(e,t,e.prev)<0||Kl(e,e.next,t)<0}function rh(e,t){let i=new ah(e.i,e.x,e.y),r=new ah(t.i,t.x,t.y),n=e.next,s=t.prev;return e.next=t,t.prev=e,i.next=n,n.prev=i,r.next=i,i.prev=r,s.next=r,r.prev=s,r}function nh(e,t,i,r){let n=new ah(e,t,i);return r?(n.next=r.next,n.prev=r,r.next.prev=n,r.next=n):(n.prev=n,n.next=n),n}function sh(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function ah(e,t,i){this.i=e,this.x=t,this.y=i,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}var oh=class{static area(e){let t=e.length,i=0;for(let r=t-1,n=0;n2&&e[t-1].equals(e[0])&&e.pop()}function hh(e,t){for(let i=0;i0)&&u.push(t,r,a),(g!==i-1||o=n)break e;{let a=t[1];e=n)break t}s=i,i=0}}for(;i>>1;et;)--s;if(++s,0!==n||s!==r){n>=s&&(s=Math.max(s,1),n=s-1);let e=this.getValueSize();this.times=ph(i,n,s),this.values=ph(this.values,n*e,s*e)}return this}validate(){let e=!0,t=this.getValueSize();t-Math.floor(t)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);let i=this.times,r=this.values,n=i.length;0===n&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let s=null;for(let a=0;a!==n;a++){let t=i[a];if("number"==typeof t&&isNaN(t)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,t),e=!1;break}if(null!==s&&s>t){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,t,s),e=!1;break}s=t}if(void 0!==r&&mh(r))for(let a=0,o=r.length;a!==o;++a){let t=r[a];if(isNaN(t)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,t),e=!1;break}}return e}optimize(){let e=ph(this.times),t=ph(this.values),i=this.getValueSize(),r=this.getInterpolation()===Gt,n=e.length-1,s=1;for(let a=1;a0){e[s]=e[n];for(let e=n*i,r=s*i,a=0;a!==i;++a)t[r+a]=t[e+a];++s}return s!==e.length?(this.times=ph(e,0,s),this.values=ph(t,0,s*i)):(this.times=e,this.values=t),this}clone(){let e=ph(this.times,0),t=ph(this.values,0),i=new(0,this.constructor)(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}};Sh.prototype.TimeBufferType=Float32Array,Sh.prototype.ValueBufferType=Float32Array,Sh.prototype.DefaultInterpolation=jt;var Ah=class extends Sh{};Ah.prototype.ValueTypeName="bool",Ah.prototype.ValueBufferType=Array,Ah.prototype.DefaultInterpolation=Vt,Ah.prototype.InterpolantFactoryMethodLinear=void 0,Ah.prototype.InterpolantFactoryMethodSmooth=void 0;var Mh=class extends Sh{};Mh.prototype.ValueTypeName="color";var Eh=class extends Sh{};Eh.prototype.ValueTypeName="number";var Ch=class extends xh{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e,t,i,r){let n=this.resultBuffer,s=this.sampleValues,a=this.valueSize,o=(i-t)/(r-t),l=e*a;for(let h=l+a;l!==h;l+=4)Qi.slerpFlat(n,0,s,l-a,s,l,o);return n}},Th=class extends Sh{InterpolantFactoryMethodLinear(e){return new Ch(this.times,this.values,this.getValueSize(),e)}};Th.prototype.ValueTypeName="quaternion",Th.prototype.DefaultInterpolation=jt,Th.prototype.InterpolantFactoryMethodSmooth=void 0;var Dh=class extends Sh{};Dh.prototype.ValueTypeName="string",Dh.prototype.ValueBufferType=Array,Dh.prototype.DefaultInterpolation=Vt,Dh.prototype.InterpolantFactoryMethodLinear=void 0,Dh.prototype.InterpolantFactoryMethodSmooth=void 0;var Ph=class extends Sh{};Ph.prototype.ValueTypeName="vector";var Ih=class{constructor(e,t=-1,i,r=Yt){this.name=e,this.tracks=i,this.duration=t,this.blendMode=r,this.uuid=di(),this.duration<0&&this.resetDuration()}static parse(e){let t=[],i=e.tracks,r=1/(e.fps||1);for(let s=0,a=i.length;s!==a;++s)t.push(Oh(i[s]).scale(r));let n=new this(e.name,e.duration,t,e.blendMode);return n.uuid=e.uuid,n}static toJSON(e){let t=[],i=e.tracks,r={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let n=0,s=i.length;n!==s;++n)t.push(Sh.toJSON(i[n]));return r}static CreateFromMorphTargetSequence(e,t,i,r){let n=t.length,s=[];for(let a=0;a1){let e=i[1],n=r[e];n||(r[e]=n=[]),n.push(t)}}let s=[];for(let a in r)s.push(this.CreateFromMorphTargetSequence(a,r[a],t,i));return s}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;let i=function(e,t,i,r,n){if(0!==i.length){let s=[],a=[];yh(i,s,a,r),0!==s.length&&n.push(new e(t,s,a))}},r=[],n=e.name||"default",s=e.fps||30,a=e.blendMode,o=e.length||-1,l=e.hierarchy||[];for(let h=0;h{t&&t(n),this.manager.itemEnd(e)}),0),n;if(void 0!==kh[e])return void kh[e].push({onLoad:t,onProgress:i,onError:r});kh[e]=[],kh[e].push({onLoad:t,onProgress:i,onError:r});let s=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,o=this.responseType;fetch(s).then((t=>{if(200===t.status||0===t.status){if(0===t.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||void 0===t.body||void 0===t.body.getReader)return t;let i=kh[e],r=t.body.getReader(),n=t.headers.get("Content-Length")||t.headers.get("X-File-Size"),s=n?parseInt(n):0,a=0!==s,o=0,l=new ReadableStream({start(e){!function t(){r.read().then((({done:r,value:n})=>{if(r)e.close();else{o+=n.byteLength;let r=new ProgressEvent("progress",{lengthComputable:a,loaded:o,total:s});for(let e=0,t=i.length;e{switch(o){case"arraybuffer":return e.arrayBuffer();case"blob":return e.blob();case"document":return e.text().then((e=>(new DOMParser).parseFromString(e,a)));case"json":return e.json();default:if(void 0===a)return e.text();{let t=/charset="?([^;"\s]*)"?/i.exec(a),i=t&&t[1]?t[1].toLowerCase():void 0,r=new TextDecoder(i);return e.arrayBuffer().then((e=>r.decode(e)))}}})).then((t=>{Rh.add(e,t);let i=kh[e];delete kh[e];for(let e=0,r=i.length;e{let i=kh[e];if(void 0===i)throw this.manager.itemError(e),t;delete kh[e];for(let e=0,r=i.length;e{this.manager.itemEnd(e)})),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}},Uh=class extends Kr{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Ni(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){let t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,void 0!==this.groundColor&&(t.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(t.object.distance=this.distance),void 0!==this.angle&&(t.object.angle=this.angle),void 0!==this.decay&&(t.object.decay=this.decay),void 0!==this.penumbra&&(t.object.penumbra=this.penumbra),void 0!==this.shadow&&(t.object.shadow=this.shadow.toJSON()),t}},Vh=class extends Uh{constructor(e,t,i){super(e,i),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(Kr.DEFAULT_UP),this.updateMatrix(),this.groundColor=new Ni(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}},jh=new Er,Gh=new Zi,Hh=new Zi,Wh=class{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new wi(512,512),this.map=null,this.mapPass=null,this.matrix=new Er,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new as,this._frameExtents=new wi(1,1),this._viewportCount=1,this._viewports=[new Wi(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){let t=this.camera,i=this.matrix;Gh.setFromMatrixPosition(e.matrixWorld),t.position.copy(Gh),Hh.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(Hh),t.updateMatrixWorld(),jh.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(jh),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(jh)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return(new this.constructor).copy(this)}toJSON(){let e={};return 0!==this.bias&&(e.bias=this.bias),0!==this.normalBias&&(e.normalBias=this.normalBias),1!==this.radius&&(e.radius=this.radius),(512!==this.mapSize.x||512!==this.mapSize.y)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}},qh=class extends Wh{constructor(){super(new Qn(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){let t=this.camera,i=2*ci*e.angle*this.focus,r=this.mapSize.width/this.mapSize.height,n=e.distance||t.far;(i!==t.fov||r!==t.aspect||n!==t.far)&&(t.fov=i,t.aspect=r,t.far=n,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}},Yh=class extends Uh{constructor(e,t,i=0,r=Math.PI/3,n=0,s=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(Kr.DEFAULT_UP),this.updateMatrix(),this.target=new Kr,this.distance=i,this.angle=r,this.penumbra=n,this.decay=s,this.map=null,this.shadow=new qh}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}},Xh=new Er,Qh=new Zi,Zh=new Zi,Kh=class extends Wh{constructor(){super(new Qn(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new wi(4,2),this._viewportCount=6,this._viewports=[new Wi(2,1,1,1),new Wi(0,1,1,1),new Wi(3,1,1,1),new Wi(1,1,1,1),new Wi(3,0,1,1),new Wi(1,0,1,1)],this._cubeDirections=[new Zi(1,0,0),new Zi(-1,0,0),new Zi(0,0,1),new Zi(0,0,-1),new Zi(0,1,0),new Zi(0,-1,0)],this._cubeUps=[new Zi(0,1,0),new Zi(0,1,0),new Zi(0,1,0),new Zi(0,1,0),new Zi(0,0,1),new Zi(0,0,-1)]}updateMatrices(e,t=0){let i=this.camera,r=this.matrix,n=e.distance||i.far;n!==i.far&&(i.far=n,i.updateProjectionMatrix()),Qh.setFromMatrixPosition(e.matrixWorld),i.position.copy(Qh),Zh.copy(i.position),Zh.add(this._cubeDirections[t]),i.up.copy(this._cubeUps[t]),i.lookAt(Zh),i.updateMatrixWorld(),r.makeTranslation(-Qh.x,-Qh.y,-Qh.z),Xh.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Xh)}},Jh=class extends Uh{constructor(e,t,i=0,r=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=i,this.decay=r,this.shadow=new Kh}get power(){return 4*this.intensity*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}},$h=class extends Wh{constructor(){super(new bs(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}},ec=class extends Uh{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Kr.DEFAULT_UP),this.updateMatrix(),this.target=new Kr,this.shadow=new $h}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}},tc=class extends En{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){let e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}},ic=class extends zh{constructor(e){super(e)}load(e,t,i,r){let n=this,s=new Fh(n.manager);s.setPath(n.path),s.setRequestHeader(n.requestHeader),s.setWithCredentials(n.withCredentials),s.load(e,(function(i){try{t(n.parse(JSON.parse(i)))}catch(s){r?r(s):console.error(s),n.manager.itemError(e)}}),i,r)}parse(e){let t={},i={};function r(e,r){if(void 0!==t[r])return t[r];let n=e.interleavedBuffers[r],s=function(e,t){if(void 0!==i[t])return i[t];let r=e.arrayBuffers[t],n=new Uint32Array(r).buffer;return i[t]=n,n}(e,n.buffer),a=Ei(n.type,s),o=new Wo(a,n.stride);return o.uuid=n.uuid,t[r]=o,o}let n=e.isInstancedBufferGeometry?new tc:new En,s=e.data.index;if(void 0!==s){let e=Ei(s.type,s.array);n.setIndex(new mn(e,1))}let a=e.data.attributes;for(let c in a){let t,i=a[c];if(i.isInterleavedBufferAttribute){let n=r(e.data,i.data);t=new Yo(n,i.itemSize,i.offset,i.normalized)}else{let e=Ei(i.type,i.array);t=new(i.isInstancedBufferAttribute?$o:mn)(e,i.itemSize,i.normalized)}void 0!==i.name&&(t.name=i.name),void 0!==i.usage&&t.setUsage(i.usage),void 0!==i.updateRange&&(t.updateRange.offset=i.updateRange.offset,t.updateRange.count=i.updateRange.count),n.setAttribute(c,t)}let o=e.data.morphAttributes;if(o)for(let c in o){let t=o[c],i=[];for(let n=0,s=t.length;n"u"?Date:performance).now()}var sc=class{constructor(e,t,i){let r,n,s;switch(this.binding=e,this.valueSize=i,t){case"quaternion":r=this._slerp,n=this._slerpAdditive,s=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(6*i),this._workIndex=5;break;case"string":case"bool":r=this._select,n=this._select,s=this._setAdditiveIdentityOther,this.buffer=new Array(5*i);break;default:r=this._lerp,n=this._lerpAdditive,s=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(5*i)}this._mixBufferRegion=r,this._mixBufferRegionAdditive=n,this._setIdentity=s,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,t){let i=this.buffer,r=this.valueSize,n=e*r+r,s=this.cumulativeWeight;if(0===s){for(let e=0;e!==r;++e)i[n+e]=i[e];s=t}else{s+=t;let e=t/s;this._mixBufferRegion(i,n,0,e,r)}this.cumulativeWeight=s}accumulateAdditive(e){let t=this.buffer,i=this.valueSize,r=i*this._addIndex;0===this.cumulativeWeightAdditive&&this._setIdentity(),this._mixBufferRegionAdditive(t,r,0,e,i),this.cumulativeWeightAdditive+=e}apply(e){let t=this.valueSize,i=this.buffer,r=e*t+t,n=this.cumulativeWeight,s=this.cumulativeWeightAdditive,a=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,n<1){let e=t*this._origIndex;this._mixBufferRegion(i,r,e,1-n,t)}s>0&&this._mixBufferRegionAdditive(i,r,this._addIndex*t,1,t);for(let o=t,l=t+t;o!==l;++o)if(i[o]!==i[o+t]){a.setValue(i,r);break}}saveOriginalState(){let e=this.binding,t=this.buffer,i=this.valueSize,r=i*this._origIndex;e.getValue(t,r);for(let n=i,s=r;n!==s;++n)t[n]=t[r+n%i];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){let e=3*this.valueSize;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){let e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let i=e;i=.5)for(let s=0;s!==n;++s)e[t+s]=e[i+s]}_slerp(e,t,i,r){Qi.slerpFlat(e,t,e,t,e,i,r)}_slerpAdditive(e,t,i,r,n){let s=this._workIndex*n;Qi.multiplyQuaternionsFlat(e,s,e,t,e,i),Qi.slerpFlat(e,t,e,t,e,s,r)}_lerp(e,t,i,r,n){let s=1-r;for(let a=0;a!==n;++a){let n=t+a;e[n]=e[n]*s+e[i+a]*r}}_lerpAdditive(e,t,i,r,n){for(let s=0;s!==n;++s){let n=t+s;e[n]=e[n]+e[i+s]*r}}},ac="\\[\\]\\.:\\/",oc=new RegExp("["+ac+"]","g"),lc="[^"+ac+"]",hc="[^"+ac.replace("\\.","")+"]",cc=/((?:WC+[\/:])*)/.source.replace("WC",lc),dc=/(WCOD+)?/.source.replace("WCOD",hc),uc=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",lc),pc=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",lc),fc=new RegExp("^"+cc+dc+uc+pc+"$"),mc=["material","materials","bones","map"],gc=class{constructor(e,t,i){this.path=t,this.parsedPath=i||gc.parseTrackName(t),this.node=gc.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,i){return e&&e.isAnimationObjectGroup?new gc.Composite(e,t,i):new gc(e,t,i)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(oc,"")}static parseTrackName(e){let t=fc.exec(e);if(null===t)throw new Error("PropertyBinding: Cannot parse trackName: "+e);let i={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=i.nodeName&&i.nodeName.lastIndexOf(".");if(void 0!==r&&-1!==r){let e=i.nodeName.substring(r+1);-1!==mc.indexOf(e)&&(i.nodeName=i.nodeName.substring(0,r),i.objectName=e)}if(null===i.propertyName||0===i.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return i}static findNode(e,t){if(void 0===t||""===t||"."===t||-1===t||t===e.name||t===e.uuid)return e;if(e.skeleton){let i=e.skeleton.getBoneByName(t);if(void 0!==i)return i}if(e.children){let i=function(e){for(let r=0;r0){let e=this._interpolants,t=this._propertyBindings;if(2501===this.blendMode)for(let i=0,r=e.length;i!==r;++i)e[i].evaluate(s),t[i].accumulateAdditive(a);else for(let i=0,n=e.length;i!==n;++i)e[i].evaluate(s),t[i].accumulate(r,a)}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;let i=this._weightInterpolant;if(null!==i){let r=i.evaluate(e)[0];t*=r,e>i.parameterPositions[1]&&(this.stopFading(),0===r&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;let i=this._timeScaleInterpolant;if(null!==i){t*=i.evaluate(e)[0],e>i.parameterPositions[1]&&(this.stopWarping(),0===t?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){let t=this._clip.duration,i=this.loop,r=this.time+e,n=this._loopCount,s=i===Ut;if(0===e)return-1===n?r:s&&1==(1&n)?t-r:r;if(2200===i){-1===n&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(r>=t)r=t;else{if(!(r<0)){this.time=r;break e}r=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(-1===n&&(e>=0?(n=0,this._setEndings(!0,0===this.repetitions,s)):this._setEndings(0===this.repetitions,!0,s)),r>=t||r<0){let i=Math.floor(r/t);r-=t*i,n+=Math.abs(i);let a=this.repetitions-n;if(a<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,r=e>0?t:0,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(1===a){let t=e<0;this._setEndings(t,!t,s)}else this._setEndings(!1,!1,s);this._loopCount=n,this.time=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:i})}}else this.time=r;if(s&&1==(1&n))return t-r}return r}_setEndings(e,t,i){let r=this._interpolantSettings;i?(r.endingStart=Wt,r.endingEnd=Wt):(r.endingStart=e?this.zeroSlopeAtStart?Wt:Ht:qt,r.endingEnd=t?this.zeroSlopeAtEnd?Wt:Ht:qt)}_scheduleFading(e,t,i){let r=this._mixer,n=r.time,s=this._weightInterpolant;null===s&&(s=r._lendControlInterpolant(),this._weightInterpolant=s);let a=s.parameterPositions,o=s.sampleValues;return a[0]=n,o[0]=t,a[1]=n+e,o[1]=i,this}},yc=new Float32Array(1),xc=class extends ai{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){let i=e._localRoot||this._root,r=e._clip.tracks,n=r.length,s=e._propertyBindings,a=e._interpolants,o=i.uuid,l=this._bindingsByRootAndName,h=l[o];void 0===h&&(h={},l[o]=h);for(let c=0;c!==n;++c){let e=r[c],n=e.name,l=h[n];if(void 0!==l)++l.referenceCount,s[c]=l;else{if(l=s[c],void 0!==l){null===l._cacheIndex&&(++l.referenceCount,this._addInactiveBinding(l,o,n));continue}let r=t&&t._propertyBindings[c].binding.parsedPath;l=new sc(gc.create(i,n,r),e.ValueTypeName,e.getValueSize()),++l.referenceCount,this._addInactiveBinding(l,o,n),s[c]=l}a[c].resultBuffer=l.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){let t=(e._localRoot||this._root).uuid,i=e._clip.uuid,r=this._actionsByClip[i];this._bindAction(e,r&&r.knownActions[0]),this._addInactiveAction(e,i,t)}let t=e._propertyBindings;for(let e=0,i=t.length;e!==i;++e){let i=t[e];0==i.useCount++&&(this._lendBinding(i),i.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){let t=e._propertyBindings;for(let e=0,i=t.length;e!==i;++e){let i=t[e];0==--i.useCount&&(i.restoreOriginalState(),this._takeBackBinding(i))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;let e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){let t=e._cacheIndex;return null!==t&&t=0;--t)e[t].stop();return this}update(e){e*=this.timeScale;let t=this._actions,i=this._nActiveActions,r=this.time+=e,n=Math.sign(e),s=this._accuIndex^=1;for(let l=0;l!==i;++l)t[l]._update(r,e,n,s);let a=this._bindings,o=this._nActiveBindings;for(let l=0;l!==o;++l)a[l].apply(s);return this}setTime(e){this.time=0;for(let t=0;tthis.max.x||e.ythis.max.y)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return!(e.max.xthis.max.x||e.max.ythis.max.y)}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return Mc.copy(e).clamp(this.min,this.max).sub(e).length()}intersect(e){return this.min.max(e.min),this.max.min(e.max),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}},Cc=new Zi,Tc=new Zi,Dc=class{constructor(e=new Zi,t=new Zi){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){Cc.subVectors(e,this.start),Tc.subVectors(this.end,this.start);let i=Tc.dot(Tc),r=Tc.dot(Cc)/i;return t&&(r=ui(r,0,1)),r}closestPointToPoint(e,t,i){let r=this.closestPointToPointParameter(e,t);return this.delta(i).multiplyScalar(r).add(this.start)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return(new this.constructor).copy(this)}},Pc=new Zi,Ic=class extends Kr{constructor(e,t){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";let i=new En,r=[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 s=0,a=1,o=32;s>-e-14,r[256|l]=1024>>-e-14|32768,n[l]=-e-1,n[256|l]=-e-1):e<=15?(r[l]=e+15<<10,r[256|l]=e+15<<10|32768,n[l]=13,n[256|l]=13):e<128?(r[l]=31744,r[256|l]=64512,n[l]=24,n[256|l]=24):(r[l]=31744,r[256|l]=64512,n[l]=13,n[256|l]=13)}let s=new Uint32Array(2048),a=new Uint32Array(64),o=new Uint32Array(64);for(let l=1;l<1024;++l){let e=l<<13,t=0;for(;0==(8388608&e);)e<<=1,t-=8388608;e&=-8388609,t+=947912704,s[l]=e|t}for(let l=1024;l<2048;++l)s[l]=939524096+(l-1024<<13);for(let l=1;l<31;++l)a[l]=l<<23;a[31]=1199570944,a[32]=2147483648;for(let l=33;l<63;++l)a[l]=2147483648+(l-32<<23);a[63]=3347054592;for(let l=1;l<64;++l)32!==l&&(o[l]=1024);return{floatView:t,uint32View:i,baseTable:r,shiftTable:n,mantissaTable:s,exponentTable:a,offsetTable:o}}();var Hc=Object.freeze({__proto__:null,fromHalfFloat:function(e){let t=e>>10;return Gc.uint32View[0]=Gc.mantissaTable[Gc.offsetTable[t]+(1023&e)]+Gc.exponentTable[t],Gc.floatView[0]},toHalfFloat:function(e){Math.abs(e)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),e=ui(e,-65504,65504),Gc.floatView[0]=e;let t=Gc.uint32View[0],i=t>>23&511;return Gc.baseTable[i]+((8388607&t)>>Gc.shiftTable[i])}});typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:D}})),typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=D);var Wc=".",qc=Symbol("target"),Yc=Symbol("unsubscribe");function Xc(e){return e instanceof Date||e instanceof Set||e instanceof Map||e instanceof WeakSet||e instanceof WeakMap||ArrayBuffer.isView(e)}var Qc=Array.isArray;function Zc(e){return"symbol"==typeof e}var Kc={after:(e,t)=>Qc(e)?e.slice(t.length):""===t?e:e.slice(t.length+1),concat:(e,t)=>Qc(e)?(e=[...e],t&&e.push(t),e):t&&void 0!==t.toString?(""!==e&&(e+=Wc),Zc(t)?e+t.toString():e+t):e,initial:e=>{if(Qc(e))return e.slice(0,-1);if(""===e)return e;let t=e.lastIndexOf(Wc);return-1===t?"":e.slice(0,t)},last:e=>{if(Qc(e))return e[e.length-1]||"";if(""===e)return e;let t=e.lastIndexOf(Wc);return-1===t?e:e.slice(t+1)},walk:(e,t)=>{if(Qc(e))for(let i of e)t(i);else if(""!==e){let i=0,r=e.indexOf(Wc);if(-1===r)t(e);else for(;i{e&&(e=e[t])})),e}},Jc=Kc;function $c(e,t,i){return e.isUnsubscribed||t.ignoreSymbols&&Zc(i)||t.ignoreUnderscores&&"_"===i.charAt(0)||"ignoreKeys"in t&&t.ignoreKeys.includes(i)}var ed=class{constructor(e){this._equals=e,this._proxyCache=new WeakMap,this._pathCache=new WeakMap,this.isUnsubscribed=!1}_getDescriptorCache(){return void 0===this._descriptorCache&&(this._descriptorCache=new WeakMap),this._descriptorCache}_getProperties(e){let t=this._getDescriptorCache(),i=t.get(e);return void 0===i&&(i={},t.set(e,i)),i}_getOwnPropertyDescriptor(e,t){if(this.isUnsubscribed)return Reflect.getOwnPropertyDescriptor(e,t);let i=this._getProperties(e),r=i[t];return void 0===r&&(r=Reflect.getOwnPropertyDescriptor(e,t),i[t]=r),r}getProxy(e,t,i,r){if(this.isUnsubscribed)return e;let n=e[r],s=n||e;this._pathCache.set(s,t);let a=this._proxyCache.get(s);return void 0===a&&(a=void 0===n?new Proxy(e,i):e,this._proxyCache.set(s,a)),a}getPath(e){return this.isUnsubscribed?void 0:this._pathCache.get(e)}isDetached(e,t){return!Object.is(e,Jc.get(t,this.getPath(e)))}defineProperty(e,t,i){return!!Reflect.defineProperty(e,t,i)&&(this.isUnsubscribed||(this._getProperties(e)[t]=i),!0)}setProperty(e,t,i,r,n){if(!this._equals(n,i)||!(t in e)){let n=this._getOwnPropertyDescriptor(e,t);return void 0!==n&&"set"in n?Reflect.set(e,t,i,r):Reflect.set(e,t,i)}return!0}deleteProperty(e,t,i){if(Reflect.deleteProperty(e,t)){if(!this.isUnsubscribed){let r=this._getDescriptorCache().get(e);r&&(delete r[t],this._pathCache.delete(i))}return!0}return!1}isSameDescriptor(e,t,i){let r=this._getOwnPropertyDescriptor(t,i);return void 0!==e&&void 0!==r&&Object.is(e.value,r.value)&&(e.writable||!1)===(r.writable||!1)&&(e.enumerable||!1)===(r.enumerable||!1)&&(e.configurable||!1)===(r.configurable||!1)&&e.get===r.get&&e.set===r.set}isGetInvariant(e,t){let i=this._getOwnPropertyDescriptor(e,t);return void 0!==i&&!0!==i.configurable&&!0!==i.writable}unsubscribe(){this._descriptorCache=null,this._pathCache=null,this._proxyCache=null,this.isUnsubscribed=!0}};function td(e){return"[object Object]"===toString.call(e)}function id(){return!0}function rd(e,t){return e.length!==t.length||e.some(((e,i)=>t[i]!==e))}var nd=new Set(["hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]),sd=new Set(["concat","includes","indexOf","join","keys","lastIndexOf"]),ad={push:id,pop:id,shift:id,unshift:id,copyWithin:rd,reverse:rd,sort:rd,splice:rd,flat:rd,fill:rd},od=new Set([...nd,...sd,...Object.keys(ad)]);function ld(e,t){if(e.size!==t.size)return!0;for(let i of e)if(!t.has(i))return!0;return!1}var hd=["keys","values","entries"],cd=new Set(["has","toString"]),dd={add:ld,clear:ld,delete:ld,forEach:ld},ud=new Set([...cd,...Object.keys(dd),...hd]);function pd(e,t){if(e.size!==t.size)return!0;let i;for(let[r,n]of e)if(i=t.get(r),i!==n||void 0===i&&!t.has(r))return!0;return!1}var fd=new Set([...cd,"get"]),md={set:pd,clear:pd,delete:pd,forEach:pd},gd=new Set([...fd,...Object.keys(md),...hd]),vd=class{constructor(e,t,i,r){this._path=t,this._isChanged=!1,this._clonedCache=new Set,this._hasOnValidate=r,this._changes=r?[]:null,this.clone=void 0===t?e:this._shallowClone(e)}static isHandledMethod(e){return nd.has(e)}_shallowClone(e){let t=e;if(td(e))t={...e};else if(Qc(e))t=[...e];else if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set([...e].map((e=>this._shallowClone(e))));else if(e instanceof Map){t=new Map;for(let[i,r]of e.entries())t.set(i,this._shallowClone(r))}return this._clonedCache.add(t),t}preferredThisArg(e,t,i,r){return e?(Qc(r)?this._onIsChanged=ad[t]:r instanceof Set?this._onIsChanged=dd[t]:r instanceof Map&&(this._onIsChanged=md[t]),r):i}update(e,t,i){let r=Jc.after(e,this._path);if("length"!==t){let e=this.clone;Jc.walk(r,(t=>{e&&e[t]&&(this._clonedCache.has(e[t])||(e[t]=this._shallowClone(e[t])),e=e[t])})),this._hasOnValidate&&this._changes.push({path:r,property:t,previous:i}),e&&e[t]&&(e[t]=i)}this._isChanged=!0}undo(e){let t;for(let i=this._changes.length-1;-1!==i;i--)t=this._changes[i],Jc.get(e,t.path)[t.property]=t.previous}isChanged(e){return void 0===this._onIsChanged?this._isChanged:this._onIsChanged(this.clone,e)}},yd=class extends vd{static isHandledMethod(e){return od.has(e)}},xd=class extends vd{undo(e){e.setTime(this.clone.getTime())}isChanged(e,t){return!t(this.clone.valueOf(),e.valueOf())}},bd=class extends vd{static isHandledMethod(e){return ud.has(e)}undo(e){for(let t of this.clone)e.add(t);for(let t of e)this.clone.has(t)||e.delete(t)}},wd=class extends vd{static isHandledMethod(e){return gd.has(e)}undo(e){for(let[t,i]of this.clone.entries())e.set(t,i);for(let t of e.keys())this.clone.has(t)||e.delete(t)}},_d=class extends vd{constructor(e,t,i,r){super(void 0,t,i,r),this._arg1=i[0],this._weakValue=e.has(this._arg1)}isChanged(e){return this._weakValue!==e.has(this._arg1)}undo(e){this._weakValue&&!e.has(this._arg1)?e.add(this._arg1):e.delete(this._arg1)}},Sd=class extends vd{constructor(e,t,i,r){super(void 0,t,i,r),this._weakKey=i[0],this._weakHas=e.has(this._weakKey),this._weakValue=e.get(this._weakKey)}isChanged(e){return this._weakValue!==e.get(this._weakKey)}undo(e){let t=e.has(this._weakKey);this._weakHas&&!t?e.set(this._weakKey,this._weakValue):!this._weakHas&&t?e.delete(this._weakKey):this._weakValue!==e.get(this._weakKey)&&e.set(this._weakKey,this._weakValue)}},Ad=class{constructor(e){this._stack=[],this._hasOnValidate=e}static isHandledType(e){return td(e)||Qc(e)||Xc(e)}static isHandledMethod(e,t){return td(e)?vd.isHandledMethod(t):Qc(e)?yd.isHandledMethod(t):e instanceof Set?bd.isHandledMethod(t):e instanceof Map?wd.isHandledMethod(t):Xc(e)}get isCloning(){return this._stack.length>0}start(e,t,i){let r=vd;Qc(e)?r=yd:e instanceof Date?r=xd:e instanceof Set?r=bd:e instanceof Map?r=wd:e instanceof WeakSet?r=_d:e instanceof WeakMap&&(r=Sd),this._stack.push(new r(e,t,i,this._hasOnValidate))}update(e,t,i){this._stack[this._stack.length-1].update(e,t,i)}preferredThisArg(e,t,i){let{name:r}=e,n=Ad.isHandledMethod(i,r);return this._stack[this._stack.length-1].preferredThisArg(n,r,t,i)}isChanged(e,t,i){return this._stack[this._stack.length-1].isChanged(e,t,i)}undo(e){void 0!==this._previousClone&&this._previousClone.undo(e)}stop(){return this._previousClone=this._stack.pop(),this._previousClone.clone}},Md={equals:Object.is,isShallow:!1,pathAsArray:!1,ignoreSymbols:!1,ignoreUnderscores:!1,ignoreDetached:!1,details:!1},Ed=(e,t,i={})=>{i={...Md,...i};let r=Symbol("ProxyTarget"),{equals:n,isShallow:s,ignoreDetached:a,details:o}=i,l=new ed(n),h="function"==typeof i.onValidate,c=new Ad(h),d=(e,t,r,n,s)=>!h||c.isCloning||!0===i.onValidate(Jc.concat(l.getPath(e),t),r,n,s),u=(t,r,n,s)=>{!$c(l,i,r)&&(!a||!l.isDetached(t,e))&&p(l.getPath(t),r,n,s)},p=(e,i,r,n,s)=>{c.isCloning?c.update(e,i,n):t(Jc.concat(e,i),r,n,s)},f=e=>e&&(e[r]||e),m=(t,n,o,h)=>function(e){return("object"==typeof e?null===e:"function"!=typeof e)||e instanceof RegExp}(t)||"constructor"===o||s&&!Ad.isHandledMethod(n,o)||$c(l,i,o)||l.isGetInvariant(n,o)||a&&l.isDetached(n,e)?t:(void 0===h&&(h=l.getPath(n)),l.getProxy(t,Jc.concat(h,o),g,r)),g={get(e,t,i){if(Zc(t)){if(t===r||t===qc)return e;if(t===Yc&&!l.isUnsubscribed&&0===l.getPath(e).length)return l.unsubscribe(),e}let n=Xc(e)?Reflect.get(e,t):Reflect.get(e,t,i);return m(n,e,t)},set(e,t,i,s){i=f(i);let a=e[r]||e,o=a[t];if(n(o,i)&&t in e)return!0;let h=d(e,t,i,o);return h&&l.setProperty(a,t,i,s,o)?(u(e,t,e[t],o),!0):!h},defineProperty(e,t,i){if(!l.isSameDescriptor(i,e,t)){let r=e[t];d(e,t,i.value,r)&&l.defineProperty(e,t,i,r)&&u(e,t,i.value,r)}return!0},deleteProperty(e,t){if(!Reflect.has(e,t))return!0;let i=Reflect.get(e,t),r=d(e,t,void 0,i);return r&&l.deleteProperty(e,t,i)?(u(e,t,void 0,i),!0):!r},apply(t,i,s){let a=i[r]||i;if(l.isUnsubscribed)return Reflect.apply(t,a,s);if((!1===o||!0!==o&&!o.includes(t.name))&&Ad.isHandledType(a)){let r=Jc.initial(l.getPath(t)),o=Ad.isHandledMethod(a,t.name);c.start(a,r,s);let h=Reflect.apply(t,c.preferredThisArg(t,i,a),o?s.map((e=>f(e))):s),u=c.isChanged(a,n),v=c.stop();if(Ad.isHandledType(h)&&o&&(i instanceof Map&&"get"===t.name&&(r=Jc.concat(r,s[0])),h=l.getProxy(h,r,g)),u){let i={name:t.name,args:s,result:h},n=c.isCloning?Jc.initial(r):r,o=c.isCloning?Jc.last(r):"";d(Jc.get(e,n),o,a,v,i)?p(n,o,a,v,i):c.undo(a)}return(i instanceof Map||i instanceof Set)&&function(e){return"object"==typeof e&&"function"==typeof e.next}(h)?function(e,t,i,r,n){let s=e.next;if("entries"===t.name)e.next=function(){let e=s.call(this);return!1===e.done&&(e.value[0]=n(e.value[0],t,e.value[0],r),e.value[1]=n(e.value[1],t,e.value[0],r)),e};else if("values"===t.name){let a=i[qc].keys();e.next=function(){let e=s.call(this);return!1===e.done&&(e.value=n(e.value,t,a.next().value,r)),e}}else e.next=function(){let e=s.call(this);return!1===e.done&&(e.value=n(e.value,t,e.value,r)),e};return e}(h,t,i,r,m):h}return Reflect.apply(t,i,s)}},v=l.getProxy(e,i.pathAsArray?[]:"",g);return t=t.bind(v),h&&(i.onValidate=i.onValidate.bind(v)),v};Ed.target=e=>e&&e[qc]||e,Ed.unsubscribe=e=>e[Yc]||e;var Cd=Ed,Td="object"==typeof global&&global&&global.Object===Object&&global,Dd="object"==typeof self&&self&&self.Object===Object&&self,Pd=Td||Dd||Function("return this")(),Id=Pd.Symbol,Od=Object.prototype,Rd=Od.hasOwnProperty,Ld=Od.toString,Bd=Id?Id.toStringTag:void 0;var zd=function(e){var t=Rd.call(e,Bd),i=e[Bd];try{e[Bd]=void 0;var r=!0}catch{}var n=Ld.call(e);return r&&(t?e[Bd]=i:delete e[Bd]),n},kd=Object.prototype.toString;var Nd=function(e){return kd.call(e)},Fd=Id?Id.toStringTag:void 0;var Ud=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Fd&&Fd in Object(e)?zd(e):Nd(e)};var Vd=function(e){return null!=e&&"object"==typeof e};var jd=function(e){return"symbol"==typeof e||Vd(e)&&"[object Symbol]"==Ud(e)};var Gd=function(e,t){for(var i=-1,r=null==e?0:e.length,n=Array(r);++i0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}};var Tu=function(e){return function(){return e}},Du=function(){try{var e=xu(Object,"defineProperty");return e({},"",{}),e}catch{}}(),Pu=Du?function(e,t){return Du(e,"toString",{configurable:!0,enumerable:!1,value:Tu(t),writable:!0})}:nu,Iu=Cu(Pu);var Ou=function(e,t){for(var i=-1,r=null==e?0:e.length;++i-1&&e%1==0&&e-1&&e%1==0&&e<=9007199254740991};var Gu=function(e){return null!=e&&ju(e.length)&&!su(e)},Hu=Object.prototype;var Wu=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Hu)};var qu=function(e,t){for(var i=-1,r=Array(e);++i-1};var jp=function(e,t){var i=this.__data__,r=kp(i,e);return r<0?(++this.size,i.push([e,t])):i[r][1]=t,this};function Gp(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t0&&r(l)?i>1?e(l,i-1,r,n,s):pf(s,l):n||(s[s.length]=l)}return s};var vf=function(e){return(null==e?0:e.length)?gf(e,1):[]};var yf=function(e){return Iu(Vu(e,void 0,vf),e+"")},xf=fp(Object.getPrototypeOf,Object),bf=Function.prototype,wf=Object.prototype,_f=bf.toString,Sf=wf.hasOwnProperty,Af=_f.call(Object);var Mf=function(e){if(!Vd(e)||"[object Object]"!=Ud(e))return!1;var t=xf(e);if(null===t)return!0;var i=Sf.call(t,"constructor")&&t.constructor;return"function"==typeof i&&i instanceof i&&_f.call(i)==Af};var Ef=function(e,t,i){var r=-1,n=e.length;t<0&&(t=-t>n?0:n+t),(i=i>n?n:i)<0&&(i+=n),n=t>i?0:i-t>>>0,t>>>=0;for(var s=Array(n);++ro))return!1;var h=s.get(e),c=s.get(t);if(h&&c)return h==t&&c==e;var d=-1,u=!0,p=2&i?new Gm:void 0;for(s.set(e,t),s.set(t,e);++d=t||i<0||d&&e-h>=s}function m(){var e=hg();if(f(e))return g(e);o=setTimeout(m,function(e){var i=t-(e-l);return d?dg(i,s-(e-h)):i}(e))}function g(e){return o=void 0,u&&r?p(e):(r=n=void 0,a)}function v(){var e=hg(),i=f(e);if(r=arguments,n=this,l=e,i){if(void 0===o)return function(e){return h=e,o=setTimeout(m,t),c?p(e):a}(l);if(d)return clearTimeout(o),o=setTimeout(m,t),p(l)}return void 0===o&&(o=setTimeout(m,t)),a}return t=ru(t)||0,Jd(i)&&(c=!!i.leading,s=(d="maxWait"in i)?cg(ru(i.maxWait)||0,t):s,u="trailing"in i?!!i.trailing:u),v.cancel=function(){void 0!==o&&clearTimeout(o),h=0,r=l=n=o=void 0},v.flush=function(){return void 0===o?a:g(hg())},v};var pg=function(e){var t=null==e?0:e.length;return t?e[t-1]:void 0};var fg=function(e,t){return t.length<2?e:uf(e,Ef(t,0,-1))};var mg=function(e,t){return sg(e,t)};var gg=function(e,t){return t=cf(t,e),null==(e=fg(e,t))||delete e[df(pg(t))]};var vg=function(e){return Mf(e)?void 0:e},yg=yf((function(e,t){var i={};if(null==e)return i;var r=!1;t=Gd(t,(function(t){return t=cf(t,e),r||(r=t.length>1),t})),Fu(e,$f(e),i),r&&(i=Nm(i,7,vg));for(var n=t.length;n--;)gg(i,t[n]);return i})),xg=yg;var bg=function(e,t,i,r){if(!Jd(e))return e;for(var n=-1,s=(t=cf(t,e)).length,a=s-1,o=e;null!=o&&++n"u")&&window.navigator.userAgent.toLowerCase().includes(" electron/")&&(()=>{if(typeof window>"u")return;let e=new URLSearchParams(window.location.search).get("desktop-app-version");e?window.localStorage.setItem("desktop-app-version",e):window.localStorage.getItem("desktop-app-version")})();var Cg=!(typeof window>"u")&&window.navigator.platform.toUpperCase().includes("MAC"),Tg=!(typeof window>"u")&&(/iPad|iPhone|iPod/.test(window.navigator.userAgent)||Cg&&"ontouchend"in document),Dg=!(typeof window>"u")&&window.navigator.userAgent.toLowerCase().indexOf("firefox")>-1,Pg=!(typeof window>"u")&&("ontouchstart"in window||navigator.maxTouchPoints>0),Ig=(()=>{if(typeof window>"u")return!1;let e=navigator.userAgent,t=navigator.vendor;return/Safari/i.test(e)&&/Apple Computer/.test(t)})(),Og=Number((()=>{if(typeof window>"u")return null;let e=navigator.userAgent.match(/Version\/(\d+\.\d)/);return e&&e[1]})());function Rg(e){return Array.isArray(e)?e:[e]}function Lg(e){return Cg?e.metaKey:e.ctrlKey}var Bg=[],zg={},kg={},Ng={};function Fg(e){Bg.includes(e)||Bg.push(e)}function Ug(e){delete zg[e.pointerId];for(let t=0;t{Wg=e}));function Xg(){if(qg)return qg;return qg=async function(){let e=i.e(72275).then(i.bind(i,72275)),[t,r]=await Promise.all([e,fetch("https://unpkg.com/@splinetool/navmesh-wasm@0.9.512/build/navmesh.wasm").then((e=>e.arrayBuffer()))]),n=t.default,s=await n({wasmBinary:r});Wg(s)}()}var Qg,Zg,Kg=new Promise((e=>{Qg=e}));function Jg(){if(Zg)return Zg;return Zg=async function(){let e=await i.e(20330).then(i.bind(i,20330));await e.init(),Qg(e)}()}var $g=class{modifyById(e,t){let i=this;if(void 0===i[e])throw new Error("not expected");{let r={...i,[e]:t};return Object.setPrototypeOf(r,$g.prototype),r}}add(e,t){return this.runOp({type:1,id:e,data:t})?.data??this}runOp(e){let t=this;if(1===e.type){let i,r=t[e.id];i=void 0===r?{type:2,id:e.id}:{type:1,id:e.id,data:r};let{id:n,data:s}=e,a={...t,[n]:s};return Object.setPrototypeOf(a,$g.prototype),{data:a,actual:e,reverse:i}}if(2===e.type){let{id:i}=e,r=t[i];if(void 0===r)return null;{let n={...t};return Object.setPrototypeOf(n,$g.prototype),delete n[i],{data:n,actual:e,reverse:{type:1,id:i,data:r}}}}return null}};function ev(e){if(void 0!==e.deepFreeze)return void e.deepFreeze(e);let t=Object.getOwnPropertyNames(e);for(let i of t){let t=e[i];t&&"object"==typeof t&&ev(t)}return Object.freeze(e)}var tv=class extends Error{};function iv(e){let t={...e};return Object.setPrototypeOf(t,Object.getPrototypeOf(e)),t}function rv(e,t,i){if(void 0===e?void 0===t?(e=0,t=10):e=t-10:void 0===t&&(t=e+10),e>t){let i=e;e=t,t=i}let r=[],n=1/(i+1);for(let s=0;st.id===e));if(n<0)throw new Error("not expected");let s=r[n];return r=[...r],r[n]={...s,data:t},this.modifyArrayBy(i,r)}}modifyArrayBy(e,t){let i=e,r=t;for(;null!==i;){let e=r,t=i;if(i=this.parent(i),void 0===i)throw new Error;r=this.childrenArray(i);let n=r.findIndex((e=>e.id===t));if(n<0)throw new Error;r=[...r],r[n]={...r[n],children:e}}Object.setPrototypeOf(r,lv.prototype);let n=r;return n.fillCaches(),n}runOp(e){switch(e.type){case 7:return this.addOp(e);case 8:return this.deleteOp(e);case 9:return this.moveOp(e)}return null}checkDuplicatedIdRec({id:e,children:t}){if(void 0!==this.get(e))return!0;for(let i of t)if(this.checkDuplicatedIdRec(i))return!0;return!1}addOp(e){let{parent:t,fi:i,id:r,data:n,children:s}=e;if(null!==t&&void 0===this.get(t))return null;if(this.checkDuplicatedIdRec(e))return null;{let a=t,o=this.childrenArray(a),l={fi:i,id:r,data:n,children:s};return o=[...o,l],o.sort(((e,t)=>e.fi-t.fi)),e.localIndex=o.indexOf(l),{data:this.modifyArrayBy(a,o),actual:e,reverse:{type:8,id:r}}}}deleteOp(e){let{id:t}=e;if(null===this.get(t))return null;{let i=this.parent(t);if(void 0===i)return null;let r=this.childrenArray(i),n=r.findIndex((e=>e.id===t));e.localIndex=n,r=[...r];let s=r.splice(n,1)[0];return{data:this.modifyArrayBy(i,r),actual:e,reverse:{type:7,...s,parent:i}}}}moveOp(e){let{parent:t,fi:i,id:r}=e;if(null!==t&&void 0===this.get(t))return this.deleteOp({type:8,id:r});if(null!==t){let e=t;for(;null!==e;){if(void 0===e)throw new Error;if(e===r)throw new tv("cyclic tree");e=this.parent(e)}}let n=this.parent(r);if(void 0===n)return null;let s=n,a=this.childrenArray(n),o=a.findIndex((e=>e.id===r));a=[...a];let l=a.splice(o,1)[0],h=this.modifyArrayBy(n,a);n=t,a=h.childrenArray(n);let c=l.fi;return l={...l,fi:i},a=[...a,l],a.sort(((e,t)=>e.fi-t.fi)),e.localIndex=a.indexOf(l),h=h.modifyArrayBy(n,a),{data:h,actual:e,reverse:{type:9,parent:s,fi:c,id:r}}}previous(e,t){if(null===t){let t=this.childrenArray(e);return 0===t.length?null:t[t.length-1].id}let i=null;for(let r of this.childrenArray(e)){if(r.id===t)return i;i=r.id}return null}traverseSortNext(e){let t=this.parent(e);if(void 0!==t){let i=this.childrenArray(t),r=i.findIndex((t=>t.id===e))+1;if(r0?t[0].id:this.traverseSortNext(e)}traverseSortPrevious(e){let t=this.childrenArray(e);return t.length>0?this.traverseSortPrevious(t[t.length-1].id):e}sortPrevious(e){let t=this.parent(e);if(void 0!==t){let i=this.childrenArray(t),r=i.findIndex((t=>t.id===e))-1;return r>=0?this.traverseSortPrevious(i[r].id):t}}getAllSorted(e){let t=[];for(let i of e){let e=this.getWithSortKey(i.id);void 0!==e&&t.push({...i,...e})}t.sort(((e,t)=>function(e,t){let i=0;for(;it[i])return 1;i+=1}return i!==t.length?-1:i!==e.length?1:0}(e.sortKey,t.sortKey)));for(let i of t)delete i.sortKey;return t}getWithSortKey(e){var t=e;let i=[],r=this.get(t),n=r;if(void 0!==r){for(;t;)i.splice(0,0,r.fi),null!==(t=this.parent(t))&&(r=this.get(t));return{...n,sortKey:i}}}insertBeforeHelper(e,t,i){return this.insertAfterHelper(e,this.previous(e,t),i)}insertAfterHelper(e,t,i){let r=this.childrenArray(e);if(null===t){if(0===r.length)return rv(0,i,i);{let e=r[0].fi;return rv(e-i,e,i)}}{let n=this.get(t);if(void 0===n||this.parent(t)!==e)throw new Error("illegal args");let s=r.find((e=>e.fi>n.fi));if(void 0===s){let e=r[r.length-1].fi;return rv(e,e+i,i)}return rv(n.fi,s.fi,i)}}};(ov||(ov={})).runOp=function(e,t){if(0!==t.type)return null;if(Array.isArray(e)){let i=t.props,r={},n=[...e],s=!1;if(i)for(let e of Object.keys(i)){let t=parseInt(e);if(isNaN(t))throw new Error("wrong index");r[e]=n[t],n[t]=i[e],s=!0}return s?{data:n,actual:t,reverse:{type:0,props:r}}:null}{let i=t.props,r={},n={...e},s=!1;if(i)for(let e of Object.keys(i)){r[e]=n[e];let t=i[e];void 0===t?delete n[e]:n[e]=t,s=!0}return s?{data:n,actual:t,reverse:{type:0,props:r}}:null}};var hv=class extends Array{constructor(...e){super(...e),Object.setPrototypeOf(this,hv.prototype)}deepFreeze(){let e=0;for(;et.id===e));if(r<0)throw new Error("not expected");let n=i[r];return i=[...i],i[r]={...n,data:t},this.modifyArrayBy(i)}}modifyArrayBy(e){Object.setPrototypeOf(e,hv.prototype);let t=e;return typeof process<"u"||t.fillCaches(),t}runOp(e){switch(e.type){case 4:return this.addOp(e);case 5:return this.deleteOp(e);case 6:return this.moveOp(e)}return null}addOp(e){let{fi:t,id:i,data:r}=e,n=this,s={fi:t,id:i,data:r};return n=[...n,s],n.sort(((e,t)=>e.fi-t.fi)),e.localIndex=n.indexOf(s),{data:this.modifyArrayBy(n),actual:e,reverse:{type:5,id:i}}}deleteOp(e){let{id:t}=e,i=this,r=i.findIndex((e=>e.id===t));if(-1===r)return null;e.localIndex=r,i=[...i];let n=i.splice(r,1)[0];return{data:this.modifyArrayBy(i),actual:e,reverse:{type:4,...n}}}moveOp(e){let{fi:t,id:i}=e,r=this;r=[...r];let n=r.findIndex((e=>e.id===i));if(-1===n)return null;let s=r[n].fi,a={...r[n],fi:t};return r[n]=a,r.sort(((e,t)=>e.fi-t.fi)),e.localIndex=r.indexOf(a),{data:this.modifyArrayBy(r),actual:e,reverse:{type:6,fi:s,id:i}}}previous(e){if(null===e)return 0===this.length?null:this[this.length-1].id;let t=null;for(let i of this){if(i.id===e)return t;t=i.id}return null}insertBeforeHelper(e,t){return this.insertAfterHelper(this.previous(e),t)}insertAfterHelper(e,t){let i=this;if(null===e){if(0===i.length)return rv(0,t,t);{let e=i[0].fi;return rv(e-t,e,t)}}{let r=this.get(e);if(void 0===r)throw new Error("illegal args");let n=i.find((e=>e.fi>r.fi));if(void 0===n){let e=i[i.length-1].fi;return rv(e,e+t,t)}return rv(r.fi,n.fi,t)}}};function cv(e){return e&&"object"==typeof e&&e instanceof mv}var dv,uv,pv,fv,mv=class{unusedFunOverridesTable(e){}runOp(e){let t=[],i=this,r=0,n={};for(;r0;){if(0===Object.keys(i).length){let n=t[r-1];n&&(i=iv(n),delete i[e.path[r-1]])}else{let n=t[r-1];if(n){let t=iv(n);t[e.path[r-1]]=i,i=t}else{let t=new mv;t[e.path[r-1]]=i,i=t}}r-=1}return{data:Object.setPrototypeOf(i,mv.prototype),actual:e,reverse:{...e,props:n}}}};function gv(e,t){if(void 0===t)return;let i=!1,r=e.map((e=>{let r=e.id,n=vv(e.data,t[r]);if(i=i||void 0!==n,void 0===n&&(n=e.data),e.children){let s=gv(e.children,t);return void 0!==s?i=!0:s=e.children,{...e,id:r,data:n,children:s}}return{...e,id:r,data:n}}));return i?r:void 0}function vv(e,t){if(!cv(t))return t;if(e instanceof lv){let i=gv(e,t);return void 0!==i&&Object.setPrototypeOf(i,Object.getPrototypeOf(e)),i}if(e instanceof hv)return function(e,t){if(void 0===t)return;let i=!1,r=e.map((e=>{let r=e.id,n=vv(e.data,t[r]);return i=i||void 0!==n,void 0===n&&(n=e.data),{...e,id:r,data:n}}));return i?(Object.setPrototypeOf(r,Object.getPrototypeOf(e)),r):void 0}(e,t);if(Array.isArray(e)){let i=!1,r=e.map(((e,r)=>{let n=vv(e,t[r]);return i=i||void 0!==n,void 0===n&&(n=e),n}));return i?(Object.setPrototypeOf(r,Object.getPrototypeOf(e)),r):void 0}if(e instanceof mv)return yv(e,t);if(e&&"object"==typeof e){let i={},r=!1;for(let[n,s]of Object.entries(e)){let e=vv(s,t[n]);r=r||void 0!==e,void 0===e&&(e=s),i[n]=e}return r?(Object.setPrototypeOf(i,Object.getPrototypeOf(e)),i):void 0}}function yv(e,t){if(void 0===e)return t;if(void 0===t)return e;if(!cv(t))return t;if(!cv(e))return dv.apply(e,t);let i=new Set;for(let n of Object.keys(e))i.add(n);for(let n of Object.keys(t))i.add(n);let r=new mv;for(let n of i){let i=yv(void 0===e?void 0:e[n],void 0===t?void 0:t[n]);r[n]=i}return r}function xv(e,t){let i={cur:[],result:[],len:0};return[e=Sv(e,t,i)??e,i.result]}function bv(e,t){return null===e?null:(e.cur[e.len]=t,e.len+=1,e)}function wv(e){e&&(e.len-=1)}function _v(e,t,i){let r=!1,n=e.map((e=>{let n=e.id,s=t[n];if(void 0!==s&&"string"==typeof s&&(r=!0,n=s,null!==i))throw new Error("not supported");let a=Sv(e.data,t,bv(i,n));wv(i),r=r||void 0!==a,void 0===a&&(a=e.data);let o=_v(e.children,t,i);return void 0!==o?r=!0:o=e.children,{...e,id:n,data:a,children:o}}));if(r)return n}function Sv(e,t,i){if(e instanceof lv){let r=_v(e,t,i);return void 0!==r&&Object.setPrototypeOf(r,Object.getPrototypeOf(e)),r}if(e instanceof hv)return function(e,t,i){let r=!1,n=e.map((e=>{let n=e.id,s=t[n];if(void 0!==s&&"string"==typeof s&&(r=!0,n=s,null!==i))throw new Error("not supported");let a=Sv(e.data,t,bv(i,n));return wv(i),r=r||void 0!==a,void 0===a&&(a=e.data),{...e,id:n,data:a}}));if(r)return Object.setPrototypeOf(n,Object.getPrototypeOf(e)),n}(e,t,i);if(Array.isArray(e)){let r=!1,n=e.map(((e,n)=>{let s=Sv(e,t,bv(i,n));return wv(i),r=r||void 0!==s,void 0===s&&(s=e),s}));return r?(Object.setPrototypeOf(n,Object.getPrototypeOf(e)),n):void 0}if(e&&"object"==typeof e&&!nv(e)){let r={},n=!1;for(let[s,a]of Object.entries(e))if("name"!==s){let e=t[s];if("string"==typeof e){if(null!==i)throw new Error("not supported");n=!0,s=e}let o=Sv(a,t,bv(i,s));wv(i),n=n||void 0!==o,void 0===o&&(o=a),r[s]=o}else r[s]=a;return n?(Object.setPrototypeOf(r,Object.getPrototypeOf(e)),r):void 0}if("string"==typeof e){let r=t[e];return void 0!==r&&function(e){if(null===e)return null;e.result.push(e.cur.slice(0,e.len))}(i),r}}(e=>{e.apply=function(e,t){return vv(e,t)??e},e.merge=function(e,t){return yv(e,t)},e.filterOp=function(e,t){let i=0,r=t.path,n=e;for(;i{e.replaceProps=function(e,t){let i=zv.zoom(t,e.path);if("object"==typeof i){let t={};for(let r of Object.keys(e.props))t[r]=i[r];return{...e,props:t}}return{...e,props:{}}}})(uv||(uv={})),(e=>{function t(e,t){let i=t.path;for(var r=[];;){let n;if(e instanceof mv&&0===t.type&&(n=e.runOp({...t,path:i.slice(r.length)}),null===n&&(n=void 0)),void 0===n&&r.length===i.length&&(n=e instanceof lv||e instanceof hv||e instanceof $g?e.runOp(t):ov.runOp(e,t)),void 0!==n){if(null!==n){let e=n.data;for(let t=r.length-1;t>=0;t--){let n=i[t],s=r[t];if(s instanceof lv){if("number"==typeof n)throw new Error("illegal arg");e=s.modifyById(n,e)}else if(s instanceof hv){if("number"==typeof n)throw new Error("illegal arg");e=s.modifyById(n,e)}else if(s instanceof $g){if("number"==typeof n)throw new Error("illegal arg");e=s.modifyById(n,e)}else if(s instanceof mv){let t={...s,[n]:e};e=Object.setPrototypeOf(t,mv.prototype)}else{if("object"!=typeof s)return null;if(Array.isArray(s)){if("string"==typeof n&&(n=parseInt(n),isNaN(n)))throw new Error("Invalid path");let t=e;e=[...s],e[n]=t}else e={...s,[n]:e}}}return{data:e,actual:{...n.actual,path:i},reverse:{...n.reverse,path:i}}}return null}let s,a=i[r.length];if(e instanceof lv){if("number"==typeof a)throw new Error("");s=e.get(a)?.data}else if(e instanceof hv){if("number"==typeof a)throw new Error("");s=e.get(a)?.data}else null!==e&&(s=e[a]);if(void 0===s)return null;r.push(e),e=s}}function i(e,t){for(let i=0;ivoid 0!==t.props[e]))}})(pv||(pv={})),(e=>{function t(e,t){var i=e;let r=[],n=[];for(let a of t)try{if(3===a.type||5===a.type&&"variables"===a.path[a.path.length-1]){let e,t,s;if(3===a.type?(e=zv.zoom(i,[...a.path,a.id]),s=pv.apply(i,{...a,type:2})):(e=zv.zoom(i,[...a.path,a.id,"value"]),s=pv.apply(i,a)),null!==s){i=s.data;let[o,l]=xv(i,{[a.id]:e});i=o;for(let s=0;sr.includes(t)?a.id:e)),e=n,h=o.pop()}else{if("alphaOverride"===h||"alpha"===h){e/=100;let t=e,r=zv.zoom(i,o.slice(0,o.length-2)),n=r.layers.map((e=>e.id===o[o.length-1]?{...e,data:{...e.data,[h]:t}}:e));Object.setPrototypeOf(n,Object.getPrototypeOf(r.layers)),r.layers=n}t=a.id}r.push({type:0,path:o,props:{[h]:e}}),n.push({type:0,path:o,props:{[h]:t}})}n.push(s.reverse),r.push(s.actual)}}else{let e=pv.apply(i,a);null!==e&&(r.push(e.actual),i=e.data,n.push(e.reverse))}}catch(s){if(s instanceof tv)return null;throw s}return{data:i,actual:r,reverse:n.reverse()}}e.empty=function(){return[]},e.removePrefix=function(e,t){let i=[];for(let r of e){let[e,...n]=r.path;e===t&&i.push({...r,path:n})}return i},e.addPrefix=function(e,t){return e.map((e=>({...e,path:[t,...e.path]})))},e.concat=function(e,t){return[...e,...t]},e.compress=function(e,t){return[...e.filter((e=>!t.some((t=>pv.subsumed(e,t))))),...t]},e.commutative=function(e,t){return e.every((e=>t.every((t=>pv.commutative(e,t)))))},e.applyAll=function(e,i){for(let r of i){let i=t(e,r);null!==i&&(e=i.data)}return e},e.apply=t})(fv||(fv={}));var Av=Symbol(),Mv=Symbol(),Ev=Symbol(),Cv=class{reportOp(e,t,i=[]){let r=this;if(null===t)return;r._current=t.data;let n=i;for(;!(r instanceof kv);){let e=r._path,t=r._current;if(""!==e&&n.splice(0,0,e),r=r._parent,null===r)return;r.update(e,t)}r.push(n,e,t.actual,t.reverse)}deleteChildren(e){if(this._children){let t=this._children[e];if(t){let i=t[Ev];i&&i(),delete this._children[e]}}}},Tv=class extends Cv{constructor(e,t,i){super(),this._parent=e,this._path=t,this._current=i}update(e,t){if(Array.isArray(this._current)){if("string"==typeof e&&(e=parseInt(e),isNaN(e)))throw new Error("Invalid path");this._current=[...this._current],this._current[e]=t}else this._current={...this._current,[e]:t}}runOp(e){this.reportOp(e,ov.runOp(this._current,e),e.path)}},Dv=class extends Cv{constructor(e,t,i){super(),this._parent=e,this._path=t,this._current=i}update(e,t){this._current={...this._current,[e]:t},Object.setPrototypeOf(this._current,$g.prototype)}runOp(e){this.reportOp(e,this._current.runOp(e))}},Pv={get(e,t){if(t===Ev)return()=>{e._parent=null};if(t===Av)return e._current;if(t===Mv)return e;let{_current:i,_children:r}=e;if("push"===t&&Array.isArray(i))throw new Error("not supported to expand array");let n=void 0===r?void 0:r[t];if(void 0!==n)return n;let s=i[t],a=Nv(e,t,s);return a!==s?(void 0===r&&(r={},e._children=r),r[t]=a,a):s},has:(e,t)=>t in e._current,ownKeys:e=>Reflect.ownKeys(e._current),defineProperty(){throw Error("not supported")},getPrototypeOf:e=>Object.getPrototypeOf(e._current),setPrototypeOf(){throw Error("not supported")},getOwnPropertyDescriptor(e,t){let i=e._current,r=Reflect.getOwnPropertyDescriptor(i,t);return r&&{writable:!0,configurable:!0,enumerable:r.enumerable,value:i[t]}}},Iv={...Pv,set(e,t,i){let r={type:0,props:{[t]:Vv(i)??i}};return e.deleteChildren(t),e.runOp(r),!0},deleteProperty(e,t){let i={type:0,props:{[t]:void 0}};return e.deleteChildren(t),e.runOp(i),!0}},Ov={...Pv,set(e,t,i){return void 0===i?this.deleteProperty(e,t):(e.deleteChildren(t),e.runOp({type:1,id:t,data:i})),!0},deleteProperty:(e,t)=>(e.runOp({type:2,id:t}),!0)},Rv=class extends Cv{constructor(e,t,i){super(),this._children={},this._parent=e,this._path=t,this._current=i,this[Ev]=()=>{this._parent=null}}unproxy(){return this._current}update(e,t){this._current=this._current.modifyById(e,t)}runOp(e){this.reportOp(e,this._current.runOp(e))}randomId(){return this._current.randomId()}isDescendantOf(e,t){return this._current.isDescendantOf(e,t)}childrenOf(e){return this._current.childrenOf(e)}traverse(e){return this._current.traverse(e)}get(e){return this._current.get(e)}parent(e){return this._current.parent(e)}traverse(e){this._current.traverse(((t,i)=>{e(t,this.data(t))}))}data(e){let{_current:t,_children:i}=this,r=void 0===i?void 0:i[e];if(void 0!==r)return r;let n=t.get(e)?.data,s=Nv(this,e,n);return s!==n?(void 0===i&&(i={},this._children=i),i[e]=s,s):n}add(e,t,i,r,n){this.runOp({type:7,parent:e,fi:t,id:i,data:r,children:n})}move(e,t,i){this.runOp({type:9,parent:e,fi:t,id:i})}insertAfter(e,t,i){let r=this._current.insertAfterHelper(e,t,i.length);for(let n=0;n{this._parent=null}}unproxy(){return this._current}get length(){return this._current.length}forEach(e){let t=this.length;for(let i=0;i0){let r=e[e.length-1];if(0===r.type&&0===t.type&&zv.equal(r.path,i))return void Object.assign(r.props,t.props)}e.push({...t,path:i})}var zv,kv=class extends Cv{constructor(e){super(),this.ts=[],this.actual=[],this.reverse=[],this._current=e}update(e,t){if(""!==e)throw new Error("");this._current=t}push(e,t,i,r){Bv(this.ts,t,e),Bv(this.actual,i,e),Bv(this.reverse,r,e)}result(){return{data:this._current,ts:this.ts,actual:this.actual,reverse:this.reverse.reverse()}}};function Nv(e,t,i){return i instanceof lv?new Rv(e,t,i):i instanceof hv?new Lv(e,t,i):i instanceof $g?new Proxy(new Dv(e,t,i),Ov):null!==i&&"object"==typeof i?nv(i)?i:new Proxy(new Tv(e,t,i),Iv):i}function Fv(e){let t=new kv(e);return[Nv(t,"",e),t]}function Uv(e,t){let[i,r]=Fv(e);return t(i),r.result()}function Vv(e){return e instanceof Rv||e instanceof Lv?e._current:null!==e&&"object"==typeof e?e[Av]:e}function jv(e,t){let i=[];if(!(t.length<=e.length))return null;for(var r=0;r{function t(e,t){return(e instanceof lv||e instanceof Rv)&&"string"==typeof t||(e instanceof hv||e instanceof Lv)&&"string"==typeof t?e.data(t):"number"==typeof t&&Array.isArray(e)||"string"==typeof t&&"object"==typeof e&&null!==e?e[t]:void 0}function i(e,i,r=0){for(;r{delete e[t]})),e}return t},e.zoomOnce=t,e.zoom=i})(zv||(zv={}));var Gv,Hv=class{},Wv=class extends Hv{constructor(e){super(),this.id=e}},qv=class extends Hv{constructor(e){super(),this.data=e}};try{Gv=new TextDecoder}catch{}var Yv,Xv,Qv,Zv,Kv,Jv,$v,ey=0,ty=[],iy=ty,ry=0,ny={},sy=0,ay=0,oy=[],ly={useRecords:!1,mapsAsObjects:!0},hy=class{},cy=new hy;cy.name="MessagePack 0xC1";var dy=!1,uy=class{constructor(e){e&&(!1===e.useRecords&&void 0===e.mapsAsObjects&&(e.mapsAsObjects=!0),e.structures?e.structures.sharedLength=e.structures.length:e.getStructures&&((e.structures=[]).uninitialized=!0,e.structures.sharedLength=0)),Object.assign(this,e)}unpack(e,t){if(Yv)return ky((()=>(Ny(),this?this.unpack(e,t):uy.prototype.unpack.call(ly,e,t))));Xv=t>-1?t:e.length,ey=0,ry=0,ay=0,Zv=null,iy=ty,Kv=null,Yv=e;try{$v=e.dataView||(e.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength))}catch(i){throw Yv=null,e instanceof Uint8Array?i:new Error("Source must be a Uint8Array or Buffer but was a "+(e&&"object"==typeof e?e.constructor.name:typeof e))}if(this instanceof uy){if(ny=this,this.structures)return Qv=this.structures,py();(!Qv||Qv.length>0)&&(Qv=[])}else ny=ly,(!Qv||Qv.length>0)&&(Qv=[]);return py()}unpackMultiple(e,t){let i,r=0;try{dy=!0;let n=e.length,s=this?this.unpack(e,n):Vy.unpack(e,n);if(!t){for(i=[s];ey=32&&(t.highByte=i-32>>5))}e.sharedLength=e.length;for(let i in t||[])if(i>=0){let r=e[i],n=t[i];n&&(r&&((e.restoreStructures||(e.restoreStructures=[]))[i]=r),e[i]=n)}return this.structures=e}decode(e,t){return this.unpack(e,t)}};function py(){try{if(!ny.trusted&&!dy){let e=Qv.sharedLength||0;eXv){let e=new Error("Unexpected end of MessagePack data");throw e.incomplete=!0,e}if(!dy)throw new Error("Data read, but end of buffer not reached")}return e}catch(e){throw Qv.restoreStructures&&fy(),Ny(),(e instanceof RangeError||e.message.startsWith("Unexpected end of buffer"))&&(e.incomplete=!0),e}}function fy(){for(let e in Qv.restoreStructures)Qv[e]=Qv.restoreStructures[e];Qv.restoreStructures=null}function my(){let e=Yv[ey++];if(e<160){if(e<128){if(e<64)return e;{let t=Qv[63&e]||ny.getStructures&&xy()[63&e];return t?(t.read||(t.read=vy(t,63&e)),t.read()):e}}if(e<144){if(e-=128,ny.mapsAsObjects){let t={};for(let i=0;i=ey)return Zv.slice(ey-sy,(ey+=t)-sy);if(0==ay&&Xv<140){let e=t<16?Dy(t):Ty(t);if(null!=e)return e}return by(t)}{let t;switch(e){case 192:return null;case 193:return Kv?(t=my(),t>0?Kv[1].slice(Kv.position1,Kv.position1+=t):Kv[0].slice(Kv.position0,Kv.position0-=t)):cy;case 194:return!1;case 195:return!0;case 196:return Py(Yv[ey++]);case 197:return t=$v.getUint16(ey),ey+=2,Py(t);case 198:return t=$v.getUint32(ey),ey+=4,Py(t);case 199:return Iy(Yv[ey++]);case 200:return t=$v.getUint16(ey),ey+=2,Iy(t);case 201:return t=$v.getUint32(ey),ey+=4,Iy(t);case 202:if(t=$v.getFloat32(ey),ny.useFloat32>2){let e=Fy[(127&Yv[ey])<<1|Yv[ey+1]>>7];return ey+=4,(e*t+(t>0?.5:-.5)>>0)/e}return ey+=4,t;case 203:return t=$v.getFloat64(ey),ey+=8,t;case 204:return Yv[ey++];case 205:return t=$v.getUint16(ey),ey+=2,t;case 206:return t=$v.getUint32(ey),ey+=4,t;case 207:return ny.int64AsNumber?(t=4294967296*$v.getUint32(ey),t+=$v.getUint32(ey+4)):t=$v.getBigUint64(ey),ey+=8,t;case 208:return $v.getInt8(ey++);case 209:return t=$v.getInt16(ey),ey+=2,t;case 210:return t=$v.getInt32(ey),ey+=4,t;case 211:return ny.int64AsNumber?(t=4294967296*$v.getInt32(ey),t+=$v.getUint32(ey+4)):t=$v.getBigInt64(ey),ey+=8,t;case 212:if(t=Yv[ey++],114==t)return Ly(63&Yv[ey++]);{let e=oy[t];if(e)return e.read?(ey++,e.read(my())):e.noBuffer?(ey++,e()):e(Yv.subarray(ey,++ey));throw new Error("Unknown extension "+t)}case 213:return t=Yv[ey],114==t?(ey++,Ly(63&Yv[ey++],Yv[ey++])):Iy(2);case 214:return Iy(4);case 215:return Iy(8);case 216:return Iy(16);case 217:return t=Yv[ey++],ay>=ey?Zv.slice(ey-sy,(ey+=t)-sy):wy(t);case 218:return t=$v.getUint16(ey),ay>=(ey+=2)?Zv.slice(ey-sy,(ey+=t)-sy):_y(t);case 219:return t=$v.getUint32(ey),ay>=(ey+=4)?Zv.slice(ey-sy,(ey+=t)-sy):Sy(t);case 220:return t=$v.getUint16(ey),ey+=2,My(t);case 221:return t=$v.getUint32(ey),ey+=4,My(t);case 222:return t=$v.getUint16(ey),ey+=2,Ey(t);case 223:return t=$v.getUint32(ey),ey+=4,Ey(t);default:if(e>=224)return e-256;if(void 0===e){let e=new Error("Unexpected end of MessagePack data");throw e.incomplete=!0,e}throw new Error("Unknown MessagePack token "+e)}}}var gy=/^[a-zA-Z_$][a-zA-Z\d_$]*$/;function vy(e,t){function i(){if(i.count++>2){let i=e.read=new Function("r","return function(){return {"+e.map((e=>gy.test(e)?e+":r()":"["+JSON.stringify(e)+"]:r()")).join(",")+"}}")(my);return 0===e.highByte&&(e.read=yy(t,e.read)),i()}let r={};for(let t=0,i=e.length;tfunction(){let i=Yv[ey++];if(0===i)return t();let r=e<32?-(e+(i<<5)):e+(i<<5),n=Qv[r]||xy()[r];if(!n)throw new Error("Record id is not defined for "+r);return n.read||(n.read=vy(n,e)),n.read()};function xy(){let e=ky((()=>(Yv=null,ny.getStructures())));return Qv=ny._mergeStructures(e,Qv)}var by=Ay,wy=Ay,_y=Ay,Sy=Ay;function Ay(e){let t;if(e<16&&(t=Dy(e)))return t;if(e>64&&Gv)return Gv.decode(Yv.subarray(ey,ey+=e));let i=ey+e,r=[];for(t="";ey65535&&(t-=65536,r.push(t>>>10&1023|55296),t=56320|1023&t),r.push(t)}else r.push(e);r.length>=4096&&(t+=Cy.apply(String,r),r.length=0)}return r.length>0&&(t+=Cy.apply(String,r)),t}function My(e){let t=new Array(e);for(let i=0;i0)return void(ey=t);i[r]=e}return Cy.apply(String,i)}function Dy(e){if(e<4){if(e<2){if(0===e)return"";{let e=Yv[ey++];return(128&e)>1?void(ey-=1):Cy(e)}}{let t=Yv[ey++],i=Yv[ey++];if((128&t)>0||(128&i)>0)return void(ey-=2);if(e<3)return Cy(t,i);let r=Yv[ey++];return(128&r)>0?void(ey-=3):Cy(t,i,r)}}{let t=Yv[ey++],i=Yv[ey++],r=Yv[ey++],n=Yv[ey++];if((128&t)>0||(128&i)>0||(128&r)>0||(128&n)>0)return void(ey-=4);if(e<6){if(4===e)return Cy(t,i,r,n);{let e=Yv[ey++];return(128&e)>0?void(ey-=5):Cy(t,i,r,n,e)}}if(e<8){let s=Yv[ey++],a=Yv[ey++];if((128&s)>0||(128&a)>0)return void(ey-=6);if(e<7)return Cy(t,i,r,n,s,a);let o=Yv[ey++];return(128&o)>0?void(ey-=7):Cy(t,i,r,n,s,a,o)}{let s=Yv[ey++],a=Yv[ey++],o=Yv[ey++],l=Yv[ey++];if((128&s)>0||(128&a)>0||(128&o)>0||(128&l)>0)return void(ey-=8);if(e<10){if(8===e)return Cy(t,i,r,n,s,a,o,l);{let e=Yv[ey++];return(128&e)>0?void(ey-=9):Cy(t,i,r,n,s,a,o,l,e)}}if(e<12){let h=Yv[ey++],c=Yv[ey++];if((128&h)>0||(128&c)>0)return void(ey-=10);if(e<11)return Cy(t,i,r,n,s,a,o,l,h,c);let d=Yv[ey++];return(128&d)>0?void(ey-=11):Cy(t,i,r,n,s,a,o,l,h,c,d)}{let h=Yv[ey++],c=Yv[ey++],d=Yv[ey++],u=Yv[ey++];if((128&h)>0||(128&c)>0||(128&d)>0||(128&u)>0)return void(ey-=12);if(e<14){if(12===e)return Cy(t,i,r,n,s,a,o,l,h,c,d,u);{let e=Yv[ey++];return(128&e)>0?void(ey-=13):Cy(t,i,r,n,s,a,o,l,h,c,d,u,e)}}{let p=Yv[ey++],f=Yv[ey++];if((128&p)>0||(128&f)>0)return void(ey-=14);if(e<15)return Cy(t,i,r,n,s,a,o,l,h,c,d,u,p,f);let m=Yv[ey++];return(128&m)>0?void(ey-=15):Cy(t,i,r,n,s,a,o,l,h,c,d,u,p,f,m)}}}}}function Py(e){return ny.copyBuffers?Uint8Array.prototype.slice.call(Yv,ey,ey+=e):Yv.subarray(ey,ey+=e)}function Iy(e){let t=Yv[ey++];if(oy[t])return oy[t](Yv.subarray(ey,ey+=e));throw new Error("Unknown extension type "+t)}var Oy=new Array(4096);function Ry(){let e=Yv[ey++];if(!(e>=160&&e<192))return ey--,my();if(e-=160,ay>=ey)return Zv.slice(ey-sy,(ey+=e)-sy);if(!(0==ay&&Xv<180))return by(e);let t,i=4095&(e<<5^(e>1?$v.getUint16(ey):e>0?Yv[ey]:0)),r=Oy[i],n=ey,s=ey+e-3,a=0;if(r&&r.bytes==e){for(;n{var i=my();let r=e;void 0!==t&&(e=e<32?-((t<<5)+e):(t<<5)+e,i.highByte=t);let n=Qv[e];return n&&n.isShared&&((Qv.restoreStructures||(Qv.restoreStructures=[]))[e]=n),Qv[e]=i,i.read=vy(i,r),i.read()},By="object"==typeof self?self:global;oy[0]=()=>{},oy[0].noBuffer=!0,oy[101]=()=>{let e=my();return(By[e[0]]||Error)(e[1])},oy[105]=e=>{let t=$v.getUint32(ey-4);Jv||(Jv=new Map);let i,r=Yv[ey];i=r>=144&&r<160||220==r||221==r?[]:{};let n={target:i};Jv.set(t,n);let s=my();return n.used?Object.assign(i,s):(n.target=s,s)},oy[112]=e=>{let t=$v.getUint32(ey-4),i=Jv.get(t);return i.used=!0,i.target},oy[115]=()=>new Set(my());var zy=["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64","BigInt64","BigUint64"].map((e=>e+"Array"));function ky(e){let t=Xv,i=ey,r=ry,n=sy,s=ay,a=Zv,o=iy,l=Jv,h=Kv,c=new Uint8Array(Yv.slice(0,Xv)),d=Qv,u=Qv.slice(0,Qv.length),p=ny,f=dy,m=e();return Xv=t,ey=i,ry=r,sy=n,ay=s,Zv=a,iy=o,Jv=l,Kv=h,Yv=c,dy=f,(Qv=d).splice(0,Qv.length,...u),ny=p,$v=new DataView(Yv.buffer,Yv.byteOffset,Yv.byteLength),m}function Ny(){Yv=null,Jv=null,Qv=null}oy[116]=e=>{let t=e[0],i=zy[t];if(!i)throw new Error("Could not find typed array for code "+t);return new By[i](Uint8Array.prototype.slice.call(e,1).buffer)},oy[120]=()=>{let e=my();return new RegExp(e[0],e[1])},oy[98]=e=>{let t=(e[0]<<24)+(e[1]<<16)+(e[2]<<8)+e[3],i=ey;ey+=t-4,(Kv=[my(),my()]).position0=0,Kv.position1=0;let r=ey;ey=i;try{return my()}finally{ey=r}},oy[255]=e=>4==e.length?new Date(1e3*(16777216*e[0]+(e[1]<<16)+(e[2]<<8)+e[3])):8==e.length?new Date(((e[0]<<22)+(e[1]<<14)+(e[2]<<6)+(e[3]>>2))/1e6+1e3*(4294967296*(3&e[3])+16777216*e[4]+(e[5]<<16)+(e[6]<<8)+e[7])):12==e.length?new Date(((e[0]<<24)+(e[1]<<16)+(e[2]<<8)+e[3])/1e6+1e3*((128&e[4]?-281474976710656:0)+1099511627776*e[6]+4294967296*e[7]+16777216*e[8]+(e[9]<<16)+(e[10]<<8)+e[11])):new Date("invalid");var Fy=new Array(147);for(let bV=0;bV<256;bV++)Fy[bV]=+("1e"+Math.floor(45.15-.30103*bV));var Uy,Vy=new uy({useRecords:!1}),jy=(Vy.unpack,Vy.unpackMultiple,Vy.unpack,new Float32Array(1));new Uint8Array(jy.buffer,0,4);try{Uy=new TextEncoder}catch{}var Gy,Hy,Wy,qy,Yy,Xy=typeof Buffer<"u",Qy=Xy?Buffer.allocUnsafeSlow:Uint8Array,Zy=Xy?Buffer:Uint8Array,Ky=Xy?4294967296:2144337920,Jy=0,$y=null,ex=/[\u0080-\uFFFF]/,tx=Symbol("record-id"),ix=class extends uy{constructor(e){super(e),this.offset=0;let t,i,r,n,s,a=0,o=Zy.prototype.utf8Write?function(e,t,i){return Wy.utf8Write(e,t,i)}:!(!Uy||!Uy.encodeInto)&&function(e,t){return Uy.encodeInto(e,Wy.subarray(t)).written},l=this;e||(e={});let h=e&&e.sequential,c=e.structures||e.saveStructures,d=e.maxSharedStructures;if(null==d&&(d=c?32:0),d>8160)throw new Error("Maximum maxSharedStructure is 8160");let u=e.maxOwnStructures;null==u&&(u=c?32:64),h&&!e.saveStructures&&(this.structures=[]);let p=d>32||u+d>64,f=d+64,m=d+u+64;if(m>8256)throw new Error("Maximum maxSharedStructure + maxOwnStructure is 8192");let g=[],v=0,y=0;this.pack=this.encode=function(e,o){if(Wy||(Wy=new Qy(8192),qy=new DataView(Wy.buffer,0,8192),Jy=0),(Yy=Wy.length-10)-Jy<2048?(Wy=new Qy(Wy.length),qy=new DataView(Wy.buffer,0,Wy.length),Yy=Wy.length-10,Jy=0):Jy=Jy+7&2147483640,t=Jy,s=l.structuredClone?new Map:null,l.bundleStrings?($y=["",""],Wy[Jy++]=214,Wy[Jy++]=98,$y.position=Jy-t,Jy+=4):$y=null,i=l.structures,i){i.uninitialized&&(i=l._mergeStructures(l.getStructures()));let e=i.sharedLength||0;if(e>d)throw new Error("Shared structures is larger than maximum shared structures, try increasing maxSharedStructures to "+i.sharedLength);if(!i.transitions){i.transitions=Object.create(null);for(let t=0;tYy&&w(Jy),l.offset=Jy;let e=function(e,t){let i,r=6*t.length,n=e.length-r;for(t.sort(((e,t)=>e.offset>t.offset?1:-1));i=t.pop();){let t=i.offset,s=i.id;e.copyWithin(t+r,t,n),r-=6;let a=t+r;e[a++]=214,e[a++]=105,e[a++]=s>>24,e[a++]=s>>16&255,e[a++]=s>>8&255,e[a++]=255&s,n=t}return e}(Wy.subarray(t,Jy),s.idsToInsert);return s=null,e}return o&mx?(Wy.start=t,Wy.end=Jy,Wy):Wy.subarray(t,Jy)}finally{if(i){if(y<10&&y++,v>1e4)i.transitions=null,y=0,v=0,g.length>0&&(g=[]);else if(g.length>0&&!h){for(let e=0,t=g.length;er&&(i=i.slice(0,r));let n=Wy.subarray(t,Jy);return!1===l.saveStructures(i,a)?(l._mergeStructures(l.getStructures()),l.pack(e)):(a=r,n)}}o&gx&&(Jy=t)}};let x=e=>{Jy>Yy&&(Wy=w(Jy));var i,r=typeof e;if("string"===r){let t,r=e.length;if($y&&r>=8&&r<4096){let t=ex.test(e);return $y[t?0:1]+=e,Wy[Jy++]=193,void x(t?-r:r)}t=r<32?1:r<256?2:r<65536?3:5;let n=3*r;if(Jy+n>Yy&&(Wy=w(Jy+n)),r<64||!o){let n,s,a,o=Jy+t;for(n=0;n>6|192,Wy[o++]=63&s|128):55296==(64512&s)&&56320==(64512&(a=e.charCodeAt(n+1)))?(s=65536+((1023&s)<<10)+(1023&a),n++,Wy[o++]=s>>18|240,Wy[o++]=s>>12&63|128,Wy[o++]=s>>6&63|128,Wy[o++]=63&s|128):(Wy[o++]=s>>12|224,Wy[o++]=s>>6&63|128,Wy[o++]=63&s|128);i=o-Jy-t}else i=o(e,Jy+t,n);i<32?Wy[Jy++]=160|i:i<256?(t<2&&Wy.copyWithin(Jy+2,Jy+1,Jy+1+i),Wy[Jy++]=217,Wy[Jy++]=i):i<65536?(t<3&&Wy.copyWithin(Jy+3,Jy+2,Jy+2+i),Wy[Jy++]=218,Wy[Jy++]=i>>8,Wy[Jy++]=255&i):(t<5&&Wy.copyWithin(Jy+5,Jy+3,Jy+3+i),Wy[Jy++]=219,qy.setUint32(Jy,i),Jy+=4),Jy+=i}else if("number"===r)if(e>>>0===e)e<64?Wy[Jy++]=e:e<256?(Wy[Jy++]=204,Wy[Jy++]=e):e<65536?(Wy[Jy++]=205,Wy[Jy++]=e>>8,Wy[Jy++]=255&e):(Wy[Jy++]=206,qy.setUint32(Jy,e),Jy+=4);else if(e>>0===e)e>=-32?Wy[Jy++]=256+e:e>=-128?(Wy[Jy++]=208,Wy[Jy++]=e+256):e>=-32768?(Wy[Jy++]=209,qy.setInt16(Jy,e),Jy+=2):(Wy[Jy++]=210,qy.setInt32(Jy,e),Jy+=4);else{let t;if((t=this.useFloat32)>0&&e<4294967296&&e>=-2147483648){let i;if(Wy[Jy++]=202,qy.setFloat32(Jy,e),t<4||(i=e*Fy[(127&Wy[Jy])<<1|Wy[Jy+1]>>7])>>0===i)return void(Jy+=4);Jy--}Wy[Jy++]=203,qy.setFloat64(Jy,e),Jy+=8}else if("object"===r)if(e){if(s){let i=s.get(e);if(i){if(!i.id){let e=s.idsToInsert||(s.idsToInsert=[]);i.id=e.push(i)}return Wy[Jy++]=214,Wy[Jy++]=112,qy.setUint32(Jy,i.id),void(Jy+=4)}s.set(e,{offset:Jy-t})}let r=e.constructor;if(r===Object)b(e,!0);else if(r===Array){(i=e.length)<16?Wy[Jy++]=144|i:i<65536?(Wy[Jy++]=220,Wy[Jy++]=i>>8,Wy[Jy++]=255&i):(Wy[Jy++]=221,qy.setUint32(Jy,i),Jy+=4);for(let t=0;t>8,Wy[Jy++]=255&i):(Wy[Jy++]=223,qy.setUint32(Jy,i),Jy+=4);for(let[t,i]of e)x(t),x(i)}else{for(let t=0,i=Gy.length;t(Wy=n,n=null,(Jy+=e)>Yy&&w(Jy),{target:Wy,targetView:qy,position:Jy-e})),x)}finally{n&&(qy=s,Jy=a,Yy=(Wy=n).length-10)}return void(r&&(r.length+Jy>Yy&&w(r.length+Jy),Jy=sx(r,Wy,Jy,i.type)))}}b(e,!e.hasOwnProperty)}}else Wy[Jy++]=192;else if("boolean"===r)Wy[Jy++]=e?195:194;else if("bigint"===r){if(e=-(BigInt(1)<0)Wy[Jy++]=207,qy.setBigUint64(Jy,e);else{if(!this.largeBigIntToFloat)throw new RangeError(e+" was too large to fit in MessagePack 64-bit integer format, set largeBigIntToFloat to convert to float-64");Wy[Jy++]=203,qy.setFloat64(Jy,Number(e))}Jy+=8}else if("undefined"===r)this.encodeUndefinedAsNil?Wy[Jy++]=192:(Wy[Jy++]=212,Wy[Jy++]=0,Wy[Jy++]=0);else{if("function"!==r)throw new Error("Unknown type: "+r);x(this.writeFunction&&this.writeFunction())}},b=!1===this.useRecords?this.variableMapSize?e=>{let t,i=Object.keys(e),r=i.length;r<16?Wy[Jy++]=128|r:r<65536?(Wy[Jy++]=222,Wy[Jy++]=r>>8,Wy[Jy++]=255&r):(Wy[Jy++]=223,qy.setUint32(Jy,r),Jy+=4);for(let n=0;n{Wy[Jy++]=222;let r=Jy-t;Jy+=2;let n=0;for(let t in e)(i||e.hasOwnProperty(t))&&(x(t),x(e[t]),n++);Wy[r+++t]=n>>8,Wy[r+t]=255&n}:e=>{let t,i=Object.keys(e),s=n.transitions||(n.transitions=Object.create(null)),a=0;for(let r=0,n=i.length;r=96&&p?(Wy[Jy++]=96+(31&(o-=96)),Wy[Jy++]=o>>5):Wy[Jy++]=o;else{o=n.nextId,o||(o=64),o=m&&(o=f),n.nextId=o+1);let e=i.highByte=o>=96&&p?o-96>>5:-1;s[tx]=o,n[o-64]=i,o=0?(Wy[Jy++]=96+(31&o),Wy[Jy++]=e):Wy[Jy++]=o):(e>=0?(Wy[Jy++]=213,Wy[Jy++]=114,Wy[Jy++]=96+(31&o),Wy[Jy++]=e):(Wy[Jy++]=212,Wy[Jy++]=114,Wy[Jy++]=o),a&&(v+=y*a),g.length>=u&&(g.shift()[tx]=0),g.push(s),x(i))}for(let r=0,n=i.length;r{let i;if(e>16777216){if(e-t>Ky)throw new Error("Packed buffer would be larger than maximum buffer size");i=Math.min(Ky,4096*Math.round(Math.max((e-t)*(e>67108864?1.25:2),4194304)/4096))}else i=1+(Math.max(e-t<<2,Wy.length-1)>>12)<<12;let r=new Qy(i);return qy=new DataView(r.buffer,0,i),Wy.copy?Wy.copy(r,0,t,e):r.set(Wy.slice(t,e)),Jy-=t,t=0,Yy=r.length-10,Wy=r}}useBuffer(e){Wy=e,qy=new DataView(Wy.buffer,Wy.byteOffset,Wy.byteLength),Jy=0}};function rx(e,t,i,r){let n=e.byteLength;if(n+1<256){var{target:s,position:a}=i(4+n);s[a++]=199,s[a++]=n+1}else if(n+1<65536){var{target:s,position:a}=i(5+n);s[a++]=200,s[a++]=n+1>>8,s[a++]=n+1&255}else{var{target:s,position:a,targetView:o}=i(7+n);s[a++]=201,o.setUint32(a,n+1),a+=4}s[a++]=116,s[a++]=t,s.set(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),a)}function nx(e,t){let i=e.byteLength;var r,n;if(i<256){var{target:r,position:n}=t(i+2);r[n++]=196,r[n++]=i}else if(i<65536){var{target:r,position:n}=t(i+3);r[n++]=197,r[n++]=i>>8,r[n++]=255&i}else{var{target:r,position:n,targetView:s}=t(i+5);r[n++]=198,s.setUint32(n,i),n+=4}r.set(e,n)}function sx(e,t,i,r){let n=e.length;switch(n){case 1:t[i++]=212;break;case 2:t[i++]=213;break;case 4:t[i++]=214;break;case 8:t[i++]=215;break;case 16:t[i++]=216;break;default:n<256?(t[i++]=199,t[i++]=n):n<65536?(t[i++]=200,t[i++]=n>>8,t[i++]=255&n):(t[i++]=201,t[i++]=n>>24,t[i++]=n>>16&255,t[i++]=n>>8&255,t[i++]=255&n)}return t[i++]=r,t.set(e,i),i+=n}function ax(e){if(e.Class){if(!e.pack&&!e.write)throw new Error("Extension has no pack or write function");if(e.pack&&!e.type)throw new Error("Extension has no type (numeric code to identify the extension)");Hy.unshift(e.Class),Gy.unshift(e)}!function(e){e.unpack?oy[e.type]=e.unpack:oy[e.type]=e}(e)}Hy=[Date,Set,Error,RegExp,ArrayBuffer,Object.getPrototypeOf(Uint8Array.prototype).constructor,hy],Gy=[{pack(e,t,i){let r=e.getTime()/1e3;if((this.useTimestamp32||0===e.getMilliseconds())&&r>=0&&r<4294967296){let{target:e,targetView:i,position:n}=t(6);e[n++]=214,e[n++]=255,i.setUint32(n,r)}else if(r>0&&r<17179869184){let{target:i,targetView:n,position:s}=t(10);i[s++]=215,i[s++]=255,n.setUint32(s,4e6*e.getMilliseconds()+(r/1e3/4294967296>>0)),n.setUint32(s+4,r)}else if(isNaN(r)){if(this.onInvalidDate)return t(0),i(this.onInvalidDate());let{target:e,targetView:r,position:n}=t(3);e[n++]=212,e[n++]=255,e[n++]=255}else{let{target:i,targetView:n,position:s}=t(15);i[s++]=199,i[s++]=12,i[s++]=255,n.setUint32(s,1e6*e.getMilliseconds()),n.setBigInt64(s+4,BigInt(Math.floor(r)))}}},{pack(e,t,i){let r=Array.from(e),{target:n,position:s}=t(this.structuredClone?3:0);this.structuredClone&&(n[s++]=212,n[s++]=115,n[s++]=0),i(r)}},{pack(e,t,i){let{target:r,position:n}=t(this.structuredClone?3:0);this.structuredClone&&(r[n++]=212,r[n++]=101,r[n++]=0),i([e.name,e.message])}},{pack(e,t,i){let{target:r,position:n}=t(this.structuredClone?3:0);this.structuredClone&&(r[n++]=212,r[n++]=120,r[n++]=0),i([e.source,e.flags])}},{pack(e,t){this.structuredClone?rx(e,16,t):nx(Xy?Buffer.from(e):new Uint8Array(e),t)}},{pack(e,t){let i=e.constructor;i!==Zy&&this.structuredClone?rx(e,zy.indexOf(i.name),t):nx(e,t)}},{pack(e,t){let{target:i,position:r}=t(1);i[r]=193}}];var ox,lx,hx,cx=new ix({useRecords:!1}),{NEVER:dx,ALWAYS:ux,DECIMAL_ROUND:px,DECIMAL_FIT:fx}=(cx.pack,cx.pack,{NEVER:0,ALWAYS:1,DECIMAL_ROUND:3,DECIMAL_FIT:4}),mx=512,gx=1024,vx=new ix({structuredClone:!0});function yx(e){if(nv(e))return e;if(Array.isArray(e))return e.map(yx);if("object"==typeof e&&null!==e){let t={};for(let i of Object.keys(e).sort())t[i]=yx(e[i]);return Object.setPrototypeOf(t,Object.getPrototypeOf(e)),t}return e}ax({Class:$g.prototype.constructor,type:1,write:e=>({...e}),read:e=>(Object.setPrototypeOf(e,$g.prototype),e)}),ax({Class:hv.prototype.constructor,type:2,write:e=>[...e],read:e=>(Object.setPrototypeOf(e,hv.prototype),e)}),ax({Class:lv.prototype.constructor,type:3,write:e=>[...e],read:e=>(Object.setPrototypeOf(e,lv.prototype),e)}),ax({Class:Wv.prototype.constructor,type:4,write:e=>e.id,read:e=>new Wv(e)}),ax({Class:qv.prototype.constructor,type:5,write:e=>e.data,read:e=>new qv(e)}),ax({Class:mv.prototype.constructor,type:6,write:e=>({...e}),read:e=>(Object.setPrototypeOf(e,mv.prototype),e)}),(e=>{function t(e){return vx.pack(e)}e.serialize=t,e.deserialize=function(e){return vx.unpack(e)},e.checksum=function(e){return function(e){var t=0;if(0===e.length)return t;for(let i=0;i{e.is=function(e){return"MouseDown"===e.type||"MouseUp"===e.type||"MousePress"===e.type||"KeyDown"===e.type||"KeyUp"===e.type||"KeyPress"===e.type},e.defaultData=function(e){return"MouseDown"===e||"MouseUp"===e||"MousePress"===e?{type:e,mode:"Object",disabled:!1,runMode:"Once",actions:new hv}:{type:e,disabled:!1,key:void 0,runMode:"Once",actions:new hv}}})(xx||(xx={})),(e=>{e.propertyDefaultData=function(e){return{type:"Property",value:[e??null,"position","x"]}},e.valueDefaultData={type:"Literal",value:0}})(bx||(bx={})),(e=>{e.comparisonDefaultData=function(e){return{type:"Comparison",operator:"==",lOperand:bx.propertyDefaultData(e),rOperand:{...bx.valueDefaultData}}},e.distanceDefaultData=function(e){return{type:"Distance",toObject:e??null,fromObject:e??null,distance:200}},e.stateDefaultData=function(e,t){return{type:"State",object:e??null,state:t??null}}})(wx||(wx={})),(e=>{e.is=function(e){return"Conditional"===e.type},e.defaultData=function(e){return{type:"Conditional",disabled:!1,inActions:new hv,outActions:new hv,condition:wx.distanceDefaultData(e)}}})(_x||(_x={})),(e=>{e.defaultData={type:"DragDrop",cursor:"hand",disabled:!1,dampingFactor:1,objects:[],snapTo:"center",snapSurfaceMode:"bbox",snapSurfaceOffset:0,dropOn:"all",autoOrient:!0,dropDestinations:[],plane:"adaptive",planeMode:"locked",referenceFrame:"global",limits:[-1/0,1/0,-1/0,1/0,-1/0,1/0],drop:!1,resetOnSnapFail:!1,snapSpeed:20,resetSpeed:20,dragDropActions:{drag:new hv,drop:new hv}}})(Sx||(Sx={})),(e=>{e.defaultData={type:"Follow",disabled:!1,maxDelta:0,dampingFactor:1,target:"cursor",plane:"custom",resetOnPointerLeave:!0,resetAfterDistanceLimit:!0,enabledTranslation:[!0,!0,!0],limitDistanceEnabled:!1,limitDistance:1e3,snapDelay:0,resetSpeed:5,actions:new hv}})(Ax||(Ax={})),(e=>{e.defaultData={type:"LookAt",disabled:!1,distance:1e3,dampingFactor:1,target:"cursor",tilt:"up",axis:"z",plane:"custom",resetOnPointerLeave:!0,resetAfterDistanceLimit:!0,enabledRotation:[!0,!0,!0],limitDistanceEnabled:!1,limitDistance:1e3,snapDelay:0,resetSpeed:5}})(Mx||(Mx={})),(e=>{e.is=function(e){return"MouseHover"===e.type},e.defaultData=function(){return{type:"MouseHover",disabled:!1,actions:new hv}}})(Ex||(Ex={})),(e=>{e.is=function(e){return"Scroll"===e.type},e.defaultData=function(){return{type:"Scroll",disabled:!1,steps:100,trigger:"load",startFrom:"enter",enterAnchor:"top",startOffset:0,endAfter:400,actions:new hv}}})(Cx||(Cx={})),(e=>{e.is=function(e){return"Start"===e.type},e.defaultData=function(){return{type:"Start",disabled:!1,actions:new hv}}})(Tx||(Tx={})),(e=>{e.is=function(e){return"Collision"===e.type},e.defaultData=function(){return{type:"Collision",disabled:!1,runMode:"Once",target:"character",actions:new hv}}})(Dx||(Dx={})),(e=>{e.is=function(e){return"Trigger"===e.type},e.defaultData=function(e,t){return{type:"Trigger",disabled:!1,runMode:"Once",target:"all",triggeringObjects:[],actions:new hv,triggerZone:"box",position:t.toArray(),rotation:[0,0,0],size:e.toArray(),radius:e.length()/2,helperVisible:!0}}})(Px||(Px={})),(Ox=Ix||(Ix={})).defaultSizes={mobile:[480,480],tablet:[768,768],desktop:[1200,1200],custom:[769,1200]},Ox.is=function(e){return"Resize"===e.type},Ox.sizeToDevice=function(e){return"string"==typeof e?e:"custom"},Ox.deviceToSize=function(e){return"string"==typeof e?[...Ox.defaultSizes[e]]:[...e]},Ox.defaultData=function(){let e={size:"mobile",operator:"<",actions:new hv},t={size:"tablet",operator:"<",actions:new hv},i={size:[...Ox.defaultSizes.custom],operator:"<>",actions:new hv},r=new hv;return r.push({id:bi.generateUUID(),fi:0,data:e},{id:bi.generateUUID(),fi:1,data:t},{id:bi.generateUUID(),fi:2,data:i}),{type:"Resize",disabled:!1,orientation:"horizontal",breakpoints:r}},Ox.defaultBreakpointData=function(){return{size:[...Ox.defaultSizes.custom],operator:"<>",actions:new hv}},(e=>{e.propertyPaths={Position:["position"],"Position X":["position","x"],"Position Y":["position","y"],"Position Z":["position","z"],Rotation:["rotation"],"Rotation X":["rotation","x"],"Rotation Y":["rotation","y"],"Rotation Z":["rotation","z"],Scale:["scale"],"Scale X":["scale","x"],"Scale Y":["scale","y"],"Scale Z":["scale","z"],Width:["width"],Height:["height"],Depth:["depth"],"Mouse Position X":["mouse","x"],"Mouse Position Y":["mouse","y"],"Mouse Pressed":["mouse","pressed"],"Screen Width":["mouse","width"],"Screen Height":["mouse","height"],"Hit Position X":["raycast","x"],"Hit Position Y":["raycast","y"],"Hit Position Z":["raycast","z"],"Hit Object Position X":["raycast","objX"],"Hit Object Position Y":["raycast","objY"],"Hit Object Position Z":["raycast","objZ"]},e.is=function(e){return"VariableChange"===e.type},e.defaultData=function(){return{disabled:!1,type:"VariableChange",actions:new hv,variableId:"",objectId:null,property:"Position X"}}})(Rx||(Rx={}));var Bx,zx,kx,Nx,Fx,Ux,Vx,jx,Gx,Hx,Wx,qx,Yx,Xx,Qx,Zx,Kx="personal camera",Jx="a218fcc3-276b-49b9-b485-49037fd14f5f",$x=5526619;function eb(e){return"string"==typeof e&&36===e.length&&/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e)}(e=>{e.isEqual=function(e,t){return e[0]===t[0]&&e[1]===t[1]},e.lerp=function(e,t,i){return[e[0]+(t[0]-e[0])*i,e[1]+(t[1]-e[1])*i]}})(Bx||(Bx={})),(kx=zx||(zx={})).isEqual=function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]},kx.add=function(e,t){return[e[0]+t[0],e[1]+t[1],e[2]+t[2]]},kx.sub=function(e,t){return[e[0]-t[0],e[1]-t[1],e[2]-t[2]]},kx.div=function(e,t){return[e[0]/t[0],e[1]/t[1],e[2]/t[2]]},kx.mul=function(e,t){return[e[0]*t[0],e[1]*t[1],e[2]*t[2]]},kx.dist=function(e,t){return Math.hypot(e[0]-t[0],e[1]-t[1],e[2]-t[2])},kx.lerp=function(e,t,i){return[e[0]+(t[0]-e[0])*i,e[1]+(t[1]-e[1])*i,e[2]+(t[2]-e[2])*i]},(e=>{e.isEqual=function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]},e.lerp=function(e,t,i){return[e[0]+(t[0]-e[0])*i,e[1]+(t[1]-e[1])*i,e[2]+(t[2]-e[2])*i,e[3]+(t[3]-e[3])*i]}})(Nx||(Nx={})),(Ux=Fx||(Fx={})).identity=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],Ux.isEqual=function(e,t){for(let i=0;i<16;i++)if(e[i]!==t[i])return!1;return!0},Ux.simplify=function(e){return e??Ux.identity},Ux.applyMatrix4=function(e,t){let i=t.slice(0);for(var r=0,n=t.length;r{e.isRGB=function(e){return"object"==typeof e&&"number"==typeof e.r&&"number"==typeof e.g&&"number"==typeof e.b},e.white={r:1,g:1,b:1},e.red={r:1,g:0,b:0},e.black={r:0,g:0,b:0},e.toRgb255a1=function(e){return{r:Math.round(255*e.r),g:Math.round(255*e.g),b:Math.round(255*e.b),a:1}},e.clone=function(e){return{r:e.r,g:e.g,b:e.b}},e.fromHex=function(e){return{r:((e=Math.floor(e))>>16&255)/255,g:(e>>8&255)/255,b:(255&e)/255}},e.toHex=function(e){return 65536*Math.round(255*e.r)+256*Math.round(255*e.g)+Math.round(255*e.b)},e.equals=function(e,t){return e.r===t.r&&e.g===t.g&&e.b===t.b},e.lerp=function(e,t,i){return{r:e.r+(t.r-e.r)*i,g:e.g+(t.g-e.g)*i,b:e.b+(t.b-e.b)*i}}})(Vx||(Vx={})),(e=>{e.white={...Vx.white,a:1},e.transparent={...Vx.white,a:0},e.from0to1=function(e){return{r:e[0],g:e[1],b:e[2],a:e[3]}},e.fromHexAndA=function(e,t){return{...Vx.fromHex(e),a:t}},e.toRgb255a1=function(e){return{r:Math.round(255*e.r),g:Math.round(255*e.g),b:Math.round(255*e.b),a:e.a}},e.equals=function(e,t){return Vx.equals(e,t)&&e.a===t.a},e.lerp=function(e,t,i){return{r:e.r+(t.r-e.r)*i,g:e.g+(t.g-e.g)*i,b:e.b+(t.b-e.b)*i,a:e.a+(t.a-e.a)*i}}})(jx||(jx={})),(e=>{e.identity={position:[0,0,0],rotation:[0,0,0],scale:[1,1,1]}})(Gx||(Gx={})),(e=>{e.defaultData={mass:1,stiffness:80,damping:10,velocity:0}})(Hx||(Hx={})),(e=>{e.defaultData={control1:[.5,0],control2:[.5,1]}})(Wx||(Wx={})),(e=>{e.linear=[0,0,1,1],e.ease=[.25,.1,.25,1],e.easeIn=[.42,0,1,1],e.easeOut=[0,0,.58,1],e.easeInOut=[.42,0,.58,1]})(qx||(qx={})),(e=>{e.all=["PerspectiveCamera","OrthographicCamera"],e.is=function(t){return e.all.includes(t)}})(Yx||(Yx={})),(e=>{e.DefaultUp=[0,1,0],e.DefaultTargetOffset=1e3,e.defaultData={far:1e5,type:"OrthographicCamera",perspective:{near:70,fov:45,zoom:1},orthographic:{near:-1e5,zoom:1},up:e.DefaultUp,isUpVectorFlipped:!1,targetOffset:e.DefaultTargetOffset},e.getZoom=function(e){return"PerspectiveCamera"===e.type?e.perspective.zoom:e.orthographic.zoom}})(Xx||(Xx={})),(e=>{e.defaultData=function(e,t=.1){return{disabled:!1,type:"linear",hideBase:!1,count:3,radial:{radius:2*Math.max(e[0],e[1]),start:0,end:360,alignment:!1,axis:"y",scale:[1,1,1],rotation:[0,0,0],position:[0,0,0]},toObject:{object:"",spreadType:"random",scale:[0,0,0],rotation:[0,0,0],position:[0,0,0],axis:"x",seed:0,count:99,align:"normal"},linear:{scale:[1,1,1],rotation:[0,0,0],position:[e[0]+e[0]*t,0,0]},grid:{count:[2,2,2],size:e.map((e=>e*(1+t))),useCenter:!0},randomness:!1,randomnessObject:{strength:100,scale:[0,0,0],rotation:[0,0,0],position:[0,0,0],movement:1,seed:0,freqScale:10,noiseType:"perlin"}}},e.merge=function(e,t){let i={...e};if(db.forEach((r=>{Object.assign(i,{[r]:t[r]??e[r]})})),i.radial={...e.radial},t.radial){let r=e.radial,n=t.radial;ub.forEach((e=>{Object.assign(i.radial,{[e]:n[e]??r[e]})}))}if(i.linear={...e.linear},t.linear){let r=e.linear,n=t.linear;pb.forEach((e=>{Object.assign(i.linear,{[e]:n[e]??r[e]})}))}if(i.grid={...e.grid},t.grid){let r=e.grid,n=t.grid;fb.forEach((e=>{Object.assign(i.grid,{[e]:n[e]??r[e]})}))}if(i.toObject={...e.toObject},t.toObject){let r=e.toObject,n=t.toObject;mb.forEach((e=>{Object.assign(i.toObject,{[e]:n[e]??r[e]})}))}if(i.randomnessObject={...e.randomnessObject},t.randomnessObject){let r=e.randomnessObject,n=t.randomnessObject;gb.forEach((e=>{Object.assign(i.randomnessObject,{[e]:n[e]??r[e]})}))}return i}})(Qx||(Qx={})),(e=>{e.defaultData={radial:{},linear:{},grid:{},toObject:{},randomnessObject:{}};let t=["radial","linear","grid","toObject","randomnessObject"];e.toOps=function(e,i){let r=[];void 0!==e.count&&r.push({type:0,path:i,props:{count:e.count}});for(let n of t){let t=e[n];t&&Object.keys(t).length>0&&r.push({type:0,path:[...i,n],props:t})}return r}})(Zx||(Zx={}));var tb,ib,rb,nb,sb,ab,ob,lb,hb,cb,db=["count"],ub=["radius","start","end","position","scale","rotation"],pb=["position","scale","rotation"],fb=["count","size"],mb=["count","position","scale","rotation"],gb=["strength","scale","rotation","position","movement","seed","freqScale"];(e=>{e.all=["PointLight","SpotLight","DirectionalLight","HemisphereLight"],e.is=function(t){return e.all.includes(t)}})(tb||(tb={})),(e=>{e.defaultData=function(e){return function(e){if("PointLight"===e)return{type:e,color:jx.white,intensity:1,distance:2e3,decay:1,shadows:!0,shadowResolution:1024,shadowRadius:1,penumbraSize:.5,depth:1e5};if("SpotLight"===e)return{type:e,color:jx.white,intensity:1,distance:2e3,decay:1,shadows:!0,penumbra:0,angle:30/180*Math.PI,depth:1e5,penumbraSize:.5,shadowResolution:1024,shadowRadius:1};if("DirectionalLight"===e)return{type:e,color:jx.white,intensity:1,shadows:!0,size:2e3,depth:1e5,penumbraSize:.5,shadowResolution:1024,shadowRadius:1};throw new Error("not implemented")}(e)}})(ib||(ib={})),(e=>{e.defaultData={enabled:"visibility",fusedBody:!0,rigidBody:"positioned",density:1,pointMass:0,gravityScale:1,friction:.5,damping:0,restitution:.2,colliderType:"convex",enabledRotation:[!0,!0,!0],enabledTranslation:[!0,!0,!0]}})(rb||(rb={})),(e=>{e.defaultData={castShadow:!0,receiveShadow:!0},e.equals=function(e,t){return e.castShadow===t.castShadow&&e.receiveShadow===t.receiveShadow}})(nb||(nb={})),(e=>{e.defaultData={flatShading:!1,wireframe:!1,side:0},e.equals=function(e,t){return e.flatShading===t.flatShading&&e.side===t.side&&e.wireframe===t.wireframe}})(sb||(sb={})),(e=>{e.defaultData={...sb.defaultData,...nb.defaultData}})(ab||(ab={})),(e=>{e.getMaterialData=function(e,t){let i=[];if("material"in e){let r="string"==typeof e.material?t.materials[e.material]??t.lib.materials[e.material]?.asset:e.material;r&&i.push(r)}else if("materials"in e)for(let r of e.materials){let e="string"==typeof r?t.materials[r]??t.lib.materials[r]?.asset:r;e&&i.push(e)}return i}})(ob||(ob={})),(e=>{e.defaultVideo={data:"",thumb:"/_assets/_videos/catThumb.png",type:"video",name:"Cat video"},e.maxSize=3e7})(lb||(lb={})),(e=>{e.is=function(e){return"texture"===e||"video"===e||"color"===e||"depth"===e||"normal"===e||"gradient"===e||"noise"===e||"fresnel"===e||"rainbow"===e||"toon"===e||"outline"===e||"transmission"===e||"matcap"===e||"displace"===e||"pattern"===e||"light"===e}})(hb||(hb={})),(e=>{e.is=function(e){return"phong"===e||"toon"===e||"lambert"===e||"physical"===e}})(cb||(cb={}));var vb,yb,xb,bb,wb=["mode","gradientType","noiseType","displacementType","projection","cnormal","crop","axis","side"],_b=["wrapping","image","video","name"];(e=>{e.patch=function(e,t){let{texture:i,...r}=t;if(Object.assign(e,r),i){let t=e.texture;t&&Object.assign(t,i)}},e.defaultData=function(e,t){return"light"===e&&t?function(e){let t={mode:0,isMask:!1,visible:!0,bumpMap:void 0,bumpMapIntensity:5,roughnessMap:void 0,alphaOverride:1};switch(e){case"phong":return{...t,category:"phong",specular:{r:.2,g:.2,b:.2},shininess:5,type:"light",visible:!0,mode:0,occlusion:!0,alpha:.6};case"toon":return{...t,category:"toon",specular:{r:.2,g:.2,b:.2},shininess:10,type:"light",alpha:1};case"lambert":return{...t,category:"lambert",emissive:{r:0,g:0,b:0},type:"light",alpha:1,visible:!0,mode:0,occlusion:!0};case"physical":return{...t,category:"physical",roughness:.2,metalness:.2,reflectivity:.2,type:"light",alpha:1,visible:!0,mode:0,occlusion:!0}}}(t):function(e){let t={alpha:1,mode:0,isMask:!1,visible:!0};switch(e){case"texture":return{...t,type:"texture",size:[128,128],blending:0,axis:"x",side:2,projection:0,texture:{image:"image_0",wrapping:1e3,repeat:[1,1],offset:[0,0]},crop:!1};case"video":return{...t,type:"video",size:[128,128],blending:0,axis:"x",side:2,projection:0,texture:{video:lb.defaultVideo,wrapping:1001,repeat:[1,1],offset:[0,0]},crop:!1};case"color":return{...t,type:"color",color:Vx.fromHex($x)};case"depth":return{...t,type:"depth",gradientType:1,smooth:!1,isVector:!0,isWorldSpace:!1,origin:[0,0,0],direction:[1,0,0],colors:[[1,1,1,1],[0,0,0,1]],steps:[0,1],near:50,far:200};case"normal":return{...t,type:"normal",cnormal:[1,1,1]};case"gradient":return{...t,type:"gradient",gradientType:0,smooth:!1,colors:[[0,0,0,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1]],steps:[0,1,1,1,1,1,1,1,1,1],num:2,angle:0,offset:[0,0],morph:[0,0]};case"noise":return{...t,type:"noise",size:[100,100,100],noiseType:0,scale:1,move:1,colorA:{...Vx.fromHex(6710886),a:1},colorB:{...Vx.fromHex(6710886),a:1},colorC:{...Vx.fromHex(16777215),a:1},colorD:{...Vx.fromHex(16777215),a:1},distortion:[1,1],fA:[1.7,9.2],fB:[8.3,2.8],voronoiStyle:0,highCut:1,lowCut:0,smoothness:.3,seed:0,quality:1};case"fresnel":return{...t,type:"fresnel",color:jx.fromHexAndA(16777215,1),bias:.1,scale:1,intensity:2,factor:1};case"rainbow":return{...t,type:"rainbow",filmThickness:30,movement:0,wavelengths:[0,0,0],noiseStrength:0,noiseScale:1,offset:[0,0,0]};case"toon":return{...t,type:"toon",positioning:2,colors:[[0,0,0,1],[.5,.5,.5,1],[.5,.5,.5,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1]],steps:[0,.475,.525,1,1,1,1,1,1,1],num:4,source:[0,1e3,0],isWorldSpace:!0,noiseStrength:0,noiseScale:1,shadowColor:jx.fromHexAndA(0,0),offset:[0,0,0]};case"outline":return{...t,type:"outline",outlineColor:jx.fromHexAndA(0,1),contourColor:jx.fromHexAndA(0,1),outlineWidth:2,contourWidth:5,outlineThreshold:.4,contourThreshold:0,outlineSmoothing:0,contourFrequency:10,contourDirection:[0,1,0],positionalLines:!1,compensation:!0};case"matcap":return{...t,type:"matcap",texture:{image:"matcap_0",wrapping:1001,repeat:[1,1],offset:[0,0]}};case"transmission":return{...t,type:"transmission",thickness:10,ior:1.5,roughness:1};case"displace":return{visible:!0,type:"displace",displacementType:"noise",noiseType:0,scale:10,movement:1,offset:[0,0,0],intensity:8,voronoiStyle:0,smoothness:.3,seed:0,highCut:1,lowCut:0,quality:1};case"pattern":return{...t,type:"pattern",style:0,projection:0,axis:"y",blending:0,offset:[0,0],colorA:{...Vx.fromHex(0),a:1},colorB:{...Vx.fromHex(16777215),a:1},frequency:[10,10],size:.5,variation:0,smoothness:.5,zigzag:0,rotation:0,vertical:[0,1],horizontal:[0,1],sides:6}}}(e)}})(vb||(vb={})),(e=>{function t(e,t="layer1",i="layer2"){let r=new hv;return r.push({fi:0,data:vb.defaultData("light",e),id:t}),r.push({fi:1,data:vb.defaultData("color"),id:i}),{layers:r}}e.isMergable=function(e){return!e.layers.some((e=>"texture"===e.data.type&&0!==e.data.projection||"depth"===e.data.type&&!e.data.isWorldSpace||"noise"===e.data.type||"displace"===e.data.type))},e.getHash=function(e){let t="";return e.layers.forEach((e=>{Object.entries(e.data).forEach((([e,i])=>{t+=`${e}${i}`,Array.isArray(i)?i.forEach((e=>t+=`${e}`)):"object"==typeof i?Object.values(i).forEach((e=>{t+="number"==typeof e?`${e.toFixed(4)}`:`${e}`})):t+=`${i}`}))})),t},e.defaultEmptyData=function(){return{layers:new hv}},e.defaultData=function(e="layer1",i="layer2"){return t("phong",e,i)},e.withName=function(e,t){return{...e,name:t}},e.defaultTwoLayerData=t,e.defaultTwoLayerTextureData=function(e,t="phong",i="layer1",r="layer2"){let n=vb.defaultData("texture");Object.assign(n.texture,{image:e});let s=new hv;return s.push({fi:0,data:n,id:i}),s.push({fi:1,data:vb.defaultData("light",t),id:r}),{layers:s}},e.defaultTwoLayerVideoTextureData=function(e,t="phong",i="layer1",r="layer2"){let n=vb.defaultData("video");Object.assign(n.texture,{video:e});let s=new hv;return s.push({fi:0,data:n,id:i}),s.push({fi:1,data:vb.defaultData("light",t),id:r}),{layers:s}}})(yb||(yb={})),(e=>{e.defaultData=function(){return{points:new hv,roundness:0,shapeHoles:[],isClosed:!1}}})(xb||(xb={})),(e=>{e.defaultData=function(){return{points:new hv,lastInsertionPlane:null,subdivisions:12,isClosed:!1}}})(bb||(bb={}));var Sb,Ab={type:"Ellipse",width:50,height:50,spikes:16,angle:360,innerRadius:0};(e=>{e.merge=function(e,t){let i={...e};return Db.forEach((r=>{Object.assign(i,{[r]:t[r]??e[r]})})),i}})(Sb||(Sb={}));var Mb,Eb,Cb,Tb={shape:Ab,depth:1,offset:0,bevel:50,bevelSides:6,angle:0,twist:0,startScale:1,endScale:1,capType:"flat"},Db=["depth","offset","angle","twist","startScale","endScale"];(e=>{e.is2DParametricMesh=function(e){return"PolygonGeometry"===e||"RectangleGeometry"===e||"StarGeometry"===e||"TriangleGeometry"===e||"EllipseGeometry"===e},e.isParametricMesh=function(e){return"PolygonGeometry"===e||"PolygonGeometry"===e||"RectangleGeometry"===e||"StarGeometry"===e||"TriangleGeometry"===e||"EllipseGeometry"===e||"PathGeometry"===e||"VectorGeometry"===e||"ConeGeometry"===e||"CubeGeometry"===e||"CylinderGeometry"===e||"DodecahedronGeometry"===e||"HelixGeometry"===e||"IcosahedronGeometry"===e||"LatheGeometry"===e||"PyramidGeometry"===e||"SphereGeometry"===e||"PlaneGeometry"===e||"BackdropGeometry"===e||"TorusGeometry"===e||"TorusKnotGeometry"===e||"BooleanGeometry"===e||"TextGeometry"===e}})(Mb||(Mb={})),(e=>{e.merge=function(e,t){let i={...e};return Object.assign(i,t),"PathGeometry"===i.type&&"extrusion"in t&&t.extrusion&&(i.extrusion={...e.extrusion},Object.assign(i.extrusion,Sb.merge(i.extrusion,t.extrusion))),i}})(Eb||(Eb={})),(e=>{e.defaultData=function(e){if("RectangleGeometry"===e)return{width:320,height:320,type:e,cornerRadius:[0,0,0,0],cornerType:0,depth:0,extrudeBevelSize:0,extrudeBevelSegments:1};if("PathGeometry"===e)return{type:e,width:1,height:1,depth:1,path:bb.defaultData(),extrusion:Tb};if("VectorGeometry"===e)return{width:1,height:1,type:e,subdivisions:12,shape:xb.defaultData(),depth:0,extrudeBevelSize:0,extrudeBevelSegments:1};if("BooleanGeometry"===e)return{type:e,operation:2,width:0,height:0,depth:0,phongAngle:35};if("TextGeometry"===e)return{type:e,width:100,height:100,depth:0,horizontalAlign:1,verticalAlign:1,fontSize:16,lineHeight:1.2,letterSpacing:0,text:{textValue:""},textTransform:1,font:"Roboto_regular",extrudeBevelSize:0,extrudeBevelSegments:1};if("SphereGeometry"===e)return{type:"SphereGeometry",width:100,height:100,depth:100,widthSegments:64,heightSegments:64,phiStart:0,phiLength:2*Math.PI,thetaStart:0,thetaLength:180};throw new Error("not implemented")}})(Cb||(Cb={}));var Pb,Ib,Ob,Rb,Lb,Bb,zb,kb,Nb,Fb,Ub,Vb,jb,Gb,Hb,Wb,qb,Yb,Xb,Qb,Zb,Kb,Jb,$b,ew,tw,iw,rw,nw,sw,aw,ow,lw,hw,cw,dw,uw,pw,fw=["width","height","depth"];function mw(e){e.layers.forEach((e=>{if("depth"===e.type&&void 0!==e.colorA){let t=e.colorA,i=e.colorB,r=[[t.r,t.g,t.b,t.a],[i.r,i.g,i.b,i.a]],n=[0,1];for(let e=2;e<10;e++)r.push(r[1]),n.push(1);let s={...Ag(Vv(e),"type","visible","isVector","isWorldSpace","origin","alpha","mode"),near:Math.max(0,e.near),far:Math.max(0,e.far),colors:r,steps:n,num:2,direction:[1,0,0],smooth:!1,gradientType:1};Object.assign(e,s)}else if("depth"===e.type&&1===e.gradientType&&(e.near<0||e.far<0)){let t={...Vv(e),near:Math.max(e.near,0),far:Math.max(e.far,0)};Object.assign(e,t)}}))}function gw(e,t){Object.values(e.shared.materials).forEach((e=>t(e)))}function vw(e,t){e.scene.objects.traverse(((e,i)=>{"materials"in i?i.materials.forEach(((e,r)=>{void 0===e&&(i.materials[r]=yb.defaultData(),e=i.materials[r]),"string"!=typeof e&&t(e)})):"material"in i?"string"!=typeof i.material&&(void 0===i.material&&(i.material=yb.defaultData()),t(i.material)):"Mesh"===i.type&&(void 0===i.material&&(i.material=yb.defaultData()),t(i.material)),"overrides"in i&&Object.values(i.overrides).forEach((e=>{e.material&&"string"!=typeof e.material&&t(e.material)}))}))}function yw(e){void 0===e.layers&&Object.assign(e,yb.defaultTwoLayerData("lambert"))}function xw(e){!e.layers||e.layers.forEach((e=>{if("depth"===e.type&&10===e.colors.length){let t=[...e.colors];t.push(e.colors[9]);let i=[...e.steps];i.push(e.steps[9]);let r={...Vv(e),colors:t,steps:i};Object.assign(e,r)}}))}function bw(e){e.scene.objects.traverse(((e,t)=>{"materials"in t?t.materials.forEach((e=>{"string"!=typeof e&&xw(e)})):"material"in t&&"string"!=typeof t.material&&xw(t.material)})),Object.values(e.shared.materials).forEach((e=>xw(e)))}function ww(e){e.layers&&e.layers.forEach((e=>{"depth"===e.type&&void 0!==e.num&&(e.colors=e.colors.slice(0,e.num),e.steps=e.steps.slice(0,e.num),delete e.num)}))}function _w(e){e.layers&&e.layers.forEach((e=>{(function(e){return"displace"!==e.type})(e)&&void 0===e.isMask&&(e.isMask=!1),("texture"===e.type||"video"===e.type)&&void 0===e.blending&&(e.blending=0),("noise"===e.type||"displace"===e.type&&"noise"===e.displacementType)&&(void 0===e.voronoiStyle&&(e.voronoiStyle=0),void 0===e.highCut&&(e.highCut=1),void 0===e.lowCut&&(e.lowCut=0),void 0===e.smoothness&&(e.smoothness=.3),void 0===e.seed&&(e.seed=0),void 0===e.quality&&(e.quality=1))}))}function Sw(e){let t=e.layers.find((e=>"light"===e.type))?.data;if("basic"===t?.category){let e=vb.defaultData("light","phong"),i=t;Object.assign(i,e),i.visible=!1}}function Aw(e){gw(e,Sw),vw(e,Sw)}function Mw(e){e.layers.forEach((e=>{"light"===e.type&&"toon"!==e.category&&void 0===e.occlusion&&(e.occlusion=!0)}))}function Ew(e){e.layers&&e.layers.forEach((e=>{"light"===e.type&&void 0===e.bumpMapIntensity&&(e.bumpMapIntensity=5)}))}function Cw(e,t){if(t<1&&(vw(e,mw),gw(e,mw),e.schema=1),t<2&&(function(e){Object.assign(e.scene.publish,{orbitControls:{...Kb.defaultData,...Vv(e.scene.publish.orbitControls)}})}(e),e.schema=2),t<3&&(function(e){function t(e){if(e.layers)for(let t of Object.values(e.layers))if(t)for(let[e,i]of Object.entries(t))if((wb.includes(e)||"boolean"==typeof i)&&delete t[e],"texture"===e)for(let[t,r]of Object.entries(i))(_b.includes(t)||"boolean"==typeof r)&&delete i[t]}e.scene.objects.traverse(((e,i)=>{i.states.forEach((e=>{let i=e;i.material?t(i.material):i.materials&&i.materials.forEach((e=>{t(e)}))}))}))}(e),e.schema=3),t<4&&(function(e){e.scene.publish.withBackground=!0}(e),e.schema=4),t<5&&(function(e){e.scene.publish.settings.web={compress:!0,preload:!0,preset:1,logo:!0,hint:!1}}(e),e.schema=5),t<6&&(function(e){e.scene.objects.traverse(((e,t)=>{let i=t.cloner;i&&(i.radial.scale=i.radial.scale.map((e=>e+1)),i.linear.scale=i.linear.scale.map((e=>e+1)))}))}(e),e.schema=6),t<7&&(function(e){e.scene.objects.traverse(((e,t)=>{let i=t.geometry;i&&("DodecahedronGeometry"===i.type||"IcosahedronGeometry"===i.type)&&(i.detail=Math.round(i.detail))}))}(e),e.schema=7),t<8&&(e.schema=8),t<9&&(bw(e),e.schema=9),t<10&&(function(e){e.scene.objects.traverse(((e,t)=>{"Mesh"===t.type&&("BooleanGeometry"===t.geometry.type||"SubdivGeometry"===t.geometry.type)&&(t.geometry.phongAngle=35)}))}(e),e.schema=10),t<11&&(function(e){e.scene.environment.ambientLight.softShadows=!1,e.scene.environment.ambientLight.softShadowQuality="low",e.scene.objects.traverse(((e,t)=>{("DirectionalLight"===t.type||"SpotLight"===t.type)&&(t.shadowResolution=1024,t.shadowRadius=1,t.depth=1e5)})),e.shared.penumbraSize=new Array(5).fill(.5)}(e),e.schema=11),t<12&&(bw(e),e.schema=12),t<13&&(function(e){e.shared.audios=Eg({},$g.prototype)}(e),e.schema=13),t<14&&(function(e){let t=e.shared.materials;Object.entries(t).forEach((([e,i])=>{if(!i.layers){let i={name:"Untitled Material",layers:[{fi:0,data:{type:"light",category:"phong",alpha:.6,visible:!0,mode:0,specular:{r:.2,g:.2,b:.2},shininess:5},id:"layer1"},{fi:1,data:{type:"color",alpha:1,visible:!0,mode:0,color:{r:.2823529411764706,g:.2823529411764706,b:.30196078431372547}},id:"layer2"}]};Object.assign(t,{[e]:i})}}))}(e),e.schema=14),t<15&&(function(e){Object.entries(Vv(e.shared.images)).filter((e=>!1===e[1].asset)).map((e=>e[0])).forEach((t=>{delete e.shared.images[t]})),Object.entries(Vv(e.shared.audios)).filter((e=>!1===e[1].asset)).map((e=>e[0])).forEach((t=>{delete e.shared.audios[t]}))}(e),e.schema=15),t<16&&(function(e){e.scene.publish.settings.web.preload=!1}(e),e.schema=16),t<17&&(vw(e,ww),gw(e,ww),e.schema=17),t<18&&(vw(e,yw),gw(e,yw),e.schema=18),t<19&&(function(e){Object.assign(e.scene.publish.settings,{video:{...Jb.defaultData.settings.video,...Vv(e.scene.publish.settings.video)}})}(e),e.schema=19),t<20&&(function(e){e.shared.fonts=Eg({},$g.prototype)}(e),function(e){let t=[];e.scene.objects.traverse(((i,r)=>{let n=r;if("TextFrame"===n.type){let r=yb.defaultTwoLayerData("phong"),s="string"==typeof n.color?e.shared.colors[n.color]:n.color;r.layers[1].data.color={r:s.r,g:s.g,b:s.b},r.layers[1].data.alpha=n.alpha;let a=function(e){return e.replace(".typeface","").replace(/optimer/gi,"open sans").replace("space_mono","space mono").replace(/alma_mono/gi,"varela round").replace(/droid_sans_mono/gi,"noto sans mono").replace(/droid_sans|gentilis|gnomon_(simple|foreground)|helvetiker/gi,"roboto").replace(/droid_serif/gi,"roboto slab").replace("_sans"," sans").replace("crimson_text","crimson text").replace("medium_medium","medium").replace("fatface_fatface","fatface").replace("100hairline","thin").replace("200thin","extralight").replace("300light","light").replace("500medium","medium").replace("600semi","semibold").replace("800heavy","extrabold").replace("900black","black").replace(/bodoni_(11|16|24|36|48|72|96)([^_])/gi,"bodoni_$1_$2").replace(/bodoni_(11|16|24|36|48|72|96)/gi,"bodoni moda").replace(/(thin|hairline)(_regular)?/gi,"100").replace(/(extra|ultra)light(_regular)?/gi,"200").replace(/light(_regular)?/gi,"300").replace(/_book|_normal|_roman/gi,"_regular").replace(/medium(_regular)?/gi,"500").replace(/(semi|demi)bold(_regular)?/gi,"600").replace(/(extra|ultra)bold(_regular)?/gi,"800").replace(/bold(_regular)?/gi,"700").replace(/(black|heavy|fatface)(_regular)?/gi,"900").replace(/([1-9]00)_italic/gi,"$1italic").replace(/regularitalic/gi,"italic").replace(/regularitalic/gi,"italic").split(" ").map((e=>e.charAt(0).toUpperCase()+e.slice(1))).join(" ")}(n.font);void 0===e.shared.fonts[a]&&(e.shared.fonts[a]={name:a});let o={name:n.name,...Ub.defaultData,...Gb.defaultData,flatShading:!1,wireframe:!1,geometry:{...Cb.defaultData("TextGeometry"),width:n.width,height:n.height,font:a,depth:0,horizontalAlign:n.horizontalAlign,verticalAlign:n.verticalAlign,fontSize:1.40625*n.fontSize,lineHeight:n.lineHeight/1.40625,letterSpacing:n.letterSpacing-1,text:n.text,textTransform:n.textTransform,extrudeBevelSize:0,extrudeBevelSegments:1},material:r,states:Vv(n.states),events:Vv(n.events),visible:n.visible,raycastLock:n.raycastLock,position:n.position,rotation:n.rotation,scale:n.scale,hiddenMatrix:n.hiddenMatrix},l=Vv(e.scene.objects).parent(i);e.scene.objects.insertAfter(l??null,i,[{id:i+"new",data:o,children:[]}]),t.push(i)}})),t.forEach((t=>{e.scene.objects.delete(t)}))}(e),e.schema=20),t<21&&(function(e){let t={0:"MouseDown",1:"MouseUp",2:"MouseHover",5:"KeyDown",6:"KeyUp",7:"Start",9:"LookAt",10:"Follow",11:"Scroll",12:"Audio",13:"GameControl"};e.scene.objects.traverse(((e,i)=>{i.events.forEach((e=>{if(t[Number(e.type)])if(Object.assign(e,{type:t[Number(e.type)]}),"Audio"===e.type&&"audioEvent"in e&&(Object.assign(e,{playAudio:e.audioEvent}),delete e.audioEvent),"GameControl"===e.type)Object.assign(e,{gameActions:{idle:new hv,move:new hv,jump:new hv}});else{let t=new hv;Object.assign(e,{actions:t}),("MouseDown"===e.type||"MouseUp"===e.type||"KeyDown"===e.type||"KeyUp"===e.type)&&"url"in e&&t.push({fi:0,id:bi.generateUUID(),data:{type:"Link",url:e.url,delay:0}}),"targets"in e&&(e.targets.forEach(((e,i,r)=>{let n={easing:e.easing,duration:e.duration};6===e.easing?Object.assign(n,Ag(e,"mass","stiffness","damping","velocity")):5===e.easing&&Object.assign(n,{control1:{...e.control1},control2:{...e.control2}});let s={repeat:e.repeat?-1:0,delay:e.delay,delayDirection:e.delayDirection,direction:e.cycle&&e.rewind?"pingpong-rewind":e.cycle?"pingpong":"normal"},a={state:e.state,...s,...n},o={allowSlerp:!0,type:"Transition",object:e.object,repeat:0,delay:0,delayDirection:void 0,direction:"normal",tweens:new hv({fi:0,id:bi.generateUUID(),data:{state:void 0,repeat:0,delay:0,delayDirection:void 0,direction:"normal",duration:0,easing:4}},{fi:1,id:bi.generateUUID(),data:a})};t.push({fi:r,id:i,data:o})})),delete e.targets)}}))}))}(e),function(e){e.scene.objects.traverse(((e,t)=>{function i(e,i){let r=new hv,n=[];if(t.events.forEach(((e,t,s)=>{if("Audio"===e.type&&e.trigger===i){let i;n.push(t),"play"===e.interaction?i={...Ag(e,"interaction","audio","delay","volume","loop"),triggerAfter:"after"in e?e.after:void 0,toggle:"after"in e?e.toggle:void 0,type:"Audio"}:("pause"===e.interaction||"stop"===e.interaction)&&(i={...Ag(e,"interaction","delay","object","playAudio"),type:"Audio"}),i&&r.push({fi:s,id:t,data:i})}})),n.forEach((e=>t.events.delete(e))),r.length){let i=t.events.find((t=>t.type===e))?.data;i?"actions"in i&&i.actions.insertBefore(null,r):t.events.insertBefore(null,[{id:bi.generateUUID(),data:{type:e,actions:r}}])}}i("Start","start"),i("MouseDown","mouseDown"),i("MouseUp","mouseUp"),i("KeyDown","keyDown"),i("KeyUp","keyUp")}))}(e),e.schema=21),t<22&&(Aw(e),e.schema=22),t<23&&(function(e){e.scene.objects.traverse(((e,t)=>{"Mesh"===t.type&&"SubdivGeometry"===t.geometry.type&&(t.geometry.scaleBaked||(t.geometry.scaleBaked=[1,1,1]))}))}(e),e.schema=23),t<24&&(function(e){e.scene.objects.traverse(((e,t)=>{("Empty"===t.type||"Mesh"===t.type)&&t.cloner&&!t.cloner.randomnessObject&&!t.cloner.toObject&&!t.cloner.randomness&&(t.cloner={...t.cloner,toObject:{object:"",spreadType:"random",scale:[0,0,0],rotation:[0,0,0],position:[0,0,0],axis:"x",seed:0,count:99,align:"normal"},randomness:!1,randomnessObject:{strength:100,scale:[0,0,0],rotation:[0,0,0],position:[0,0,0],movement:1,seed:0,freqScale:10,noiseType:"perlin"}})}))}(e),e.schema=24),(t<25||void 0===e.shared.videos)&&(function(e){e.shared.videos=Eg({},$g.prototype)}(e),t<25&&(e.schema=25)),t<26&&(function(e){e.scene.objects.traverse(((t,i)=>{let r=e.scene.objects.unproxy().parent(t);if(r){let t=Vv(e.scene.objects.data(r));t&&"Mesh"===t.type&&"BooleanGeometry"===t.geometry.type&&"Mesh"===i.type&&(i.visible=!0!==Vv(i).booleanExclude)}}))}(e),e.schema=26),t<27&&(function(e){e.scene.objects.traverse(((e,t)=>{if("Mesh"===t.type){let e=t;"NonParametricGeometry"===t.geometry.type?void 0!==e.material&&delete e.material:void 0!==e.materials&&delete e.materials}}))}(e),e.schema=27),t<28&&(Aw(e),e.schema=28),t<29&&(function(e){function t(e){Object.setPrototypeOf(e,mv.prototype),e.texture&&Object.setPrototypeOf(e.texture,mv.prototype)}function i(e){Object.setPrototypeOf(e,mv.prototype);for(let i in e)t(e[i])}e.scene.objects.traverse(((e,t)=>{t.states.forEach((e=>{let t=e;if(t.material){let e=Vv(t.material).layers;i(e),t.material.layers=e}if(t.materials)for(let r=0;r{"Mesh"===t.type&&"NonParametricGeometry"===t.geometry.type&&!("material"in t)&&!("materials"in t)&&(t.material=yb.defaultTwoLayerData("phong"))}))}(e),e.schema=30),t<31&&(function(e){void 0===e.scene.publish.orbitControls.autoZoom&&(e.scene.publish.orbitControls.autoZoom=!1),e.scene.objects.traverse(((e,t)=>{("OrthographicCamera"===t.type||"PerspectiveCamera"===t.type)&&(void 0===t.orthographic.autoZoom&&(t.orthographic.autoZoom=!1),void 0===t.orthographic.autoZoomFrustumSize&&(t.orthographic.autoZoomFrustumSize=790))}))}(e),e.schema=31),t<33&&(function(e){e.scene.objects.traverse(((e,t)=>{void 0===t.pathSnapping&&(t.pathSnapping={pathId:null,slide:0,offset:0,orientation:"tangential"}),void 0===t.pathSnapping.offset&&(t.pathSnapping.offset=0)}))}(e),e.schema=33),t<34&&(function(e){void 0===e.scene.publish.mouseEventTarget&&(e.scene.publish.mouseEventTarget="canvas"),void 0===e.scene.publish.settings.web.hint&&(e.scene.publish.settings.web.hint=!1)}(e),e.schema=34),t<35&&(function(e){let{video:t}=e.scene.publish.settings;"gif"===t.format&&t.fps>48&&(t.fps=15)}(e),e.schema=35),t<36&&(function(e){e.scene.objects.traverse(((e,t)=>{t.events.forEach((e=>{"GameControl"===e.type&&(e.resetYPosition=Math.abs(e.resetYPosition-t.position[1]))}))}))}(e),e.schema=36),t<37&&(function(e){let t=e.scene.environment.usePhysics;e.scene.objects.traverse(((e,i)=>{t&&null===i.physics?i.collision=!1:i.collision="visibility"}))}(e),e.schema=37),t<38&&(vw(e,_w),gw(e,_w),e.schema=38),t<39&&(function(e){e.scene.objects.traverse(((e,t)=>{t.events.forEach((e=>{"GameControl"===e.type&&(e.navmesh=pw.defaultDataThirdPerson.navmesh)}))}))}(e),e.schema=39),t<40&&(function(e){e.scene.styles||(e.scene.styles=tw.defaultData())}(e),e.schema=40),t<41&&(function(e){void 0===e.scene.environment.ambientLight.occlusion&&(e.scene.environment.ambientLight.occlusion=!1),void 0===e.scene.environment.ambientLight.aoFullRes&&(e.scene.environment.ambientLight.aoFullRes=!1),void 0===e.scene.environment.ambientLight.radius&&(e.scene.environment.ambientLight.radius=256),void 0===e.scene.environment.ambientLight.bias&&(e.scene.environment.ambientLight.bias=.5),void 0===e.scene.environment.ambientLight.aoColor&&(e.scene.environment.ambientLight.aoColor={r:.19607843137254902,g:.19607843137254902,b:.19607843137254902}),vw(e,Mw),gw(e,Mw)}(e),e.schema=41),t<42&&(function(e){e.scene.objects.traverse(((e,t)=>{t.events.forEach((e=>{"GameControl"===e.type&&Object.assign(e.gameActions,{run:new hv})}))}))}(e),e.schema=42),t<43&&(function(e){e.scene.objects.traverse(((e,t)=>{t.events.forEach((e=>{"GameControl"===e.type&&(e.keyAssignments=[...e.keyAssignments,["run","\u21e7"],["none","Ctrl"]])}))}))}(e),e.schema=43),t<99){vw(e,Ew),gw(e,Ew),null===e.scene.publish.playCamera&&(e.scene.publish.playCamera=Kx);let t=Vv(e.scene.objects),i=e.scene.objects;e.scene.publish.playPage=Jx,i.insertBefore(null,null,[{id:Jx,data:{...Xb.defaultData,backgroundColor:e.scene.backgroundColor,fog:e.scene.fog,postprocessing:e.scene.postprocessing,ao:Ag(e.scene.environment.ambientLight,"occlusion","aoFullRes","radius","bias","aoColor"),publish:{playCamera:e.scene.publish.playCamera,gameControlObject:e.scene.publish.gameControlObject},shadow:Ag(e.scene.environment.ambientLight,"softShadowQuality"),globalPhysics:{...Bb.defaultData,...Ag(e.scene.environment,"usePhysics","gravity")},camera:Vv(e.scene.ownerCamera)??Xb.defaultData.camera,name:"Scene"},children:[]}]);for(let e of t)e.id!==rw.TRASH_CAN_ID&&i.move(Jx,e.fi,e.id);let r=0,n=0;e.shared.penumbraSize&&e.scene.objects.traverse(((t,i)=>{"DirectionalLight"===i.type?(i.penumbraSize=e.shared.penumbraSize[Math.min(r,2)],r+=1):"SpotLight"===i.type&&(i.penumbraSize=e.shared.penumbraSize[3+Math.min(n,1)],n+=1),(void 0===i.physics||null===i.physics)&&"Instance"!==i.type&&(i.physics={},Object.assign(i.physics,rb.defaultData)),void 0!==i.physics&&null!==i.physics&&(i.physics.enabled=i.collision??"visibility",delete i.collision)})),e.schema=99}}function Tw(e){e.layers&&e.layers.forEach((e=>{"light"===e.type&&void 0===e.alphaOverride&&(e.alphaOverride=1)}))}(e=>{e.defaultData={enabled:!1,useBackgroundColor:!1,color:Vx.white,near:.1,far:2e3}})(Pb||(Pb={})),(e=>{let t={opacity:1,blendFunction:13,enabled:!1};e.defaultData={enabled:!1,pixelation:{...t,blendFunction:16,granularity:15},bloom:{...t,blendFunction:16,intensity:1,blurScale:1,luminanceThreshold:.25,luminanceSmoothing:.025,kernelSize:3},chromaticAberration:{...t,offset:[2,2]},vignette:{...t,darkness:1,offset:0},hueSaturation:{...t,hue:3,saturation:0},brightnessContrast:{...t,brightness:.25,contrast:0},depthOfField:{...t,focalLength:2,focusDistance:2,bokehScale:2},noise:{...t,blendFunction:16}}})(Ib||(Ib={})),(e=>{e.defaultData={softShadowQuality:"low"}})(Ob||(Ob={})),(e=>{e.defaultData={enabled:!0,color:{r:.8274509803921568,g:.8274509803921568,b:.8274509803921568},intensity:.75}})(Rb||(Rb={})),(e=>{e.defaultData={occlusion:!1,aoFullRes:!1,radius:256,bias:.5,aoColor:{r:.19607843137254902,g:.19607843137254902,b:.19607843137254902}}})(Lb||(Lb={})),(e=>{e.defaultData={usePhysics:!1,gravity:-10}})(Bb||(Bb={})),(e=>{e.defaultData={playCamera:Kx,gameControlObject:null}})(zb||(zb={})),(e=>{e.defaultData={backgroundColor:jx.fromHexAndA(2960946,1),postprocessing:Ib.defaultData,fog:Pb.defaultData,globalPhysics:Bb.defaultData,ambient:Rb.defaultData,ao:Lb.defaultData,shadow:Ob.defaultData,publish:zb.defaultData}})(kb||(kb={})),(e=>{e.isComponentRelated=function(e){return"Component"===e||"Instance"===e},e.isEmptyOrComponent=function(e){return"Empty"===e||"Instance"===e}})(Nb||(Nb={})),(e=>{e.identity={...Gx.identity,hiddenMatrix:Fx.identity},e.fromObject=function(e){return{position:e.position,rotation:e.rotation,scale:e.scale,hiddenMatrix:e.hiddenMatrix}},e.merge=function(e,t){return{position:t?.position||e.position,rotation:t?.rotation||e.rotation,scale:t?.scale||e.scale,hiddenMatrix:t?.hiddenMatrix||e.hiddenMatrix}},e.diff=function(e,t){return function(e){for(let t of Object.keys(e))void 0===e[t]&&delete e[t];return e}({position:zx.isEqual(e.position,t.position)?void 0:t.position,rotation:zx.isEqual(e.rotation,t.rotation)?void 0:t.rotation,scale:zx.isEqual(e.scale,t.scale)?null:t.scale,hiddenMatrix:Fx.isEqual(e.hiddenMatrix,t.hiddenMatrix)?void 0:t.hiddenMatrix})}})(Fb||(Fb={})),(e=>{e.defaultData={states:new hv,events:new hv,visible:!0,raycastLock:!1,physics:rb.defaultData,pathSnapping:{pathId:null,slide:0,offset:0,orientation:"tangential"},...Fb.identity,cloner:null}})(Ub||(Ub={})),(e=>{e.defaultData={type:"Empty",...Ub.defaultData}})(Vb||(Vb={})),(e=>{e.defaultData={type:"Component",...Ub.defaultData}})(jb||(jb={})),(e=>{e.defaultData={type:"Mesh",...Ub.defaultData,...ab.defaultData}})(Gb||(Gb={})),(e=>{e.defaultData={...Ub.defaultData,...Fb.identity,position:[0,0,Xx.DefaultTargetOffset],...Xx.defaultData}})(Hb||(Hb={})),(e=>{e.defaultData=function(e){return{...Ub.defaultData,...ib.defaultData(e)}},e.defaultDirectionalLightData={...e.defaultData("DirectionalLight"),position:[200,300,300],name:"Directional Light",intensity:.7}})(Wb||(Wb={})),(e=>{function t(e,t,i=0){for(;i{function t(e,t){return{...Ub.defaultData,...t,component:e,overrides:new mv,physics:void 0,events:void 0,type:"Instance"}}e.rootOverrideProps=["physics","events"],e.compositeNonOptionalOverrideProps=["geometry"],e.compositeEntireOverrideOverrideProps=["material"],e.ofComponent=t,e.fromComponentData=function(e){let i=Fb.fromObject(e.data);return t(e.id,i)}})(Yb||(Yb={})),(e=>{e.defaultData={type:"Page",...Ub.defaultData,physics:{...rb.defaultData,fusedBody:!1},...kb.defaultData,camera:Hb.defaultData}})(Xb||(Xb={})),(e=>{e.defaultCamera={position:[0,0,1e3],scale:[1,1,1],rotation:[0,0,0],hiddenMatrix:Fx.identity,name:"Play Camera",visible:!0,raycastLock:!1,physics:rb.defaultData,states:new hv,events:new hv,cloner:null,pathSnapping:{pathId:null,orientation:"tangential",slide:0,offset:0},...Xx.defaultData},e.KeysByResetCategory={States:["states"],Events:["events"],Material:["material","materials"],Geometry:["geometry"],Position:["position"],Rotation:["rotation"],Scale:["scale"],Transform:["position","scale","rotation","hiddenMatrix"],Name:["name"],Visibility:["visible","raycastLock","flatShading","wireframe","side"],Shadows:["castShadow","receiveShadow"],Cloner:["cloner"],Physics:["physics"]},e.defaultMeshObject={name:"Rectangle",...Ub.defaultData,...Gb.defaultData,geometry:Cb.defaultData("RectangleGeometry"),material:yb.defaultTwoLayerData("phong","layer1","layer2")},e.defaultBooleanObject={name:"Boolean",...Ub.defaultData,...Gb.defaultData,geometry:Cb.defaultData("BooleanGeometry"),material:yb.defaultTwoLayerData("phong","layer1","layer2")},e.defaultTextObject={name:"Text",...Ub.defaultData,...Gb.defaultData,geometry:Cb.defaultData("TextGeometry"),material:yb.defaultTwoLayerData("phong","layer1","layer2")}})(Qb||(Qb={})),(e=>{e.newEmpty=function(e,t){let i={name:t};return"Mesh"===e.type?(i.geometry={},"material"in e&&(i.material={layers:new mv}),"materials"in e&&(i.materials=e.materials.map((e=>({layers:new mv}))))):Yx.is(e.type)&&(i.perspective={},i.orthographic={}),i},e.toOps=function(e,t){let i,r=[],n={orthographic:0,perspective:0,geometry:0};function s(e,t){for(let[i,n]of Object.entries(t.layers)){let{texture:t,...s}=n;if(void 0!==t&&Object.keys(t).length>0){let n={path:[...e,"layers",i,"texture"],props:t,type:0};r.push(n)}if(Object.keys(s).length>0){let t={path:[...e,"layers",i],props:s,type:0};r.push(t)}}}for(let[a,o]of Object.entries(t))if("name"!==a)if("cloner"===a)r.push(...Zx.toOps(o,["cloner"]));else if("pathSnapping"===a)r.push({path:[a],props:{slide:o.slide,offset:o.offset},type:0});else if("material"===a)s(["material"],o);else if("materials"===a)for(let[e,t]of Object.entries(o))s(["materials",e],t);else if(0===n[a]){if("geometry"===a&&void 0!==o.extrusion){let e={path:[a,"extrusion"],props:o.extrusion,type:0};r.push(e),o={...o},delete o.extrusion}if(Object.keys(o).length>0){let e={path:[a],props:o,type:0};r.push(e)}}else void 0===i&&(i={path:[],props:{},type:0},r.push(i)),i.props[a]=o;return r},e.patch=function(e,t){if(void 0===t)return e;let i={...e};if(Object.assign(i,Fb.merge(i,t)),Object.assign(i,{pathSnapping:Object.assign({},i.pathSnapping,{slide:t.pathSnapping?.slide??i.pathSnapping?.slide??0,offset:t.pathSnapping?.offset??i.pathSnapping?.offset??0})}),Yx.is(e.type)){i.orthographic={...i.orthographic},i.perspective={...i.perspective};let e=t;void 0!==e.orthographic?.zoom&&(i.orthographic.zoom=e.orthographic.zoom),void 0!==e.perspective?.zoom&&(i.perspective.zoom=e.perspective.zoom),void 0!==e.isUpVectorFlipped&&(i.isUpVectorFlipped=e.isUpVectorFlipped),void 0!==e.targetOffset&&(i.targetOffset=e.targetOffset)}else if("Mesh"===e.type)"geometry"in t&&Object.assign(i,{geometry:Eb.merge(i.geometry,t.geometry)}),(t.material||t.materials)&&(i=function(e,t){if(void 0===t)return e;let i={...e};return"material"in i&&"material"in t&&t.material&&(i.material=Uv(i.material,(e=>{if("string"!=typeof e)for(let[i,r]of Object.entries(t.material.layers)){let t=e.layers.data(i);t&&vb.patch(t,r)}})).data),i.materials&&t.materials&&(i.materials=Uv(i.materials,(e=>{for(let r=0;r{e.defaultData={enablePan:!0,enableZoom:!0,enableRotate:!0,enableDamping:!0,rotationLimitsMode:0,rotationVerticalOffset:{min:Math.PI/4,max:Math.PI/4},rotationHorizontalOffset:{min:Math.PI/4,max:Math.PI/4},rotationSoftLimit:2,panLimitsMode:0,panVerticalOffset:{min:250,max:250},panHorizontalOffset:{min:250,max:250},panSoftLimit:2,zoomLimitsEnabled:!1,zoomLimits:{min:.1,max:2},autoRotate:!1,autoRotateSpeed:2,autoRotateClockwise:!0,hoverRotatePanMode:0,hoverRotatePanStrength:20,hoverRotateDamping:.125,isTouchZoom:!0,orbitTouches:2,panTouches:3,resetHoverEffectOnPointerLeave:!0}})(Kb||(Kb={})),(e=>{e.defaultData={orbitControls:Kb.defaultData,playPage:Jx,withBackground:!0,preventScroll:!1,preventTouchScroll:!1,hideCursor:!1,mouseEventTarget:"canvas",joystickSizeAndXYOffset:Array(12).fill(0).map(((e,t)=>{let i=0,r=0;return t<5?r=-30:t<10&&(r=30),0===t||10===t||5===t?i=30:(4===t||11===t||9===t)&&(i=-30),[120,[i,r],"show"]})),settings:{image:{format:"jpg",ratio:1},video:{format:"mp4",imageFormat:"jpg",fps:30,mbps:80,ratio:Math.max(1,typeof window<"u"?Math.floor(window.devicePixelRatio):1),stopMode:"manual",duration:5e3},web:{logo:!0,compress:!0,preset:1,preload:!0,hint:!1}},stopRaycast:!0,hdTransmission:!1}})(Jb||(Jb={})),(e=>{e.defaultData={id:"basic",label:"Basic",style:"None",prompt:""}})($b||($b={})),(e=>{e.defaultData={weather:0,shadows:0,lightOrigin:0,temperature:0,sun:0,camera:0,environment:0,particles:0,nature:0,floor:0}})(ew||(ew={})),(e=>{e.defaultData=()=>({mode:"line-art-both",prompt:"",negativePrompt:"",style:{...$b.defaultData},isRandomSeed:!0,seed:e.generateSeed(),guessMode:!1,advanced:!1,steps:20,guidanceScale:7.5,controlNetScale:1,modifiers:ew.defaultData}),e.generateSeed=()=>Math.round(1e5*Math.random())})(tw||(tw={})),(e=>{e.physicsEnabled=function(e){return void 0!==e.find((e=>"Page"===e.data.type&&e.data.globalPhysics.usePhysics))},e.traverseModuleInstances=function(e,t,i){e.scene.objects.traverseFrom(t,((t,r)=>{if("Instance"===r.type){let n=Ow.getComponentData(e,r.component)?.data;n&&i(t,r,n.events)}else i(t,r,r.events)}))}})(iw||(iw={})),(e=>{function t(e={withLight:!0,withSquare:!0}){let t=[],i=Qb.defaultMeshObject;!0===e.withLight&&t.push({fi:-1,data:Wb.defaultDirectionalLightData,id:"830a2708-8ed9-49cf-a68e-085299899103",children:[]}),!0===e.withSquare&&t.push({fi:1,id:"7ba78968-2a55-48f2-b14c-5191da3e075e",data:i,children:[]});let r=new lv;return r.push({fi:1,id:Jx,data:{...Xb.defaultData,name:"Scene 1"},children:t}),r}function i(t){return{...e.defaultData,objects:Eg(t,lv.prototype)}}e.TRASH_CAN_ID="830a2708-8ed9-49cf-a68e-085299892222",e.defaultData={objects:t(),publish:Jb.defaultData,styles:tw.defaultData()},e.emptyDataWithoutPage=function(){return{objects:new lv,publish:Jb.defaultData,styles:tw.defaultData()}},e.emptyDataWithPage=function(e){return{objects:t(e),publish:Jb.defaultData,styles:tw.defaultData()}},e.withObjs=i,e.withObj=function(e,t){return i([{id:e,data:t,children:[],fi:0}])}})(rw||(rw={})),(e=>{e.defaultData={preset:"fullscreen",allowResponsive:!1,size:[512,512],coords:[0,0],sceneScale:1,color:{r:0,g:0,b:0,a:.5}}})(nw||(nw={})),(e=>{e.emptyImage={data:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVQYV2NgYAAAAAMAAWgmWQ0AAAAASUVORK5CYII=",name:"empty"}})(sw||(sw={})),(e=>{function t(e){return void 0!==e.textValue}function i(e){return"boolean"==typeof e}e.isTextValue=t,e.isNumber=function(e){return"number"==typeof e},e.isBoolean=i,e.typeOfVariable=function(e){return t(e)?"string":i(e)?"boolean":"number"},e.getDisplayedValue=function(t){return e.isTextValue(t)?Array.isArray(t.textValue)?t.textValue.map((e=>e.toString().padStart(t.padding??2,"0"))).join(t.deliminator??":")+(void 0!==t.suffix?" "+t.suffix:""):t.textValue.toString():e.isBoolean(t)?t?"True":"False":e.isNumber(t)?parseFloat(t.toFixed(3)).toString():t.toString()}})(aw||(aw={})),(e=>{e.all=["images","videos","colors","audios","fonts","materials","variables"]})(ow||(ow={})),(e=>{e.all=[...ow.all,"components"]})(lw||(lw={})),(e=>{e.defaultData=function(){return{images:new $g,videos:new $g,colors:new $g,audios:new $g,fonts:new $g,materials:new $g,components:new $g,variables:new $g}}})(hw||(hw={})),(e=>{e.defaultData=function(){return{images:new $g,videos:new $g,colors:new $g,audios:new $g,fonts:new $g,materials:new $g,components:new $g,variables:new $g}}})(cw||(cw={})),(e=>{e.defaultColors=function(){let e={"89b10010-844c-11ec-a8a3-0242ac120002":{r:.5,g:.5,b:.5,a:1,name:"Default Color"}};return Eg(e,$g.prototype)},e.defaultImages=function(e){let t={};return e?.withAITexture&&(t["a1b10010-844c-a8a3-11ec-0242ac2011ec"]={...sw.emptyImage,name:"AI generated image"}),Eg(t,$g.prototype)},e.emptyData=function(){return{catelogs:new $g,materials:new $g,images:new $g,videos:new $g,colors:new $g,audios:new $g,fonts:new $g,variables:new hv,lib:cw.defaultData()}},e.defaultVariables=function(e){switch(e){case"number":return{value:0,name:"Number"};case"boolean":return{value:!1,name:"Boolean"};case"string":return{value:{textValue:"String value"},name:"String"};case"time":let t=[0,0,0];return{name:"Time",value:{textValue:t,deliminator:":",padding:2,suffix:"AM"},dynamicVariableType:"time",format:"HH:mm:ss",format12h24h:"12ampm",timeZone:null,hasEnd:!1,endValue:{textValue:t,deliminator:":",padding:2,suffix:"AM"},autoStart:!0,repeat:!1};case"counter":return{name:"Counter",value:0,dynamicVariableType:"counter",updateInterval:1e3,increment:1,autoStart:!0,hasEnd:!0,endValue:60,repeat:!0,randomStart:!1,range:[0,100],decimals:0};case"random":return{name:"Random",value:0,dynamicVariableType:"random",updateInterval:1e3,increment:1,autoStart:!0,isStatic:!1,hasEnd:!0,endValue:60,repeat:!0,min:0,max:100,decimals:0};default:console.error("Unknown variable type",e)}},e.getFormattedTimerTime=function(e,t){if("HH:mm:ss"===t.format){let t=Math.floor(e/3600),i=Math.floor((e-3600*t)/60);return{textValue:[t,i,Math.round(e-3600*t-60*i)]}}if("mm:ss"===t.format){let t=Math.floor(e/60);return{textValue:[t,Math.round(e-60*t)]}}return e="number"===t.format?Math.round(e):Math.round(1e3*e)/1e3}})(dw||(dw={})),(e=>{e.list=["idle","move","jump","run"]})(uw||(uw={})),(e=>{e.defaultColliderData={type:"capsule",height:200,radius:50,position:[0,0,0],rotation:[0,0,0]},e.defaultDataThirdPerson={moveMode:"walk",forwardDirection:"+z",speedTranslate:1e3,speedRotate:100,runMultiplier:2,rotationMode:"normal",rotBy:"keys",rotByTouch:"drag",delayPos:[.3,.3],delayRot:[.3,.3],keyAssignments:[["moveNegZ","W"],["moveNegX","A"],["movePosZ","S"],["movePosX","D"],["rotPosX","\u25b2"],["rotPosY","\u25c0"],["rotNegX","\u25bc"],["rotNegY","\u25b6"],["jump","Space"],["run","\u21e7"],["none","Ctrl"]],touchControl:!0,joystickPosLoc:5,joystickRotLoc:11,jumpTouchButtonLoc:9,collider:e.defaultColliderData,colliderHelperVisible:!0,collisionEnabled:!0,jumpPower:100,resetYPosition:3e3,alignToGround:!1,autoOrientMove:!0,orientWith:"camera",orientMode:"radial",delayPosCamera:.3,delayRotCamera:.3,camera:"",cameraXAxis:"Limit",cameraYAxis:"Free",cameraRotXLimits:[0,Math.PI/2],cameraRotYLimits:[-Math.PI/2,Math.PI/2],gameActions:{idle:new hv,move:new hv,jump:new hv,run:new hv},navmesh:{enabled:!1,ch:6,cs:6,walkableClimb:5,walkableHeight:1,walkableRadius:0,zones:"all",objects:[],helperVisible:!0,destinationHelperRadius:0,destinationHelperColor:jx.fromHexAndA(3728051,1)}}})(pw||(pw={}));var Dw=180/Math.PI;function Pw(e){e.rotation=e.rotation.slice(0,3).map((e=>e*Dw))}function Iw(e){Pw(e),"Page"===e.type&&Pw(e.camera),e.states?.forEach((e=>{void 0===e.rotation||null===e.rotation||(e.rotation=e.rotation.slice(0,3).map((e=>e*Dw)))}));let t=e.geometry;t&&"SphereGeometry"===t.type&&(t.thetaLength=(t.thetaLength??180)*Dw),t&&"TorusGeometry"===t.type&&(t.arc=t.arc*Dw),t&&"PathGeometry"===t.type&&(t.extrusion.angle*=Dw,t.extrusion.twist*=Dw),"Mesh"===e.type&&"TextGeometry"===e.geometry.type&&(e.geometry.text={textValue:e.geometry.text}),Array.isArray(Vv(e.events))&&e.events?.forEach((e=>{("MouseDown"===e.type||"MouseUp"===e.type||"MousePress"===e.type||"KeyDown"===e.type||"KeyUp"===e.type||"KeyPress"===e.type||"Collision"===e.type||"Trigger"===e.type)&&(e.runMode=e.toggle?"Toggle":"Once")}))}var Ow,Rw=107;function Lw(e,t){t(e.data);for(let i of e.children)Lw(i,t)}function Bw(e){let t=e.schema??104;t!==Rw&&t<105&&(Lw(e.asset,Iw),e.schema=105)}function zw(e){let t=e.schema??0;if(t!==Rw){console.warn("updating from ",t,"to ",Rw),Cw(e,t),t<100&&(void 0===e.scene.publish.joystickSizeAndXYOffset&&(e.scene.publish.joystickSizeAndXYOffset=Jb.defaultData.joystickSizeAndXYOffset),e.schema=100),t<101&&(vw(e,Tw),gw(e,Tw),e.schema=101),t<102&&(function(e){e.scene.objects.traverse(((e,t)=>{let i=t.geometry;i&&"PathGeometry"===i.type&&(i.extrusion.capType="flat",i.extrusion.bevel=50,i.extrusion.bevelSides=6,"Custom"===i.extrusion.shape.type&&(i.extrusion.shape.shapeQuality="low"))}))}(e),e.schema=102),t<104&&(e.shared.catelogs=new $g,e.shared.lib=cw.defaultData(),e.schema=104),t<105&&(function(e){e.shared.variables=Eg({},$g.prototype)}(e),e.scene.objects.traverse(((e,t)=>{Iw(t)})),e.schema=105);for(let t of Object.values(e.shared.lib.components))Bw(t);t<106&&(function(e){let t=Vv(e.shared.variables);e.shared.variables=Eg(Object.entries(t??{}).map((([e,t],i)=>({fi:i,id:e,data:t}))),hv.prototype)}(e),e.schema=106),t<107&&(e.shared.lib.variables=cw.defaultData().variables,e.schema=107)}}function kw(e,t=!1){let i=null!==e[0].index,r=new Set(Object.keys(e[0].attributes)),n=new Set(Object.keys(e[0].morphAttributes)),s={},a={},o=e[0].morphTargetsRelative,l=new En,h=0;for(let c=0;c{e.defaultData={schema:Rw,scene:rw.defaultData,frames:(new $g).add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",nw.defaultData),shared:{...dw.emptyData(),colors:dw.defaultColors()}},e.emptyDataForImports=function(e){let t=rw.emptyDataWithPage(e);return{schema:Rw,scene:t,frames:(new $g).add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",nw.defaultData),shared:{...dw.emptyData(),colors:dw.defaultColors(),images:dw.defaultImages(e)}}},e.emptyData=function(){return{schema:Rw,scene:rw.emptyDataWithPage(),frames:(new $g).add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",nw.defaultData),shared:dw.emptyData()}},e.collabHelper={...fv,updateSchema:e=>(e.schema??0)i&&(i=n,t=r)}return t}function Gw(e,t){t.set(e)}function Hw(e,t,i){let r,n;for(let s=0;s<3;s++){let a=s+3;r=e[s],n=t[s],i[s]=rn?r:n}}function Ww(e,t,i){for(let r=0;r<3;r++){let n=t[e+2*r],s=t[e+2*r+1],a=n-s,o=n+s;ai[r+3]&&(i[r+3]=o)}}function qw(e){let t=e[3]-e[0],i=e[4]-e[1],r=e[5]-e[2];return 2*(t*i+i*r+r*t)}function Yw(e,t,i,r,n=null){let s=1/0,a=1/0,o=1/0,l=-1/0,h=-1/0,c=-1/0,d=1/0,u=1/0,p=1/0,f=-1/0,m=-1/0,g=-1/0,v=null!==n;for(let y=6*t,x=6*(t+i);yl&&(l=n),v&&tf&&(f=t);let x=e[y+2],b=e[y+3],w=x-b,_=x+b;wh&&(h=_),v&&xm&&(m=x);let S=e[y+4],A=e[y+5],M=S-A,E=S+A;Mc&&(c=E),v&&Sg&&(g=S)}r[0]=s,r[1]=a,r[2]=o,r[3]=l,r[4]=h,r[5]=c,v&&(n[0]=d,n[1]=u,n[2]=p,n[3]=f,n[4]=m,n[5]=g)}var Xw=32,Qw=(e,t)=>e.candidate-t.candidate,Zw=new Array(Xw).fill().map((()=>({count:0,bounds:new Float32Array(6),rightCacheBounds:new Float32Array(6),leftCacheBounds:new Float32Array(6),candidate:0}))),Kw=new Float32Array(6);function Jw(e,t){function i(e){u&&u(e/p)}function r(t,n,u,p=null,m=0){if(!f&&m>=l&&(f=!0,h&&(console.warn(`MeshBVH: Max depth of ${l} reached when generating BVH. Consider increasing maxDepth.`),console.warn(e))),u<=c||m>=l)return i(n+u),t.offset=n,t.count=u,t;let g=function(e,t,i,r,n,s){let a=-1,o=0;if(0===s)a=jw(t),-1!==a&&(o=(t[a]+t[a+3])/2);else if(1===s)a=jw(e),-1!==a&&(o=function(e,t,i,r){let n=0;for(let s=t,a=t+i;s=s.candidate?Ww(n,i,s.rightCacheBounds):(Ww(n,i,s.leftCacheBounds),s.count++)}}for(let i=0;i=Xw&&(t=Xw-1);let s=Zw[t];s.count++,Ww(n,i,s.bounds)}let t=Zw[Xw-1];Gw(t.bounds,t.rightCacheBounds);for(let e=Xw-2;e>=0;e--){let t=Zw[e],i=Zw[e+1];Hw(t.bounds,i.rightCacheBounds,t.rightCacheBounds)}let u=0;for(let i=0;i=o;)a--;if(!(s65535?new Uint32Array(new n(4*r)):new Uint16Array(new n(2*r)),e.setIndex(new mn(i,1));for(let e=0;em&&(m=h),d>m&&(m=d);let g=(m-p)/2,v=2*r;s[f+v+0]=p+g,s[f+v+1]=g+(Math.abs(p)+g)*Fw,pt[r+3]&&(t[r+3]=m)}}return s}(e,n),o=e.index.array,l=t.maxDepth,h=t.verbose,c=t.maxLeafTris,d=t.strategy,u=t.onProgress,p=e.index.count/3,f=!1,m=[],g=function(e){if(!e.groups||!e.groups.length)return[{offset:0,count:e.index.count/3}];let t=[],i=new Set;for(let n of e.groups)i.add(n.start),i.add(n.start+n.count);let r=Array.from(i.values()).sort(((e,t)=>e-t));for(let n=0;no&&(o=t);let i=e[c+2];il&&(l=i);let r=e[c+4];rh&&(h=r)}r[0]=n,r[1]=s,r[2]=a,r[3]=o,r[4]=l,r[5]=h}(a,e.offset,e.count,s),r(t,e.offset,e.count,s),m.push(t)}else for(let v of g){let e=new Uw;e.boundingData=new Float32Array(6),Yw(a,v.offset,v.count,e.boundingData,s),r(e,v.offset,v.count,s),m.push(e)}return m}var $w=class{constructor(){this.min=1/0,this.max=-1/0}setFromPointsField(e,t){let i=1/0,r=-1/0;for(let n=0,s=e.length;nr?s:r}this.min=i,this.max=r}setFromPoints(e,t){let i=1/0,r=-1/0;for(let n=0,s=t.length;nr?a:r}this.min=i,this.max=r}isSeparated(e){return this.min>e.max||e.min>this.max}};$w.prototype.setFromBox=function(){let e=new Zi;return function(t,i){let r=i.min,n=i.max,s=1/0,a=-1/0;for(let o=0;o<=1;o++)for(let i=0;i<=1;i++)for(let l=0;l<=1;l++){e.x=r.x*o+n.x*(1-o),e.y=r.y*i+n.y*(1-i),e.z=r.z*l+n.z*(1-l);let h=t.dot(e);s=Math.min(h,s),a=Math.max(h,a)}this.min=s,this.max=a}}();!function(){let e=new $w}();var e_=function(){let e=new Zi,t=new Zi,i=new Zi;return function(r,n,s){let a=r.start,o=e,l=n.start,h=t;i.subVectors(a,l),e.subVectors(r.end,r.start),t.subVectors(n.end,n.start);let c,d,u=i.dot(h),p=h.dot(o),f=h.dot(h),m=i.dot(o),g=o.dot(o)*f-p*p;c=0!==g?(u*p-m*f)/g:0,d=(u+c*p)/f,s.x=c,s.y=d}}(),t_=function(){let e=new wi,t=new Zi,i=new Zi;return function(r,n,s,a){e_(r,n,e);let o=e.x,l=e.y;if(o>=0&&o<=1&&l>=0&&l<=1)return r.at(o,s),void n.at(l,a);if(o>=0&&o<=1)return l<0?n.at(0,a):n.at(1,a),void r.closestPointToPoint(a,!0,s);if(l>=0&&l<=1)return o<0?r.at(0,s):r.at(1,s),void n.closestPointToPoint(s,!0,a);{let e,h;e=o<0?r.start:r.end,h=l<0?n.start:n.end;let c=t,d=i;return r.closestPointToPoint(h,!0,t),n.closestPointToPoint(e,!0,i),c.distanceToSquared(h)<=d.distanceToSquared(e)?(s.copy(c),void a.copy(h)):(s.copy(e),void a.copy(d))}}}(),i_=function(){let e=new Zi,t=new Zi,i=new rs,r=new Dc;return function(n,s){let{radius:a,center:o}=n,{a:l,b:h,c:c}=s;if(r.start=l,r.end=h,r.closestPointToPoint(o,!0,e).distanceTo(o)<=a||(r.start=l,r.end=c,r.closestPointToPoint(o,!0,e).distanceTo(o)<=a)||(r.start=h,r.end=c,r.closestPointToPoint(o,!0,e).distanceTo(o)<=a))return!0;let d=s.getPlane(i);if(Math.abs(d.distanceToPoint(o))<=a){let e=d.projectPoint(o,t);if(s.containsPoint(e))return!0}return!1}}();function r_(e){return Math.abs(e)<1e-15}var n_=class extends hn{constructor(...e){super(...e),this.isExtendedTriangle=!0,this.satAxes=new Array(4).fill().map((()=>new Zi)),this.satBounds=new Array(4).fill().map((()=>new $w)),this.points=[this.a,this.b,this.c],this.sphere=new vr,this.plane=new rs,this.needsUpdate=!0}intersectsSphere(e){return i_(e,this)}update(){let e=this.a,t=this.b,i=this.c,r=this.points,n=this.satAxes,s=this.satBounds,a=n[0],o=s[0];this.getNormal(a),o.setFromPoints(a,r);let l=n[1],h=s[1];l.subVectors(e,t),h.setFromPoints(l,r);let c=n[2],d=s[2];c.subVectors(t,i),d.setFromPoints(c,r);let u=n[3],p=s[3];u.subVectors(i,e),p.setFromPoints(u,r),this.sphere.setFromPoints(this.points),this.plane.setFromNormalAndCoplanarPoint(a,e),this.needsUpdate=!1}};n_.prototype.closestPointToSegment=function(){let e=new Zi,t=new Zi,i=new Dc;return function(r,n=null,s=null){let a,{start:o,end:l}=r,h=this.points,c=1/0;for(let d=0;d<3;d++){let o=(d+1)%3;i.start.copy(h[d]),i.end.copy(h[o]),t_(i,r,e,t),a=e.distanceToSquared(t),a1-1e-10){let e=this.satBounds,a=this.satAxes;i[0]=u.a,i[1]=u.b,i[2]=u.c;for(let t=0;t<4;t++){let n=e[t],s=a[t];if(r.setFromPoints(s,i),n.isSeparated(r))return!1}let o=u.satBounds,l=u.satAxes;t[0]=this.a,t[1]=this.b,t[2]=this.c;for(let i=0;i<4;i++){let e=o[i],n=l[i];if(r.setFromPoints(n,t),e.isSeparated(r))return!1}for(let h=0;h<4;h++){let e=a[h];for(let a=0;a<4;a++){let o=l[a];if(s.crossVectors(e,o),r.setFromPoints(s,t),n.setFromPoints(s,i),r.isSeparated(n))return!1}}return p&&(f||console.warn("ExtendedTriangle.intersectsTriangle: Triangles are coplanar which does not support an output edge. Setting edge to 0, 0, 0."),p.start.set(0,0,0),p.end.set(0,0,0)),!0}{let e=this.points,t=!1,i=0;for(let o=0;o<3;o++){let r=e[o],n=e[(o+1)%3];h.start.copy(r),h.end.copy(n),h.delta(a);let s=t?c.start:c.end,l=r_(g.distanceToPoint(r));if(r_(g.normal.dot(a))&&l){c.copy(h),i=2;break}if((g.intersectLine(h,s)||l)&&!r_(s.distanceTo(n))){if(i++,t)break;t=!0}}if(1===i&&u.containsPoint(c.end))return p&&(p.start.copy(c.end),p.end.copy(c.end)),!0;if(2!==i)return!1;let r=u.points,n=!1,s=0;for(let a=0;a<3;a++){let e=r[a],t=r[(a+1)%3];h.start.copy(e),h.end.copy(t),h.delta(o);let i=n?d.start:d.end,l=r_(m.distanceToPoint(e));if(r_(m.normal.dot(o))&&l){d.copy(h),s=2;break}if((m.intersectLine(h,i)||l)&&!r_(i.distanceTo(t))){if(s++,n)break;n=!0}}if(1===s&&this.containsPoint(d.end))return p&&(p.start.copy(d.end),p.end.copy(d.end)),!0;if(2!==s)return!1;if(c.delta(a),d.delta(o),a.dot(o)<0){let e=d.start;d.start=d.end,d.end=e}let f=c.start.dot(a),v=c.end.dot(a),y=d.start.dot(a),x=d.end.dot(a);return(f===x||y===v||v0?p.start.copy(c.start):p.start.copy(d.start),l.subVectors(c.end,d.end),l.dot(a)<0?p.end.copy(c.end):p.end.copy(d.end)),!0)}}}(),n_.prototype.distanceToPoint=function(){let e=new Zi;return function(t){return this.closestPointToPoint(t,e),t.distanceTo(e)}}(),n_.prototype.distanceToTriangle=function(){let e=new Zi,t=new Zi,i=["a","b","c"],r=new Dc,n=new Dc;return function(s,a=null,o=null){let l=a||o?r:null;if(this.intersectsTriangle(s,l))return(a||o)&&(a&&l.getCenter(a),o&&l.getCenter(o)),0;let h=1/0;for(let t=0;t<3;t++){let r,n=i[t],l=s[n];this.closestPointToPoint(l,e),r=l.distanceToSquared(e),rnew Zi)),this.satAxes=new Array(3).fill().map((()=>new Zi)),this.satBounds=new Array(3).fill().map((()=>new $w)),this.alignedSatBounds=new Array(3).fill().map((()=>new $w)),this.needsUpdate=!1,e&&this.min.copy(e),t&&this.max.copy(t),i&&this.matrix.copy(i)}set(e,t,i){this.min.copy(e),this.max.copy(t),this.matrix.copy(i),this.needsUpdate=!0}copy(e){this.min.copy(e.min),this.max.copy(e.max),this.matrix.copy(e.matrix),this.needsUpdate=!0}};s_.prototype.update=function(){let e=this.matrix,t=this.min,i=this.max,r=this.points;for(let l=0;l<=1;l++)for(let n=0;n<=1;n++)for(let s=0;s<=1;s++){let a=r[1*l|2*n|4*s];a.x=l?i.x:t.x,a.y=n?i.y:t.y,a.z=s?i.z:t.z,a.applyMatrix4(e)}let n=this.satBounds,s=this.satAxes,a=r[0];for(let l=0;l<3;l++){let e=s[l],t=n[l],i=r[1<new Dc)),i=new Array(12).fill().map((()=>new Dc)),r=new Zi,n=new Zi;return function(s,a=0,o=null,l=null){if(this.needsUpdate&&this.update(),this.intersectsBox(s))return(o||l)&&(s.getCenter(n),this.closestPointToPoint(n,r),s.closestPointToPoint(r,n),o&&o.copy(r),l&&l.copy(n)),0;let h=a*a,c=s.min,d=s.max,u=this.points,p=1/0;for(let e=0;e<8;e++){let t=u[e];n.copy(t).clamp(c,d);let i=t.distanceToSquared(n);if(i0&&h.normal.multiplyScalar(-1));let t={a:s,b:a,c:o,normal:new Zi,materialIndex:0};hn.getNormal(a_,o_,l_,t.normal),h.face=t,h.faceIndex=s}return h}function v_(e,t,i,r,n){let s=3*r,a=e.index.getX(s),o=e.index.getX(s+1),l=e.index.getX(s+2),{position:h,normal:c,uv:d,uv1:u}=e.attributes,p=g_(i,h,c,d,u,a,o,l,t);return p?(p.faceIndex=r,n&&n.push(p),p):null}function y_(e,t,i,r){let n=e.a,s=e.b,a=e.c,o=t,l=t+1,h=t+2;i&&(o=i.getX(t),l=i.getX(t+1),h=i.getX(t+2)),n.x=r.getX(o),n.y=r.getY(o),n.z=r.getZ(o),s.x=r.getX(l),s.y=r.getY(l),s.z=r.getZ(l),a.x=r.getX(h),a.y=r.getY(h),a.z=r.getZ(h)}function x_(e,t,i,r,n,s,a){let o=i.index,l=i.attributes.position;for(let h=e,c=t+e;h=0;c?(n=A_(e),a=M_(e,o)):(n=M_(e,o),a=A_(e));let d=R_(n,s,r,C_)?P_(n,t,i,r):null;if(d){let e=d.point[h];if(c?e<=s[a+l]:e>=s[a+l+3])return d}let u=R_(a,s,r,C_)?P_(a,t,i,r):null;return d&&u?d.distance<=u.distance?d:u:d||u||null}}var I_=function(){let e,t,i=[],r=new b_((()=>new $i));return function(...s){e=r.getPrimitive(),t=r.getPrimitive(),i.push(e,t);let a=n(...s);r.releasePrimitive(e),r.releasePrimitive(t),i.pop(),i.pop();let o=i.length;return o>0&&(t=i[o-1],e=i[o-2]),a};function n(i,r,s,a,o=null,l=0,h=0){function c(e){let t=2*e,i=z_,r=k_;for(;!w_(t,i);)t=2*(e=A_(e));return __(e,r)}function d(e){let t=2*e,i=z_,r=k_;for(;!w_(t,i);)t=2*(e=M_(e,r));return __(e,r)+S_(t,i)}let u=2*i,p=B_,f=z_,m=k_;if(w_(u,f)){let t=__(i,m),r=S_(u,f);return Vw(i,p,e),a(t,r,!1,h,l+i,e)}{let u,g,v,y,x=A_(i),b=M_(i,m),w=x,_=b;if(o&&(v=e,y=t,Vw(w,p,v),Vw(_,p,y),u=o(v),g=o(y),gn.intersectsBox(e),intersectsTriangle:e=>{e.a.applyMatrix4(h),e.b.applyMatrix4(h),e.c.applyMatrix4(h),e.needsUpdate=!0;for(let i=3*v,r=3*(y+v);inew n_)),eS=class{static serialize(e,t={}){if(t.isBufferGeometry)return console.warn("MeshBVH.serialize: The arguments for the function have changed. See documentation for new signature."),eS.serialize(arguments[0],{cloneBuffers:void 0===arguments[2]||arguments[2]});t={cloneBuffers:!0,...t};let i,r=e.geometry,n=e._roots,s=r.getIndex();return i=t.cloneBuffers?{roots:n.map((e=>e.slice())),index:s.array.slice()}:{roots:n,index:s.array},i}static deserialize(e,t,i={}){if("boolean"==typeof i)return console.warn("MeshBVH.deserialize: The arguments for the function have changed. See documentation for new signature."),eS.deserialize(arguments[0],arguments[1],{setIndex:void 0===arguments[2]||arguments[2]});i={setIndex:!0,...i};let{index:r,roots:n}=e,s=new eS(t,{...i,[V_]:!0});if(s._roots=n,i.setIndex){let i=t.getIndex();if(null===i){let i=new mn(e.index,1,!1);t.setIndex(i)}else i.array!==r&&(i.array.set(r),i.needsUpdate=!0)}return s}constructor(e,t={}){if(!e.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");if((t=Object.assign({strategy:0,maxDepth:40,maxLeafTris:10,verbose:!0,useSharedArrayBuffer:!1,setBoundingBox:!0,onProgress:null,[V_]:!1},t)).useSharedArrayBuffer&&typeof SharedArrayBuffer>"u")throw new Error("MeshBVH: SharedArrayBuffer is not available.");this._roots=null,t[V_]||(this._roots=function(e,t){let i,r,n,s=Jw(e,t),a=[],o=t.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer;for(let c=0;cMath.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return r[s+6]=i/4,i=h(i,a),r[s+7]=o,i}}}(e,t),!e.boundingBox&&t.setBoundingBox&&(e.boundingBox=this.getBoundingBox(new $i))),this.geometry=e}refit(e=null){e&&Array.isArray(e)&&(e=new Set(e));let t,i,r,n,s=this.geometry,a=s.index.array,o=s.attributes.position,l=0,h=this._roots;for(let d=0,u=h.length;dd&&(d=i),ru&&(u=r),np&&(p=n)}return(n[t+0]!==s||n[t+1]!==l||n[t+2]!==c||n[t+3]!==d||n[t+4]!==u||n[t+5]!==p)&&(n[t+0]=s,n[t+1]=l,n[t+2]=c,n[t+3]=d,n[t+4]=u,n[t+5]=p,!0)}{let r=t+8,a=i[t+6],o=r+s,h=a+s,d=l,u=!1,p=!1;e?d||(u=e.has(o),p=e.has(h),d=!u&&!p):(u=!0,p=!0);let f=d||p,m=!1;(d||u)&&(m=c(r,s,d));let g=!1;f&&(g=c(a,s,d));let v=m||g;if(v)for(let e=0;e<3;e++){let i=r+e,s=a+e,o=n[i],l=n[i+3],h=n[s],c=n[s+3];n[t+e]=oc?l:c}return v}}}traverse(e,t=0){let i=this._roots[t],r=new Uint32Array(i),n=new Uint16Array(i);!function t(s,a=0){let o=2*s,l=65535===n[o+15];if(l){let t=r[s+6],h=n[o+14];e(a,l,new Float32Array(i,4*s,6),t,h)}else{let n=s+8,o=r[s+6],h=r[s+7];e(a,l,new Float32Array(i,4*s,6),h)||(t(n,a+1),t(o,a+1))}}(0)}raycast(e,t=U){let i=this._roots,r=this.geometry,n=[],s=t.isMaterial,a=Array.isArray(t),o=r.groups,l=s?t.side:t;for(let h=0,c=i.length;h{let s=3*i;return e(t,s,s+1,s+2,r,n)}}e={boundsTraverseOrder:i,intersectsBounds:e,intersectsTriangle:t,intersectsRange:null},console.warn("MeshBVH: Shapecast function signature has changed and now takes an object of callbacks as a second argument. See docs for new signature.")}let n=$_.getPrimitive(),{boundsTraverseOrder:s,intersectsBounds:a,intersectsRange:o,intersectsTriangle:l}=e;if(o&&l){let e=o;o=(t,i,s,a,o)=>!!e(t,i,s,a,o)||x_(t,i,r,l,s,a,n)}else o||(o=l?(e,t,i,s)=>x_(e,t,r,l,i,s,n):(e,t,i)=>i);let h=!1,c=0;for(let d of this._roots){if(F_(d),h=I_(0,r,a,o,s,c),U_(),h)break;c+=d.byteLength}return $_.releasePrimitive(n),h}bvhcast(e,t,i){let{intersectsRanges:r,intersectsTriangles:n}=i,s=this.geometry.index,a=this.geometry.attributes.position,o=e.geometry.index,l=e.geometry.attributes.position;H_.copy(t).invert();let h=$_.getPrimitive(),c=$_.getPrimitive();if(n){let e=function(e,i,r,d,u,p,f,m){for(let g=r,v=r+d;gG_.intersectsBox(e),intersectsRange:(t,i,n,s,a,o)=>(j_.copy(o),j_.applyMatrix4(H_),e.shapecast({intersectsBounds:e=>j_.intersectsBox(e),intersectsRange:(e,n,o,l,h)=>r(t,i,e,n,s,a,l,h)}))});return $_.releasePrimitive(h),$_.releasePrimitive(c),d}intersectsBox(e,t){return W_.set(e.min,e.max,t),W_.needsUpdate=!0,this.shapecast({intersectsBounds:e=>W_.intersectsBox(e),intersectsTriangle:e=>W_.intersectsTriangle(e)})}intersectsSphere(e){return this.shapecast({intersectsBounds:t=>e.intersectsBox(t),intersectsTriangle:t=>t.intersectsSphere(e)})}closestPointToGeometry(e,t,i={},r={},n=0,s=1/0){e.boundingBox||e.computeBoundingBox(),W_.set(e.boundingBox.min,e.boundingBox.max,t),W_.needsUpdate=!0;let a=this.geometry,o=a.attributes.position,l=a.index,h=e.attributes.position,c=e.index,d=$_.getPrimitive(),u=$_.getPrimitive(),p=X_,f=Q_,m=null,g=null;r&&(m=Z_,g=K_);let v=1/0,y=null,x=null;return H_.copy(t).invert(),q_.matrix.copy(H_),this.shapecast({boundsTraverseOrder:e=>W_.distanceToBox(e),intersectsBounds:(e,t,i)=>i{if(e.boundsTree)return e.boundsTree.shapecast({boundsTraverseOrder:e=>q_.distanceToBox(e),intersectsBounds:(e,t,i)=>i{for(let a=3*e,b=3*(e+s);a(Y_.copy(e).clamp(t.min,t.max),Y_.distanceToSquared(e)),intersectsBounds:(e,t,i)=>i{t.closestPointToPoint(e,Y_);let r=e.distanceToSquared(Y_);return r{Vw(0,new Float32Array(t),J_),e.union(J_)})),e}},tS=d(p()),iS=.5*(Math.sqrt(3)-1),rS=(3-Math.sqrt(3))/6,nS=1/6,sS=(Math.sqrt(5),Math.sqrt(5),e=>0|Math.floor(e)),aS=new Float64Array([1,1,-1,1,1,-1,-1,-1,1,0,-1,0,1,0,-1,0,0,1,0,-1,0,1,0,-1]),oS=new Float64Array([1,1,0,-1,1,0,1,-1,0,-1,-1,0,1,0,1,-1,0,1,1,0,-1,-1,0,-1,0,1,1,0,-1,1,0,1,-1,0,-1,-1]);function lS(e=Math.random){let t=hS(e),i=new Float64Array(t).map((e=>aS[e%12*2])),r=new Float64Array(t).map((e=>aS[e%12*2+1]));return function(e,n){let s,a,o=0,l=0,h=0,c=(e+n)*iS,d=sS(e+c),u=sS(n+c),p=(d+u)*rS,f=e-(d-p),m=n-(u-p);f>m?(s=1,a=0):(s=0,a=1);let g=f-s+rS,v=m-a+rS,y=f-1+2*rS,x=m-1+2*rS,b=255&d,w=255&u,_=.5-f*f-m*m;if(_>=0){let e=b+t[w];_*=_,o=_*_*(i[e]*f+r[e]*m)}let S=.5-g*g-v*v;if(S>=0){let e=b+s+t[w+a];S*=S,l=S*S*(i[e]*g+r[e]*v)}let A=.5-y*y-x*x;if(A>=0){let e=b+1+t[w+1];A*=A,h=A*A*(i[e]*y+r[e]*x)}return 70*(o+l+h)}}function hS(e){let t=new Uint8Array(512);for(let i=0;i<256;i++)t[i]=i;for(let i=0;i<255;i++){let r=i+~~(e()*(256-i)),n=t[i];t[i]=t[r],t[r]=n}for(let i=256;i<512;i++)t[i]=t[i-256];return t}var cS,dS=new hn,uS=class{constructor(e){this.weightAttribute=null;let t=e.geometry;if(!t.isBufferGeometry||3!==t.attributes.position.itemSize)throw new Error("THREE.MeshSurfaceSampler: Requires BufferGeometry triangle mesh.");t.index&&(t=t.toNonIndexed()),this.geometry=t,this.randomFunction=Math.random,this.positionAttribute=this.geometry.getAttribute("position"),this.distribution=null}build(){let e=this.positionAttribute,t=new Float32Array(e.count/3);for(let r=0;re){n=s;break}e1&&(r=1-r,n=1-n),dS.a.fromBufferAttribute(this.positionAttribute,3*e),dS.b.fromBufferAttribute(this.positionAttribute,3*e+1),dS.c.fromBufferAttribute(this.positionAttribute,3*e+2),t.set(0,0,0).addScaledVector(dS.a,r).addScaledVector(dS.b,n).addScaledVector(dS.c,1-(r+n)),dS.getNormal(i),this}},pS=d(f()),fS=new Er,mS=new Er,gS=new Er;(e=>{e.is=function(e){return e&&e.__isSPEObject}})(cS||(cS={}));var vS,yS=e=>class extends e{constructor(){super(...arguments),this.previousModelViewMatrix=new Er,this.copyPreviousMatrix=!0,this.hiddenMatrix=new Er,this.matrixWorldRigid=new Er,this.shearScale=new Er,this.shearScaleInv=new Er}get __isSPEObject(){return!0}isDescendantOf(e){e instanceof Kr&&(e=e.uuid);let t=this;for(;t.parent;){if(t.parent.uuid===e)return!0;t=t.parent}return!1}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(null===this.parent?this.matrixWorld.multiplyMatrices(this.hiddenMatrix,this.matrix):(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.hiddenMatrix),this.matrixWorld.multiplyMatrices(this.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);for(let t of this.children)t.updateMatrixWorld(e)}updateWorldMatrix(e,t){let i=this.parent;if(e&&null!==i&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),null===this.parent?this.matrixWorld.multiplyMatrices(this.hiddenMatrix,this.matrix):(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.hiddenMatrix),this.matrixWorld.multiplyMatrices(this.matrixWorld,this.matrix)),t)for(let r of this.children)r.updateWorldMatrix(!1,!0)}traverseChildren(e,t=0){for(let i of this.children)cS.is(i)&&i.traverseObject(e,t+1)}traverseObject(e,t=0){if(!0!==e(this,t))for(let i of this.children)cS.is(i)&&i.traverseObject(e,t+1)}updateMatrixWorldSVD(){let e=this.matrixWorld.elements,t=[[e[0],e[4],e[8]],[e[1],e[5],e[9]],[e[2],e[6],e[10]]],{u:i,v:r,q:n}=(0,pS.SVD)(t),s=fS.set(i[0][0],i[0][1],i[0][2],0,i[1][0],i[1][1],i[1][2],0,i[2][0],i[2][1],i[2][2],0,0,0,0,1),a=mS.set(r[0][0],r[0][1],r[0][2],0,r[1][0],r[1][1],r[1][2],0,r[2][0],r[2][1],r[2][2],0,0,0,0,1),o=gS.copy(a).transpose();this.shearScale.makeScale(n[0],n[1],n[2]).multiply(o).premultiply(a),this.shearScaleInv.copy(this.shearScale).invert(),this.matrixWorldRigid.multiplyMatrices(s,o).copyPosition(this.matrixWorld),n.every((e=>Math.abs(n[0]-e)<.01))?this.hasNonUniformScale=!1:this.hasNonUniformScale=!0}attach(e,t){this.updateWorldMatrix(!0,!1);let i=(new Er).copy(this.matrixWorld).invert();return null!==e.parent&&(e.parent.updateWorldMatrix(!0,!1),i.multiply(e.parent.matrixWorld)),"hiddenMatrix"in e&&e.hiddenMatrix instanceof Er?e.hiddenMatrix.premultiply(i):e.applyMatrix4(i),e.updateWorldMatrix(!1,!1),this.add(e),void 0!==t&&(this.children.pop(),this.children.splice(t,0,e)),this}copy(e,t=!1){return super.copy(e,t),this.hasNonUniformScale=e.hasNonUniformScale,this}onAfterRender(e,t,i,r,n,s){this.copyPreviousMatrix&&this.previousModelViewMatrix.copy(this.modelViewMatrix)}},xS=class extends(yS(Kr)){},bS=class extends xS{constructor(e){super(),this.object=e,this.matrixAutoUpdate=!1,this.hasNonUniformScale=e.hasNonUniformScale}raycast(e,t){}expand(){let e=0,t=this.object.entityChildren(e);for(;t;){let i=this.children[e];i?.object!==t&&(i&&this.remove(i),i=new bS(t),this.add(i),this.children.splice(e,0,this.children.pop()),i.matrixWorldNeedsUpdate=!0,i.matrixAutoUpdate=!1,i.matrix=t.matrix,i.hiddenMatrix=t.hiddenMatrix),i.expand(),e+=1,t=this.object.entityChildren(e)}for(;this.children.length>e;)this.remove(this.children[e])}get visible(){return void 0!==this.playModeVisible?this.playModeVisible:this.object.visible||this.object.dataPatched.visible&&!0===this.object.dataPatched.cloner?.hideBase}set visible(e){}get castShadow(){return this.object.castShadow}set castShadow(e){}get receiveShadow(){return this.object.receiveShadow}set receiveShadow(e){}get isMesh(){return(e=>"Mesh"===e.type)(this.object)}get isLight(){return this.object.isLight}get layers(){return this.object.layers}set layers(e){}get isCamera(){return!1}get geometry(){if(this.object.geometry)return this.object.geometry}get material(){if(this.object.material)return this.object.material}},wS=new Zi,_S=new Zi,SS=new Er,AS=[new Zi(-1,1,1),new Zi(-1,-1,1),new Zi(1,-1,1),new Zi(1,1,1),new Zi(-1,1,-1),new Zi(-1,-1,-1),new Zi(1,-1,-1),new Zi(1,1,-1)],MS=[[0,3],[1,2],[5,6],[4,7],[0,1],[3,2],[7,6],[4,5],[0,4],[1,5],[2,6],[3,7]],ES=[[0,2],[7,5],[4,1],[3,6],[4,3],[1,6]],CS=(e,t,i)=>{e.updateEntityBoxSize(wS,_S),SS.copy(t).multiply(e.matrixWorld),0===_S.x&&0===_S.y&&0===_S.z?i.push(new Zi(wS.x,wS.y,wS.z).applyMatrix4(SS)):AS.forEach((e=>{i.push(e.clone().multiply(_S).add(wS).applyMatrix4(SS))}))},TS=class extends $i{constructor(){super(...arguments),this.matrix=new Er,this.vertices=[],this.faces=[],this.edges=[],this.centerEdges=[]}copy(e){return super.copy(e),this.matrix.copy(e.matrix),this.vertices=e.vertices.map((e=>e.clone())),this.faces=e.faces.map((e=>e.clone())),this.edges=e.edges.map((e=>e.clone())),this.centerEdges=e.centerEdges.map((e=>e.clone())),this}setFromObjectSize(e,t=!1){e.updateWorldMatrix(!1,t),this.makeEmpty(),this.matrix.copy(e.matrixWorld);let i=(new Er).copy(e.matrixWorld).invert();return this.expandByObjectSize(e,i,t)}expandByObjectSize(e,t,i=!1){let r=[];return!0===i?e.traverseEntity((e=>{if(e.visible||e.cloner&&e.data.visible){if(!("geometry"in e))return void r.push(new Zi);CS(e,t,r)}})):CS(e,t,r),this.setFromPoints(r)}getCenter(e){return(e=super.getCenter(e)).applyMatrix4(this.matrix),e}getPositionToCenter(e){return(e=super.getCenter(e)).applyMatrix4(SS.copy(this.matrix).setPosition(0,0,0)),e}computeVertices(){this.getSize(_S).multiplyScalar(.5),this.getCenter(wS),SS.copy(this.matrix).setPosition(wS),this.vertices=AS.map((e=>e.clone().multiply(_S).applyMatrix4(SS)))}computeEdges(){this.vertices.length>0&&this.computeVertices(),this.edges=MS.map((([e,t])=>new Dc(this.vertices[e],this.vertices[t]))),this.centerEdges=this.edges.map((e=>e.getCenter(new Zi)))}computeFaces(){this.vertices.length>0&&this.computeVertices(),this.faces=ES.map((([e,t])=>this.vertices[e].clone().add(this.vertices[t]).multiplyScalar(.5)))}},DS={Cloner:()=>{},changeEntityProptotype:()=>{},createEntity:()=>{}},PS=class extends Tl{constructor(){super()}getPoints(e=12){let t,i=[],r=this.getCurveLengths(),n=r[r.length-1]/r.length;for(let s=0,a=this.curves;s1&&!i[i.length-1].equals(i[0])&&i.push(i[0]),i}},IS=.001;function OS(e,t,i){return t.clone().sub(e).cross(t.clone().sub(i)).length()<=IS}function RS(e,t){let i=new Zi(...e.position),r=new Zi(...e.controlNext.position),n=new Zi(...t.controlPrevious.position),s=new Zi(...t.position);return OS(i,r,s)&&OS(i,n,s)}function LS(e){let t=e.points.map((e=>new Zi(...e.data.position))),i=[e.points[0]],r=new Zi(...i[0].data.position);for(let c=0;cIS&&(h=new _l(e,e.clone().lerp(t,.3),t.clone().lerp(e,.3),t))}else r.position.distanceTo(s.position)>IS&&(h=new _l(r.position,r.controlNext,s.controlPrevious,s.position));l[2*c+1]=h}for(let c=0;c{e&&h.add(e)})),h}(e=>{e.is=function(e){return e&&e.__isEntity}})(vS||(vS={}));var BS=e=>vS.is(e),zS={type:"completeState",isfromEntity:!0},kS=["x","y","z"],NS=new Zi,FS=(new Zi).set(0,1,0),US=e=>class extends(yS(e)){constructor(){super(...arguments),this.raycastLock=!1,this.scaleLock=!1,this.disposed=!1,this.stateSelection=null,this.destroyedInAction=!1,this.instances=[],this.prevState=null,this.currentState=null,this.reversibleToState=null,this.currentTransitionEvent=null,this.previousAction=null,this._singleBBox=new TS,this._recursiveBBox=new TS,this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0,this._needApplyPathSnapping=!0,this.attachedPaths=new Set}get __isEntity(){return!0}entityChildren(e){let t=this.children[e];if(vS.is(t))return t}entityChildrenCount(){let e=this.children.length;for(;e--;)if(vS.is(this.children[e]))return e+1;return 0}get isConcreteEntity(){return"string"==typeof this.identity}get isVirtualEntity(){return"string"!=typeof this.identity}get isInstanceRoot(){return this.isConcreteEntity&&"Instance"===this.data.type}nearestInstanceSelfOrParent(){let e=this;for(;"Instance"!==e.data.type;){let t=e.parent;if(!vS.is(t))return;e=t}return e}forInstancesRec(e){this.instances.forEach((t=>{t.disposed||e(t),t.forInstancesRec(e)}))}super_Entity(e,t){"string"==typeof e&&(this.uuid=e),this.identity=e,this.data=t,this.matrixAutoUpdate=!1,this.dataPatched=this.data}changeSelectedState(e,t,i=!1){if(0!==this.data.states.length||i){for(let e of this.data.states)Zb.toOps(this.data,e.data).forEach((e=>{let i=uv.replaceProps(e,this.data);this.dataPatched=this.data,this.updateByPatchedOp(i,this.data,t)}));if(null!==e){let i=this.data.states.data(e);i&&(this.dataPatched=Zb.patch(this.data,i),Zb.toOps(this.data,i).forEach((e=>{this.updateByPatchedOp(e,this.dataPatched,t)})))}i&&this.updateTransformState(this.dataPatched,t),this.stateSelection=e,this.updatePathSnapping(this.dataPatched.pathSnapping)}}get singleBBox(){return this.singleBBoxNeedsUpdate&&(this.singleBBoxNeedsUpdate=!1,this._singleBBox.setFromObjectSize(this,!1),this._singleBBox.computeVertices(),this._singleBBox.computeEdges(),this._singleBBox.computeFaces()),this._singleBBox}get recursiveBBox(){return this.recursiveBBoxNeedsUpdate&&(this.recursiveBBoxNeedsUpdate=!1,this._recursiveBBox.setFromObjectSize(this,!0),this._recursiveBBox.computeVertices(),this._recursiveBBox.computeEdges(),this._recursiveBBox.computeFaces()),this._recursiveBBox}updateEntityBoxSize(e,t){e.setScalar(0),t.setScalar(0)}resetBBoxNeedsUpdateSelf(){this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0}resetBBoxNeedsUpdate(){this.resetBBoxNeedsUpdateSelf(),this.traverseAncestors((e=>{BS(e)&&e.resetBBoxNeedsUpdateSelf()})),this.traverseEntity((e=>{e.resetBBoxNeedsUpdateSelf()}))}find(e){let t;return this.traverseEntity((i=>{i.uuid===e&&(t=i)})),t}traverseSortNextHelper(){let e=this.parent;if(e){let t=e.children,i=t.indexOf(this)+1;if(vS.is(t[i]))return t[i];if(vS.is(e))return e.traverseSortNextHelper()}}sortNext(){let e=this.children;return this.children.length>0&&vS.is(this.children[0])?e[0]:this.traverseSortNextHelper()}goUp(e){let t=this;for(;e>0&&null!==t;)t=t.parent,e-=1;return t}hasAnccestorOrSelf(e){return this===e||this.hasAnccestor(e)}hasAnccestor(e){let t=this.parent;for(;t;){if(e===t)return!0;t=t.parent}return!1}countToAccestor(e){let t=0,i=this;for(;i!==e;){if(null===i)return-1;i=i.parent,t+=1}return t}forEachEntity(e){for(let t of this.children)BS(t)&&e(t)}traverseEntityAncestors(e){this.traverseAncestors((t=>{vS.is(t)&&e(t)}))}traverseConcreteEntity(e,t=0){if(!0!==e(this,t))for(let i of this.children)BS(i)&&i.isConcreteEntity&&i.traverseEntity(e,t+1)}traverseEntity(e,t=0){if(!0!==e(this,t))for(let i of this.children)BS(i)&&i.traverseEntity(e,t+1)}traverseVisibleEntity(e){e(this);for(let t of this.children)BS(t)&&t.visible&&t.traverseVisibleEntity(e)}updateMatrix(){super.updateMatrix(),this.cloner&&this.cloner.onObjUpdateMatrix(),this.dispatchEvent({type:"updateMatrix"})}updateMatrixWorld(e){super.updateMatrixWorld(e),this.dispatchEvent({type:"updateMatrixWorld"})}copy(e,t=!1){return super.copy(e,t),this.dataPatched=e.dataPatched,this.raycastLock=e.raycastLock,this.scaleLock=e.scaleLock,this.hiddenMatrix.copy(e.hiddenMatrix),this}hasEntityChild(){return this.children.some((e=>BS(e)))}isAncestorOf(e){if(this.uuid===e)return!1;let t=!1;return this.traverseEntity((i=>{i.uuid===e&&(t=!0)})),t}toObjectTransformState(e=[]){this.updateWorldMatrix(!0,!1);let t={position:this.position.toArray(),rotation:[this.rotation.x*bi.RAD2DEG,this.rotation.y*bi.RAD2DEG,this.rotation.z*bi.RAD2DEG],scale:this.scale.toArray(),hiddenMatrix:this.hiddenMatrix.toArray()};return xg(t,e)}getTransformValues(e,t,i){return t[e].map(((t,r)=>i?.shared.getVariable(t,[this.uuid,e,kS[r]])??t))}updateTransformState(e,t){let i=!1;return e.position&&(this.position.fromArray(this.getTransformValues("position",e,t)),i=!0),e.rotation&&(NS.fromArray(this.getTransformValues("rotation",e,t)).multiplyScalar(bi.DEG2RAD),this.rotation.setFromVector3(NS),i=!0),e.scale&&(this.scale.fromArray(this.getTransformValues("scale",e,t)),i=!0),void 0!==e.hiddenMatrix&&(i=!0,this.hiddenMatrix.fromArray(e.hiddenMatrix??Fx.identity)),i&&(this.updateMatrix(),this.resetBBoxNeedsUpdate(),this.invalidateClonerTransform(this),this.traverseEntityAncestors((e=>{e.invalidateClonerTransform(this)}))),e.position&&e.rotation&&e.scale&&void 0!==e.hiddenMatrix&&this.updateWorldMatrix(!1,!0),i}onVariableUpdate(e=!1){e?this.resetBBoxNeedsUpdate():(this.updateMatrix(),this.resetBBoxNeedsUpdate(),this.invalidateClonerTransform(this),this.traverseEntityAncestors((e=>{e.invalidateClonerTransform(this)})))}dispose(){this.disposed=!0,this.cloner&&(this.cloner.removeFromParent(),this.cloner=void 0)}disposeChildrenRecursively(){for(let e of this.children)vS.is(e)&&e.disposeRecursively()}disposeRecursively(){this.dispose(),this.children.forEach((e=>{vS.is(e)&&e.disposeRecursively()}))}toState(e=[]){let t={name:this.name,visible:this.visible,raycastLock:this.raycastLock,...this.toObjectTransformState(e)};return xg(t,e)}updateByObjUpdateOp(e,t){void 0!==e&&this.updateByOp({type:0,props:e,path:[]},{...this.data,...e},t,!1)}updateByOp(e,t,i,r){let n=this.data;this.data=t;let s=e,a=jv(e.path,["states","*"]);if(null!==a){if(0===e.type){let[t]=a;if(this?.stateSelection===t){let t={...e.props};if(delete t.name,Object.values(e.props).some((e=>void 0===e))){let i=this.data;if(void 0!==i){let r=zv.zoom(i,e.path.slice(2));if(r)for(let i in e.props)void 0===e.props[i]&&i in r&&(t[i]=r[i])}}s={...e,props:t,path:e.path.slice(2)}}}}else if(0===e.type){let t=this.stateSelection?this.data.states.data(this.stateSelection):void 0;if(void 0!==t){if(void 0!==e.props.name&&t.name){let{name:e,...i}=t;t=i}if(void 0!==e.props.material&&"material"in t){let{material:e,...i}=t;t=i}let i=zv.removeOverridden(e.path,e.props,t);s={...e,props:i}}}if(this.updateByPatchedOpBase(s,Zb.patch(this.data,this.stateSelection?this.data.states.data(this.stateSelection):void 0),i),jv(e.path,["overrides"])){let r=[],n=[...e.path];for(r.push(n[1]),n.splice(0,2);n.length>0&&"descendants"===n[0];)r.push(n[1]),n.splice(0,2);if(void 0===r[r.length-1]){if(0===e.type)for(let t of Object.keys(e.props)){r[r.length-1]=t;let n=i.scene.findInstance([this.uuid,...r]);n&&(n.overrideData=e.props[t],n.updateState(dv.apply(n.component.data,n.overrideData),i))}}else{let s=i.scene.findInstance([this.uuid,...r]);if(s){let a=zv.zoom(s.component.data,n);if(0===(e={...e,path:n}).type){let t=e.props;if(a)for(let[i,r]of Object.entries(e.props))void 0===r&&(t===e.props&&(t={...e.props}),t[i]=a[i]);e={...e,props:t}}s.overrideData=qb.resolve(t.overrides,r),s.updateByOp(e,pv.applySimple(s.data,e),i,!1)}}}else if(this.instances.length>0){let r;if(0===e.path.length&&0===e.type){let t;for(let i of Yb.rootOverrideProps)i in e.props&&(void 0===t&&(t={}),t[i]=e.props[i]);t&&(r={...e,props:t})}else for(let t of Yb.rootOverrideProps)if(jv(e.path,[t])){r=e;break}void 0!==r&&this.instances.forEach((e=>{if(e.isInstanceRoot){let t=dv.filterOp(e.overrideData,r);t&&e.updateByOp(t,pv.applySimple(e.data,t),i,!0)}})),this.instances.forEach((r=>{if(!r.isInstanceRoot){let s=dv.filterOp(r.overrideData,e);if(s){let a;a=n===r.data&&e===s?t:pv.applySimple(r.data,s),r.updateByOp(s,a,i,!0)}}}))}}updateByPatchedOpBase(e,t,i){if(this.dataPatched=t,0===e.path.length&&0===e.type)void 0!==e.props.type&&!Yx.is(e.props.type)&&DS.changeEntityProptotype(this,t,i);else if(1===e.path.length&&"geometry"===e.path[0]&&0===e.type&&"type"in e.props){DS.changeEntityProptotype(this,t,i);for(let e of this.children)vS.is(e)&&e.updateVisible(i.scene)}this.updateByPatchedOp(e,t,i)}updateByPatchedOp(e,t,i){if(0===e.path.length&&0===e.type&&this.updateState(e.props,i),null!==jv(e.path,["pathSnapping"])&&this.updatePathSnapping(t.pathSnapping),null!==jv(e.path,["cloner"])){let r=pv.drop(e,1);0===r.path.length&&0===r.type&&!0===r.props.disabled?this.setFromClonerState(null,i):this.cloner?this.cloner.updateState(t.cloner,i.scene):(this.setFromClonerState(t.cloner,i),this.expandCloner(i.scene)),this.updateVisible(i.scene)}}updatePathSnapping(e=this.dataPatched.pathSnapping){this._updatedPathSnapping=e,this._needApplyPathSnapping=!0}get updatedPathSnapping(){return this._updatedPathSnapping}applyPathSnapping(e){let t=this._updatedPathSnapping?.pathId??this.dataPatched.pathSnapping.pathId,i=this._updatedPathSnapping?.slide??this.dataPatched.pathSnapping.slide??0,r=this._updatedPathSnapping?.offset??this.dataPatched.pathSnapping.offset??0,n=this._updatedPathSnapping?.orientation??this.dataPatched.pathSnapping.orientation;if(null===t)return;let s=e.find(t);if(!s||!1===this._needApplyPathSnapping)return;this._needApplyPathSnapping=!1;let a=s.data;if(a.geometry.path.points.length<=1)return;let o=LS(a.geometry.path),l=(i+r)%1;i+r===1&&0===l&&(l=1);let h=o.getPointAt(l),c=this.parent?this.parent?.matrixWorld:new Er;s.updateMatrixWorld();let d=(new Er).multiplyMatrices(c.clone().invert(),s.matrixWorld);h.applyMatrix4(d);let u={position:h.toArray(),rotation:a.rotation};if("tangential"===n){let e=(new Er).extractRotation(s.matrixWorld),t=o.getTangentAt(l).applyMatrix4(e).add(h),i=(new Er).lookAt(h,t,FS),r=NS.setFromEuler((new zr).setFromRotationMatrix(i)).multiplyScalar(bi.RAD2DEG);u={...u,rotation:r.toArray()}}this.updateTransformState(u),this.traverseEntity((e=>{e._cameraType&&e.dispatchEvent(zS)}))}updateVisible(e){if(this.visible=this.dataPatched.visible&&(!this.dataPatched.cloner||(this.dataPatched.cloner.disabled??!1)||!0!==this.dataPatched.cloner?.hideBase),!e)return;let t=!1;this.traverseEntity((e=>{if("Splat"===e.data.type)return t=!0,!0})),t&&e.reloadSplats()}updateState_Entity(e,t){void 0!==e.name&&(this.name=e.name),void 0!==e.raycastLock&&(this.raycastLock=e.raycastLock),void 0!==e.visible&&(this.updateVisible(t?.scene),this.resetBBoxNeedsUpdate()),t&&"cloner"in e&&void 0!==e.cloner&&(this.setFromClonerState(e.cloner,t),this.updateVisible(t.scene)),this.updateTransformState(e,t)}get attachedSurfaceCloners(){return this.children.filter((e=>e instanceof DS.Cloner&&"toObject"===e.parameters.type))}setFromClonerState(e,t){this.disposed||(null===e||e.disabled?(this.cloner&&this.cloner.removeFromParent(),this.cloner=void 0):void 0===this.cloner?(this.cloner=new DS.Cloner(this,e),t.scene.addPendingExpandCloner(this)):this.cloner.updateState(e,t.scene))}expandCloner(e){!this.disposed&&this.cloner&&this.cloner.expandClones(e)}invalidateClonerTransform(e){this.cloner&&this.cloner.invalidateTransform(e)}},VS=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,radialSegments:64,heightSegments:1,openEnded:!1,thetaStart:0,thetaLength:360,cornerRadius:8,cornerSegments:8,hollow:0},e.parameters);i.thetaLength=bi.clamp(i.thetaLength,0,360);let r=i.width/2,n=i.radiusTop??r,s=i.radiusBottom??r;return n===s?(n=r,s=r):n>s?(n=r,s=s*r/n):(n=n*r/s,s=r),{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width),radiusTop:n,radiusBottom:s})}}static build(e){let t,{width:i,depth:r,height:n,radialSegments:s,heightSegments:a,openEnded:o,thetaStart:l,thetaLength:h,radiusTop:c,radiusBottom:d,cornerRadius:u,cornerSegments:p,hollow:f}=e.parameters;return 0===h?(t=new En,t.setAttribute("position",new yn([],3))):t=u||f?new HS(c,d,n,s,a,o,l,h*Math.PI/180,u,u,p,f):new Il(c,d,n,s,a,o,l,h*Math.PI/180),t.scale(1,1,r/i),Object.assign(t,{userData:{...e,type:"CylinderGeometry"}})}};function jS(e,t,i){i.x=e.x*t.x,i.y=e.y,i.z=e.x*t.y}function GS(e){return new wi(e.y,-e.x)}var HS=class extends En{constructor(e,t,i,r,n,s,a,o,l,h,c,d,u=!1){super(),this.type="RoundedCylinderBufferGeometry",e=void 0!==e?e:1,t=void 0!==t?t:1,i=i||1,r=Math.floor(r)||8,n=Math.floor(n)||1,s=void 0!==s&&s,a=void 0!==a?a:0,o=void 0!==o?o:2*Math.PI,s&&(l=0,h=0);let p=[],f=[],m=[],g=[],v=0,y=i/2,x=new Zi,b=new Zi;u&&0==e&&(e=l),u&&0==t&&(t=h);let w=new wi(e,y),_=new wi(t,-y),S=null,A=null,M=null,E=null,C=w.clone().sub(_),T=0,D=0,P=0;d>0&&(T=Math.min(e,t)*(1-d),D=e-T,P=t-T);let I=w.clone();I.x-=T;let O=Math.PI-C.angle(),R=C.angle(),L=Math.tan(R/2),B=Math.tan(O/2),z=L+B,k=d?z:B,N=d?z:L;if(l=Math.min(l,(e-D)/k,C.length()/z),h=Math.min(h,(t-P)/N,C.length()/z),l>0){let e=l/L;S=w.clone().sub(new wi(e,l)),d&&(M=S.clone(),M.x-=T-z*l),w.sub(C.clone().setLength(e))}if(h>0){let e=h/B;A=_.clone().sub(new wi(e,-h)),_.add(C.clone().setLength(e)),d&&(E=A.clone(),E.x-=T-z*h,I.sub(C.clone().setLength(e)))}C=w.clone().sub(_);let F=C.length()<.5,U=[];for(let H=0;H<=r;H++){let c=[],u=H/r,p=u*o+a,y=new wi(Math.sin(p),Math.cos(p));if(E&&A?(V(c,u,y,O,h,E,-1,!0),V(c,u,y,R,h,A,-1,!1)):A?(j(c,y,A.x,0,-1),V(c,u,y,R,h,A,-1,!1)):s||j(c,y,t,P,-1),jS(GS(C).normalize(),y,x),!F)for(let e=0;e<=n;e++){let t=e/n;jS(C.clone().multiplyScalar(t).add(_),y,b),f.push(b.x,b.y,b.z),m.push(x.x,x.y,x.z),g.push(u,.5+b.y/i),c.push(v++)}if(M&&S?(V(c,u,y,O,l,S,1,!1),V(c,u,y,R,l,M,1,!0)):S?(V(c,u,y,O,l,S,1,!1),j(c,y,S.x,0,1)):s||j(c,y,e,D,1),d&&!F){jS(GS(C).multiplyScalar(-1).normalize(),y,x);for(let e=0;e<=n;e++){let t=e/n;jS(C.clone().multiplyScalar(-t).add(I),y,b),f.push(b.x,b.y,b.z),m.push(x.x,x.y,x.z),g.push(u,.5+b.y/i),c.push(v++)}}d&&!s&&c.push(c[0]),U.push(c)}for(let H=0;Hp.push(e,t,i):(e,t,i)=>p.push(e,i,t);jS(new wi((e+t+D+P)/4,0),s,o),f.push(o.x,o.y,o.z),m.push(a.x,0,a.y),g.push(.5,.5);let h=v++;for(let e of r){let t=f.slice(3*e,3*e+3);f.push(...t),m.push(a.x,0,a.y);let i=g.slice(2*e,2*e+2);g.push(...i),v++}for(let e=h+1;e0?1:-1,d.push(T.x,T.y,T.z),u.push(o/g),u.push(1-a/v),E+=1}}for(let a=0;a0?(e,t,i)=>h.push(e,t,i):(e,t,i)=>h.push(e,i,t);for(let e=0;e<=o;e++){let t=[],i=WS*(1-e/o),h=Math.cos(i),g=Math.sin(i),v=0;for(let o=0;o<=e;o++){let i=Math.cos(v),o=Math.sin(v);l.x=h*i,l.y=g,l.z=h*o;let m=f.clone().addScaledVector(l,a);c.push(r*m.x,n*m.y,s*m.z),d.push(r*l.x,n*l.y,s*l.z),u.push(0,0),t.push(p++),v+=WS/e}m.push(t)}let v=m.length-1;for(let e=0;e0&&(g("z","y","x",-1,-1,1,i,t,e,s,0),g("z","y","x",1,-1,-1,i,t,e,s,1),g("z","y","x",-1,1,-1,i,t,e,s,1),g("z","y","x",1,1,1,i,t,e,s,0),g("x","y","z",-1,-1,-1,e,t,i,r,0),g("x","y","z",1,-1,1,e,t,i,r,1),g("x","y","z",-1,1,1,e,t,i,r,0),g("x","y","z",1,1,-1,e,t,i,r,1),g("y","x","z",-1,-1,1,t,e,i,n,0),g("y","x","z",1,-1,-1,t,e,i,n,1),g("y","x","z",1,1,1,t,e,i,n,1),g("y","x","z",-1,1,-1,t,e,i,n,0),v(1,1,1),v(-1,1,1),v(1,-1,1),v(-1,-1,1),v(1,1,-1),v(-1,1,-1),v(1,-1,-1),v(-1,-1,-1)),this.setIndex(h),this.setAttribute("position",new yn(c,3)),this.setAttribute("normal",new yn(d,3)),this.setAttribute("uv",new yn(u,2))}},YS=class extends En{constructor(e=[],t=[],i="",r=1,n=.2,s=4){super(),this.type="PolyhedronGeometryRound";let a=[],o=[],l=[];return function(){0==(n=Math.min(.99999,n))&&(s=0);let o={IcosahedronGeometry:5,DodecahedronGeometry:3,HexahedronGeometry:3,OctahedronGeometry:4,TetrahedronGeometry:3}[i],h=new Zi,c=h.clone(),d=new hn,u=n*r,p=r-u,f=s+1,m=new Zi,g=(e,t)=>m.subVectors(e,t).normalize(),v=(e,t)=>Array(e).fill(void 0).map(t),y=v(e.length/3,((t,i)=>(new Zi).fromArray(e,3*i).setLength(r))),x=[],b=1e6;for(let e=0;ee[0]==r))}x.push(h)}let w=[];{let e,t,i=0,r=0,n=3==o;for(let a=0;a<=s;a++){e=a*(a+1)/2,t=(a+1)*(a+2)/2;for(let o=0;ov(o,(()=>h.clone()))));for(let e=0;ee.add(t)),v).multiplyScalar(1/o);for(let a=0;as[e]));a.push(...c.map((e=>[e.x,e.y,e.z])).flat()),l.push(...c.map((e=>(g(e,_),[m.x,m.y,m.z]))).flat())}}let D=[];for(let e=0;et%b==e)),n=C[e][t],s=C[i][r];for(let e=0;e{a.push(e[0].x,e[0].y,e[0].z),l.push(e[1].x,e[1].y,e[1].z)}))}D.push(n[0][0],s[f][0],n[f][0],s[0][0])}}for(;D.length;){let e,t,i,r;[e,t]=D.splice(0,2);let n=[e];for(;e!=t;)n.push(t),i=D.indexOf(t),r=i%2,t=D.splice(i-r,2)[1-r];m.subVectors(n[0],n[1]).cross(h.subVectors(n[0],n[2])).normalize();let s=m.dot(n[0])<0;s&&m.negate();for(let o=1;o<=n.length-2;o++)[n[o+ +s],n[o+1-+s],n[0]].forEach((e=>{a.push(e.x,e.y,e.z),l.push(m.x,m.y,m.z)}))}}(),function(){let e=new Zi;for(let p=0;p{r<0&&1===e.x&&(o[t]=e.x-1),0===i.x&&0===i.z&&(o[t]=r/2/Math.PI+.5)};for(let p=0,f=0;p.9&&n<.1&&(e<.2&&(o[a+0]+=1),t<.2&&(o[a+2]+=1),i<.2&&(o[a+4]+=1))}function d(e){return Math.atan2(e.z,-e.x)}function u(e){return Math.atan2(-e.y,Math.sqrt(e.x*e.x+e.z*e.z))}}(),this.setAttribute("position",new yn(a,3)),this.setAttribute("normal",new yn(l,3)),void this.setAttribute("uv",new yn(o,2))}static fromJSON(e){return new YS(e.vertices,e.indices,e.radius,e.corner,e.cornerSides)}},XS=class extends YS{constructor(e=1,t=.2,i=4){let r=(1+Math.sqrt(5))/2,n=1/r,s="DodecahedronGeometry";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,-n,-r,0,-n,r,0,n,-r,0,n,r,-n,-r,0,-n,r,0,n,-r,0,n,r,0,-r,0,-n,r,0,-n,-r,0,n,r,0,n],[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],s,e,t,i),this.type=s}static fromJSON(e){return new XS(e.radius,e.corner,e.cornerSides)}},QS=1e-12,ZS=class{constructor(e){this.position=new wi,this.startPosition=new wi,this.uuid=bi.generateUUID(),this.position=e.clone()}start(){this.reset()}reset(){this.startPosition.copy(this.position)}applyOffset(e){this.position.copy(this.startPosition).add(e)}copy(e){return this.position.copy(e.position),this.startPosition.copy(e.startPosition),this}clone(){return new ZS(this.position).copy(this)}toJSON(){return[this.position.x,this.position.y]}},KS=class extends ZS{constructor(e){super(e.position),this.parent=e}copy(e){return super.copy(e),this}clone(){return new KS(this.parent).copy(this)}},JS=class extends ZS{constructor(e,t){super(t),this.controls=[],this.roundness=0,this.areControlsDirectionsMirrored=!0,this.uuid=e,this.controls.push(new KS(this),new KS(this))}static create(e,t){let i=new JS(e,new wi(...t.position));return i.controls[0].position.set(...t.controlPrevious.position),i.controls[1].position.set(...t.controlNext.position),i.roundness=t.roundness,i.areControlsDirectionsMirrored=t.areControlsDirectionsMirrored,i}getOppositeControl(e){let t=this.controls.indexOf(e);return 0===t?this.controls[1]:1===t?this.controls[0]:null}applyOffsetToControls(e,t=1){for(let i=0,r=this.controls.length;iMath.PI&&(d*=-1),a=hA(c,l)?(l+c)*(r/d-.5)*8/3/(o-h):(o+h)*(r/d-.5)*8/3/(c-l),n.set(t.x-a*l,t.y+a*o),s.set(i.x+a*c,i.y-a*h),[n,s]}function yA(e,t){return e.position.equals(e.controls[1].position)&&t.position.equals(t.controls[0].position)}function xA(e,t){return fA(e.position,e.controls[1].position,t.position)&&fA(e.position,t.controls[0].position,t.position)}function bA(e,t=12,i=!1){let r=[];for(let n=0,s=e.length;n0&&(r[n-1]+=e),a+=e}void 0!==s.curveAfter&&(a+=wA(s.curveAfter,t)),r.push(a)}return e.length>0&&i&&void 0!==e[0].roundedCurveCorner&&(r[e.length-1]+=.5*wA(e[0].roundedCurveCorner,t)),r}function wA(e,t=12){return e&&e instanceof ul?2*t:e&&(e instanceof Sl||e instanceof Al)?1:e&&e instanceof El?t*e.points.length:t}var _A,SA,AA=new wi,MA=new wi,EA=new wi,CA=new wi,TA=new wi,DA=new wi,PA=class extends Bl{constructor(e=100,t=100){super(),this.points=[],this.shapeHoles=[],this.plane=new rs(new Zi(0,0,-1)),this.subdivision=0,this.controlSnapDistance=4,this.pointIDs=0,this.isMesh2D=!1,this.isText=!1,this._roundness=0,this.isClosed=!1,this.useCubicForRoundedCorners=!0,this.uuid=bi.generateUUID(),this.needsUpdate=!1,this.roundedCurves=[],this._width=e,this._height=t}static createFromState(e,t,i){let r=new PA;return r.isClosed=e.isClosed,r.points=e.points.map((e=>JS.create(e.id,e.data))),"number"==typeof e.roundness&&(r.roundness=e.roundness),r.shapeHoles=e.shapeHoles.map((e=>PA.createFromState(e))),void 0!==t&&void 0!==i&&r.applySize(t,i),r.update(),r}get width(){return this._width}get height(){return this._height}get roundness(){return this._roundness}set roundness(e){if(this._roundness!==e){this._roundness=e;for(let t=0,i=this.points.length;tthis.getPointIndexById(e))).filter((e=>e>=0))}getPointIndexById(e){let t=this.points.length,i=this.points.findIndex((t=>t.uuid===e));if(i<0){let i=t;for(let t=0,r=this.shapeHoles.length;t0){let t=this.points.length;for(let i=0,r=this.shapeHoles.length;i=0)return t;if(t=this.points.length,this.shapeHoles.length>0)for(let i=0,r=this.shapeHoles.length;i=0)return t+n;t+=r.points.length}return-1}getAllPoints(){let e=[].concat(...this.shapeHoles.map((e=>e.points)));return[...this.points,...e]}applySize(e,t){0===e&&(e=.001),0===t&&(t=.001),this._width=e,this._height=t}applyScale(e,t){let i=AA.set(e,t);for(let r=0,n=this.points.length;r=0&&this.points.splice(t,1),this.needsUpdate=!0}removePointById(e){let t=this.points.find((t=>t.uuid===e));t&&this.removePoint(t)}update(){for(let e=0,t=this.shapeHoles.length;e1&&!(e.getX(a-1)===e.getX(0)&&e.getY(a-1)===e.getY(0)&&e.getZ(a-1)===e.getZ(0))&&(e.setXYZ(a,e.getX(0),e.getY(0),e.getZ(0)),a++)}(e,i?this.roundedCurves:this.curves,t,this.autoClose),r.reduce(((e,t)=>e+t),0)+1}computeCurveDivisions(e=12){return this.curveDivisions=bA(this.points,e,!1),this.roundedCurveDivisions=bA(this.points,e,!0),this.curveDivisions}extractFilteredShapePointsToBuffer(e,t,i=12){return 2*function(e,t,i,r=12,n=!0){let s=oA.set(0,0,0),a=0,o=[];for(let l=0;l1&&!(e.getX(a-1)===e.getX(0)&&e.getY(a-1)===e.getY(0)&&e.getZ(a-1)===e.getZ(0))&&(e.setXYZ(a,e.getX(0),e.getY(0),e.getZ(0)),a++),o}(e,this.curves,t,i,this.autoClose).reduce(((e,t)=>e+t),0)}extractShapePointsToFlatArray(e,t=12){return this.subdivision=t,void 0===this.curveDivisions&&this.computeCurveDivisions(t),function(e,t,i=12,r=!0){let n,s=0;for(let a=0;a1&&!(hA(e[s-1],e[1],QS)&&hA(e[s-2],e[0],QS))&&(e.push(e[0],e[1]),s++),e}(e,this.roundedCurves,t,this.autoClose)}getCurveIndexFromVertexId(e,t=!1){let i=0;void 0===this.curveDivisions&&this.computeCurveDivisions(this.subdivision);let r=t?this.roundedCurveDivisions:this.curveDivisions,n=0;t&&void 0!==this.points[0].roundedCurveCorner&&(n=.5*wA(this.points[0].roundedCurveCorner,this.subdivision));let s=e-n;s<0&&(s+=r.reduce(((e,t)=>e+t),0));for(let a=0,o=r.length;a=this.points.length-1?0:e+1],s=this.curveDivisions,a=s[e];if(yA(r,n)){let e=r.position.distanceTo(n.position);return r.position.distanceTo(AA.set(i.x,i.y))/e}let o=0;for(let l=0;l2){let e=0;for(let t=0,i=this.points.length;t0&&!a){let r=i.curveBefore,n=i.curveAfter;if(void 0===r||void 0===n)continue;let a,o=i.roundedCurveBefore,l=i.roundedCurveAfter,h=r.getLength(),c=n.getLength(),d=Math.min(s,.499*h),u=Math.min(s,.499*c),p=Math.min(d,u),f=1-p/h,m=p/c,g=r.getPointAt(f,AA),v=n.getPointAt(m,MA);if(this._subSplitCurve(r,o,f,g,void 0),this._subSplitCurve(n,l,m,void 0,v),this.useCubicForRoundedCorners){let e=uA(g,i.position,v)/2,t=Math.tan(e)*g.distanceTo(i.position),[r,n]=mA(g,v,t,EA,CA),s=gA(r,n,i.position),[o,l]=vA(s,g,v,t,TA,DA);a=new wl(g.clone(),o.clone(),l.clone(),v.clone())}else a=new Ml(g.clone(),i.position.clone(),v.clone());i.roundedCurveCorner=a,this.roundedCurves.splice(t+e,0,a),e++}}}}_subSplitCurve(e,t,i,r,n){if(!(e instanceof Sl)){let s=e,a=t,o=s.getUtoTmapping(i,0),l=function(e,t,i,r,n=.5){let s=eA.subVectors(t,e).multiplyScalar(n).add(e),a=tA.subVectors(i,t).multiplyScalar(n).add(t),o=iA.subVectors(r,i).multiplyScalar(n).add(i),l=s,h=rA.subVectors(a,s).multiplyScalar(n).add(s),c=nA.subVectors(o,a).multiplyScalar(n).add(a),d=o,u=sA.subVectors(c,h).multiplyScalar(n).add(h);return[e.x,e.y,l.x,l.y,h.x,h.y,u.x,u.y,c.x,c.y,d.x,d.y,r.x,r.y]}(s.v0,s.v1,s.v2,s.v3,o);return void 0!==r&&(a.v0.set(l[0],l[1]),a.v1.set(l[2],l[3]),a.v2.set(l[4],l[5]),a.v3.set(l[6],l[7])),void 0!==n&&(a.v0.set(l[6],l[7]),a.v1.set(l[8],l[9]),a.v2.set(l[10],l[11]),a.v3.set(l[12],l[13])),a}return void 0!==r&&t.v2.copy(r),void 0!==n&&t.v1.copy(n),t}clone(){let e=new PA(this._width,this._height);return e.points=this.points.map((e=>e.clone())),e.isClosed=this.isClosed,e.roundness=this.roundness,e.isMesh2D=this.isMesh2D,e.shapeHoles=this.shapeHoles.map((e=>e.clone())),e}toJSON(){return{points:this.points.reduce(((e,t)=>e.concat(t.toJSON())),[]),shapeHoles:this.shapeHoles.map((e=>e.toJSON())),isClosed:this.isClosed,roundness:this.roundness}}fromJSON(e){this.points=[],this.pointIDs=0;let t=e.points.length/7;for(let i=0;i{let t=new PA;return t.fromJSON(e),t})):[],this.isClosed=e.isClosed,this._roundness=e.roundness,this._update(),this}fromShape(e,t=!1){this.isText=t;let i=(e,t)=>{t instanceof wl&&t.v3.equals(e.position)&&e.controls[0].position.copy(t.v2)};return this.points=(e=>{let t,r,n=[];for(t=0,r=e.length;t0?e[t-1]:null;s instanceof wl?(r=this.createPoint(s.v0),r.controls[1].position.copy(s.v1)):s instanceof Sl&&(r=this.createPoint(s.v1)),void 0!==r&&(null!==a&&i(r,a),n.push(r))}let s=e[e.length-1],a=!1;return s instanceof wl?s.v3.equals(n[0].position)&&(n[0].controls[0].position.copy(s.v2),a=!0):s instanceof Sl&&s.v2.equals(n[0].position)&&(a=!0),this.isClosed=a,n})(e.curves),e instanceof Bl&&(this.shapeHoles=e.holes.map((e=>{let t=new PA;return t.fromShape(e),t}))),this.update(),this}updatePoint(e,t){let i=this.getPointByUuid(e);i&&(void 0!==t.position&&i.position.fromArray(t.position),void 0!==t.roundness&&(i.roundness=t.roundness),void 0!==t.areControlsDirectionsMirrored&&(i.areControlsDirectionsMirrored=t.areControlsDirectionsMirrored),this.needsUpdate=!0)}updatePreviousControl(e,t){let i=this.getPointByUuid(e)?.controls[0];i&&(t.position&&i.position.fromArray(t.position),this.needsUpdate=!0)}updateNextControl(e,t){let i=this.getPointByUuid(e)?.controls[1];i&&(t.position&&i.position.fromArray(t.position),this.needsUpdate=!0)}},IA=2*Math.PI;function OA({x:e,y:t},i,r,n,s){return{x:e*i+n,y:t*r+s}}function RA(e,t){let i=1.5707963267948966===t?.551915024494:-1.5707963267948966===t?-.551915024494:1.3333333333333333*Math.tan(t/4),r=Math.cos(e),n=Math.sin(e),s=Math.cos(e+t),a=Math.sin(e+t);return[{x:r-n*i,y:n+r*i},{x:s+a*i,y:a-s*i},{x:s,y:a}]}function LA(e,t,i,r){let n=e*r-t*i<0?-1:1,s=Math.min(1,Math.max(-1,e*i+t*r));return n*Math.acos(s)}function BA({px:e,py:t,cx:i,cy:r,rx:n,ry:s,largeArcFlag:a,sweepFlag:o}){let l=[];if(0===n||0===s)return[];let h=(e-i)/2,c=(t-r)/2;if(0===h&&0===c)return[];n=Math.abs(n),s=Math.abs(s);let d=Math.pow(h,2)/Math.pow(n,2)+Math.pow(c,2)/Math.pow(s,2);d>1&&(n*=Math.sqrt(d),s*=Math.sqrt(d));let u=function(e,t,i,r,n,s,a,o,l,h){let c=Math.pow(n,2),d=Math.pow(s,2),u=Math.pow(a,2),p=Math.pow(o,2),f=c*d-c*p-d*u;f<0&&(f=0),f/=c*p+d*u,f=Math.sqrt(f)*(l===h?-1:1);let m=f*n/s*o,g=f*-s/n*a,v=m+(e+i)/2,y=g+(t+r)/2,x=(a-m)/n,b=(o-g)/s,w=(-a-m)/n,_=(-o-g)/s,S=LA(1,0,x,b),A=LA(x,b,w,_);return!h&&A>0&&(A-=IA),h&&A<0&&(A+=IA),{centerx:v,centery:y,ang1:S,ang2:A}}(e,t,i,r,n,s,h,c,a,o),{ang1:p,ang2:f}=u,{centerx:m,centery:g}=u,v=Math.abs(f)/(IA/4);Math.abs(1-v)<1e-7&&(v=1);let y=Math.max(Math.ceil(v),1);f/=y;for(let x=0;x{let{x:t,y:i}=OA(e[0],n,s,m,g),{x:r,y:a}=OA(e[1],n,s,m,g),{x:o,y:l}=OA(e[2],n,s,m,g);return{x1:t,y1:i,x2:r,y2:a,x:o,y:l}}))}function zA(e,t){if(!e)throw t||"Assertion Failed!"}!function(e){e[e.ODD=0]="ODD",e[e.NONZERO=1]="NONZERO",e[e.POSITIVE=2]="POSITIVE",e[e.NEGATIVE=3]="NEGATIVE",e[e.ABS_GEQ_TWO=4]="ABS_GEQ_TWO"}(_A||(_A={})),function(e){e[e.POLYGONS=0]="POLYGONS",e[e.CONNECTED_POLYGONS=1]="CONNECTED_POLYGONS",e[e.BOUNDARY_CONTOURS=2]="BOUNDARY_CONTOURS"}(SA||(SA={}));var kA=function(){function e(){}return e.vertEq=function(e,t){return e.s===t.s&&e.t===t.t},e.vertLeq=function(e,t){return e.s0?n0?(i.t-r.t)*n+(i.t-t.t)*s:0},e.transEval=function(t,i,r){zA(e.transLeq(t,i)&&e.transLeq(i,r));var n=i.t-t.t,s=r.t-i.t;return n+s>0?n0?(i.s-r.s)*n+(i.s-t.s)*s:0},e.vertCCW=function(e,t,i){return e.s*(t.t-i.t)+t.s*(i.t-e.t)+i.s*(e.t-t.t)>=0},e.interpolate=function(e,t,i,r){return(e=e<0?0:e)<=(i=i<0?0:i)?0===i?(t+r)/2:t+e/(e+i)*(r-t):r+i/(e+i)*(t-r)},e.intersect=function(t,i,r,n,s){var a,o,l;e.vertLeq(t,i)||(l=t,t=i,i=l),e.vertLeq(r,n)||(l=r,r=n,n=l),e.vertLeq(t,r)||(l=t,t=r,r=l,l=i,i=n,n=l),e.vertLeq(r,i)?e.vertLeq(i,n)?((a=e.edgeEval(t,r,i))+(o=e.edgeEval(r,i,n))<0&&(a=-a,o=-o),s.s=e.interpolate(a,r.s,o,i.s)):((a=e.edgeSign(t,r,i))+(o=-e.edgeSign(t,n,i))<0&&(a=-a,o=-o),s.s=e.interpolate(a,r.s,o,n.s)):s.s=(r.s+i.s)/2,e.transLeq(t,i)||(l=t,t=i,i=l),e.transLeq(r,n)||(l=r,r=n,n=l),e.transLeq(t,r)||(l=t,t=r,r=l,l=i,i=n,n=l),e.transLeq(r,i)?e.transLeq(i,n)?((a=e.transEval(t,r,i))+(o=e.transEval(r,i,n))<0&&(a=-a,o=-o),s.t=e.interpolate(a,r.t,o,i.t)):((a=e.transSign(t,r,i))+(o=-e.transSign(t,n,i))<0&&(a=-a,o=-o),s.t=e.interpolate(a,r.t,o,n.t)):s.t=(r.t+i.t)/2},e}(),NA=function(){this.next=null,this.prev=null,this.anEdge=null,this.trail=null,this.n=0,this.marked=!1,this.inside=!1},FA=function(){function e(e){this.side=e,this.next=null,this.Org=null,this.Sym=null,this.Onext=null,this.Lnext=null,this.Lface=null,this.activeRegion=null,this.winding=0}return Object.defineProperty(e.prototype,"Rface",{get:function(){return this.Sym.Lface},set:function(e){this.Sym.Lface=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Dst",{get:function(){return this.Sym.Org},set:function(e){this.Sym.Org=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Oprev",{get:function(){return this.Sym.Lnext},set:function(e){this.Sym.Lnext=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Lprev",{get:function(){return this.Onext.Sym},set:function(e){this.Onext.Sym=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Dprev",{get:function(){return this.Lnext.Sym},set:function(e){this.Lnext.Sym=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Rprev",{get:function(){return this.Sym.Onext},set:function(e){this.Sym.Onext=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Dnext",{get:function(){return this.Sym.Onext.Sym},set:function(e){this.Sym.Onext.Sym=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Rnext",{get:function(){return this.Sym.Lnext.Sym},set:function(e){this.Sym.Lnext.Sym=e},enumerable:!0,configurable:!0}),e}(),UA=function(){this.next=null,this.prev=null,this.anEdge=null,this.coords=[0,0,0],this.s=0,this.t=0,this.pqHandle=0,this.n=0,this.idx=0},VA=function(){function e(){var e=new UA,t=new NA,i=new FA(0),r=new FA(1);e.next=e.prev=e,e.anEdge=null,t.next=t.prev=t,i.next=i,i.Sym=r,r.next=r,r.Sym=i,this.vHead=e,this.fHead=t,this.eHead=i,this.eHeadSym=r}return e.prototype.makeEdge_=function(e){var t=new FA(0),i=new FA(1);e.Sym.sidethis.size||this.leq(s[t].key,s[i].key)){n[e].handle=t,s[t].node=e;break}n[e].handle=i,s[i].node=e,e=r}},e.prototype.floatUp_=function(e){var t,i,r,n=this.nodes,s=this.handles;for(t=n[e].handle;;){if(i=n[r=e>>1].handle,0===r||this.leq(s[i].key,s[t].key)){n[e].handle=t,s[t].node=e;break}n[e].handle=i,s[i].node=e,e=r}},e.prototype.init=function(){for(var e=this.size;e>=1;--e)this.floatDown_(e);this.initialized=!0},e.prototype.min=function(){return this.handles[this.nodes[1].handle].key},e.prototype.insert=function(e){var t,i;if(2*(t=++this.size)>this.max){var r,n;for(this.max*=2,n=this.nodes.length,this.nodes.length=this.max+1,r=n;r0&&(e[1].handle=e[this.size].handle,t[e[1].handle].node=1,t[i].key=null,t[i].node=this.freeList,this.freeList=i,--this.size,this.size>0&&this.floatDown_(1)),r},e.prototype.delete=function(e){var t,i=this.nodes,r=this.handles;zA(e>=1&&e<=this.max&&null!==r[e].key),i[t=r[e].node].handle=i[this.size].handle,r[i[t].handle].node=t,--this.size,t<=this.size&&(t<=1||this.leq(r[i[t>>1].handle].key,r[i[t].handle].key)?this.floatDown_(t):this.floatUp_(t)),r[e].key=null,r[e].node=this.freeList,this.freeList=e},e}(),WA=function(){this.eUp=null,this.nodeUp=null,this.windingNumber=0,this.inside=!1,this.sentinel=!1,this.dirty=!1,this.fixUpperEdge=!1},qA=function(){this.key=null,this.next=null,this.prev=null},YA=function(){function e(e,t){this.frame=e,this.leq=t,this.head=new qA,this.head.next=this.head,this.head.prev=this.head}return e.prototype.min=function(){return this.head.next},e.prototype.max=function(){return this.head.prev},e.prototype.insert=function(e){return this.insertBefore(this.head,e)},e.prototype.search=function(e){var t=this.head;do{t=t.next}while(null!==t.key&&!this.leq(this.frame,e,t.key));return t},e.prototype.insertBefore=function(e,t){do{e=e.prev}while(null!==e.key&&!this.leq(this.frame,e.key,t));var i=new qA;return i.key=t,i.next=e.next,e.next.prev=i,i.prev=e,e.next=i,i},e.prototype.delete=function(e){e.next.prev=e.prev,e.prev.next=e.next},e}(),XA=function(){function e(){}return e.regionBelow=function(e){return e.nodeUp.prev.key},e.regionAbove=function(e){return e.nodeUp.next.key},e.debugEvent=function(e){},e.addWinding=function(e,t){e.winding+=t.winding,e.Sym.winding+=t.Sym.winding},e.edgeLeq=function(e,t,i){var r=e.event,n=t.eUp,s=i.eUp;return n.Dst===r?s.Dst===r?kA.vertLeq(n.Org,s.Org)?kA.edgeSign(s.Dst,n.Org,s.Org)<=0:kA.edgeSign(n.Dst,s.Org,n.Org)>=0:kA.edgeSign(s.Dst,r,s.Org)<=0:s.Dst===r?kA.edgeSign(n.Dst,r,n.Org)>=0:kA.edgeEval(n.Dst,r,n.Org)>=kA.edgeEval(s.Dst,r,s.Org)},e.deleteRegion=function(e,t){t.fixUpperEdge&&zA(0===t.eUp.winding),t.eUp.activeRegion=null,e.dict.delete(t.nodeUp)},e.fixUpperEdge=function(e,t,i){zA(t.fixUpperEdge),e.mesh.delete(t.eUp),t.fixUpperEdge=!1,t.eUp=i,i.activeRegion=t},e.topLeftRegion=function(t,i){var r,n=i.eUp.Org;do{i=e.regionAbove(i)}while(i.eUp.Org===n);if(i.fixUpperEdge){if(null===(r=t.mesh.connect(e.regionBelow(i).eUp.Sym,i.eUp.Lnext)))return null;e.fixUpperEdge(t,i,r),i=e.regionAbove(i)}return i},e.topRightRegion=function(t){var i=t.eUp.Dst;do{t=e.regionAbove(t)}while(t.eUp.Dst===i);return t},e.addRegionBelow=function(e,t,i){var r=new WA;return r.eUp=i,r.nodeUp=e.dict.insertBefore(t.nodeUp,r),r.fixUpperEdge=!1,r.sentinel=!1,r.dirty=!1,i.activeRegion=r,r},e.isWindingInside=function(e,t){switch(e.windingRule){case _A.ODD:return 0!=(1&t);case _A.NONZERO:return 0!==t;case _A.POSITIVE:return t>0;case _A.NEGATIVE:return t<0;case _A.ABS_GEQ_TWO:return t>=2||t<=-2}throw new Error("Invalid winding rulle")},e.computeWinding=function(t,i){i.windingNumber=e.regionAbove(i).windingNumber+i.eUp.winding,i.inside=e.isWindingInside(t,i.windingNumber)},e.finishRegion=function(t,i){var r=i.eUp,n=r.Lface;n.inside=i.inside,n.anEdge=r,e.deleteRegion(t,i)},e.finishLeftRegions=function(t,i,r){for(var n,s=null,a=i,o=i.eUp;a!==r;){if(a.fixUpperEdge=!1,(n=(s=e.regionBelow(a)).eUp).Org!=o.Org){if(!s.fixUpperEdge){e.finishRegion(t,a);break}n=t.mesh.connect(o.Lprev,n.Sym),e.fixUpperEdge(t,s,n)}o.Onext!==n&&(t.mesh.splice(n.Oprev,n),t.mesh.splice(o,n)),e.finishRegion(t,a),o=s.eUp,a=s}return o},e.addRightEdges=function(t,i,r,n,s,a){var o,l,h,c,d=!0;h=r;do{zA(kA.vertLeq(h.Org,h.Dst)),e.addRegionBelow(t,i,h.Sym),h=h.Onext}while(h!==n);for(null===s&&(s=e.regionBelow(i).eUp.Rprev),l=i,c=s;(h=(o=e.regionBelow(l)).eUp.Sym).Org===c.Org;)h.Onext!==c&&(t.mesh.splice(h.Oprev,h),t.mesh.splice(c.Oprev,h)),o.windingNumber=l.windingNumber-h.winding,o.inside=e.isWindingInside(t,o.windingNumber),l.dirty=!0,!d&&e.checkForRightSplice(t,l)&&(e.addWinding(h,c),e.deleteRegion(t,l),t.mesh.delete(c)),d=!1,l=o,c=h;l.dirty=!0,zA(l.windingNumber-h.winding===o.windingNumber),a&&e.walkDirtyRegions(t,l)},e.spliceMergeVertices=function(e,t,i){e.mesh.splice(t,i)},e.vertexWeights=function(e,t,i){var r=kA.vertL1dist(t,e),n=kA.vertL1dist(i,e),s=.5*n/(r+n),a=.5*r/(r+n);e.coords[0]+=s*t.coords[0]+a*i.coords[0],e.coords[1]+=s*t.coords[1]+a*i.coords[1],e.coords[2]+=s*t.coords[2]+a*i.coords[2]},e.getIntersectData=function(t,i,r,n,s,a){i.coords[0]=i.coords[1]=i.coords[2]=0,i.idx=-1,e.vertexWeights(i,r,n),e.vertexWeights(i,s,a)},e.checkForRightSplice=function(t,i){var r=e.regionBelow(i),n=i.eUp,s=r.eUp;if(kA.vertLeq(n.Org,s.Org)){if(kA.edgeSign(s.Dst,n.Org,s.Org)>0)return!1;kA.vertEq(n.Org,s.Org)?n.Org!==s.Org&&(t.pq.delete(n.Org.pqHandle),e.spliceMergeVertices(t,s.Oprev,n)):(t.mesh.splitEdge(s.Sym),t.mesh.splice(n,s.Oprev),i.dirty=r.dirty=!0)}else{if(kA.edgeSign(n.Dst,s.Org,n.Org)<0)return!1;e.regionAbove(i).dirty=i.dirty=!0,t.mesh.splitEdge(n.Sym),t.mesh.splice(s.Oprev,n)}return!0},e.checkForLeftSplice=function(t,i){var r,n=e.regionBelow(i),s=i.eUp,a=n.eUp;if(zA(!kA.vertEq(s.Dst,a.Dst)),kA.vertLeq(s.Dst,a.Dst)){if(kA.edgeSign(s.Dst,a.Dst,s.Org)<0)return!1;e.regionAbove(i).dirty=i.dirty=!0,r=t.mesh.splitEdge(s),t.mesh.splice(a.Sym,r),r.Lface.inside=i.inside}else{if(kA.edgeSign(a.Dst,s.Dst,a.Org)>0)return!1;i.dirty=n.dirty=!0,r=t.mesh.splitEdge(a),t.mesh.splice(s.Lnext,a.Sym),r.Rface.inside=i.inside}return!0},e.checkForIntersect=function(t,i){var r,n,s=e.regionBelow(i),a=i.eUp,o=s.eUp,l=a.Org,h=o.Org,c=a.Dst,d=o.Dst,u=new UA;if(zA(!kA.vertEq(d,c)),zA(kA.edgeSign(c,t.event,l)<=0),zA(kA.edgeSign(d,t.event,h)>=0),zA(l!==t.event&&h!==t.event),zA(!i.fixUpperEdge&&!s.fixUpperEdge),l===h||Math.min(l.t,c.t)>Math.max(h.t,d.t))return!1;if(kA.vertLeq(l,h)){if(kA.edgeSign(d,l,h)>0)return!1}else if(kA.edgeSign(c,h,l)<0)return!1;return e.debugEvent(t),kA.intersect(c,l,d,h,u),zA(Math.min(l.t,c.t)<=u.t),zA(u.t<=Math.max(h.t,d.t)),zA(Math.min(d.s,c.s)<=u.s),zA(u.s<=Math.max(h.s,l.s)),kA.vertLeq(u,t.event)&&(u.s=t.event.s,u.t=t.event.t),r=kA.vertLeq(l,h)?l:h,kA.vertLeq(r,u)&&(u.s=r.s,u.t=r.t),kA.vertEq(u,l)||kA.vertEq(u,h)?(e.checkForRightSplice(t,i),!1):!kA.vertEq(c,t.event)&&kA.edgeSign(c,t.event,u)>=0||!kA.vertEq(d,t.event)&&kA.edgeSign(d,t.event,u)<=0?d===t.event?(t.mesh.splitEdge(a.Sym),t.mesh.splice(o.Sym,a),i=e.topLeftRegion(t,i),a=e.regionBelow(i).eUp,e.finishLeftRegions(t,e.regionBelow(i),s),e.addRightEdges(t,i,a.Oprev,a,a,!0),!0):c===t.event?(t.mesh.splitEdge(o.Sym),t.mesh.splice(a.Lnext,o.Oprev),s=i,i=e.topRightRegion(i),n=e.regionBelow(i).eUp.Rprev,s.eUp=o.Oprev,o=e.finishLeftRegions(t,s,null),e.addRightEdges(t,i,o.Onext,a.Rprev,n,!0),!0):(kA.edgeSign(c,t.event,u)>=0&&(e.regionAbove(i).dirty=i.dirty=!0,t.mesh.splitEdge(a.Sym),a.Org.s=t.event.s,a.Org.t=t.event.t),kA.edgeSign(d,t.event,u)<=0&&(i.dirty=s.dirty=!0,t.mesh.splitEdge(o.Sym),o.Org.s=t.event.s,o.Org.t=t.event.t),!1):(t.mesh.splitEdge(a.Sym),t.mesh.splitEdge(o.Sym),t.mesh.splice(o.Oprev,a),a.Org.s=u.s,a.Org.t=u.t,a.Org.pqHandle=t.pq.insert(a.Org),e.getIntersectData(t,a.Org,l,c,h,d),e.regionAbove(i).dirty=i.dirty=s.dirty=!0,!1)},e.walkDirtyRegions=function(t,i){for(var r,n,s=e.regionBelow(i);;){for(;s.dirty;)i=s,s=e.regionBelow(s);if(!i.dirty&&(s=i,null===(i=e.regionAbove(i))||!i.dirty))return;if(i.dirty=!1,r=i.eUp,n=s.eUp,r.Dst!==n.Dst&&e.checkForLeftSplice(t,i)&&(s.fixUpperEdge?(e.deleteRegion(t,s),t.mesh.delete(n),n=(s=e.regionBelow(i)).eUp):i.fixUpperEdge&&(e.deleteRegion(t,i),t.mesh.delete(r),r=(i=e.regionAbove(s)).eUp)),r.Org!==n.Org)if(r.Dst===n.Dst||i.fixUpperEdge||s.fixUpperEdge||r.Dst!==t.event&&n.Dst!==t.event)e.checkForRightSplice(t,i);else if(e.checkForIntersect(t,i))return;r.Org===n.Org&&r.Dst===n.Dst&&(e.addWinding(n,r),e.deleteRegion(t,i),t.mesh.delete(r),i=e.regionAbove(s))}},e.connectRightVertex=function(t,i,r){var n,s=r.Onext,a=e.regionBelow(i),o=i.eUp,l=a.eUp,h=!1;o.Dst!==l.Dst&&e.checkForIntersect(t,i),kA.vertEq(o.Org,t.event)&&(t.mesh.splice(s.Oprev,o),i=e.topLeftRegion(t,i),s=e.regionBelow(i).eUp,e.finishLeftRegions(t,e.regionBelow(i),a),h=!0),kA.vertEq(l.Org,t.event)&&(t.mesh.splice(r,l.Oprev),r=e.finishLeftRegions(t,a,null),h=!0),h?e.addRightEdges(t,i,r.Onext,s,s,!0):(n=kA.vertLeq(l.Org,o.Org)?l.Oprev:o,n=t.mesh.connect(r.Lprev,n),e.addRightEdges(t,i,n,n.Onext,n.Onext,!1),n.Sym.activeRegion.fixUpperEdge=!0,e.walkDirtyRegions(t,i))},e.connectLeftDegenerate=function(t,i,r){var n,s,a,o,l;return n=i.eUp,kA.vertEq(n.Org,r)?(zA(!1),void e.spliceMergeVertices(t,n,r.anEdge)):kA.vertEq(n.Dst,r)?(zA(!1),i=e.topRightRegion(i),s=o=(a=(l=e.regionBelow(i)).eUp.Sym).Onext,l.fixUpperEdge&&(zA(s!==a),e.deleteRegion(t,l),t.mesh.delete(a),a=s.Oprev),t.mesh.splice(r.anEdge,a),kA.edgeGoesLeft(s)||(s=null),void e.addRightEdges(t,i,a.Onext,o,s,!0)):(t.mesh.splitEdge(n.Sym),i.fixUpperEdge&&(t.mesh.delete(n.Onext),i.fixUpperEdge=!1),t.mesh.splice(r.anEdge,n),void e.sweepEvent(t,r))},e.connectLeftVertex=function(t,i){var r,n,s,a,o,l,h=new WA;if(h.eUp=i.anEdge.Sym,r=t.dict.search(h).key,n=e.regionBelow(r)){if(a=r.eUp,o=n.eUp,0===kA.edgeSign(a.Dst,i,a.Org))return void e.connectLeftDegenerate(t,r,i);if(s=kA.vertLeq(o.Dst,a.Dst)?r:n,r.inside||s.fixUpperEdge){if(s===r)l=t.mesh.connect(i.anEdge.Sym,a.Lnext);else l=t.mesh.connect(o.Dnext,i.anEdge).Sym;s.fixUpperEdge?e.fixUpperEdge(t,s,l):e.computeWinding(t,e.addRegionBelow(t,r,l)),e.sweepEvent(t,i)}else e.addRightEdges(t,r,i.anEdge,i.anEdge,null,!0)}},e.sweepEvent=function(t,i){t.event=i,e.debugEvent(t);for(var r=i.anEdge;null===r.activeRegion;)if((r=r.Onext)===i.anEdge)return void e.connectLeftVertex(t,i);var n=e.topLeftRegion(t,r.activeRegion);zA(null!==n);var s=e.regionBelow(n),a=s.eUp,o=e.finishLeftRegions(t,s,null);o.Onext===a?e.connectRightVertex(t,n,o):e.addRightEdges(t,n,o.Onext,a,a,!0)},e.addSentinel=function(e,t,i,r){var n=new WA,s=e.mesh.makeEdge();s.Org.s=i,s.Org.t=r,s.Dst.s=t,s.Dst.t=r,e.event=s.Dst,n.eUp=s,n.windingNumber=0,n.inside=!1,n.fixUpperEdge=!1,n.sentinel=!0,n.dirty=!1,n.nodeUp=e.dict.insert(n)},e.initEdgeDict=function(t){t.dict=new YA(t,e.edgeLeq);var i=t.bmax[0]-t.bmin[0],r=t.bmax[1]-t.bmin[1],n=t.bmin[0]-i,s=t.bmax[0]+i,a=t.bmin[1]-r,o=t.bmax[1]+r;e.addSentinel(t,n,s,a),e.addSentinel(t,n,s,o)},e.doneEdgeDict=function(t){for(var i,r=0;null!==(i=t.dict.min().key);)i.sentinel||(zA(i.fixUpperEdge),zA(1==++r)),zA(0===i.windingNumber),e.deleteRegion(t,i)},e.removeDegenerateEdges=function(t){var i,r,n,s=t.mesh.eHead;for(i=s.next;i!==s;i=r)r=i.next,n=i.Lnext,kA.vertEq(i.Org,i.Dst)&&i.Lnext.Lnext!==i&&(e.spliceMergeVertices(t,n,i),t.mesh.delete(i),n=(i=n).Lnext),n.Lnext===i&&(n!==i&&((n===r||n===r.Sym)&&(r=r.next),t.mesh.delete(n)),(i===r||i===r.Sym)&&(r=r.next),t.mesh.delete(i))},e.initPriorityQ=function(e){var t,i,r,n=0;for(i=(r=e.mesh.vHead).next;i!==r;i=i.next)n++;for(n+=8,t=e.pq=new HA(n,kA.vertLeq),i=(r=e.mesh.vHead).next;i!==r;i=i.next)i.pqHandle=t.insert(i);return i===r&&(t.init(),!0)},e.donePriorityQ=function(e){e.pq=null},e.removeDegenerateFaces=function(t,i){var r,n,s;for(r=i.fHead.next;r!==i.fHead;r=n)n=r.next,zA((s=r.anEdge).Lnext!==s),s.Lnext.Lnext===s&&(e.addWinding(s.Onext,s),t.mesh.delete(s));return!0},e.computeInterior=function(t,i){var r,n;if(void 0===i&&(i=!0),e.removeDegenerateEdges(t),!e.initPriorityQ(t))return!1;for(e.initEdgeDict(t);null!==(r=t.pq.extractMin());){for(;null!==(n=t.pq.min())&&kA.vertEq(n,r);)n=t.pq.extractMin(),e.spliceMergeVertices(t,r.anEdge,n.anEdge);e.sweepEvent(t,r)}return t.event=t.dict.min().key.eUp.Org,e.debugEvent(t),e.doneEdgeDict(t),e.donePriorityQ(t),!!e.removeDegenerateFaces(t,t.mesh)&&(i&&t.mesh.check(),!0)},e}(),QA=function(){function e(){this.mesh=new VA,this.normal=[0,0,0],this.sUnit=[0,0,0],this.tUnit=[0,0,0],this.bmin=[0,0],this.bmax=[0,0],this.windingRule=_A.ODD,this.dict=null,this.pq=null,this.event=null,this.vertexIndexCounter=0,this.vertices=[],this.vertexIndices=[],this.vertexCount=0,this.elements=[],this.elementCount=0}return e.prototype.dot_=function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]},e.prototype.normalize_=function(e){var t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2];if(!t)throw"Zero-size vector!";t=Math.sqrt(t),e[0]/=t,e[1]/=t,e[2]/=t},e.prototype.longAxis_=function(e){var t=0;return Math.abs(e[1])>Math.abs(e[0])&&(t=1),Math.abs(e[2])>Math.abs(e[t])&&(t=2),t},e.prototype.computeNormal_=function(e){var t,i,r,n,s,a,o=[0,0,0],l=[0,0,0],h=[0,0,0],c=[0,0,0],d=[0,0,0],u=[null,null,null],p=[null,null,null],f=this.mesh.vHead;t=f.next;for(var m=0;m<3;++m)n=t.coords[m],l[m]=n,p[m]=t,o[m]=n,u[m]=t;for(t=f.next;t!==f;t=t.next)for(var g=0;g<3;++g)(n=t.coords[g])o[g]&&(o[g]=n,u[g]=t);var v=0;if(o[1]-l[1]>o[0]-l[0]&&(v=1),o[2]-l[2]>o[v]-l[v]&&(v=2),l[v]>=o[v])return e[0]=0,e[1]=0,void(e[2]=1);for(a=0,i=p[v],r=u[v],h[0]=i.coords[0]-r.coords[0],h[1]=i.coords[1]-r.coords[1],h[2]=i.coords[2]-r.coords[2],t=f.next;t!==f;t=t.next)c[0]=t.coords[0]-r.coords[0],c[1]=t.coords[1]-r.coords[1],c[2]=t.coords[2]-r.coords[2],d[0]=h[1]*c[2]-h[2]*c[1],d[1]=h[2]*c[0]-h[0]*c[2],d[2]=h[0]*c[1]-h[1]*c[0],(s=d[0]*d[0]+d[1]*d[1]+d[2]*d[2])>a&&(a=s,e[0]=d[0],e[1]=d[1],e[2]=d[2]);a<=0&&(e[0]=e[1]=e[2]=0,e[this.longAxis_(h)]=1)},e.prototype.checkOrientation_=function(){for(var e,t,i=this.mesh.fHead,r=this.mesh.vHead,n=0,s=i.next;s!==i;s=s.next)if(!((t=s.anEdge).winding<=0))do{n+=(t.Org.s-t.Dst.s)*(t.Org.t+t.Dst.t),t=t.Lnext}while(t!==s.anEdge);if(n<0){for(e=r.next;e!==r;e=e.next)e.t=-e.t;this.tUnit[0]=-this.tUnit[0],this.tUnit[1]=-this.tUnit[1],this.tUnit[2]=-this.tUnit[2]}},e.prototype.projectPolygon_=function(){var e,t,i=this.mesh.vHead,r=[0,0,0],n=!1;r[0]=this.normal[0],r[1]=this.normal[1],r[2]=this.normal[2],!r[0]&&!r[1]&&!r[2]&&(this.computeNormal_(r),n=!0),e=this.sUnit,t=this.tUnit;var s=this.longAxis_(r);e[s]=0,e[(s+1)%3]=1,e[(s+2)%3]=0,t[s]=0,t[(s+1)%3]=0,t[(s+2)%3]=r[s]>0?1:-1;for(var a=i.next;a!==i;a=a.next)a.s=this.dot_(a.coords,e),a.t=this.dot_(a.coords,t);n&&this.checkOrientation_();for(var o=!0,l=i.next;l!==i;l=l.next)o?(this.bmin[0]=this.bmax[0]=l.s,this.bmin[1]=this.bmax[1]=l.t,o=!1):(l.sthis.bmax[0]&&(this.bmax[0]=l.s),l.tthis.bmax[1]&&(this.bmax[1]=l.t))},e.prototype.addWinding_=function(e,t){e.winding+=t.winding,e.Sym.winding+=t.Sym.winding},e.prototype.tessellateMonoRegion_=function(e,t){var i,r;if((i=t.anEdge).Lnext===i||i.Lnext.Lnext===i)throw"Mono region invalid";for(;kA.vertLeq(i.Dst,i.Org);i=i.Lprev);for(;kA.vertLeq(i.Org,i.Dst);i=i.Lnext);r=i.Lprev;for(;i.Lnext!==r;)if(kA.vertLeq(i.Dst,r.Org)){for(;r.Lnext!==i&&(kA.edgeGoesLeft(r.Lnext)||kA.edgeSign(r.Org,r.Dst,r.Lnext.Dst)<=0);)r=e.connect(r.Lnext,r).Sym;r=r.Lprev}else{for(;r.Lnext!==i&&(kA.edgeGoesRight(i.Lprev)||kA.edgeSign(i.Dst,i.Org,i.Lprev.Org)>=0);)i=e.connect(i,i.Lprev).Sym;i=i.Lnext}if(r.Lnext===i)throw"Mono region invalid";for(;r.Lnext.Lnext!==i;)r=e.connect(r.Lnext,r).Sym;return!0},e.prototype.tessellateInterior_=function(e){for(var t,i=e.fHead.next;i!==e.fHead;i=t)if(t=i.next,i.inside&&!this.tessellateMonoRegion_(e,i))return!1;return!0},e.prototype.discardExterior_=function(e){for(var t,i=e.fHead.next;i!==e.fHead;i=t)t=i.next,i.inside||e.zapFace(i)},e.prototype.setWindingNumber_=function(e,t,i){for(var r,n=e.eHead.next;n!==e.eHead;n=r)r=n.next,n.Rface.inside!==n.Lface.inside?n.winding=n.Lface.inside?t:-t:i?e.delete(n):n.winding=0},e.prototype.getNeighbourFace_=function(e){return e.Rface&&e.Rface.inside?e.Rface.n:-1},e.prototype.outputPolymesh_=function(e,t,i,r){var n,s,a=0,o=0;i>3&&e.mergeConvexFaces(i);for(var l=e.vHead.next;l!==e.vHead;l=l.next)l.n=-1;for(var h=e.fHead.next;h!==e.fHead;h=h.next)if(h.n=-1,h.inside){n=h.anEdge,s=0;do{-1===(l=n.Org).n&&(l.n=o,o++),s++,n=n.Lnext}while(n!==h.anEdge);if(s>i)throw"Face vertex greater that support polygon";h.n=a,++a}this.elementCount=a,t===SA.CONNECTED_POLYGONS&&(a*=2),this.elements=[],this.elements.length=a*i,this.vertexCount=o,this.vertices=[],this.vertices.length=o*r,this.vertexIndices=[],this.vertexIndices.length=o;for(l=e.vHead.next;l!==e.vHead;l=l.next)if(-1!==l.n){var c=l.n*r;this.vertices[c+0]=l.coords[0],this.vertices[c+1]=l.coords[1],r>2&&(this.vertices[c+2]=l.coords[2]),this.vertexIndices[l.n]=l.idx}var d=0;for(h=e.fHead.next;h!==e.fHead;h=h.next)if(h.inside){n=h.anEdge,s=0;do{l=n.Org;this.elements[d++]=l.n,s++,n=n.Lnext}while(n!==h.anEdge);for(var u=s;u2&&(this.vertices[o++]=i.Org.coords[2]),this.vertexIndices[l++]=this.vertexIdCallback?this.vertexIdCallback(i):i.Org.idx,s++,i=i.Lnext}while(i!==r);this.elements[h++]=n,this.elements[h++]=s,n+=s}},e.prototype.addContour=function(e,t){null===this.mesh&&(this.mesh=new VA),e<2&&(e=2),e>3&&(e=3);for(var i=null,r=0;r2?t[r+2]:0,i.Org.idx=this.vertexIndexCounter++,this.edgeCreateCallback&&this.edgeCreateCallback(i),i.winding=1,i.Sym.winding=-1},e.prototype.tesselate=function(e,t,i,r,n,s){if(void 0===e&&(e=_A.ODD),void 0===t&&(t=SA.POLYGONS),void 0===s&&(s=!0),this.vertices=[],this.elements=[],this.vertexIndices=[],this.vertexIndexCounter=0,n&&(this.normal[0]=n[0],this.normal[1]=n[1],this.normal[2]=n[2]),this.windingRule=e,r<2&&(r=2),r>3&&(r=3),!this.mesh)return!1;this.projectPolygon_(),XA.computeInterior(this,s);var a=this.mesh;return t===SA.BOUNDARY_CONTOURS?this.setWindingNumber_(a,1,!0):this.tessellateInterior_(a),s&&a.check(),t===SA.BOUNDARY_CONTOURS?this.outputContours_(a,r):this.outputPolymesh_(a,t,i,r),!0},e}();function ZA(e){var t=e.windingRule,i=void 0===t?_A.ODD:t,r=e.elementType,n=void 0===r?SA.POLYGONS:r,s=e.polySize,a=void 0===s?3:s,o=e.vertexSize,l=void 0===o?2:o,h=e.normal,c=void 0===h?[0,0,1]:h,d=e.contours,u=void 0===d?[]:d,p=e.strict,f=void 0===p||p,m=e.debug,g=void 0!==m&&m;if(!u&&f)throw new Error("Contours can't be empty");if(u){var v=new QA;e.edgeCreateCallback&&(v.edgeCreateCallback=e.edgeCreateCallback),e.vertexIdCallback&&(v.vertexIdCallback=e.vertexIdCallback);for(var y=0;ythis.capacity){let e=this.capacity;for(;t>e;)e*=2;this.realloc(e)}let i=this.size;return this.size=t,i}reserve(e){let t=this.size+e;t>this.capacity&&this.realloc(t)}shrink(){this.debug&&console.log(`shrinking ${this.capacity} \u2192 ${this.size}`),this.realloc(this.size,!0)}},JA=KA;JA.eSize=8*Float32Array.BYTES_PER_ELEMENT;var $A=d(g()),eM={vertices:[160,160,-160,160,-160,-160,160,-160],vertexIndices:[1,0,3,2],vertexCount:4,elements:[0,4],elementCount:1,mesh:void 0},tM={vertices:[],vertexIndices:[],vertexCount:0,elements:[],elementCount:0,mesh:void 0},iM={vertices:[-160,160,160,-160,160,160,-160,-160],vertexIndices:[1,3,0,2],vertexCount:4,elements:[0,1,2,1,0,3],elementCount:2,mesh:void 0},rM=(e,t)=>([i,r])=>(r=i?e:e+t)<=r),nM=class extends En{constructor(e,t,i=0,r=12,n=3,s=_A.ODD,a=!1){super(),this.forPathBevel=a,this.type="ShapeGeometry",this.vertexCache={},this._shape=e,this._depth=t,this._curveSegments=r,this._bevelSegmentsInput=n;let o,l,h,c=this._shape.extractShapePointsToFlatArray([],r),d=this._shape.shapeHoles.map((e=>{let t=e.extractShapePointsToFlatArray([],r),i=[];for(let r=t.length-1;r>=1;r-=2){let e=t[r-1],n=t[r-0];i.push(e,n)}return i})),u=[],p=[];for(let M=0;Me.position))).getSize(new wi).length():0===u[0].length?i:(0,$A.default)(u).distance,i<=0?(this._bevel=0,this._bevelSegments=0):(this._bevel=Math.min(i,o,t/2),this._bevelSegments=Math.floor(n));try{l=ZA({windingRule:s,elementType:SA.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[c]})}catch{l=eM}try{h=ZA({windingRule:_A.ODD,elementType:SA.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[...d]})}catch{h=tM}if(!l)throw new Error("error generating geometry");let f=l.elementCount;if(h){l.elementCount+=h.elementCount;for(let e=0;eg&&(g=t),iy&&(y=i)}this._minX=m,this._minY=v,this._width=g-m,this._height=y-v,this._buffer=new JA(this._computeBufferEstimatedSize(l));let x=[],b=[];for(let M=l.elementCount-1;M>=0;M--){let e=M>=f,t=2*M,i=l.elements[t+0],n=l.elements[t+1],s=i+n,h={start:i,count:n,normals:[],continuous:[],concave:[]},c=i,u=s-1,p=i+1,m=this._shape.roundedCurves.length;do{let t=c-i,r=l.vertices[2*u+0],a=l.vertices[2*u+1],o=l.vertices[2*c+0],d=l.vertices[2*c+1],f=l.vertices[2*p+0],g=l.vertices[2*p+1],v=o-r,y=d-a,x=Math.sqrt(v*v+y*y);v/=x,y/=x;let b=o-f,w=d-g,_=Math.sqrt(b*b+w*w);b/=_,w/=_,h.normals[2*t+0]=-w,h.normals[2*t+1]=b,h.concave[t]=v*w-y*b>0;let S=l.vertexIndices[c];if(Array.isArray(S))h.continuous[t]=!1;else{let[e,i]=this._shape.getCurveIndexFromVertexId(S-1,!0);if(i>0&&i<1)h.continuous[t]=!0;else{let r=1===i?e+1:e-1;r=(r+m)%m;let n=1===i?0:1,s=this._shape.roundedCurves[e].getTangent(i),a=this._shape.roundedCurves[r].getTangent(n);h.continuous[t]=s.dot(a)>.95}}e&&(h.normals[2*t+0]*=-1,h.normals[2*t+1]*=-1),[u,c,p]=[c,p,p+1],p>=s&&(p-=n)}while(p!==i+1);let g=[];g.push({bevelI:0,angle:0,size:0,boundary:{vertices:l.vertices.slice(2*i,2*s),vertexCount:n,vertexIndices:new Array(n).fill(!0).map(((e,t)=>[t,t])),elements:[0,n],elementCount:1,mesh:null},reverseMap:[],insetPoints:l.vertices.slice(2*i,2*s)});let v=0;for(let a=1;a<=this._bevelSegments;a++){let t=a/this._bevelSegments*Math.PI/2,i=(1-Math.cos(t))*this._bevel,s=[],o=[],c=[],d=[],u=0;for(let a=0;at&&(n-=2*Math.PI);let o=n-t;if(h.continuous[a]||e){let r=t+o/2,n=Math.cos(r)*i,l=Math.sin(r)*i;s[2*u+0]=f+n*(e?-1:1),s[2*u+1]=m+l*(e?-1:1),d[u]=a,u++}else{let e=Math.max(1,Math.floor(r/4*Math.abs(o)/Math.PI));for(let r=0;r<=e;r++){let n=t+o*(r/e),l=Math.cos(n)*i,h=Math.sin(n)*i;s[2*u+0]=f+l,s[2*u+1]=m+h,d[u]=a,u++}}}else s[2*u+0]=f+g,s[2*u+1]=m+v,d[u]=a,o[a]=u,u++,s[2*u+0]=f,s[2*u+1]=m,d[u]=a,u++,s[2*u+0]=f+y,s[2*u+1]=m+x,d[u]=a,c[a]=u,u++}let p=ZA({windingRule:_A.POSITIVE,elementType:SA.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[s],edgeCreateCallback:e=>{let t=e.Org.idx,i=d[t],r=d[(t+1)%d.length];e.idx=[i,r],e.Sym.idx=[r,i]},vertexIdCallback:e=>{let t=e.Lprev.idx;return[t?t[1]:0,e.idx?e.idx[0]:0]}});if(!p)throw console.log("Error"),new Error(`error generating bevel geometry for ${a}'th loop`);if(!p.vertexCount){let e=(a-1)/this._bevelSegments*Math.PI/2;v=(1-Math.sin(e))*this._bevel;break}for(let e=0;e{let r=0,n=e.boundary.vertexIndices.length;for(;rm){let n=r/m,o=0;for(let l=1;l(o+1)*n&&(o++,f=this._buildBevelVert(h,t,(u+o)%s,o/(m-1),v),x.push(w.topN,p.topP,f.topP),!1===a&&x.push(p.bottomP,w.bottomN,f.bottomP),w=f)}else{let n=m/r,o=0;for(let l=1;l(o+1)*n&&(o++,p=this._buildBevelVert(h,e,(d+o)%i,o/(r-1),v),x.push(b.topN,p.topP,w.topN),!1===a&&x.push(p.bottomP,b.bottomN,w.bottomN),b=p)}d=(d+r)%i,u=(u+m)%s,l=(l+1)%o}while(l!==m)}if(!1===a&&this._depth>2*this._bevel&&this._buildWall(g,h,x),e){let e=[];for(let t=x.length-1;t>=w+2;t-=3){let i=x[t-2],r=x[t-1],n=x[t-0];e.push(n,r,i)}x.splice(w,x.length-w,...e)}if(e){let e=[];for(let t=g[g.length-1].boundary.vertices.length-1;t>=1;t-=2){let i=g[g.length-1].boundary.vertices[t-1],r=g[g.length-1].boundary.vertices[t-0];e.push(i,r)}b.push(e)}if(!e){let e,t=g[g.length-1];try{e=ZA({windingRule:g.length>1?_A.POSITIVE:_A.ODD,elementType:SA.POLYGONS,vertexSize:2,strict:!0,contours:[t.insetPoints,...b]})}catch{e=iM}if(!e)throw new Error("Error generating geometry for surface");0===d.length&&this._bevel0,l=e.continuous[a]||h);let u=Math.cos(t.angle),p=Math.sin(t.angle),f=2*i,m=2*a,g=2*o,v=t.boundary.vertices[f+0],y=t.boundary.vertices[f+1],x=(1-p)*this._bevel,b=(v-this._minX)/this._width,w=(y-this._minY)/this._height;this.forPathBevel&&(void 0!==n&&(b=n),w=1);let _=e.normals[m+0],S=e.normals[m+1],A=e.normals[g+0],M=e.normals[g+1];if(h){_+=(A-_)*(1-r),S+=(M-S)*(1-r);let e=Math.sqrt(_*_+S*S);_/=e,S/=e}let E=this.forPathBevel?this._buffer.get(l?1:2):this._buffer.get(l?2:4),C=3*E,T=2*E,D={i:i,fi:a,topP:E+0,topN:E+0,bottomP:E+1,bottomN:E+1,pathBevelUCoord:n};return this._buffer.positions[C+0]=v,this._buffer.positions[C+1]=y,this._buffer.positions[C+2]=(this.forPathBevel?this._bevel:this._depth)-x,this._buffer.normals[C+0]=_*u,this._buffer.normals[C+1]=S*u,this._buffer.normals[C+2]=p,this._buffer.uvs[T+0]=b,this._buffer.uvs[T+1]=w,!1===this.forPathBevel&&(this._buffer.positions[C+3]=v,this._buffer.positions[C+4]=y,this._buffer.positions[C+5]=x,this._buffer.normals[C+3]=_*u,this._buffer.normals[C+4]=S*u,this._buffer.normals[C+5]=-p,this._buffer.uvs[T+2]=w,this._buffer.uvs[T+3]=b),l||(this.forPathBevel?(E+=1,C+=3,T+=2):(E+=2,C+=6,T+=4),D.topP=E+0,D.bottomP=E+1,this._buffer.positions[C+0]=v,this._buffer.positions[C+1]=y,this._buffer.positions[C+2]=(this.forPathBevel?this._bevel:this._depth)-x,this._buffer.normals[C+0]=A*u,this._buffer.normals[C+1]=M*u,this._buffer.normals[C+2]=p,this._buffer.uvs[T+0]=b,this._buffer.uvs[T+1]=w,!1===this.forPathBevel&&(this._buffer.positions[C+3]=v,this._buffer.positions[C+4]=y,this._buffer.positions[C+5]=x,this._buffer.normals[C+3]=A*u,this._buffer.normals[C+4]=M*u,this._buffer.normals[C+5]=-p,this._buffer.uvs[T+2]=w,this._buffer.uvs[T+3]=b)),this.vertexCache[s]=D,D}clone(){let e=new nM(this._shape,this._depth,this._bevel,this._curveSegments,this._bevelSegmentsInput);return e.userData=Fm(this.userData),e}},sM=class extends En{constructor(e,t=12,i={}){super(),this.type="ShapeGeometry",this.windingRule=_A.ODD,this.elementType=SA.POLYGONS,this.polySize=3,this.vertexSize=2,this.strict=!0,this._shape=e,this._curveSegments=t,this._triangulationOptions=Object.assign({windingRule:_A.ODD,elementType:SA.POLYGONS,polySize:3,vertexSize:2,strict:!0},i);let r,n,s,a=this._shape.extractShapePointsToFlatArray([],this._curveSegments),o=this._shape.shapeHoles.map((e=>e.extractShapePointsToFlatArray([],this._curveSegments))),l=!0,h=!0;for(let u=0,p=a.length/2;ut&&(t=a),ln&&(n=l)}let s=t-e,a=n-i;for(let o=0,l=c;o0&&a.update());let l=a??new PA(r,n);return{parameters:Object.assign(i,{width:r,height:n,depth:s,roundness:o}),shape:l}}static build(e){let t,{depth:i,extrudeBevelSize:r,extrudeBevelSegments:n,subdivisions:s,roundness:a,windingRule:o}=e.parameters;return e.shape.roundness=a,t=i<=0?new sM(e.shape,s,{windingRule:o}):new aM(e.shape,i,r,s,n,o),Object.assign(t,{userData:{...e,type:"VectorGeometry"}})}},lM=2*Math.PI,hM=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,depth:0,spikes:64,angle:360,innerRadius:0,extrudeBevelSize:0,extrudeBevelSegments:1},e.parameters);return i.angle=bi.clamp(i.angle,0,360),{shape:e.shape&&e.shape instanceof PA?e.shape:new PA,parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??0)})}}static build(e){let t,{width:i,height:r,spikes:n,angle:s,innerRadius:a,depth:o,extrudeBevelSize:l,extrudeBevelSegments:h}=e.parameters,c=e.shape,d=function(e,t,i,r,n,s){if(r>=lM)return n>30||n%4==0?(function(e,t,i,r=0,n=0,s=0){let a=.5522847498,o=t*a,l=i*a;e.addPoint(uM(n-t,s,n-t,s-l,n-t,s+l)),e.addPoint(uM(n,s+i,n-o,s+i,n+o,s+i)),e.addPoint(uM(n+t,s,n+t,s+l,n+t,s-l)),e.addPoint(uM(n,s-i,n+o,s-i,n-o,s-i)),r>0&&fM(e,t,i,r)}(e,t,i,s),Math.round(n/4)):cM(e,r,n,t,i,s);r=Math.max(r,.001);let a={x:0,y:i},o=r+.5*Math.PI,l={x:Math.cos(o)*t,y:Math.sin(o)*i},h=BA({px:a.x,py:a.y,cx:l.x,cy:l.y,rx:t,ry:i,largeArcFlag:r>Math.PI,sweepFlag:!0});return n>30||n%h.length==0?function(e,t,i,r,n,s,a,o){let l=Math.round(n/r.length);e.addPoint(dM(t,i));for(let h=0,c=r.length;h0?pM(e,s,a,o):e.addPoint(dM(0,0)),l}(e,a.x,a.y,h,n,t,i,s):cM(e,r,n,t,i,s)}(c,.5*i,.5*r,s*Math.PI/180,n,a);return c.isClosed=!0,c.update(),0===s?(t=new En,t.setAttribute("position",new yn([],3))):t=oM.create({shape:c,parameters:{subdivisions:d,depth:o,extrudeBevelSize:l,extrudeBevelSegments:h}}),Object.assign(t,{userData:{...e,type:"EllipseGeometry"}})}};function cM(e,t,i,r,n,s){let a=-t/i;for(let o=0;o<=i;o++){let t=a*o,i=Math.sin(t)*r,s=Math.cos(t)*n;e.addPoint(dM(i,s))}return t0?pM(e,r,n,s):e.addPoint(dM(0,0)):(e.removePoint(e.points[e.points.length-1]),s>0&&fM(e,r,n,s)),1}function dM(e,t){return new JS(bi.generateUUID(),new wi(e,t))}function uM(e,t,i,r,n,s){let a=dM(e,t);return a.controls[0].position.set(i,r),a.controls[1].position.set(n,s),a}function pM(e,t,i,r){mM(e,t,i,r).forEach((t=>e.addPoint(t)))}function fM(e,t,i,r){let n=mM(e,t,i,r),s=new PA;n.forEach((e=>s.addPoint(e))),s.isClosed=!0,e.shapeHoles.push(s)}function mM(e,t,i,r){let n=r*t/100,s=n*(Math.abs(i)/Math.abs(t)),a=new wi(n/t,s/i),o=e.points.map((e=>{let t=e.clone();return t.uuid=bi.generateUUID(),t})).reverse();return o.forEach((e=>{e.position.multiply(a);let t=e.controls[0].position.clone().multiply(a),i=e.controls[1].position.clone().multiply(a);e.controls[0].position.copy(i),e.controls[1].position.copy(t)})),o}var gM=new vn([0,0,0],1),vM=class extends En{constructor(e=!0,t=1,i=1,r=1,n=1,s=1,a=1,o=1,l=1,h=1,c=1,d=1){if(super(),0===s)return;let u=e&&1===s;u&&(d=0),c>100&&(c=100),0===c&&(d=0);let p,f,m,g,v,y,x,b,w=()=>new Zi,_=new Zi,S=w(),A=w(),M=w(),E=w(),C=w(),T=w(),D=w(),P=w(),I=w(),O=w(),R=w(),L=i-2*o+.001,B=L/s,z=Math.ceil(a*s),k=z+1,N=L/z,F=-L/2,U=h+1,V=2*Math.PI/h,j=Math.PI/2/d,G=Math.min((1-c/100)*o,o-.01),H=o-G,W=0,q=2*d+2,Y=U*q/2,X=Y+U*k,Q=Math.max(0,U*(k+q)),[Z,K,J]=[3,3,2].map((e=>Array(Q*e).fill(0))),$=[],ee=n-o;function te(t,i){let r=Math.PI/2;y=i*N,b=2*Math.PI*(y%B)/B+r,y+=F,x=Math.sin(b)*ee,v=Math.cos(b)*ee,e?t.set(v,x,y):t.set(v,y,x)}te(_,-1e-10),te(S,0),E.copy(_),te(_,1);let ie=_.distanceTo(S),re=u?0:H+G,ne=ie*z+2*re,se=G,ae=ne-re;for(let ce=0;ce<=z;ce++){te(A,ce),R.subVectors(A,E).normalize(),E.copy(A),I.copy(A).setComponent(+e+1,0).normalize(),O.crossVectors(R,I).normalize();let t=0===ce,i=ce===z,r=t?3*Math.PI/2:j,n=t?se:ae,s=t?U:X,a=t?0:Q-U,l=R.clone().multiplyScalar(t?-H:H).add(A),c=R.clone().multiplyScalar(t?-1:1).normalize();for(let e=0;e{Z[3*W+e]=l.getComponent(e),K[3*W+e]=c.getComponent(e)})),J[2*W]=+i,J[2*W+1]=e/h),S.copy(T).multiplyScalar(G),M.addVectors(A,S);for(let i=0;i{Z[3*W+e]=S.getComponent(e),K[3*W+e]=P.getComponent(e)}));let o=+t+Math.sin(a);J[2*W]=(n+H*o)/ne,J[2*W+1]=e/h}}S.addVectors(A,C),W=Y+ce*U+e,[0,1,2].forEach((e=>{Z[3*W+e]=S.getComponent(e),K[3*W+e]=T.getComponent(e)})),J[2*W]=(re+ce*ie)/ne,J[2*W+1]=e/h}}let oe=k+2*d+2,[le,he]=[+u,oe-1];for(let ce=le;ce<=he-1;ce++){let e=u&&ce===he-1;for(let t=0;t0)for(let d=0;d0&&(this.normalsNeedUpdate=!0)}computeFlatVertexNormals(){this.computeFaceNormals();for(let e=0,t=this.faces.length;e0&&(this.normalsNeedUpdate=!0)}computeMorphNormals(){for(let t=0,i=this.faces.length;t=0;o--){let e=s[o];this.faces.splice(e,1);for(let t=0,i=this.faceVertexUvs.length;t0,a=e.vertexNormals.length>0,o=1!==e.color.r||1!==e.color.g||1!==e.color.b,l=e.vertexColors.length>0,f=0;if(f=h(f,0,0),f=h(f,1,t),f=h(f,2,r),f=h(f,3,n),f=h(f,4,s),f=h(f,5,a),f=h(f,6,o),f=h(f,7,l),i.push(f),i.push(e.a,e.b,e.c),i.push(e.materialIndex),n){let e=this.faceVertexUvs[0][p];i.push(u(e[0]),u(e[1]),u(e[2]))}if(s&&i.push(c(e.normal)),a){let t=e.vertexNormals;i.push(c(t[0]),c(t[1]),c(t[2]))}if(o&&i.push(d(e.color)),l){let t=e.vertexColors;i.push(d(t[0]),d(t[1]),d(t[2]))}}function h(e,t,i){return i?e|1<0&&(e.data.colors=s),o.length>0&&(e.data.uvs=[o]),e.data.faces=i,e}clone(){return(new _M).copy(this)}copy(e){this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.name=e.name;let t=e.vertices;for(let d=0,u=t.length;d0){let i=new Float32Array(3*e.normals.length);t.setAttribute("normal",TM.call(new mn(i,3),e.normals))}if(e.colors.length>0){let i=new Float32Array(3*e.colors.length);t.setAttribute("color",EM.call(new mn(i,3),e.colors))}if(e.uvs.length>0){let i=new Float32Array(2*e.uvs.length);t.setAttribute("uv",CM.call(new mn(i,2),e.uvs))}if(e.uvs2.length>0){let i=new Float32Array(2*e.uvs2.length);t.setAttribute("uv2",CM.call(new mn(i,2),e.uvs2))}t.groups=e.groups;for(let r in e.morphTargets){let i=[],n=e.morphTargets[r];for(let e=0,t=n.length;e0){let i=new yn(4*e.skinIndices.length,4);t.setAttribute("skinIndex",DM.call(i,e.skinIndices))}if(e.skinWeights.length>0){let i=new yn(4*e.skinWeights.length,4);t.setAttribute("skinWeight",DM.call(i,e.skinWeights))}return null!==e.boundingSphere&&(t.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(t.boundingBox=e.boundingBox.clone()),t}computeTangents(){console.error("THREE.Geometry: .computeTangents() has been removed.")}computeLineDistances(){console.error("THREE.Geometry: .computeLineDistances() has been removed. Use THREE.Line.computeLineDistances() instead.")}applyMatrix(e){return console.warn("THREE.Geometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(e)}dispose(){this.dispatchEvent({type:"dispose"})}static createBufferGeometryFromObject(e){let t=new En,i=e.geometry;if(e.isPoints||e.isLine){let e=new yn(3*i.vertices.length,3),r=new yn(3*i.colors.length,3);if(t.setAttribute("position",TM.call(e,i.vertices)),t.setAttribute("color",EM.call(r,i.colors)),i.lineDistances&&i.lineDistances.length===i.vertices.length){let e=new yn(i.lineDistances.length,1);t.setAttribute("lineDistance",MM.call(e,i.lineDistances))}null!==i.boundingSphere&&(t.boundingSphere=i.boundingSphere.clone()),null!==i.boundingBox&&(t.boundingBox=i.boundingBox.clone())}else e.isMesh&&(t=i.toBufferGeometry());return t}};_M.prototype.isGeometry=!0;var SM=class{constructor(){this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingBox=null,this.boundingSphere=null,this.verticesNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.groupsNeedUpdate=!1}computeGroups(e){let t,i,r,n=[],s=e.faces;for(i=0;i0,a=n[1]&&n[1].length>0,o=e.morphTargets,l=o.length;if(l>0){t=[];for(let e=0;e0){h=[];for(let e=0;e0&&0===i.length&&console.error("THREE.DirectGeometry: Faceless geometries are not supported.");for(let g=0;g0;)this._smooth(e);return e.computeFaceNormals(),e.computeVertexNormals(),e}_smooth(e){let t,i,r,n,s,a=new Zi,o=e.vertices,l=e.faces,h=e.faceVertexUvs[0],c=void 0!==h&&h.length>0,d=[],u=new Map;!function(e,t,i,r){let n,s,a;for(n=0,s=e.length;n3&&(w=3/(8*t)),_=1-t*Number(w),S=w,t<=2&&(2==t&&(_=3/4,S=1/8)),C=E.clone().multiplyScalar(_),a.set(0,0,0),n=0;n0){{let e=t.clone().add(r).multiplyScalar(.5),i=b.clone().sub(e).normalize(),n=x.clone().sub(e).normalize().add(i).normalize().multiplyScalar(-1);O(e,m.clone().sub(p),n,S.angle())}let f,g;{let e=new Zi;UM(E,P,e);let t=m.clone().add(n).multiplyScalar(.5);t=jM(t,r,b);let i=m.clone().sub(n);[f,g]=O(t,i,e,o,n.y)}{let e=f,t=e.clone().setY(0).normalize(),i=new Zi(0,-1,0),r=t.clone().cross(i);R(e,t,i,r)}I.concat(g);{let t=S.angle(),r=Math.PI-t,n=b.clone();n.y-=s/Math.sin(t-Math.PI/2);let o=new Zi,p=[];for(let l=0;li&&n>r?Math.min(e*i/t,e*r/n):t>i?e*i/t:n>r?e*r/n:e}let p=[];p[0]=0===n[0]?0:u(n[0],n[0]+n[3],n[0]+n[1]),p[1]=0===n[1]?0:u(n[1],n[1]+n[2],n[1]+n[0]),p[2]=0===n[2]?0:u(n[2],n[2]+n[1],n[2]+n[3]),p[3]=0===n[3]?0:u(n[3],n[3]+n[0],n[3]+n[2]);let f=c.x,m=d.x,g=d.y,v=c.y;t.addPoint(t.createPoint(f,g)),t.addPoint(t.createPoint(m,g)),t.addPoint(t.createPoint(m,v)),t.addPoint(t.createPoint(f,v)),t.isClosed=!0;let y=!0;for(let b=0,w=t.points.length;b0&&p[b]!==p[b-1]&&(y=!1);y&&(t.roundness=p[0]),t.useCubicForRoundedCorners=1!==s,t.update();let x=oM.create({shape:t,parameters:{depth:a,extrudeBevelSize:o,extrudeBevelSegments:l}});return Object.assign(x,{userData:{...e,type:"RectangleGeometry"}})}},WM=class extends En{constructor(e=1,t=1,i=1,r=90,n=10,s=24){super(),this.type="BackdropGeometry";let a=[],o=[],l=[],h=.001;0==n&&(s=1),s=Math.max(1,Math.floor(s)),n=Math.min(n,100),r=Math.min(180-h,r),r*=Math.PI/180;let c=[],d=Math.PI/2,u=(e=0,t=0,i=0)=>new Zi(e,t,i),p=u(),f=u(),[m,g,v]=[t/2,e/2,i/2],y=-g,x=+g,[b,w,_]=[u(y,-m,+v),u(y,-m,-v),u(y,+m,-v)],S=(e,t=!1)=>Math.sin(e-Math.PI/(+t+1)),A=(e,t=!1)=>Math.cos(e-Math.PI/(+t+1));_.y=Math.sin(r)*t-m;let M=Math.cos(r)*t-v,E=b.z-h;r<=d?(_.z=Math.min(M,E),_.z==E&&(_.y-=(M-E)/Math.tan(d-r))):w.z=Math.min(w.z-M-v,b.z-h),p.subVectors(b,w),f.subVectors(_,w);let C=Math.min(p.length(),f.length())*n/100,T=C*Math.tan(r/2),D=C/Math.cos(r/2),P=p.clone().normalize().add(f.normalize()).setLength(D).add(w);p.set(0,S(r,!0),A(r,!0)),c.push([_,p.clone()]);let I=(Math.PI-r)/s;for(let j=0;j<=s;j++){let e=d+r+j*I;p.set(0,Math.sin(e)*T,Math.cos(e)*T),p.add(P),f.set(0,S(e),A(e)),c.push([p.clone(),f.clone()])}c.push([b,u(0,1,0)]);let O=Math.sin(I/2)*T*2,R=c.length-1,L=c[0][0].distanceTo(c[1][0]),B=L+O*s+c[R-1][0].distanceTo(c[R][0]);c[0].push(1);for(let j=0;j<=s;j++)c[j+1].push(1-(L+j*O)/B);c[R].push(0);let z,k,N,[F,U,V]=c[0];for(let j=1;je.length)))}static isDecimalDigit(e){return e>=48&&e<=57}static binaryPrecedence(e){return YM.binary_ops[e]||0}static isIdentifierStart(e){return e>=65&&e<=90||e>=97&&e<=122||e>=128&&!YM.binary_ops[String.fromCharCode(e)]||YM.additional_identifier_chars.has(String.fromCharCode(e))}static isIdentifierPart(e){return YM.isIdentifierStart(e)||YM.isDecimalDigit(e)}throwError(e){let t=new Error(e+" at character "+this.index);throw t.index=this.index,t.description=e,t}runHook(e,t){if(YM.hooks[e]){let i={context:this,node:t};return YM.hooks.run(e,i),i.node}return t}searchHook(e){if(YM.hooks[e]){let t={context:this};return YM.hooks[e].find((function(e){return e.call(t.context,t),t.node})),t.node}}gobbleSpaces(){let e=this.code;for(;e===YM.SPACE_CODE||e===YM.TAB_CODE||e===YM.LF_CODE||e===YM.CR_CODE;)e=this.expr.charCodeAt(++this.index);this.runHook("gobble-spaces")}parse(){this.runHook("before-all");let e=this.gobbleExpressions(),t=1===e.length?e[0]:{type:YM.COMPOUND,body:e};return this.runHook("after-all",t)}gobbleExpressions(e){let t,i,r=[];for(;this.index0;){if(YM.binary_ops.hasOwnProperty(e)&&(!YM.isIdentifierStart(this.code)||this.index+e.lengthn.right_a&&e.right_a?i>e.prec:i<=e.prec;for(;r.length>2&&o(r[r.length-2]);)a=r.pop(),t=r.pop().value,s=r.pop(),e={type:YM.BINARY_EXP,operator:t,left:s,right:a},r.push(e);e=this.gobbleToken(),e||this.throwError("Expected expression after "+l),r.push(n,e)}for(o=r.length-1,e=r[o];o>1;)e={type:YM.BINARY_EXP,operator:r[o-1].value,left:r[o-2],right:e},o-=2;return e}gobbleToken(){let e,t,i,r;if(this.gobbleSpaces(),r=this.searchHook("gobble-token"),r)return this.runHook("after-token",r);if(e=this.code,YM.isDecimalDigit(e)||e===YM.PERIOD_CODE)return this.gobbleNumericLiteral();if(e===YM.SQUOTE_CODE||e===YM.DQUOTE_CODE)r=this.gobbleStringLiteral();else if(e===YM.OBRACK_CODE)r=this.gobbleArray();else{for(t=this.expr.substr(this.index,YM.max_unop_len),i=t.length;i>0;){if(YM.unary_ops.hasOwnProperty(t)&&(!YM.isIdentifierStart(this.code)||this.index+t.length=t.length&&this.throwError("Unexpected token "+String.fromCharCode(e));break}if(n===YM.COMMA_CODE){if(this.index++,r++,r!==t.length)if(e===YM.CPAREN_CODE)this.throwError("Unexpected token ,");else if(e===YM.CBRACK_CODE)for(let e=t.length;e{if("object"!=typeof e||!e.name||!e.init)throw new Error("Invalid JSEP plugin format");this.registered[e.name]||(e.init(this.jsep),this.registered[e.name]=e)}))}}(YM),COMPOUND:"Compound",SEQUENCE_EXP:"SequenceExpression",IDENTIFIER:"Identifier",MEMBER_EXP:"MemberExpression",LITERAL:"Literal",THIS_EXP:"ThisExpression",CALL_EXP:"CallExpression",UNARY_EXP:"UnaryExpression",BINARY_EXP:"BinaryExpression",ARRAY_EXP:"ArrayExpression",TAB_CODE:9,LF_CODE:10,CR_CODE:13,SPACE_CODE:32,PERIOD_CODE:46,COMMA_CODE:44,SQUOTE_CODE:39,DQUOTE_CODE:34,OPAREN_CODE:40,CPAREN_CODE:41,OBRACK_CODE:91,CBRACK_CODE:93,QUMARK_CODE:63,SEMCOL_CODE:59,COLON_CODE:58,unary_ops:{"-":1,"!":1,"~":1,"+":1},binary_ops:{"||":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10},right_associative:new Set,additional_identifier_chars:new Set(["$","_"]),literals:{true:!0,false:!1,null:null},this_str:"this"}),YM.max_unop_len=YM.getMaxKeyLen(YM.unary_ops),YM.max_binop_len=YM.getMaxKeyLen(YM.binary_ops);var QM=e=>new YM(e).parse();Object.getOwnPropertyNames(YM).forEach((e=>{void 0===QM[e]&&"prototype"!==e&&(QM[e]=YM[e])})),QM.Jsep=YM;var ZM={name:"ternary",init(e){e.hooks.add("after-expression",(function(t){if(t.node&&this.code===e.QUMARK_CODE){this.index++;let i=t.node,r=this.gobbleExpression();if(r||this.throwError("Expected expression"),this.gobbleSpaces(),this.code===e.COLON_CODE){this.index++;let n=this.gobbleExpression();if(n||this.throwError("Expected expression"),t.node={type:"ConditionalExpression",test:i,consequent:r,alternate:n},i.operator&&e.binary_ops[i.operator]<=.9){let r=i;for(;r.right.operator&&e.binary_ops[r.right.operator]<=.9;)r=r.right;t.node.test=r.right,r.right=t.node,t.node=i}}else this.throwError("Expected :")}}))}};QM.plugins.register(ZM);var KM=["+","-","*","/","(",")","==","!=",">","<",">=","<=","and","or","!","%","^",","],JM=["0","1","2","3","4","5","6","7","8","9","."],$M=["sin","cos","tan","asin","acos","atan","atan2","sqrt","abs","log","exp","floor","ceil","round","min","max","random"];function eE(e){return"string"==typeof e&&(!isNaN(e)&&!isNaN(parseFloat(e)))}function tE(e,t,i="number"){let r,n,s="";for(let a=0;a0&&"id"in n)return void console.error("Two variables in a row",e);let o=t.getVariable(r.id),l=aw.getDisplayedValue(o);"number"===i&&aw.isTextValue(o)&&Array.isArray(o.textValue)&&1===o.textValue.length?l=parseFloat(l).toString():"boolean"===i&&aw.isBoolean(o)?l=o?"true":"false":"boolean"===i&&aw.isTextValue(o)&&!Array.isArray(o.textValue)&&(l='"'+l+'"'),s+=l}else"string"!==i?"and"!==r.name?"or"!==r.name?"True"!==r.name?"False"!==r.name?"boolean"!==i||eE(r.name)||JM.includes(r.name)||KM.includes(r.name)||$M.includes(r.name.replace(/\($/g,""))?s+=r.name:s+='"'+r.name+'"':s+="false":s+="true":s+="||":s+="&&":('"'!==r.name&&"+"!==r.name&&(s+=r.name),"+"===r.name&&"\\"===s[s.length-1]&&(s=s.slice(0,-1)+r.name))}if("string"===i)return s;if(0===e.length){if("number"===i)return 0;if("boolean"===i)return!1}try{r=QM(s)}catch(Ox){return void console.error(s,Ox)}try{n=iE(r)}catch(Ox){console.error(s,r,Ox)}return n}function iE(e){switch(e.type){case"BinaryExpression":switch(e.operator){case"==":return Number(iE(e.left)===iE(e.right));case"!=":return Number(iE(e.left)!==iE(e.right));case">":return Number(iE(e.left)>iE(e.right));case">=":return Number(iE(e.left)>=iE(e.right));case"<":return Number(iE(e.left)=1)try{i=iE(e.arguments[0])}catch(t){console.warn(t)}if(e.arguments.length>=2)try{r=iE(e.arguments[1])}catch(t){console.warn(t)}return i=Math.min(r,i),r=Math.max(r,i),i+Math.random()*(r-i)}return Math[e.callee.name].apply(null,e.arguments.map(iE))}throw new Error("Unknown node");default:throw new Error("Unknown node type: "+e.type)}}QM.addBinaryOp("^",11,!0);var rE=new Er,nE=new Er;var sE=class extends En{constructor(e){super(),this.type="PathExtrusionGeometry",this.inputs=e,this.build()}_isGeometryClosed(){return this.inputs.path.isClosed&&1===this.inputs.parameters.extrusion.depth}_isOpenEnded(){let e=this.inputs.parameters.extrusion;return!(this.inputs.path.isClosed&&1===e.depth&&function(e,t){let i=2*Math.PI;return(e%i+i)%i==(t%i+i)%i}(e.twist,0)&&e.startScale===e.endScale)}build(){let e=this._extractPathPoints();if(e.length<2)return;let t=this._computeBasisMatrices(e),{depth:i,offset:r}=this.inputs.parameters.extrusion;i=Math.max(0,Math.min(i,1)),r=Math.max(0,Math.min(r,1));let n=this.inputs.path.isClosed?e.length:e.length-1,s=Math.floor(r*n),a=this.inputs.path.isClosed?Math.ceil((i+r)*n):Math.ceil(Math.min(1,i+r)*n),o=Math.min(Math.max(2,a-s+1),n+2),l=[],h=[];for(let R=0;R{l[e]=l[e].clone().lerp(l[t],i),h[e]=function(e,t,i){let r=[new Zi,new Zi,new Zi],n=[new Zi,new Zi,new Zi];return e.extractBasis(r[0],r[1],r[2]),t.extractBasis(n[0],n[1],n[2]),r.forEach(((e,t)=>{let r=n[t],s=bi.lerp(e.length(),r.length(),i);e.lerp(r,i).setLength(s)})),(new Er).makeBasis(r[0],r[1],r[2])}(h[e],h[t],i)},d=0,u=r*n%1;(!this.inputs.path.isClosed||i<=1)&&(u||0===r)&&(d=u,c(0,1,d));let p=0,f=(r+i)*n%1;if((this.inputs.path.isClosed&&i<=1||!this.inputs.path.isClosed&&r+i<1)&&f&&(p=f,c(l.length-1,l.length-2,1-p)),0===i){let e=l.length-1;l[e].copy(l[0]),h[e].copy(h[0])}this._applyPathModifiers(h,d,p);let{bevel:m,bevelSides:g}=this.inputs.parameters.extrusion,v=m>0?this.inputs.parameters.extrusion.capType:"flat",y=5;"Custom"===this.inputs.parameters.extrusion.shape.type&&(y="low"===this.inputs.parameters.extrusion.shape.shapeQuality?5:12);let x,{regions:b,infos:w,vertices:_}=this._computeShapePoints(y),S=0;"round"===v&&(x=new nM(this.inputs.shapeData,2*m,m,y,g,void 0,!0),S=x.getAttribute("position").count);let A=0,M=0;w.sort(((e,t)=>e.start-t.start)),w.forEach((e=>{e.verticesStart=A,e.verticesCount=e.continuous.reduce(((e,t,i)=>e+(0!==i&&t?1:2)),0),M+=e.verticesCount,A=M}));let E,C=M*o,T=0;if(this._isOpenEnded()&&"flat"===v){try{E=ZA({windingRule:_A.ODD,elementType:SA.POLYGONS,polySize:3,vertexSize:2,strict:!0,contours:b})}catch{E=iM}T=E.vertexCount}let D=C+2*T+2*S,P=C+2*T,I={positions:new Float32Array(3*D),normals:new Float32Array(3*D),uvs:new Float32Array(2*D)},O=[];if(w.forEach((e=>{this._extrudeRegion(e,_,h,l,I,O,this._isGeometryClosed()&&!this._isOpenEnded())})),E&&(this._closeEnd(E,C,O,I,h[0],l[0],!1),this._closeEnd(E,C+T,O,I,h[h.length-1],l[l.length-1],!0)),x){I.positions.set(x.getAttribute("position").array,3*P),I.normals.set(x.getAttribute("normal").array,3*P),I.uvs.set(x.getAttribute("uv").array,2*P);let e=O.length;O.push(...x.getIndex().array.map((e=>e+P))),P+=S,I.positions.set(x.getAttribute("position").array,3*P),I.normals.set(x.getAttribute("normal").array,3*P),I.uvs.set(x.getAttribute("uv").array,2*P);let t=O.length;O.push(...x.getIndex().array.map((e=>e+P))),this.setAttribute("position",new mn(I.positions,3)),this.setAttribute("normal",new mn(I.normals,3)),this.setAttribute("uv",new mn(I.uvs,2)),this.setIndex(O);let i=rE;i.copy(h[h.length-1]).setPosition(l[l.length-1]),this.applyMatrix4OnRange(i,P,D),i.copy(h[0]).setPosition(l[0]).multiply(nE.makeScale(1,1,-1)),this.applyMatrix4OnRange(i,P-S,P),this.reverseIndicesOnRange(e,t)}else this.setAttribute("position",new mn(I.positions,3)),this.setAttribute("normal",new mn(I.normals,3)),this.setAttribute("uv",new mn(I.uvs,2)),this.setIndex(O)}_extractPathPoints(){let e=LS(this.inputs.path).getPoints(this.inputs.path.subdivisions);if(e.length<2)return[];let t=[e[0]];return e.forEach((e=>{t[t.length-1].distanceToSquared(e)>.001&&t.push(e)})),this.inputs.path.isClosed&&t[t.length-1].distanceTo(t[0])<.001&&t.pop(),t}_computeBasisMatrices(e){let t=[],i=e.length,r=this.inputs.path.isClosed,n=new Zi,s=new Zi,a=new Zi,o=new Zi,l=new Zi(0,1,0);for(let f=0;f0&&(u*=-1);for(let f=1;f{let d=0===c?0:c===r-1?1:(c-t)/(r-(0===i?0:1)-(t+(1-i)));l.makeRotationZ(bi.lerp(n,n+s,d)*bi.DEG2RAD);let u=bi.lerp(a,o,d);h.makeScale(u,u,u),e.multiply(l).multiply(h)})),e}_computeShapePoints(e=12,t=_A.ODD){let i,r,n=this.inputs.shapeData,s=n.extractShapePointsToFlatArray([],e),a=n.shapeHoles.map((t=>{let i=t.extractShapePointsToFlatArray([],e),r=[];for(let e=i.length-1;e>=1;e-=2){let t=i[e-1],n=i[e-0];r.push(t,n)}return r}));try{i=ZA({windingRule:t,elementType:SA.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[s]})}catch{i=eM}try{r=ZA({windingRule:_A.ODD,elementType:SA.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[...a]})}catch{r=tM}if(!i)throw new Error("error generating geometry");let o=i.elementCount;if(r){i.elementCount+=r.elementCount;for(let e=0;eh&&(h=t),rd&&(d=r)}let u=[];for(let p=i.elementCount-1;p>=0;p--){let e=p>=o,t=2*p,r=i.elements[t+0],s=i.elements[t+1],a=r+s,l={start:r,count:s,normals:[],isHole:e,continuous:[],verticesStart:0,verticesCount:0};u.push(l);let h=r,c=a-1,d=r+1,f=n.roundedCurves.length;do{let t=h-r,o=i.vertices[2*c+0],u=i.vertices[2*c+1],p=i.vertices[2*h+0],m=i.vertices[2*h+1],g=i.vertices[2*d+0],v=i.vertices[2*d+1],y=p-o,x=m-u,b=Math.sqrt(y*y+x*x);y/=b,x/=b;let w=p-g,_=m-v,S=Math.sqrt(w*w+_*_);w/=S,_/=S,l.normals[2*t+0]=-_,l.normals[2*t+1]=w;let A=i.vertexIndices[h];if(Array.isArray(A))l.continuous[t]=!1;else{let[e,i]=n.getCurveIndexFromVertexId(A-1,!0);if(i>0&&i<1)l.continuous[t]=!0;else{let r=1===i?e+1:e-1;r=(r+f)%f;let s=1===i?0:1,a=n.roundedCurves[e].getTangent(i),o=n.roundedCurves[r].getTangent(s);l.continuous[t]=a.dot(o)>.95}}e&&(l.normals[2*t+0]*=-1,l.normals[2*t+1]*=-1),[c,h,d]=[h,d,d+1],d>=a&&(d-=s)}while(d!==r+1)}return{regions:[s,...a],infos:u,vertices:i.vertices}}_insertVertex(e,t,i,r,n){let s=2*t,a=3*t;e.positions[a+0]=i.x,e.positions[a+1]=i.y,e.positions[a+2]=i.z,e.normals[a+0]=r.x,e.normals[a+1]=r.y,e.normals[a+2]=r.z,e.uvs[s+0]=n.x,e.uvs[s+1]=n.y}_extrudeRegion(e,t,i,r,n,s,a){let o=new Zi,l=new Zi,h=new Zi,c=new Zi,d=new wi;i.forEach(((s,a)=>{let u=r[a],p=e.verticesStart*i.length+e.verticesCount*a;for(let r=0;r{this.update(e),t?.requestRender()}))}async updateFont(e,t){let i=t.getFont(e);i&&(this.font=i,await i.loadingPromise)}update(e){let t=this.font;if(this.userData={parameters:e,type:"TextGeometry"},!t?.isLoaded)return void console.warn("Cannot update text because its font is not loaded");let{width:i,height:r,depth:n,extrudeBevelSize:s,extrudeBevelSegments:a,text:o,textTransform:l}=e,h=aw.getDisplayedValue(o),c=function(e,t,i){let r=[""],n="";for(let s of i)n+=s," "===s||"\n"===s?(r[r.length-1]+=n,n="","\n"===s&&r.push("")):t.getTextWidth(r[r.length-1]+n,e)>e.width&&(r[r.length-1].length&&r.push(""),t.getTextWidth(r[r.length-1]+n,e)>e.width&&(1===n.length?(r[r.length-1]+=n,n=""):(r[r.length-1]+=n.slice(0,-1),n=n[n.length-1],r.push(""))));return r[r.length-1]+=n,r}(e,t,2===l?h.toUpperCase():3===l?h.toLowerCase():h),{shapes:d,charWidths:u,charCoords:p}=t.generateShapes(c,e),f=.5*("number"==typeof i?i:1),m=.5*("number"==typeof r?r:1),g=d.map((e=>(new PA).fromShape(e,!0)));this.vectorShapes=g;let v=g.map((e=>oM.create({shape:e,parameters:{depth:n,extrudeBevelSegments:a,extrudeBevelSize:s,windingRule:n<=0?_A.NONZERO:_A.ODD,subdivisions:this.isLowResolution&&n>0?1:12}}))),y=v.length?kw(v):aE();y.translate(-f,m,0),this.dispose(),this.wrappedText=c,this.charCoords=p,this.charWidths=u,this.deleteAttribute("extrudeNormal"),Object.entries(y.attributes).forEach((([e,t])=>{this.setAttribute(e,t)})),this.setIndex(y.index),this.computeBoundingSphere()}clone(){let e=Eg(new En,lE.prototype);return e.copy(this),console.log("CloneGeometry",this,e),e}copy(e){return Object.entries(e.attributes).forEach((([e,t])=>{this.setAttribute(e,t)})),this.setIndex(e.index),this.userData={parameters:{...e.userData.parameters},type:"TextGeometry"},this}async setText(e){this.font&&await this.font.loadingPromise,await this.update({...this.userData.parameters,text:e})}get text(){return this.userData.parameters.text??""}};var hE,cE,dE=new Promise((e=>{hE=e})),uE=!1;function pE(){if(!uE)return cE||(cE=async function(){let e=i.e(86256).then(i.bind(i,86256)),[t,r]=await Promise.all([e,fetch("https://unpkg.com/@splinetool/modelling-wasm@0.9.512/build/process.wasm").then((e=>e.arrayBuffer()))]),n=t.default,s=await n({wasmBinary:r});hE(s),uE=!0}(),cE)}function fE(e,t,i,r){let n,s,a;"PathGeometry"===e.type?(s=JSON.parse(JSON.stringify(e)),a=[[],["extrusion"]]):(s={...e},a=[[]]);for(let c of a){let e=s;for(let t of c)e=e[t];for(n in e){let i=e[n];eb(i)&&(e[n]=t.getVariable(i,[r.uuid,"geometry",...c,n]))}}let o,l={parameters:s,type:s.type};if("PathGeometry"===s.type)l.path=s.path;else if("VectorGeometry"===s.type){let e=PA.createFromState(s.shape,s.width,s.height);l.shape=e}else if("NonParametricGeometry"===s.type)s.data.groups&&s.data.groups?.forEach((e=>e.materialIndex=Math.max(e.materialIndex??0,0))),l.geometry=(new ic).parse(s);else{if("SubdivGeometry"===s.type){let t=new SE(s,i);return t.data=e,t}if("TextGeometry"===s.type)return new lE(s,t)}try{o=qE(l)}catch(h){console.error(h)}if(!o){let e=PA.createFromState(xb.defaultData(),100,100);l.shape=e,o=qE(l)}return o}var mE=new Er;function gE(e,t,i,r){let n,s,a,o=e.position.array,l=e.normal.array,h=mE.makeScale(t,i,r).invert().elements;for(var c=0,d=o.length;c{vE=e}));var bE=new Float32Array([10,10,0,-10,10,0,-10,-10,0,10,-10,0]),wE=new Uint32Array([0,1,2,3]),_E=new Uint8Array([4]),SE=class extends En{constructor(e,t){super(),this.data=e,this.flatShading=t,this.subdivPointer=0,this.rebuild(),this.freeSubdivPointer()}mutateDirectlyScaleBaked(e,t){this.freeSubdivPointer();let i=this.data.scaleBaked,r=zx.div(t,i);this.subdividedGeometry&&gE(this.subdividedGeometry.attributes,...r),this.originalGeometry&&gE(this.originalGeometry.attributes,...r),this.data=e;let n=this.userData.parameters;this.userData.parameters={width:n.width*r[0],height:n.height*r[1],depth:n.depth*r[2]},this.originalGeometry.boundingSphere.center.multiply(xE.fromArray(r));let s=xE.set(n.width,n.height,n.depth).length();this.originalGeometry.boundingSphere.radius=s/2}ensureSubdivPointer(){return 0===this.subdivPointer&&this.rebuild(),this.subdivPointer}rebuild(){let e,t,i;try{({originalGeometry:e,subdividedGeometry:t,subdivPointer:i}=SE.build(this.data,void 0,!this.flatShading,void 0))}catch{e=new jn(100,100,100),i=0}this.subdivPointer=i,this.originalGeometry=e,this.subdividedGeometry=t??void 0;let r=this.subdividedGeometry??this.originalGeometry;Object.assign(this,r),this.calcBoundingBox()}freeSubdivPointer(){this.subdivPointer&&(SE.freeSubdivPointer(this.subdivPointer),this.subdivPointer=0)}dispose(){super.dispose(),this.freeSubdivPointer()}calcBoundingBox(){let e=this.originalGeometry;null===e.boundingSphere&&(e.boundingSphere=new vr,this.subdividedGeometry&&(this.subdividedGeometry.boundingSphere=e.boundingSphere));let t=e.attributes.position,i=e.boundingSphere.center;yE.setFromBufferAttribute(t),yE.getCenter(i),e.boundingSphere.radius=i.distanceTo(yE.max),isNaN(e.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),yE.getSize(xE);let r={width:xE.x,height:xE.y,depth:xE.z};return this.userData.parameters=r,r}static build(e,t,i,r){let n,s,a,o=e?.phongAngle??35;!1===i&&(o=-1),t&&(vE.free_bvh(t),vE.free_subdivision_surface(t));try{n=SE.allocate(e,r)}catch(l){console.error(l,e),n=SE.allocate({positionWASM:bE,indexWASM:wE,verticesPerFaceWASM:_E},r)}if(vE.set_destination_refinement_level(n,0),s=SE.buildLevel(n,!0,o),e.subdivisions>0)try{vE.set_destination_refinement_level(n,e.subdivisions),a=SE.buildLevel(n,!1,o)}catch{try{vE.set_destination_refinement_level(n,e.subdivisions-1),a=SE.buildLevel(n,!1,o)}catch{a=null}}else a=null;return{subdivPointer:n,originalGeometry:s,subdividedGeometry:a}}static primitiveToQuads(e,t,i){e.widthSegments>16&&(e.widthSegments=16),e.heightSegments>16&&(e.heightSegments=16),e.depthSegments>16&&(e.depthSegments=16),e.radialSegments>16&&(e.radialSegments=16),"DodecahedronGeometry"===e.type&&(e.detail=0);let r,n,s,a,o,l,h=void 0!==e.shape||void 0!==e.path?t.geometry:fE(e,i,!1);if(r="TorusGeometry"===e.type&&e.arc===2*Math.PI?h.getClosedTorusIndicesForBooleanOrSubdiv():h.getIndex(),({positions:n,triIndices:o}=ME(h.getAttribute("position"),r)),"CylinderGeometry"===e.type&&0===e.cornerRadius&&0===e.hollow&&!1===e.openEnded){let t=e.radialSegments*e.heightSegments*3*2;l=[t,t+3*e.radialSegments]}return({indices:s,verticesPerFace:a}=PE(n,o,h,l)),{positions:n,indices:s,verticesPerFace:a}}static allocate(e,t){let i,r,n,s=[],a=[];e.positionWASM&&e.positionWASM.length>0?(i=e.positionWASM,r=e.indexWASM,n=e.verticesPerFaceWASM):(i=bE,r=wE,n=_E);let o,l=i.length,h=r.length,c=n.length,d=i.length+s.length+a.length,u=r.length+n.length,p=d*Float32Array.BYTES_PER_ELEMENT+u*Uint32Array.BYTES_PER_ELEMENT,f=d*Float32Array.BYTES_PER_ELEMENT,m=(Uint32Array.BYTES_PER_ELEMENT,vE._malloc(p)),g=new Float32Array(vE.HEAPF32.buffer,m,d),v=new Uint32Array(vE.HEAPU32.buffer,m+f,u);g.set(i,0),g.set(s,i.length),g.set(a,i.length+s.length),v.set(r,0),v.set(n,r.length),e?.scaleBaked?.some((e=>1!==e))&&(o=(new Er).makeScale(...e.scaleBaked)),t&&(o?o.premultiply(t):o=t);let y=o?vE.alloc_subdivision_surface2(m,l,m+f,h,m+f+r.length*Uint32Array.BYTES_PER_ELEMENT,c,o.elements):vE.alloc_subdivision_surface(m,l,m+f,h,m+f+r.length*Uint32Array.BYTES_PER_ELEMENT,c);return vE._free(m),y}static buildLevel(e,t,i,r,n){let s=n?vE.get_mesh_data2(e,t?vE.Level.CONTROL:vE.Level.REFINED,i,n.elements):vE.get_mesh_data(e,t?vE.Level.CONTROL:vE.Level.REFINED,i),a=vE.HEAPU32.subarray(s>>2,8+(s>>2)),o=a.subarray(4,8),l=0,h=vE.HEAPU32[a[l]>>2],c=vE.HEAPF32.subarray(h>>2,(h>>2)+o[l]);l++;let d=vE.HEAPU32[a[l]>>2],u=vE.HEAPF32.subarray(d>>2,(d>>2)+o[l]);l++;let p=vE.HEAPU32[a[l]>>2],f=vE.HEAPU32.subarray(p>>2,(p>>2)+o[l]);l++;let m=vE.HEAPU32[a[l]>>2],g=vE.HEAPU32.subarray(m>>2,(m>>2)+o[l]);if(l++,void 0===r){let e=new En;if(e.setIndex(new vn(g,1)),e.setAttribute("position",new yn(c,3)),e.setAttribute("normal",new yn(u,3)),t){e.setAttribute("faceMap",new vn(f,1));let t=new Float32Array(u.length/3*4).fill(0);e.setAttribute("color",new mn(t,4))}return vE.free_mesh_data(s),e.userData.type="SubdivGeometry",e}r.getAttribute("position").copyArray(c),r.getAttribute("normal").copyArray(u),r.attributes.position.needsUpdate=!0,r.attributes.normal.needsUpdate=!0,vE.free_mesh_data(s)}static freeSubdivPointer(e){vE.free_bvh(e),vE.free_subdivision_surface(e)}static buildControlCageWireframe(e,t,i){let r=vE.get_wireframe_data_for_base_level(e),n=vE.HEAPU32.subarray(r>>2,4+(r>>2)),s=n.subarray(2,4),a=0,o=vE.HEAPU32[n[a]>>2],l=vE.HEAPF32.subarray(o>>2,(o>>2)+s[a]);a++;let h=vE.HEAPU32[n[a]>>2],c=vE.HEAPU32.subarray(h>>2,(h>>2)+s[a]);if(void 0===t){let e=new En;e.setAttribute("position",new yn(l,3));let t=new Float32Array(l.length);for(let r=0,n=l.length;r>2,6+(n>>2)),a=s.subarray(3,6),o=0,l=vE.HEAPU32[s[o]>>2],h=new Float32Array(vE.HEAPF32.subarray(l>>2,(l>>2)+a[o]));o++;let c=vE.HEAPU32[s[o]>>2],d=new Uint32Array(vE.HEAPU32.subarray(c>>2,(c>>2)+a[o]));o++;let u=vE.HEAPU32[s[o]>>2],p=new Uint8Array(vE.HEAPU32.subarray(u>>2,(u>>2)+a[o]));return vE.free_topological_data(n),{positions:h,indices:d,verticesPerFace:p}}},AE=["getX","getY","getZ"];function ME(e,t){let i={},r=t?t.count:e.count,n=0,s=[],a=[];for(let l=0;l=360){let e=t.length/2/r;t=t.filter(((t,i)=>Math.floor(i/2)%e==0))}let a=0;for(let e=0;e=0;i-=2)e.push(t[i],t[i+1],0),n.push(o++);return s.push(o),{indices:n,verticesPerFace:s}}let a=new Float32Array([i.userData.parameters.depth])[0],o=0;for(;o.005||r&&r.some(((e,t)=>t%2!=1&&(o>=r[t]&&oe.arrayBuffer()))]),n=t.default,s=await n({wasmBinary:r});IE(s)}(),OE}function kE(e){let t=e.length,i=t*Uint32Array.BYTES_PER_ELEMENT,r=t*Float32Array.BYTES_PER_ELEMENT,n=Number.isInteger(e[0])?i:r,s=RE._malloc(n);return(Number.isInteger(e[0])?new Uint32Array(RE.HEAPU32.buffer,s,t):new Float32Array(RE.HEAPF32.buffer,s,t)).set(e,0),s}function NE(e){switch(e){case 0:return RE.OP.UNION;case 1:return RE.OP.INTERSECTION;case 2:return RE.OP.A_MINUS_B;case 3:return RE.OP.B_MINUS_A;case 4:return RE.OP.SYMMETRIC_DIFFERENCE;case 5:return RE.OP.ALL;default:throw new Error("Unknown boolean operation "+e)}}function FE(e,t){void 0===LE&&(LE=RE.init_csg());let i=kE(e),r=RE.csg_calc_topological(LE,i,e.length,NE(t));RE._free(i);let n=RE.HEAPU32.subarray(r>>2,6+(r>>2)),s=n.subarray(3,6),a=0,o=RE.HEAPU32[n[a]>>2],l=new Float32Array(RE.HEAPF32.subarray(o>>2,(o>>2)+s[a]));a++;let h=RE.HEAPU32[n[a]>>2],c=new Uint32Array(RE.HEAPU32.subarray(h>>2,(h>>2)+s[a]));a++;let d=RE.HEAPU32[n[a]>>2],u=new Uint8Array(RE.HEAPU32.subarray(d>>2,(d>>2)+s[a]));return RE.free_mesh_data(r),{positions:l,indices:c,verticesPerFace:u}}function UE(e,t,i,r){void 0===LE&&(LE=RE.init_csg());let n=kE(e),s=RE.csg_calc(LE,n,e.length,r,NE(t));RE._free(n);let a=RE.HEAPU32.subarray(s>>2,5+(s>>2)),o=a.subarray(2,5),l=0,h=RE.HEAPU32[a[l]>>2],c=RE.HEAPF32.subarray(h>>2,(h>>2)+o[l]);l++;let d=RE.HEAPU32[a[l]>>2],u=RE.HEAPF32.subarray(d>>2,(d>>2)+o[l]);l++;let p=o[l];i.setAttribute("position",new yn(c,3)),i.setAttribute("normal",new yn(u,3));let f=RE.HEAPF32.subarray(5+(s>>2),5+(s>>2)+6);return null===i.boundingSphere&&(i.boundingSphere=new vr),i.boundingSphere.radius=-1,i.userData.parameters={width:2*f[3],height:2*f[4],depth:2*f[5]},RE.free_mesh_data(s),p}function VE(e,t,i){if(void 0===RE)return-1;let r,n,s;if(t&&void 0!==e.userData.positions){let t=e.userData;s=t.verticesPerFace.length,r=t.positions,n=Array(t.verticesPerFace.reduce(((e,t)=>e+t),0)+s);for(let e=0,i=0,r=0;e{for(var i in t)s(e,i,{get:t[i],enumerable:!0})})(BE,{calcBoolean:()=>UE,calcBooleanTopological:()=>FE,freeMeshSet:()=>HE,getMeshSet:()=>VE,hasOpenEdges:()=>jE,transformMeshSet:()=>GE}),new Promise((e=>{IE=e})).then((e=>RE=e));var WE={ConeGeometry:class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,radialSegments:32,heightSegments:8,openEnded:!1,thetaStart:0,thetaLength:360,cornerRadiusTop:8,cornerRadiusBottom:8,cornerSegments:8},e.parameters);return i.thetaLength=bi.clamp(i.thetaLength,0,360),{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(e){let t,{width:i,depth:r,height:n,radialSegments:s,heightSegments:a,openEnded:o,thetaStart:l,thetaLength:h,cornerRadiusTop:c,cornerRadiusBottom:d,cornerSegments:u}=e.parameters;return 0===h?(t=new En,t.setAttribute("position",new yn([],3))):t=c>0||d>0||h<360?new HS(0,i/2,n,s,a,o,l,h*Math.PI/180,c,d,u,0,!0):new Ol(i/2,n,s,a,o),t.scale(1,1,r/i),Object.assign(t,{userData:{...e,type:"ConeGeometry"}})}},CubeGeometry:class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,widthSegments:1,heightSegments:1,depthSegments:1,cornerRadius:8,cornerSegments:8},e.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(e){let t,{width:i,height:r,depth:n,widthSegments:s,heightSegments:a,depthSegments:o,cornerRadius:l,cornerSegments:h}=e.parameters;return t=0==l?new jn(i,r,n,s,a,o):new qS(i,r,n,s,a,o,l,h),Object.assign(t,{userData:{...e,type:"CubeGeometry"}})}},CylinderGeometry:VS,DodecahedronGeometry:class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,detail:0,corner:0,cornerSides:4},e.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(e){let{width:t,height:i,depth:r,detail:n,corner:s,cornerSides:a}=e.parameters,o=0===n&&0!==s?new XS(.5*t,s,a):new Ll(.5*t,n);return o.scale(1,i/t,r/t),Object.assign(o,{userData:{...e,type:"DodecahedronGeometry"}})}},EllipseGeometry:hM,HelixGeometry:class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,revolutions:2,segments:40,pathRadius:10,pathType:0,pathSegments:30,cornerRadius:30,cornerSegments:4},e.parameters),r=Math.abs(i.width),n=Math.abs(i.height??r),s=Math.abs(i.depth??r),a=Math.abs(Math.min(r,s))/2;return{parameters:Object.assign(i,{width:r,height:n,depth:s,radius:a,segments:Math.round(i.segments),pathSegments:Math.round(i.pathSegments),cornerSegments:Math.round(i.cornerSegments)})}}static build(e){let{width:t,height:i,depth:r,radius:n,revolutions:s,segments:a,pathRadius:o,pathType:l,pathSegments:h,cornerRadius:c,cornerSegments:d}=e.parameters,u=new vM(!1,t,i,r,n,s,a,o,l,h,c,d);return Object.assign(u,{userData:{...e,type:"HelixGeometry"}})}},IcosahedronGeometry:class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,detail:0,corner:0,cornerSides:4},e.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(e){let{width:t,height:i,depth:r,detail:n,corner:s,cornerSides:a}=e.parameters,o=0===n&&0!==s?new yM(.5*t,s,a):new ch(.5*t,n);return o.scale(1,i/t,r/t),Object.assign(o,{userData:{...e,type:"IcosahedronGeometry"}})}},LatheGeometry:class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){(e.parameters?.points??[]).forEach((e=>{Array.isArray(e)&&(e.x=e[0],e.y=e[1])}));let i=Object.assign({},t?.parameters??{width:100,segments:64,verticalSegments:64,points:[{x:0,y:-50,id:0},{x:50,y:-50,id:1},{x:50,y:50,id:2},{x:0,y:50,id:3}]},e.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(e){let{points:t,segments:i,verticalSegments:r}=e.parameters,n=new Bl;n.moveTo(t[0].x,t[0].y),n.bezierCurveTo(t[1].x,t[1].y,t[2].x,t[2].y,t[3].x,t[3].y);let s=new Pl(n.extractPoints(r).shape,i);return s.rotateZ(Math.PI),Object.assign(s,{userData:{...e,type:"LatheGeometry"}})}},NonParametricGeometry:class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i,r=e.geometry??t?.geometry??(new En).copy(new jn(100,100,100));void 0===t?(r.computeBoundingBox(),r.boundingBox.getSize(NM),i={width:NM.x,height:NM.y,depth:NM.z,subdivisions:0}):i=t.parameters;let n={...i,...e.parameters};return{parameters:{width:Math.abs(n.width),height:Math.abs(n.height),depth:Math.abs(n.depth),subdivisions:Math.abs(n.subdivisions)},geometry:r}}static build(e){let{width:t,height:i,depth:r,subdivisions:n}=e.parameters,s=e.geometry??(new En).copy(new jn(100,100,100)),a=s.userData.parameters;void 0===a?(s.computeBoundingBox(),s.boundingBox.getSize(NM)):NM.set(a.width,a.height,a.depth),(t!==NM.x||i!==NM.y||r!==NM.z)&&s.scale(0===NM.x?1:t/NM.x,0===NM.y?1:i/NM.y,0===NM.z?1:r/NM.z);let o=s.originalGeometry;try{n>0?(void 0===o||a?.subdivisions!==n)&&(void 0===o&&(o=s),s=new kM(n).modify(o).toBufferGeometry()):(void 0!==o&&(s=o),o=void 0,void 0===s.getAttribute("normal")&&s.computeVertexNormals())}catch{void 0!==o&&(s=o),o=void 0,void 0===s.getAttribute("normal")&&s.computeVertexNormals()}return void 0!==o&&Object.assign(s,{originalGeometry:o}),delete e.geometry,Object.assign(s,{userData:{...e,type:"NonParametricGeometry"}})}static loadFromUrl(e,t,i){new ic(i).load(e,(e=>{let i=this.normalizeInputs({geometry:e});e.boundingBox.getSize(NM);let r=100/NM.x;Object.assign(i.parameters,{width:100,height:NM.y*r,depth:NM.z*r}),t(this.build(i))}))}},PolygonGeometry:FM,PyramidGeometry:class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,radialSegments:4,heightSegments:1,cornerRadius:0,cornerSegments:8,openEnded:!1},e.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(e){let{width:t,height:i,depth:r,radialSegments:n,heightSegments:s,openEnded:a,cornerRadius:o,cornerSegments:l}=e.parameters,h=new GM(.5*t,i,n,s,a,o,l);return h.scale(1,1,r/t),Object.assign(h,{userData:{...e,type:"PyramidGeometry"}})}},RectangleGeometry:HM,SphereGeometry:class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,widthSegments:64,heightSegments:64,phiStart:0,phiLength:2*Math.PI,thetaStart:0,thetaLength:180},e.parameters);return i.thetaLength=bi.clamp(i.thetaLength,0,180),{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(e){let t,{width:i=100,height:r=i,depth:n=i,widthSegments:s=64,heightSegments:a=64,phiStart:o,phiLength:l,thetaStart:h,thetaLength:c}=e.parameters;return 0===c?(t=new En,t.setAttribute("position",new yn([],3))):t=new dh(.5*i,s,a,o,l,h,c*bi.DEG2RAD),t.scale(1,r/i,n/i),Object.assign(t,{userData:{...e,type:"SphereGeometry"}})}},PlaneGeometry:class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,depth:0,widthSegments:8,heightSegments:8},e.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:0})}}static build(e){let{width:t=100,height:i=t,widthSegments:r=8,heightSegments:n=8}=e.parameters,s=new hs(t,i,r,n);return s.scale(1,1,1),Object.assign(s,{userData:{...e,type:"PlaneGeometry"}})}},BackdropGeometry:class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,angle:90,cornerRadius:24,cornerSegments:8},e.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(e){let{width:t,height:i,depth:r,angle:n,cornerRadius:s,cornerSegments:a}=e.parameters,o=new WM(t,i,r,n,s,a);return Object.assign(o,{userData:{...e,type:"BackdropGeometry"}})}},StarGeometry:qM,TextFrameGeometry:class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,depth:0},e.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??0)})}}static build(e){let{width:t,height:i}=e.parameters,r=new hs(t,i);return Object.assign(r,{userData:{...e,type:"TextFrameGeometry"}})}},TorusGeometry:class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,radialSegments:32,tubularSegments:64,arc:360,cornerRadius:30,cornerSegments:8},e.parameters),r=Math.abs(i.width),n=Math.abs(i.height??i.width),s=Math.round(Math.abs(i.depth??.25*i.width));return{parameters:Object.assign(i,{width:r,height:n,depth:s})}}static build(e){let{width:t,height:i,depth:r,radialSegments:n,tubularSegments:s,arc:a,cornerRadius:o,cornerSegments:l}=e.parameters,h=function(e,t,i,r,n,s,a,o,l,h,c){[t,i]=[i,t],a=t/2;let d=bi.clamp(n/360,0,1);if(0===d){let e=new En;return e.setAttribute("position",new yn([],3)),e}return 1===d&&(h=0),new vM(!0,e,t,i,r,d,s,a,o,l,h,c)}(t,i,r,.5*t,a,s,0,0,n,o,l);return h.scale(1,i/t,1),Object.assign(h,{userData:{...e,type:"TorusGeometry"}})}},TorusKnotGeometry:class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,tubularSegments:64,radialSegments:32,p:2,q:3},e.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width),tube:i.tube??.125*i.width})}}static build(e){let{width:t,tube:i,tubularSegments:r,radialSegments:n,p:s,q:a}=e.parameters,o=.5*t;o!==i&&(o-=i);let l=new uh(o,i,r,n,s,a);return Object.assign(l,{userData:{...e,type:"TorusKnotGeometry"}})}},TriangleGeometry:class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,depth:0,spikes:5,cornerRadius:0,extrudeBevelSize:0,extrudeBevelSegments:1,isRect:!1},e.parameters);return{shape:e.shape&&e.shape instanceof PA?e.shape:new PA,parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width*(i.isRect?1:Math.sqrt(3)/2)),depth:Math.abs(i.depth??0)})}}static build(e){let{width:t=100,height:i,cornerRadius:r,depth:n,extrudeBevelSize:s,extrudeBevelSegments:a,isRect:o}=e.parameters,l=e.shape,h=.5*t,c=.5*i;o?(l.addPoint(l.createPoint(-h,c)),l.addPoint(l.createPoint(h,-c)),l.addPoint(l.createPoint(-h,-c))):(l.addPoint(l.createPoint(0,c)),l.addPoint(l.createPoint(h,-c)),l.addPoint(l.createPoint(-h,-c))),l.isClosed=!0;for(let u=0,p=l.points.length;u=2){let t=new sE(e);return Object.assign(t,{userData:{...e,type:"PathGeometry"}})}return Object.assign(new En,{userData:{...e,type:"PathGeometry"}})}},VectorGeometry:oM},qE=e=>WE[e.type].create(e);function YE(e){return null!==e&&"booleanOp"in e}var XE=class extends(US(Un)){constructor(){super(...arguments),this.booleanMeshSetAddress=-1,this.booleanWasTransformed=!1,this.booleanMatrixInvOld=new Er}updateVisible(e){super.updateVisible(e),this.visible=!YE(this.parent)&&this.visible,YE(this.parent)&&this.parent.invalidateDownstreamBooleanData()}freeBooleanPointer(){-1!==this.booleanMeshSetAddress&&(BE.freeMeshSet(this.booleanMeshSetAddress),this.booleanMeshSetAddress=-1)}invalidateDownstreamBooleanData(e=!1){return e?this.booleanWasTransformed=!0:this.freeBooleanPointer(),YE(this.parent)?this.parent.invalidateDownstreamBooleanData():this}invalidateUpstreamBooleanData(){this.freeBooleanPointer();for(let e of this.children)e instanceof XE&&(e.freeBooleanPointer(),YE(e)&&e.invalidateUpstreamBooleanData())}updateTransformState(e,t){let i=super.updateTransformState(e,t);return i&&YE(this.parent)&&this.invalidateDownstreamBooleanData(!0),i}onVariableUpdate(e=!1){super.onVariableUpdate(e),YE(this.parent)&&this.invalidateDownstreamBooleanData(!0)}},QE=new $i;function ZE(e,t=0,i=e.count,r,n){let s=1/0,a=1/0,o=1/0,l=-1/0,h=-1/0,c=-1/0;for(let d=t;dl&&(l=t),i>h&&(h=i),r>c&&(c=r)}QE.min.set(s,a,o),QE.max.set(l,h,c),QE.getCenter(r),QE.getSize(n).multiplyScalar(.5)}var KE=new En,JE=new un,$E=class extends XE{constructor(e,t){super(KE,JE),this.super_Entity(e,t)}updateState(e,t){this.updateState_Entity(e,t)}updateEntityBoxSize(e,t){let i=this.geometry.getAttribute("position");void 0!==i?ZE(i,this.geometry.drawRange.start,this.geometry.drawRange.count<1/0?this.geometry.drawRange.count:i.count,e,t):super.updateEntityBoxSize(e,t)}},eC=class{constructor(e){e=e??{},this.name=e.name,this.type=e.type,this.node=e.node,this.size=e.size,this.needsUpdate=e.needsUpdate}get value(){return this.node.value}set value(e){this.node.value=e}},tC=class{constructor(e){this.hashProperties=void 0,this.isNode=!0,this.shortcuts={},this.uuid=bi.generateUUID(),this.type=e,this.name=""}analyze(e,t){t=t??{},e.analyzing=!0,this.build(e.addFlow(t.slot,t.cache,t.context),"v4"),e.clearVertexNodeCode(),e.clearFragmentNodeCode(),e.removeFlow(),e.analyzing=!1}analyzeAndFlow(e,t,i){return i=i??{},this.analyze(e,i),this.flow(e,t,i)}flow(e,t,i){i=i??{},e.addFlow(i.slot,i.cache,i.context);let r={result:this.build(e,t),code:e.clearNodeCode(),extra:e.context.extra};return e.removeFlow(),r}build(e,t,i){t=t??this.getType(e,t);let r=e.getNodeData(i??this);return e.analyzing&&this.appendDepsNode(e,r,t),-1===e.nodes.indexOf(this)&&e.nodes.push(this),void 0!==this.updateFrame&&-1===e.updaters.indexOf(this)&&e.updaters.push(this),this.generate(e,t,i)}updateFrame(e){}generateReadonly(e,t,i,r,n,s){return""}generate(e,t,i,r,n){return""}parse(e,t,i,r){}appendDepsNode(e,t,i){t.deps=(t.deps||0)+1;let r=e.getTypeLength(i);(r>(t.outputMax||0)||this.getType(e,i))&&(t.outputMax=r,t.output=i)}setName(e){this.name=e}getName(){return this.name}getType(e,t){return"sampler2D"===t||"samplerCube"===t?t:this.type}getHash(){let e,t,i="{";for(e in this)t=this[e],t instanceof tC&&(i+='"'+e+'":'+t.getHash()+",");if(this.hashProperties)for(let r=0;r0||this.getLabel()?(this.appendDepsNode(e,s,t),this.generate(e,t,i)):super.build(e,t,i);if(n)return s.name=s.name||super.build(e,t,i),s.name;if(!this.getLabel()&&(!this.getShared(e,a)||e.context.ignoreCache||1===s.deps))return super.build(e,t,i);i=this.getUUID(!1);let o=this.getTemp(e,i);if(o)return e.format(o,a,t);{o=super.generate(e,t,i,s.output,r);let n=this.generate(e,a,i);return e.addNodeCode(o+" = "+n+";"),e.format(o,a,t)}}return super.build(e,t,i)}getShared(e,t){return"sampler2D"!==t&&"samplerCube"!==t&&this.shared}getUnique(e,t){return this.unique}setLabel(e){return this.label=e,this}getLabel(){return this.label}getUUID(e){let t=this.uuid;return"string"==typeof this.scope&&(t=this.scope+"-"+t),t}getTemp(e,t){t=t||this.uuid;let i=e.getVars()[t];return i?i.name:void 0}generate(e,t,i,r,n){return this.getShared(e,t)||console.error("TempNode is not shared"),i=i??this.uuid,e.getTempVar(i,r??this.getType(e),n,this.getLabel()).name}},nC=class extends rC{constructor(e,t){(t=t??{}).shared=void 0!==t.shared&&t.shared,super(e,t),this.readonly=!1}setReadonly(e){return this.readonly=e,this.hashProperties=this.readonly?["value"]:void 0,this}getReadonly(){return this.readonly}generate(e,t,i,r,n,s){i=e.getUUID(i??this.getUUID()),r=r??this.getType(e);let a=e.getNodeData(i);return this.getReadonly()&&void 0!==this.generateReadonly?this.generateReadonly(e,t,i,r,n,s):e.isShader("vertex")?(a.vertex||(a.vertex=e.createVertexUniform(r,this,n,s,this.getLabel())),e.format(a.vertex.name,r,t)):(a.fragment||(a.fragment=e.createFragmentUniform(r,this,n,s,this.getLabel())),e.format(a.fragment.name,r,t))}},sC=class extends nC{constructor(e=0,t){super("v2"),this.nodeType="Vector2",this.value=e instanceof wi?e:new wi(e,t)}get x(){return this.value.x}set x(e){this.value.x=e}get y(){return this.value.y}set y(e){this.value.y=e}generateReadonly(e,t,i,r,n,s){return e.format("vec2("+this.value.x+", "+this.value.y+")",r,t)}},aC=class extends nC{constructor(e=0,t,i){super("v3"),this.nodeType="Vector3",this.value=e instanceof Zi?e:new Zi(e,t,i)}get x(){return this.value.x}set x(e){this.value.x=e}get y(){return this.value.y}set y(e){this.value.y=e}get z(){return this.value.z}set z(e){this.value.z=e}generateReadonly(e,t,i,r,n,s){return e.format("vec3("+this.value.x+", "+this.value.y+", "+this.value.z+")",r,t)}},oC=class extends Ni{constructor(e,t,i,r){super(e,t,i),this.isColorA=!0,this.a=r}setRGBA(e,t,i,r){super.setRGB(e,t,i),this.a=r}copy(e){return super.copy(e),this.a="a"in e?e.a:1,this}clone(){return new this.constructor(this.r,this.g,this.b,this.a)}setStyle(e,t="srgb"){let i;if("transparent"===e)return this.setRGBA(0,0,0,0),this;if(i=/^((?:rgb|hsl)a?)\(([^)]*)\)/.exec(e)){let r,n=i[1],s=i[2];switch(n){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return this.a="rgba"===n?parseFloat(r[4]):1,super.setStyle(e,t);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)%\s*,\s*(\d*\.?\d+)%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return this.a="hsla"===n?parseFloat(r[4]):1,super.setStyle(e,t)}}return super.setStyle(e,t)}get x(){return this.r}get y(){return this.g}get z(){return this.b}get w(){return this.a}set x(e){this.r=e}set y(e){this.g=e}set z(e){this.b=e}set w(e){this.a=e}},lC=class extends nC{constructor(e){super("v4"),this.nodeType="Vector4",this.value=e instanceof oC?e:new oC(e.r,e.g,e.b,e.a)}generateReadonly(e,t,i,r,n,s){return e.format("vec4("+this.value.r+", "+this.value.g+", "+this.value.b+", "+this.value.a+")",r,t)}},hC=/^\s*([a-z_0-9]+)\s([a-z_0-9]+)\s*\((.*?)\)/i,cC=/[a-z_0-9]+/gi,dC=class extends rC{constructor(e,t,i,r,n){super(n),this.src="",this.nodeType="Function",this.useKeywords=!0,this.includes=[],this.extensions={},this.keywords={},this.isMethod=void 0===n,this.isInterface=!1,this.parse(e,t,i,r)}getShared(e,t){return!this.isMethod}getType(e){return e.getTypeByFormat(this.type)}getInputByName(e){if(this.inputs){let t=this.inputs.length;for(;t--;)if(this.inputs[t].name===e)return this.inputs[t]}}getIncludeByName(e){if(this.includes){let t=this.includes.length;for(;t--;)if(this.includes[t].name===e)return this.includes[t]}}generate(e,t,i,r,n){let s,a=0,o=this.src;if(this.includes)for(let h=0;h1?(a=l[1],s=l[2],o=l[3]):(s=this.src,a="f"),this.name=s,this.type=a,this.value=o}build(e,t){if("source"===t){if(this.value)return this.useDefine?"#define "+this.name+" "+this.value:"const "+this.type+" "+this.name+" = "+this.value+";";if(this.useDefine)return this.src}return e.include(this),e.format(this.name,this.getType(e),t)}generate(e,t,i,r,n){return e.format(this.name,this.getType(e),t)}},fC=pC;fC.PI="PI",fC.PI2="PI2",fC.RECIPROCAL_PI="RECIPROCAL_PI",fC.RECIPROCAL_PI2="RECIPROCAL_PI2",fC.LOG2="LOG2",fC.EPSILON="EPSILON";var mC=new RegExp("^structs*([a-z_0-9]+)s*{s*((.|\n)*?)}","gim"),gC=new RegExp("s*(w*?)s*(w*?)(=|;)","gim"),vC=class extends rC{constructor(e=""){super(),this.inputs=[],this.src="",this.nodeType="Struct",this.parse(e)}getType(e){return e.getTypeByFormat(this.name)}getInputByName(e){let t=this.inputs.length;for(;t--;)if(this.inputs[t].name===e)return this.inputs[t]}generate(e,t,i,r,n){return"source"===t?this.src+";":e.format("( "+this.src+" )",this.getType(e),t)}parse(e=""){this.src=e,this.inputs=[];let t=mC.exec(e);if(t){let e,i=t[2];for(;e=gC.exec(i);)this.inputs.push({type:e[1],name:e[2]});this.name=t[1]}else this.name="";this.type=this.name}},yC=class extends rC{constructor(e){super("v2",{shared:!1}),this.nodeType="UV",this.index=e??0}generate(e,t){e.requires.uv[this.index]=!0;let i=this.index>0?this.index+1:"",r=e.isShader("vertex")?"uv"+i:"vUv"+i;return e.format(r,this.getType(e),t)}};iC.addKeyword("uv",(function(){return new yC})),iC.addKeyword("uv2",(function(){return new yC(1)}));var xC=class extends rC{constructor(e,t){super("v4"),this.nodeType="ColorSpace",this.input=e,this.method=t??xC.LINEAR_TO_LINEAR,this.hashProperties=["method"]}static getEncodingComponents(e){switch(e){case Xt:return["Linear"];case Qt:return["sRGB"];default:return[]}}generate(e,t){let i=this.input.build(e,"v4"),r=this.getType(e),n=xC.Nodes[this.method],s=e.include(n);if(s===xC.LINEAR_TO_LINEAR)return e.format(i,r,t);if(2===n.inputs?.length){let n=this.factor.build(e,"f");return e.format(s+"( "+i+", "+n+" )",r,t)}return e.format(s+"( "+i+" )",r,t)}fromEncoding(e){let t=xC.getEncodingComponents(e);this.method="LinearTo"+t[0],this.factor=t[1]}fromDecoding(e){let t=xC.getEncodingComponents(e);this.method=t[0]+"ToLinear",this.factor=t[1]}},bC=xC;bC.Nodes={LinearToLinear:new dC(["vec4 LinearToLinear( in vec4 value ) {","\treturn value;","}"].join("\n")),sRGBToLinear:new dC(["vec4 sRGBToLinear( in vec4 value ) {","\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );","}"].join("\n")),LinearTosRGB:new dC(["vec4 LinearTosRGB( in vec4 value ) {","\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.w );","}"].join("\n"))},bC.LINEAR_TO_LINEAR="LinearToLinear",bC.SRGB_TO_LINEAR="sRGBToLinear",bC.LINEAR_TO_SRGB="LinearTosRGB";var wC=class extends dC{constructor(e="",t,i,r,n){super(e,n,r,i,t),this.nodeType="Expression"}},_C=class extends nC{constructor(e=new Hi,t,i,r){super("v4",{shared:!0}),this.nodeType="Texture",this.value=e,this.uv=t??new yC,this.bias=i,this.project=void 0!==r&&r}getTexture(e,t){return super.generate(e,t,this.value.uuid,"t")}generate(e,t){if("sampler2D"===t)return this.getTexture(e,t);let i,r,n=this.getTexture(e,t),s=this.uv.build(e,this.project?"v4":"v2"),a=this.bias?this.bias.build(e,"f"):void 0;void 0===a&&e.context.bias&&(a=e.context.bias.setTexture(this).build(e,"f")),i=this.project?"texture2DProj":a?"tex2DBias":"tex2D",r=a?i+"( "+n+", "+s+", "+a+" )":i+"( "+n+", "+s+" )";let o={include:e.isShader("vertex"),ignoreCache:!0},l=this.getType(e);return e.addContext(o),this.colorSpace=this.colorSpace??new bC(new wC("",l)),this.colorSpace.fromDecoding(e.getTextureEncodingFromMap(this.value)),this.colorSpace.input.parse(r),r=this.colorSpace.build(e,l),e.removeContext(),e.format(r,l,t)}},SC=class extends nC{constructor(e){super("f"),this.nodeType="Float",this.value=e??0}generateReadonly(e,t,i,r,n,s){return e.format(this.value+(this.value%1?"":".0"),r,t)}},AC=class extends rC{constructor(e,t){super(),this.inputs=[],this.nodeType="FunctionCall",this.value=e,this.inputs=t??[]}getFunction(){return this.value}getType(e){return this.value.getType(e)}generate(e,t,i,r,n){r=this.getType(e);let s=this.value,a=s.build(e,t)+"( ",o=[];if(s.inputs){for(let t=0;te.getTypeLength(t)?i:t}generate(e,t){let i=this.getType(e);this.type=i;let r=this.a.build(e,i),n=this.b.build(e,i);return e.format("( "+r+" "+this.op+" "+n+" )",i,t)}},EC=MC;EC.ADD="+",EC.SUB="-",EC.MUL="*",EC.DIV="/";var CC=class extends rC{constructor(e,t=CC.ABS,i,r){super(),this.nodeType="Math",this.a=e,"string"!=typeof t?this.b=t:r=t,"string"!=typeof i?this.c=i:r=i,this.method=r,this.hashProperties=["method"]}getNumInputs(e){switch(this.method){case CC.MIX:case CC.CLAMP:case CC.REFRACT:case CC.SMOOTHSTEP:case CC.FACEFORWARD:return 3;case CC.MIN:case CC.MAX:case CC.MOD:case CC.STEP:case CC.REFLECT:case CC.DISTANCE:case CC.DOT:case CC.CROSS:case CC.POW:return 2;default:return 1}}getInputType(e){let t=e.getTypeLength(this.a.getType(e)),i=this.b?e.getTypeLength(this.b.getType(e)):0,r=this.c?e.getTypeLength(this.c.getType(e)):0;return t>i&&t>r?this.a.getType(e):i>r?this.b.getType(e):this.c.getType(e)}getType(e){switch(this.method){case CC.LENGTH:case CC.DISTANCE:case CC.DOT:return"f";case CC.CROSS:return"v3"}return this.getInputType(e)}generate(e,t){let i,r,n,s=this.a?e.getTypeLength(this.a.getType(e)):0,a=this.b?e.getTypeLength(this.b.getType(e)):0,o=this.c?e.getTypeLength(this.c.getType(e)):0,l=this.getInputType(e),h=this.getType(e);switch(this.type=h,this.method){case CC.NEGATE:return e.format("( -"+this.a.build(e,l)+" )",l,t);case CC.INVERT:return e.format("( 1.0 - "+this.a.build(e,l)+" )",l,t);case CC.CROSS:i=this.a.build(e,"v3"),r=this.b.build(e,"v3");break;case CC.STEP:i=this.a.build(e,1===s?"f":l),r=this.b.build(e,l);break;case CC.MIN:case CC.MAX:case CC.MOD:i=this.a.build(e,l),r=this.b.build(e,1===a?"f":l);break;case CC.REFRACT:i=this.a.build(e,l),r=this.b.build(e,l),n=this.c.build(e,"f");break;case CC.MIX:i=this.a.build(e,l),r=this.b.build(e,l),n=this.c.build(e,1===o?"f":l);break;default:i=this.a.build(e,l),this.b&&(r=this.b.build(e,l)),this.c&&(n=this.c.build(e,l))}let c=[];c.push(i),r&&c.push(r),n&&c.push(n);let d=this.getNumInputs(e);if(c.length!==d)throw Error(`Arguments not match used in "${this.method}". Require ${d}, currently ${c.length}.`);return e.format(this.method+"( "+c.join(", ")+" )",h,t)}},TC=CC;TC.RAD="radians",TC.DEG="degrees",TC.EXP="exp",TC.EXP2="exp2",TC.LOG="log",TC.LOG2="log2",TC.SQRT="sqrt",TC.INV_SQRT="inversesqrt",TC.FLOOR="floor",TC.CEIL="ceil",TC.NORMALIZE="normalize",TC.FRACT="fract",TC.SATURATE="saturate",TC.SIN="sin",TC.COS="cos",TC.TAN="tan",TC.ASIN="asin",TC.ACOS="acos",TC.ARCTAN="atan",TC.ABS="abs",TC.SIGN="sign",TC.LENGTH="length",TC.NEGATE="negate",TC.INVERT="invert",TC.MIN="min",TC.MAX="max",TC.MOD="mod",TC.STEP="step",TC.REFLECT="reflect",TC.DISTANCE="distance",TC.DOT="dot",TC.CROSS="cross",TC.POW="pow",TC.MIX="mix",TC.CLAMP="clamp",TC.REFRACT="refract",TC.SMOOTHSTEP="smoothstep",TC.FACEFORWARD="faceforward";var DC=class extends rC{constructor(e,t,i){super("v4"),this.nodeType="TextureCubeUV",this.value=e,this.uv=t,this.bias=i}bilinearCubeUV(e,t,i,r){let n=new AC(DC.Nodes.bilinearCubeUV,[t,i,r]);this.colorSpaceTL=this.colorSpaceTL??new bC(new wC("","v4")),this.colorSpaceTL.fromDecoding(e.getTextureEncodingFromMap(this.value.value)),this.colorSpaceTL.input.parse(n.build(e)+".tl"),this.colorSpaceTR=this.colorSpaceTR??new bC(new wC("","v4")),this.colorSpaceTR.fromDecoding(e.getTextureEncodingFromMap(this.value.value)),this.colorSpaceTR.input.parse(n.build(e)+".tr"),this.colorSpaceBL=this.colorSpaceBL??new bC(new wC("","v4")),this.colorSpaceBL.fromDecoding(e.getTextureEncodingFromMap(this.value.value)),this.colorSpaceBL.input.parse(n.build(e)+".bl"),this.colorSpaceBR=this.colorSpaceBR??new bC(new wC("","v4")),this.colorSpaceBR.fromDecoding(e.getTextureEncodingFromMap(this.value.value)),this.colorSpaceBR.input.parse(n.build(e)+".br");let s={include:e.isShader("vertex"),ignoreCache:!0};e.addContext(s),this.colorSpaceTLExp=new wC(this.colorSpaceTL.build(e,"v4"),"v4"),this.colorSpaceTRExp=new wC(this.colorSpaceTR.build(e,"v4"),"v4"),this.colorSpaceBLExp=new wC(this.colorSpaceBL.build(e,"v4"),"v4"),this.colorSpaceBRExp=new wC(this.colorSpaceBR.build(e,"v4"),"v4"),e.removeContext();let a=new wC("mix( mix( cubeUV_TL, cubeUV_TR, cubeUV.f.x ), mix( cubeUV_BL, cubeUV_BR, cubeUV.f.x ), cubeUV.f.y )","v4");return a.keywords.cubeUV_TL=this.colorSpaceTLExp,a.keywords.cubeUV_TR=this.colorSpaceTRExp,a.keywords.cubeUV_BL=this.colorSpaceBLExp,a.keywords.cubeUV_BR=this.colorSpaceBRExp,a.keywords.cubeUV=n,a}generate(e,t){if(e.isShader("fragment")){let i=this.uv,r=this.bias||e.context.roughness,n=new AC(DC.Nodes.roughnessToMip,[r]),s=new TC(n,DC.Nodes.m0,DC.Nodes.cubeUV_maxMipLevel,TC.CLAMP),a=new TC(s,TC.FLOOR),o=new TC(s,TC.FRACT),l=this.bilinearCubeUV(e,this.value,i,a),h=this.bilinearCubeUV(e,this.value,i,new EC(a,new SC(1).setReadonly(!0),EC.ADD)),c=new TC(l,h,o,TC.MIX);return e.format(c.build(e),"v4",t)}return console.warn("TextureCubeUVNode is not compatible with "+e.shader+" shader."),e.format("vec4( 0.0 )",this.getType(e),t)}},PC=DC;PC.Nodes=function(){let e=new vC("struct TextureCubeUVData {\n\t\t\tvec4 tl;\n\t\t\tvec4 tr;\n\t\t\tvec4 br;\n\t\t\tvec4 bl;\n\t\t\tvec2 f;\n\t\t}"),t=new fC("float cubeUV_maxMipLevel 8.0",!0),i=new fC("float cubeUV_minMipLevel 4.0",!0),r=new fC("float cubeUV_maxTileSize 256.0",!0),n=new fC("float cubeUV_minTileSize 16.0",!0),s=new dC("float getFace(vec3 direction) {\n\t\t\t\tvec3 absDirection = abs(direction);\n\t\t\t\tfloat face = -1.0;\n\t\t\t\tif (absDirection.x > absDirection.z) {\n\t\t\t\t\tif (absDirection.x > absDirection.y)\n\t\t\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\t\t\telse\n\t\t\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t\t\t} else {\n\t\t\t\t\tif (absDirection.z > absDirection.y)\n\t\t\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\t\t\telse\n\t\t\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t\t\t}\n\t\t\t\treturn face;\n\t\t}");s.useKeywords=!1;let a=new dC("vec2 getUV(vec3 direction, float face) {\n\t\t\t\tvec2 uv;\n\t\t\t\tif (face == 0.0) {\n\t\t\t\t\tuv = vec2(direction.z, direction.y) / abs(direction.x); // pos x\n\t\t\t\t} else if (face == 1.0) {\n\t\t\t\t\tuv = vec2(-direction.x, -direction.z) / abs(direction.y); // pos y\n\t\t\t\t} else if (face == 2.0) {\n\t\t\t\t\tuv = vec2(-direction.x, direction.y) / abs(direction.z); // pos z\n\t\t\t\t} else if (face == 3.0) {\n\t\t\t\t\tuv = vec2(-direction.z, direction.y) / abs(direction.x); // neg x\n\t\t\t\t} else if (face == 4.0) {\n\t\t\t\t\tuv = vec2(-direction.x, direction.z) / abs(direction.y); // neg y\n\t\t\t\t} else {\n\t\t\t\t\tuv = vec2(direction.x, direction.y) / abs(direction.z); // neg z\n\t\t\t\t}\n\t\t\t\treturn 0.5 * (uv + 1.0);\n\t\t}");a.useKeywords=!1;let o=new dC("TextureCubeUVData bilinearCubeUV(sampler2D envMap, vec3 direction, float mipInt) {\n\t\t\tfloat face = getFace(direction);\n\t\t\tfloat filterInt = max(cubeUV_minMipLevel - mipInt, 0.0);\n\t\t\tmipInt = max(mipInt, cubeUV_minMipLevel);\n\t\t\tfloat faceSize = exp2(mipInt);\n\t\t\tfloat texelSize = 1.0 / (3.0 * cubeUV_maxTileSize);\n\t\t\tvec2 uv = getUV(direction, face) * (faceSize - 1.0);\n\t\t\tvec2 f = fract(uv);\n\t\t\tuv += 0.5 - f;\n\t\t\tif (face > 2.0) {\n\t\t\t\tuv.y += faceSize;\n\t\t\t\tface -= 3.0;\n\t\t\t}\n\t\t\tuv.x += face * faceSize;\n\t\t\tif(mipInt < cubeUV_maxMipLevel){\n\t\t\t\tuv.y += 2.0 * cubeUV_maxTileSize;\n\t\t\t}\n\t\t\tuv.y += filterInt * 2.0 * cubeUV_minTileSize;\n\t\t\tuv.x += 3.0 * max(0.0, cubeUV_maxTileSize - 2.0 * faceSize);\n\t\t\tuv *= texelSize;\n\t\t\tvec4 tl = texture2D(envMap, uv);\n\t\t\tuv.x += texelSize;\n\t\t\tvec4 tr = texture2D(envMap, uv);\n\t\t\tuv.y += texelSize;\n\t\t\tvec4 br = texture2D(envMap, uv);\n\t\t\tuv.x -= texelSize;\n\t\t\tvec4 bl = texture2D(envMap, uv);\n\t\t\treturn TextureCubeUVData( tl, tr, br, bl, f );\n\t\t}",[e,s,a,t,i,r,n]);o.useKeywords=!1;let l=new fC("float r0 1.0",!0),h=new fC("float v0 0.339",!0),c=new fC("float m0 -2.0",!0),d=new fC("float r1 0.8",!0),u=new fC("float v1 0.276",!0),p=new fC("float m1 -1.0",!0),f=new fC("float r4 0.4",!0),m=new fC("float v4 0.046",!0),g=new fC("float m4 2.0",!0),v=new fC("float r5 0.305",!0),y=new fC("float v5 0.016",!0),x=new fC("float m5 3.0",!0),b=new fC("float r6 0.21",!0),w=new fC("float v6 0.0038",!0),_=new fC("float m6 4.0",!0);return{bilinearCubeUV:o,roughnessToMip:new dC("float roughnessToMip(float roughness) {\n\t\t\tfloat mip = 0.0;\n\t\t\tif (roughness >= r1) {\n\t\t\t\tmip = (r0 - roughness) * (m1 - m0) / (r0 - r1) + m0;\n\t\t\t} else if (roughness >= r4) {\n\t\t\t\tmip = (r1 - roughness) * (m4 - m1) / (r1 - r4) + m1;\n\t\t\t} else if (roughness >= r5) {\n\t\t\t\tmip = (r4 - roughness) * (m5 - m4) / (r4 - r5) + m4;\n\t\t\t} else if (roughness >= r6) {\n\t\t\t\tmip = (r5 - roughness) * (m6 - m5) / (r5 - r6) + m5;\n\t\t\t} else {\n\t\t\t\tmip = -2.0 * log2(1.16 * roughness);// 1.16 = 1.79^0.25\n\t\t\t}\n\t\t\treturn mip;\n\t\t}",[l,h,c,d,u,p,f,m,g,v,y,x,b,w,_]),m0:c,cubeUV_maxMipLevel:t}}();var IC=class extends rC{constructor(e){super("v3"),this.nodeType="Normal",this.scope=e??IC.VIEW}getShared(){return this.scope===IC.WORLD}build(e,t,i,r){let n=e.context[this.scope+"Normal"];return n?n.build(e,t,i,r):super.build(e,t,i)}generate(e,t,i,r,n){let s;switch(this.scope){case IC.VIEW:s=e.isShader("vertex")?"transformedNormal":"geometryNormal";break;case IC.LOCAL:e.isShader("vertex")?s="objectNormal":(e.requires.normal=!0,s="vObjectNormal");break;case IC.WORLD:e.isShader("vertex")?s="inverseTransformDirection( transformedNormal, viewMatrix ).xyz":(e.requires.worldNormal=!0,s="vWNormal")}return e.format(s,this.getType(e),t)}},OC=IC;OC.LOCAL="local",OC.WORLD="world",OC.VIEW="view",OC.NORMAL="normal",iC.addKeyword("viewNormal",(function(){return new OC(OC.VIEW)})),iC.addKeyword("localNormal",(function(){return new OC(OC.NORMAL)})),iC.addKeyword("worldNormal",(function(){return new OC(OC.WORLD)}));var RC=class extends rC{constructor(e){super("v3"),this.nodeType="Position",this.scope=e??RC.LOCAL}getType(){return this.scope===RC.PROJECTION?"v4":this.type}getShader(){switch(this.scope){case RC.LOCAL:case RC.WORLD:return!1}return!0}generate(e,t,i,r,n){let s;switch(this.scope){case RC.LOCAL:e.isShader("vertex")?s="transformed":(e.requires.position=!0,s="vPosition");break;case RC.WORLD:if(e.isShader("vertex"))return"( modelMatrix * vec4( transformed, 1.0 ) ).xyz";e.requires.worldPosition=!0,s="vWPosition";break;case RC.VIEW:s=e.isShader("vertex")?"-mvPosition.xyz":"vViewPosition";break;case RC.PROJECTION:s=e.isShader("vertex")?"( projectionMatrix * modelViewMatrix * vec4( position, 1.0 ) )":"vec4( 0.0 )"}return e.format(s,this.getType(),t)}},LC=RC;LC.LOCAL="local",LC.WORLD="world",LC.VIEW="view",LC.PROJECTION="projection",iC.addKeyword("position",(function(){return new LC})),iC.addKeyword("worldPosition",(function(){return new LC(LC.WORLD)})),iC.addKeyword("viewPosition",(function(){return new LC(LC.VIEW)}));var BC=class extends rC{constructor(e){super("v3"),this.nodeType="Reflect",this.scope=e??BC.CUBE}getUnique(e){return!e.context.viewNormal}getType(){return this.scope===BC.SPHERE?"v2":this.type}generate(e,t){let i=this.getUnique(e);if(e.isShader("fragment")){let r;switch(this.scope){case BC.VECTOR:{let t=new OC(OC.VIEW),n=e.context.roughness,s=t.build(e,"v3"),a=new LC(LC.VIEW).build(e,"v3"),o=n?n.build(e,"f"):void 0,l=`reflect( -normalize( ${a} ), ${s} )`;o&&(l=`normalize( mix( ${l}, ${s}, ${o} * ${o} ) )`);let h=`inverseTransformDirection( ${l}, viewMatrix )`;i?(e.addNodeCode(`vec3 reflectVec = ${h};`),r="reflectVec"):r=h;break}case BC.CUBE:{let t=new BC(BC.VECTOR).build(e,"v3"),n="vec3( -"+t+".x, "+t+".yz )";i?(e.addNodeCode(`vec3 reflectCubeVec = ${n};`),r="reflectCubeVec"):r=n;break}case BC.SPHERE:{let t="normalize( ( viewMatrix * vec4( "+new BC(BC.VECTOR).build(e,"v3")+", 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) ).xy * 0.5 + 0.5";i?(e.addNodeCode(`vec2 reflectSphereVec = ${t};`),r="reflectSphereVec"):r=t;break}}return e.format(r,this.getType(),t)}return console.warn("ReflectNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.type,t)}},zC=BC;zC.CUBE="cube",zC.SPHERE="sphere",zC.VECTOR="vector";var kC=class extends rC{constructor(e=new _C,t,i){super("v4"),this.nodeType="TextureCube",this.value=e,this.radianceNode=new PC(this.value,t??new zC(zC.VECTOR),i),this.irradianceNode=new PC(this.value,new OC(OC.WORLD),new SC(1).setReadonly(!0))}generate(e,t){return e.isShader("fragment")?(e.require("irradiance"),e.context.bias&&e.context.bias.setTexture(this.value),("irradiance"===e.slot?this.irradianceNode:this.radianceNode).build(e,t)):(console.warn("TextureCubeNode is not compatible with "+e.shader+" shader."),e.format("vec4( 0.0 )",this.getType(e),t))}},NC=class extends nC{constructor(e=new Jn,t,i){super("v4",{shared:!0}),this.nodeType="CubeTexture",this.value=e,this.uv=t??new zC,this.bias=i}getTexture(e,t){return super.generate(e,t,this.value.uuid,"tc")}generate(e,t){if("samplerCube"===t)return this.getTexture(e,t);let i,r=this.getTexture(e,t),n=this.uv?.build(e,"v3"),s=this.bias?this.bias.build(e,"f"):void 0;void 0===s&&e.context.bias&&(s=e.context.bias.setTexture(this).build(e,"f")),i=s?"texCubeBias( "+r+", "+n+", "+s+" )":"texCube( "+r+", "+n+" )";let a={include:e.isShader("vertex"),ignoreCache:!0},o=this.getType(e);return e.addContext(a),this.colorSpace=this.colorSpace??new bC(new wC("",o)),this.colorSpace.fromDecoding(e.getTextureEncodingFromMap(this.value)),this.colorSpace.input.parse(i),i=this.colorSpace.build(e,o),e.removeContext(),e.format(i,o,t)}},FC=["x","y","z","w"],UC=["float","vec2","vec3","vec4"],VC={float:"f",vec2:"v2",vec3:"v3",vec4:"v4",mat4:"v4",int:"i",bool:"b","float[]":"f[]","vec4[]":"v4[]"},jC={t:"sampler2D",tc:"samplerCube",b:"bool",i:"int",f:"float",c:"vec3",v2:"vec2",v3:"vec3",v4:"vec4",m3:"mat3",m4:"mat4","f[]":"float[]","v4[]":"vec4[]"},GC=class{constructor(){this.includes={consts:{},functions:{},structs:{}},this.cache="",this.slot="",this.shader="",this.context={},this.needsJitter=!0,this.getIncludesCode=function(){function e(e,t){return e.deps.length-t.deps.length}return function(t,i){let r=this.getIncludes(t,i);if(!r)return"";let n="";r=r.sort(e);for(let e=0;e","#include "].join("\n"),this.parsCode={vertex:["float neighbor_offset = 0.0001;",""].join("\n"),fragment:["float accumAlpha = 0.0;","void accumulateAlpha(float alpha) {\n\t\t\t\t\taccumAlpha += (1.0 - accumAlpha) * alpha;\n\t\t\t\t}",""].join("\n")},this.code={vertex:"",fragment:""},this.nodeCode={vertex:"",fragment:""},this.resultCode={vertex:"",fragment:""},this.finalCode={vertex:"",fragment:""},this.inputs={uniforms:{list:[],vertex:[],fragment:[]},arrayUniforms:{list:[],vertex:[],fragment:[]},vars:{varying:[],vertex:[],fragment:[]}},this.defines={},this.uniforms={},this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.updaters=[],this.nodes=[],this.analyzing=!1}build(e,t){this.addVertexParsCode("\nuniform int frameIndex;\nuniform vec2 resolution;\nuniform mat4 previousModelViewMatrix;\nuniform mat4 previousProjectionMatrix;\n\nvarying vec4 vCurrentPosition;\nvarying vec4 vPreviousPosition;\n"),this.addFragmentParsCode("\nlayout(location = 1) out vec4 gVelocity;\n\nuniform int frameIndex;\nuniform vec2 resolution;\n\nvarying vec4 vCurrentPosition;\nvarying vec4 vPreviousPosition;\n\nconst vec2 haltonSequence[16] = vec2[16](\nvec2( 0.000000,-0.333334),\nvec2(-0.500000, 0.333334),\nvec2( 0.500000,-0.777778),\nvec2(-0.750000,-0.111112),\nvec2( 0.250000, 0.555556),\nvec2(-0.250000,-0.555556),\nvec2( 0.750000, 0.111112),\nvec2(-0.875000, 0.777778),\nvec2(0.125000, -0.925926),\nvec2(-0.375000, -0.259260),\nvec2(0.625000, 0.407408),\nvec2(-0.625000, -0.703704),\nvec2(0.375000, -0.037038),\nvec2(-0.125000, 0.629630),\nvec2(0.875000, -0.481482),\nvec2(-0.937500, 0.185186));\n\nvec2 vogelDiskSample(int sampleIndex, int sampleCount, float angle) {\n const float goldenAngle = 2.399963f; // radians\n float r = sqrt(float(sampleIndex) + 0.5f) / sqrt(float(sampleCount));\n float theta = float(sampleIndex) * goldenAngle + angle;\n float sine = sin(theta);\n float cosine = cos(theta);\n return vec2(cosine, sine) * r;\n}\n\n// Derived from the interleaved gradient function from Jimenez 2014 http:goo.gl/eomGso\nfloat getNoiseInterleavedGradient(vec2 screenPos) {\n vec3 magic = vec3(0.06711056f, 0.00583715f, 52.9829189f);\n return fract(magic.z * fract(dot(screenPos, magic.xy)));\n}\n\n"),this.buildShader("vertex",e),this.buildShader("fragment",t);for(let i=0;i0?i+1:"";this.addVaryCode("varying vec2 vUv"+e+";"),i>0&&this.addVertexParsCode("attribute vec2 uv"+e+";"),this.addVertexFinalCode("vUv"+e+" = uv"+e+";")}return this.requires.color[0]&&(this.addVaryCode("varying vec4 vColor;"),this.addVertexParsCode("attribute vec4 color;"),this.addVertexFinalCode("vColor = color;")),this.requires.color[1]&&(this.addVaryCode("varying vec4 vColor2;"),this.addVertexParsCode("attribute vec4 color2;"),this.addVertexFinalCode("vColor2 = color2;")),this.requires.position&&(this.addVaryCode("varying vec3 vPosition;"),this.addVertexFinalCode("vPosition = transformed;")),this.requires.worldPosition,this.requires.normal&&(this.addVaryCode("varying vec3 vObjectNormal;"),this.addVertexFinalCode("vObjectNormal = normal;")),this.requires.modelMatrix&&this.addFragmentParsCode("uniform mat4 modelMatrix;"),this.requires.viewMatrix&&this.addFragmentParsCode("uniform mat4 viewMatrix;"),this.requires.projectionMatrix&&this.addFragmentParsCode("uniform mat4 projectionMatrix;"),this.requires.worldNormal&&(this.addVaryCode("varying vec3 vWNormal;"),this.addVertexFinalCode("vWNormal = inverseTransformDirection( transformedNormal, viewMatrix ).xyz;")),this.requires.vWorldViewDir&&(this.addVaryCode("varying vec3 vWorldViewDir;"),this.addVertexFinalCode("vWorldViewDir = isPerspectiveMatrix( projectionMatrix ) ? ( (modelMatrix * vec4(position, 1.0)).xyz - cameraPosition ) : vec3( -viewMatrix[0][2], -viewMatrix[1][2], -viewMatrix[2][2] );")),this.needsJitter&&(this.addVertexFinalCode("\n// TODO: This could be generated CPU side and passed to the shader every frame\nconst vec2 haltonSequence[16] = vec2[16](\nvec2( 0.000000,-0.333334),\nvec2(-0.500000, 0.333334),\nvec2( 0.500000,-0.777778),\nvec2(-0.750000,-0.111112),\nvec2( 0.250000, 0.555556),\nvec2(-0.250000,-0.555556),\nvec2( 0.750000, 0.111112),\nvec2(-0.875000, 0.777778),\nvec2(0.125000, -0.925926),\nvec2(-0.375000, -0.259260),\nvec2(0.625000, 0.407408),\nvec2(-0.625000, -0.703704),\nvec2(0.375000, -0.037038),\nvec2(-0.125000, 0.629630),\nvec2(0.875000, -0.481482),\nvec2(-0.937500, 0.185186));\n\n// TODO: Pass correct view size\nvec2 offset = haltonSequence[frameIndex];\noffset.x /= resolution.x;\noffset.y /= resolution.y;\n\nvec4 currentPosition = gl_Position;\nvec4 currentPositionJittered = currentPosition + (vec4(offset.x, offset.y, 0.0, 0.0) * currentPosition.w);\n\n// We want to calculate the velocity with unjittered positions\n// so that things that are not moving get a velocity = 0\nvCurrentPosition = currentPosition;\nvPreviousPosition = previousProjectionMatrix * previousModelViewMatrix * vec4(transformed, 1.0);\n#ifdef OUTLINE_COMPENSATION\nvPreviousPosition.xy += OUTLINE_COMPENSATION;\n#endif\ngl_Position = currentPositionJittered;\n\n"),this.addFragmentFinalCode("\nvec2 oldPos = vPreviousPosition.xy;\n oldPos /= vPreviousPosition.w;\n oldPos.xy = (oldPos.xy+1.)/2.0;\n\nvec2 newPos = vCurrentPosition.xy;\n newPos /= vCurrentPosition.w;\n newPos.xy = (newPos.xy+1.)/2.0;\n\nvec2 velocity = (newPos - oldPos);\n\n// Discard fully transparent pixels \nif (gl_FragColor.a <= 0.0) discard;\n\ngVelocity = vec4(velocity, 0.0, 1.0);\n")),this}buildShader(e,t){this.resultCode[e]=t.build(this.setShader(e),"v4")}setMaterial(e,t){return this.defines={},this}addFlow(e,t,i){return this.addSlot(e).addCache(t).addContext(i)}removeFlow(){return this.removeSlot().removeCache().removeContext()}addCache(e){return this.cache=e??"",this.caches.push(this.cache),this}removeCache(){return this.caches.pop(),this.cache=this.caches[this.caches.length-1]||"",this}addContext(e){return this.context=Object.assign({},this.context,e),this.context.extra=this.context.extra||{},this.contexts.push(this.context),this}removeContext(){return this.contexts.pop(),this.context=this.contexts[this.contexts.length-1]||{},this}addSlot(e){return this.slot=e||"",this.slots.push(this.slot),this}removeSlot(){return this.slots.pop(),this.slot=this.slots[this.slots.length-1]||"",this}addFragmentVariable(e,t){void 0===this.fragmentVariables[e]&&(this.addFragmentCode(`${t} ${e};`),this.fragmentVariables[e]="")}addFragmentParsVariable(e,t){void 0===this.fragmentParsVariables[e]&&(this.addFragmentParsCode(`${t} ${e};`),this.fragmentParsVariables[e]="")}addVertexParsVariable(e,t){void 0===this.vertexParsVariables[e]&&(this.addVertexParsCode(`${t} ${e};`),this.vertexParsVariables[e]="")}addVertexCode(e){this.addCode(e,"vertex")}addFragmentCode(e){this.addCode(e,"fragment")}addCode(e,t){this.code[t??this.shader]+=e+"\n"}addVertexNodeCode(e){this.addNodeCode(e,"vertex")}addFragmentNodeCode(e){this.addNodeCode(e,"fragment")}addNodeCode(e,t){this.nodeCode[t??this.shader]+=e+"\n"}clearNodeCode(e){e=e??this.shader;let t=this.nodeCode[e];return this.nodeCode[e]="",t}clearVertexNodeCode(){return this.clearNodeCode("vertex")}clearFragmentNodeCode(){return this.clearNodeCode("fragment")}addVertexFinalCode(e){this.addFinalCode(e,"vertex")}addFragmentFinalCode(e){this.addFinalCode(e,"fragment")}addFinalCode(e,t){this.finalCode[t??this.shader]+=e+"\n"}addVertexParsCode(e){this.addParsCode(e,"vertex")}addFragmentParsCode(e){this.addParsCode(e,"fragment")}addParsCode(e,t){this.parsCode[t??this.shader]+=e+"\n"}addVaryCode(e){this.addVertexParsCode(e),this.addFragmentParsCode(e)}isCache(e){return-1!==this.caches.indexOf(e)}isSlot(e){return-1!==this.slots.indexOf(e)}define(e,t){this.defines[e]=void 0===t?1:t}require(e){this.requires[e]=!0}isDefined(e){return void 0!==this.defines[e]}getVar(e,t,i,r="varying",n="V",s=""){let a=this.getVars(r),o=a[e];if(!o){let r=a.length;o={name:i||"node"+n+r+(s?"_"+s:""),type:t},a.push(o),a[e]=o}return o}getTempVar(e,t,i,r){return this.getVar(e,t,i,this.shader,"T",r)}getAttribute(e,t){if(!this.attributes[e]){let i=this.getVar(e,t);this.addVertexParsCode("attribute "+t+" "+e+";"),this.addVertexFinalCode(i.name+" = "+e+";"),this.attributes[e]={varying:i,name:e,type:t}}return this.attributes[e]}getCode(e){return[this.prefixCode,this.parsCode[e],this.getVarListCode(this.getVars("varying"),"varying"),this.getVarListCode(this.inputs.uniforms[e],"uniform"),this.getVarListCode(this.inputs.arrayUniforms[e],"uniform"),this.getIncludesCode("consts",e),this.getIncludesCode("structs",e),this.getIncludesCode("functions",e),"void main() {",this.getVarListCode(this.getVars(e)),this.code[e],this.resultCode[e],this.finalCode[e],"}"].join("\n")}getVarListCode(e,t){t=t??"";let i="";for(let r=0,n=e.length;r 0.5 ) {\n\t\t\t\t\tif ( uvs.x < 0.0 || uvs.x > 1.0 || uvs.y < 0.0 || uvs.y > 1.0 ) {\n\t\t\t\t\t\tlalpha = 0.0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tlalpha *= mask;\n\n\t\t\t\tcalpha = lalpha / clamp( lalpha + accumAlpha, 0.00001, 1.0 );\n\t\t\t\taccumAlpha += (1.0 - accumAlpha) * lalpha * (1.0 - float(isMask));\n\n\t\t\t\treturn col;\n\t\t\t}`);i=e.include(s);break;case 4:i=e.include(oT.Nodes.triplanar);break;default:i=e.include(oT.Nodes.uv)}e.addFragmentVariable(this.calpha,"float");let n=[];if(n.push("normal"),n.push(this.texture.generate(e,"t")),n.push(this.textureSize.build(e,"v2")),n.push(this.crop.build(e,"f")),n.push(this.mat.build(e,"mat3")),n.push(this.size.build(e,"v2")),n.push(this.blending.build(e,"f")),n.push(this.isMask.build(e,"b")),n.push(this.mask?`luminance(${this.mask.flow(e,"v3").result})`:"1.0"),n.push(this.alpha.build(e,"f")),n.push(this.mode.build(e,"i")),n.push(this.calpha),4===this.projection.value){let t=`${r}_writeUvs`,i=t+"0",s=t+"1",a=t+"2",o=`${r}_triplanarWeights`;e.addFragmentVariable(i,"vec2"),e.addFragmentVariable(s,"vec2"),e.addFragmentVariable(a,"vec2"),e.addFragmentVariable(o,"vec3"),n.push(i),n.push(s),n.push(a),n.push(o)}else{let t=`${r}_writeUvs`;e.addFragmentVariable(t,"vec2"),n.push(t)}return e.format(i+"("+n.join(",")+")",this.getType(e),t)}},lT=oT;lT.Nodes={cylindrical:new dC("\nvec3 cylindricalTexture(vec3 normal, sampler2D tex, vec2 textureSize, float crop, mat3 mat, vec2 size, float blending, bool isMask, float mask, float alpha, int mode, out float calpha, out vec2 writeUv) {\n vec3 posN = normalize(position);\n float u = 0.5 + atan(posN.z, posN.x) / (2.*3.1415);\n float scaledHeight = position.y / (size.y * 0.5);\n float v = (scaledHeight / 2.) + .5;\n\n vec2 calculatedUv = vec2(u,v);\n\t\t\t\tvec2 uvs = ( mat * vec3( calculatedUv * 2. - 1., 1. ) / 2. + 0.5 ).xy;\n\t\t\t\twriteUv = uvs;\n\n vec2 df = fwidth(uvs);\n \tif(df.x > 0.5) df.x = 0.;\n\n\t\t\t\t#ifdef GL_EXT_shader_texture_lod\n vec4 tmp = texture2DLodEXT(tex, uvs, log2(max(df.x, df.y)*min(textureSize.x, textureSize.y)));\n\t\t\t\t#else\n vec4 tmp = textureLod(tex, uvs, log2(max(df.x, df.y)*min(textureSize.x, textureSize.y)));\n\t\t\t\t#endif\n\n\t\t\t\tvec3 col = tmp.rgb;\n\t\t\t\tfloat lalpha = alpha * tmp.a;\n\t\t\t\tif ( crop > 0.5 ) {\n\t\t\t\t\tif ( uvs.x < 0.0 || uvs.x > 1.0 || uvs.y < 0.0 || uvs.y > 1.0 ) {\n\t\t\t\t\t\tlalpha = 0.0;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tlalpha *= mask;\n\t\t\t\t\n\t\t\t\tcalpha = lalpha / clamp( lalpha + accumAlpha, 0.00001, 1.0 );\n\t\t\t\taccumAlpha += (1.0 - accumAlpha) * lalpha * (1.0 - float(isMask));\n\n\t\t\t\treturn col;\n\t\t\t}\n"),spherical:new dC("\nvec3 sphericalTexture(vec3 normal, sampler2D tex, vec2 textureSize, float crop, mat3 mat, vec2 size, float blending, bool isMask, float mask, float alpha, int mode, out float calpha, out vec2 writeUv) {\n vec3 posN = normalize(vPosition);\n float u = 0.5 + atan(posN.z, posN.x) / (2.*3.1415);\n float v = 0.5 + asin(posN.y) / 3.1415;\n\n vec2 calculatedUv = vec2(u,v);\n\t\t\t\tvec2 uvs = ( mat * vec3( calculatedUv * 2. - 1., 1. ) / 2. + 0.5 ).xy;\n\t\t\t\twriteUv = uvs;\n\n vec2 df = fwidth(uvs);\n \tif(df.x > 0.5) df.x = 0.;\n\t\t\t\t#ifdef GL_EXT_shader_texture_lod\n vec4 tmp = texture2DLodEXT(tex, uvs, log2(max(df.x, df.y)*min(textureSize.x, textureSize.y)));\n\t\t\t\t#else\n vec4 tmp = textureLod(tex, uvs, log2(max(df.x, df.y)*min(textureSize.x, textureSize.y)));\n\t\t\t\t#endif\n\n\t\t\t\tvec3 col = tmp.rgb;\n\t\t\t\tfloat lalpha = alpha * tmp.a;\n\t\t\t\tif ( crop > 0.5 ) {\n\t\t\t\t\tif ( uvs.x < 0.0 || uvs.x > 1.0 || uvs.y < 0.0 || uvs.y > 1.0 ) {\n\t\t\t\t\t\tlalpha = 0.0;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tlalpha *= mask;\n\n\t\t\t\tcalpha = lalpha / clamp( lalpha + accumAlpha, 0.00001, 1.0 );\n\t\t\t\taccumAlpha += (1.0 - accumAlpha) * lalpha * (1.0 - float(isMask));\n\n\t\t\t\treturn col;\n\t\t\t}\n"),uv:new dC("vec3 uvTexture(vec3 normal, sampler2D tex, vec2 textureSize, float crop, mat3 mat, vec2 size, float blending, bool isMask, float mask, float alpha, int mode, out float calpha, out vec2 writeUv) {\n\t\t\t\tvec2 uvs = ( mat * vec3( vUv * 2. - 1., 1. ) / 2. + 0.5 ).xy;\n\t\t\t\twriteUv = uvs;\n\n\t\t\t\tvec4 tmp = texture2D( tex, uvs );\n\n\t\t\t\tvec3 col = tmp.rgb;\n\n\t\t\t\tfloat lalpha = alpha * tmp.a;\n\t\t\t\tif ( crop > 0.5 ) {\n\t\t\t\t\tif ( uvs.x < 0.0 || uvs.x > 1.0 || uvs.y < 0.0 || uvs.y > 1.0 ) {\n\t\t\t\t\t\tlalpha = 0.0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tlalpha *= mask;\n\n\t\t\t\tcalpha = lalpha / clamp( lalpha + accumAlpha, 0.00001, 1.0 );\n\t\t\t\taccumAlpha += (1.0 - accumAlpha) * lalpha * (1.0 - float(isMask));\n\n\t\t\t\treturn col;\n\t\t\t}"),triplanar:new dC("vec3 triplanarTexture(vec3 normal, sampler2D tex, vec2 textureSize, float crop, mat3 mat, vec2 size, float blending, bool isMask, float mask, float alpha, int mode, out float calpha, out vec2 writeUvs0, out vec2 writeUvs1, out vec2 writeUvs2, out vec3 writeWeights) {\n\t\t\t\tvec3 p = position;\n\t\t\t\tvec2 uv0 = (1.0 + p.xy) / 2.0; \n\t\t\t\tvec2 uv1 = (1.0 + p.zy) / 2.0;\t\t\n\t\t\t\tvec2 uv2 = (1.0 + p.xz) / 2.0;\t\t\n\t\n\t\t\t\tuv0 = (mat * vec3((uv0 * 2.0 - 1.0) / (size * 0.5), 1.0) / 2.0 + 0.5).xy;\n\t\t\t\tuv1 = (mat * vec3((uv1 * 2.0 - 1.0) / (size * 0.5), 1.0) / 2.0 + 0.5).xy;\n\t\t\t\tuv2 = (mat * vec3((uv2 * 2.0 - 1.0) / (size * 0.5), 1.0) / 2.0 + 0.5).xy;\n\n\t\t\t\t// Range from 3 to 128 seems to be good\n\t\t\t\tfloat exponent = (1.0 - blending) * 125.0 + 3.0;\n\n\t\t\t\tvec3 n = vObjectNormal;\n\t\t\t\tvec3 weights = abs(normalize(n));\n\t\t\t\tweights = pow(weights, vec3(exponent));\n\t\t\t\tweights /= dot(weights, vec3(1.0));\n\n\t\t\t\t// Write out all sets of UVs that we generated\n\t\t\t\twriteUvs0 = uv0;\n\t\t\t\twriteUvs1 = uv1;\n\t\t\t\twriteUvs2 = uv2;\n\t\t\t\twriteWeights = weights;\n\n\t\t\t\t// Derivatives for LOD\n\t\t\t\tvec2 df0 = fwidth(uv0);\n\t\t\t\tvec2 df1 = fwidth(uv1);\n\t\t\t\tvec2 df2 = fwidth(uv2);\n\t\t\t\tif (df0.x > 0.5) df0.x = 0.0;\n\t\t\t\tif (df1.x > 0.5) df1.x = 0.0;\n\t\t\t\tif (df2.x > 0.5) df2.x = 0.0;\n\n\t\t\t\t#ifdef GL_EXT_shader_texture_lod\n \tvec4 tmp = \n\t\t\t\t\t\ttexture2DLodEXT(tex, uv0, log2(max(df0.x, df0.y)*min(textureSize.x, textureSize.y))) * weights.z + \n\t\t\t\t\t\ttexture2DLodEXT(tex, uv1, log2(max(df1.x, df1.y)*min(textureSize.x, textureSize.y))) * weights.x + \n\t\t\t\t\t\ttexture2DLodEXT(tex, uv2, log2(max(df2.x, df2.y)*min(textureSize.x, textureSize.y))) * weights.y;\n\t\t\t\t#else\n \tvec4 tmp = \n\t\t\t\t\t\ttextureLod(tex, uv0, log2(max(df0.x, df0.y)*min(textureSize.x, textureSize.y))) * weights.z + \n\t\t\t\t\t\ttextureLod(tex, uv1, log2(max(df1.x, df1.y)*min(textureSize.x, textureSize.y))) * weights.x + \n\t\t\t\t\t\ttextureLod(tex, uv2, log2(max(df2.x, df2.y)*min(textureSize.x, textureSize.y))) * weights.y;\n\t\t\t\t#endif\n\n\t\t\t\tvec3 col = tmp.rgb;\n\t\t\t\tfloat lalpha = alpha * tmp.a;\n\n\t\t\t\t// Apply cropping across all 3 planes\n\t\t\t\tif ( crop > 0.5 ) {\n\t\t\t\t\tif ( uv0.x < 0.0 || uv0.x > 1.0 || uv0.y < 0.0 || uv0.y > 1.0 ) {\n\t\t\t\t\t\tlalpha = 0.0;\n\t\t\t\t\t}\n\t\t\t\t\tif ( uv1.x < 0.0 || uv1.x > 1.0 || uv1.y < 0.0 || uv1.y > 1.0 ) {\n\t\t\t\t\t\tlalpha = 0.0;\n\t\t\t\t\t}\n\t\t\t\t\tif ( uv2.x < 0.0 || uv2.x > 1.0 || uv2.y < 0.0 || uv2.y > 1.0 ) {\n\t\t\t\t\t\tlalpha = 0.0;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tlalpha *= mask;\n\t\t\t\tcalpha = lalpha / clamp(lalpha + accumAlpha, 0.00001, 1.0);\n\t\t\t\taccumAlpha += (1.0 - accumAlpha) * lalpha * (1.0 - float(isMask));\n\n\t\t\t\treturn col;//n * 0.5 + 0.5;\n\t\t\t}\t\t\t\n\t\t\t")};var hT=class extends rC{constructor(e,t,i,r,n,s,a,o,l,h,c,d){super("v3"),this.nodeType="Depth",this.gradientType=e,this.smooth=t,this.near=i,this.far=r,this.isVector=n,this.isWorldSpace=s,this.origin=a,this.direction=o,this.colors=l,this.steps=h,this.isMask=d,this.alpha=c,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(e,t){let i=`g${this.uuid.toString().replace(/-/g,"")}`,r=new dC(`vec3 ${i}_sdepth(float near, float far, vec3 origin, vec3 direction, vec4 colors[${i}_MAX_COLORS], float steps[${i}_MAX_COLORS], bool isMask, float mask, float alpha, out float calpha) {\n vec4 color = colors[0];\n #ifdef ${i}_IS_VECTOR\n #ifdef ${i}_LINEAR\n #ifdef ${i}_WORLDSPACE\n float depth = vectorLinearWorldSpaceDepth(direction, origin, near, far);\n #else\n float depth = vectorLinearObjectSpaceDepth(direction, origin, near, far);\n #endif\n #else\n #ifdef ${i}_WORLDSPACE\n float depth = vectorSphericalWorldSpaceDepth(origin, near, far);\n #else\n float depth = vectorSphericalObjectSpaceDepth(origin, near, far);\n #endif\n #endif\n #else\n float dist = length(vWPosition - cameraPosition);\n\t\t\t float depth = ( dist - near ) / ( far - near );\n #endif\n\n\n float p;\n #ifdef ${i}_SMOOTH\n\t\t\t\tfor ( int i = 1; i < ${i}_MAX_COLORS; i++ ) {\n\t\t\t\t\t\tp = clamp( ( depth - steps[i-1] ) / ( steps[i] - steps[i-1] ), 0.0, 1.0 );\n\t\t\t\t\t\tcolor = mix(color, colors[i], smoothstep(0.0, 1.0, p));\n\t\t\t\t\t}\n #else\n for ( int i = 1; i < ${i}_MAX_COLORS; i++ ) {\n p = clamp(( depth - steps[i - 1] ) / ( steps[i] - steps[i - 1] ), 0.0, 1.0);\n color = mix(color, colors[i], p);\n }\n #endif\n\n float lalpha = alpha * color.a * mask;\n calpha = mix(lalpha / clamp(lalpha + accumAlpha, 0.00001, 1.0), lalpha, float(isMask));\n\t\t\t accumAlpha += (1.0 - accumAlpha) * lalpha * (1.0 - float(isMask));\n\t\t\t \n return color.rgb;\n\t\t\t}`,[hT.Nodes.vectorLinearWorldSpaceDepth,hT.Nodes.vectorLinearObjectSpaceDepth,hT.Nodes.vectorSphericalObjectSpaceDepth,hT.Nodes.vectorSphericalWorldSpaceDepth]);if(e.isShader("fragment")){e.define(`${i}_MAX_COLORS`,this.colors.value.length),this.smooth.value&&e.define(`${i}_SMOOTH`),this.isVector.value>.5&&e.define(`${i}_IS_VECTOR`),0===this.gradientType.value&&e.define(`${i}_LINEAR`),this.isWorldSpace.value>.5&&e.define(`${i}_WORLDSPACE`),e.require("worldPosition"),e.addFragmentVariable(this.calpha,"float");let n=e.include(r),s=[];return s.push(this.near.build(e,"f")),s.push(this.far.build(e,"f")),s.push(this.origin.build(e,"v3")),s.push(this.direction.build(e,"v3")),s.push(this.colors.build(e,"v4[]")),s.push(this.steps.build(e,"f[]")),s.push(this.isMask.build(e,"b")),s.push(this.mask?`luminance(${this.mask.flow(e,"v3").result})`:"1.0"),s.push(this.alpha.build(e,"f")),s.push(this.calpha),e.format(n+"("+s.join(",")+")",this.getType(e),t)}return console.warn("DepthNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.getType(e),t)}},cT=hT;cT.Nodes={vectorLinearWorldSpaceDepth:new dC("float vectorLinearWorldSpaceDepth(vec3 direction, vec3 origin, float near, float far) {\n vec3 n = normalize(direction);\n float dist = (n.x*(vWPosition.x - origin.x) + n.y*(vWPosition.y - origin.y) + n.z*(vWPosition.z - origin.z));\n return ( dist - near ) / ( far - near );\n }"),vectorLinearObjectSpaceDepth:new dC("float vectorLinearObjectSpaceDepth(vec3 direction, vec3 origin, float near, float far) {\n vec3 n = normalize(direction);\n float dist = (n.x*(position.x - origin.x) + n.y*(position.y - origin.y) + n.z*(position.z - origin.z));\n return ( dist - near ) / ( far - near );\n }"),vectorSphericalWorldSpaceDepth:new dC("float vectorSphericalWorldSpaceDepth(vec3 origin, float near, float far) {\n float dist = length(vWPosition - origin);\n return ( dist - near ) / ( far - near );\n }"),vectorSphericalObjectSpaceDepth:new dC("float vectorSphericalObjectSpaceDepth(vec3 origin, float near, float far) {\n float dist = length(position - origin);\n return ( dist - near ) / ( far - near );\n }")};var dT=class extends rC{constructor(e,t,i,r,n,s,a,o){super("v3"),this.nodeType="Fresnel",this.color=e,this.bias=t,this.scale=i,this.intensity=r,this.factor=n,this.isMask=o,this.alpha=s,this.mode=a,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(e,t){if(e.require("vWorldViewDir"),e.require("worldNormal"),e.isShader("fragment")){e.addFragmentVariable(this.calpha,"float");let i=new dC("vec3 fresnel(vec3 color, float bias, float scale, float intensity, float factor, bool isMask, float mask, float alpha, int mode, out float calpha) {\n\t\t\t\t\tfloat fresnel = bias + scale * pow( abs( factor + dot( normalize( vWorldViewDir ), normalize( vWNormal ) ) ), intensity );\n\n\t\t\t\t\tfloat lalpha = clamp(fresnel, 0.0, 1.0) * alpha * mask;\n\t\t\t\t\tcalpha = mix(lalpha / clamp(lalpha + accumAlpha, 0.00001, 1.0), lalpha, float(isMask));\n\t\t\t\t\taccumAlpha += (1.0 - accumAlpha) * lalpha * (1.0 - float(isMask));\n\n\t\t\t\t\treturn color;\n\t\t\t\t}"),r=e.include(i),n=[];return n.push(this.color.build(e,"c")),n.push(this.bias.build(e,"f")),n.push(this.scale.build(e,"f")),n.push(this.intensity.build(e,"f")),n.push(this.factor.build(e,"f")),n.push(this.isMask.build(e,"b")),n.push(this.mask?`luminance(${this.mask.flow(e,"v3").result})`:"1.0"),n.push(this.alpha.build(e,"f")),n.push(this.mode.build(e,"i")),n.push(this.calpha),e.format(r+"("+n.join(",")+")",this.getType(e),t)}return console.warn("FresnelNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.getType(e),t)}},uT=class extends rC{constructor(e,t,i,r,n,s,a,o,l){super("v3"),this.nodeType="Gradient",this.gradientType=e,this.smooth=t,this.colors=i,this.steps=r,this.offset=n,this.morph=s,this.angle=a,this.isMask=l,this.alpha=o,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(e,t){if(e.isShader("fragment")){e.define("GRAD_MAX",10),e.require("uv"),e.requires.uv=[!0],e.addFragmentVariable(this.calpha,"float");let i=e.include(uT.Nodes.gradient),r=[];return r.push(this.gradientType.build(e,"i")),r.push(this.smooth.build(e,"b")),r.push(this.colors.build(e,"v4[]")),r.push(this.steps.build(e,"f[]")),r.push(this.offset.build(e,"v2")),r.push(this.morph.build(e,"v2")),r.push(this.angle.build(e,"f")),r.push(this.isMask.build(e,"b")),r.push(this.mask?`luminance(${this.mask.flow(e,"v3").result})`:"1.0"),r.push(this.alpha.build(e,"f")),r.push(this.calpha),e.format(i+"("+r.join(",")+")",this.getType(e),t)}return console.warn("GradientNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.getType(e),t)}},pT=uT;pT.Nodes={gradient:new dC("vec3 gradient(int gradientType, bool smoothed, vec4 colors[GRAD_MAX], float steps[GRAD_MAX], vec2 offset, vec2 morph, float angle, bool isMask, float mask, float alpha, out float calpha) {\n\t\t\t\tvec4 color = colors[0];\n\t\t\t\tvec2 m = morph / vUv.xy;\n\t\t\t\tvec2 rot = vec2( 0.5 + m.x, m.y );\n\t\t\t\tvec2 dt = vec2(\n\t\t\t\t\tcos( angle ) * rot.x - sin( angle ) * rot.y,\n\t\t\t\t\tsin( angle ) * rot.x + cos( angle ) * rot.y\n\t\t\t\t);\n\t\t\t\tvec2 pt = ( vUv - 0.5 + offset ) / 2.0 + dt / 2.0;\n\t\t\t\tfloat t = dot( pt, dt ) / dot( dt, dt );\n\t\t\t\tif ( gradientType == 1 ) {\n\t\t\t\t\tt = distance (\n\t\t\t\t\t\t( vUv + morph ) * 3.0,\n\t\t\t\t\t\t( vUv + offset ) + 1.0\n\t\t\t\t\t) + angle;\n\t\t\t\t} else if ( gradientType == 2 ) {\n\t\t\t\t\tfloat polar = atan(\n\t\t\t\t\t\tvUv.x + morph.x - 0.5 + offset.x,\n\t\t\t\t\t\tvUv.y + morph.y - 0.5 + offset.y\n\t\t\t\t\t) * -1.0;\n\t\t\t\t\tt = fract( ( angle / PI / -2.0 ) + 0.5 * ( polar / PI ) );\n\t\t\t\t}\n\n\t\t\t\tfloat p;\n\t\t\t\tif (smoothed) {\n\t\t\t\t\tfor ( int i = 1; i < GRAD_MAX; i++ ) {\n\t\t\t\t\t\tp = clamp( ( t - steps[i-1] ) / ( steps[i] - steps[i-1] ), 0.0, 1.0 );\n\t\t\t\t\t\tcolor = mix(color, colors[i], smoothstep(0.0, 1.0, p));\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\t\t\t\t\tfor ( int i = 1; i < GRAD_MAX; i++ ) {\n\t\t\t\t\t\tp = clamp( ( t - steps[i-1] ) / ( steps[i] - steps[i-1] ), 0.0, 1.0 );\n\t\t\t\t\t\tcolor = mix(color, colors[i], p);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tfloat lalpha = alpha * color.a * mask;\n\t\t\t\tcalpha = mix(lalpha / clamp(lalpha + accumAlpha, 0.00001, 1.0), lalpha, float(isMask));\n\t\t\t\taccumAlpha += (1.0 - accumAlpha) * lalpha * (1.0 - float(isMask));\n\t\t\t\t\n\t\t\t\treturn color.xyz;\n\t\t\t}")};var fT=class extends rC{constructor(e,t,i,r){super("v3"),this.nodeType="Matcap",this.texture=e,this.isMask=r,this.alpha=t,this.mode=i,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(e,t){if(e.isShader("fragment")){e.addFragmentVariable(this.calpha,"float");let i=e.include(fT.Nodes.matcap);e.require("normal"),e.requires.normal=!0;let r=[];return r.push(this.texture.generate(e,"t")),r.push("normal"),r.push(this.isMask.build(e,"b")),r.push(this.mask?`luminance(${this.mask.flow(e,"v3").result})`:"1.0"),r.push(this.alpha.build(e,"f")),r.push(this.mode.build(e,"i")),r.push(this.calpha),e.format(i+"("+r.join(",")+")",this.getType(e),t)}return console.warn("MatcapNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.getType(e),t)}},mT=fT;mT.Nodes={matcap:new dC("vec3 matcap(sampler2D matcapTex, vec3 normal, bool isMask, float mask, float alpha, int mode, out float calpha) {\n\t\t\t\t\tvec3 viewDir = normalize( vViewPosition );\n\t\t\t\t\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\t\t\t\t\tvec3 y = cross( viewDir, x );\n\t\t\t\t\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; // 0.495 to remove artifacts caused by undersized matcap disks\n\t\t\t\t\tvec4 matcapColor = texture2D( matcapTex, uv );\n\n\t\t\t\t\tfloat lalpha = alpha * mask;\n\t\t\t\t\tcalpha = mix(lalpha / clamp(lalpha + accumAlpha, 0.00001, 1.0), lalpha, float(isMask));\n\t\t\t\t\taccumAlpha += (1.0 - accumAlpha) * lalpha * (1.0 - float(isMask));\n\t\t\t\t\t\n\t\t\t\t\treturn matcapColor.rgb;\n \t}")};var gT=(e=>(e.SIMPLEX="simplex3d",e.SIMPLEX_FRACTAL="simplex3dFractal",e.ASHIMA="simplexAshima",e.FBM="fbm",e.PERLIN="perlin",e.VORONOI="voronoi",e))(gT||{}),vT=function(){let e=new dC("vec3 random3(vec3 c) {\n\t\t\tfloat j = 4096.0*sin(dot(c,vec3(17.0, 59.4, 15.0)));\n\t\t\tvec3 r;\n\t\t\tr.z = fract(512.0*j);\n\t\t\tj *= .125;\n\t\t\tr.x = fract(512.0*j);\n\t\t\tj *= .125;\n\t\t\tr.y = fract(512.0*j);\n\t\t\treturn r-0.5;\n\t\t}"),t=new dC("float simplex3d(vec3 p) {\n\t\t\t vec3 s = floor(p + dot(p, vec3(F3)));\n\t\t\t vec3 x = p - s + dot(s, vec3(G3));\n\t\t\t \n\t\t\t vec3 e = step(vec3(0.0), x - x.yzx);\n\t\t\t vec3 i1 = e*(1.0 - e.zxy);\n\t\t\t vec3 i2 = 1.0 - e.zxy*(1.0 - e);\n\t\t\t\t\n\t\t\t vec3 x1 = x - i1 + G3;\n\t\t\t vec3 x2 = x - i2 + 2.0*G3;\n\t\t\t vec3 x3 = x - 1.0 + 3.0*G3;\n\t\t\t \n\t\t\t vec4 w, d;\n\t\t\t \n\t\t\t w.x = dot(x, x);\n\t\t\t w.y = dot(x1, x1);\n\t\t\t w.z = dot(x2, x2);\n\t\t\t w.w = dot(x3, x3);\n\t\t\t \n\t\t\t w = max(0.6 - w, 0.0);\n\t\t\t \n\t\t\t d.x = dot(random3(s), x);\n\t\t\t d.y = dot(random3(s + i1), x1);\n\t\t\t d.z = dot(random3(s + i2), x2);\n\t\t\t d.w = dot(random3(s + 1.0), x3);\n\t\t\t \n\t\t\t w *= w;\n\t\t\t w *= w;\n\t\t\t d *= w;\n\t\t\t \n\t\t\t return dot(d, vec4(52.0));\n\t\t}",[e]);t.keywords.F3=new fC("float F3 0.3333333"),t.keywords.G3=new fC("float G3 0.1666667");let i=new dC("float simplex3dFractal(vec3 m) {\n\t\t\tmat3 rot1 = mat3(-0.37, 0.36, 0.85,-0.14,-0.93, 0.34,0.92, 0.01,0.4);\n\t\t\tmat3 rot2 = mat3(-0.55,-0.39, 0.74, 0.33,-0.91,-0.24,0.77, 0.12,0.63);\n\t\t\tmat3 rot3 = mat3(-0.71, 0.52,-0.47,-0.08,-0.72,-0.68,-0.7,-0.45,0.56);\n\t\t\treturn 0.5333333 * simplex3d(m * rot1)\n\t\t\t\t + 0.2666667 * simplex3d(2.0 * m * rot2)\n\t\t\t\t + 0.1333333 * simplex3d(4.0 * m * rot3)\n\t\t\t\t + 0.0666667 * simplex3d(8.0 * m);\n\t\t}",[t]),r=new dC("vec4 permute(vec4 x){return mod(((x*34.0)+1.0)*x, 289.0);}"),n=new dC("vec4 taylorInvSqrt(vec4 r){return 1.79284291400159 - 0.85373472095314 * r;}"),s=new dC("float simplexAshima(vec3 v) {\n\t\t const vec2 C = vec2(1.0/6.0, 1.0/3.0) ;\n\t\t const vec4 D = vec4(0.0, 0.5, 1.0, 2.0);\n\t\t vec3 i = floor(v + dot(v, C.yyy) );\n\t\t vec3 x0 = v - i + dot(i, C.xxx) ;\n\t\t vec3 g = step(x0.yzx, x0.xyz);\n\t\t vec3 l = 1.0 - g;\n\t\t vec3 i1 = min( g.xyz, l.zxy );\n\t\t vec3 i2 = max( g.xyz, l.zxy );\n\t\t vec3 x1 = x0 - i1 + 1.0 * C.xxx;\n\t\t vec3 x2 = x0 - i2 + 2.0 * C.xxx;\n\t\t vec3 x3 = x0 - 1. + 3.0 * C.xxx;\n\t\t i = mod(i, 289.0 ); \n\t\t vec4 p = permute( permute( permute( \n\t\t\t\t\t i.z + vec4(0.0, i1.z, i2.z, 1.0 ))\n\t\t\t\t + i.y + vec4(0.0, i1.y, i2.y, 1.0 )) \n\t\t\t\t + i.x + vec4(0.0, i1.x, i2.x, 1.0 ));\n\t\t float n_ = 1.0/7.0; // N=7\n\t\t vec3 ns = n_ * D.wyz - D.xzx;\n\t\t vec4 j = p - 49.0 * floor(p * ns.z *ns.z); // mod(p,N*N)\n\t\t vec4 x_ = floor(j * ns.z);\n\t\t vec4 y_ = floor(j - 7.0 * x_ ); // mod(j,N)\n\t\t vec4 x = x_ *ns.x + ns.yyyy;\n\t\t vec4 y = y_ *ns.x + ns.yyyy;\n\t\t vec4 h = 1.0 - abs(x) - abs(y);\n\t\t vec4 b0 = vec4( x.xy, y.xy );\n\t\t vec4 b1 = vec4( x.zw, y.zw );\n\t\t vec4 s0 = floor(b0)*2.0 + 1.0;\n\t\t vec4 s1 = floor(b1)*2.0 + 1.0;\n\t\t vec4 sh = -step(h, vec4(0.0));\n\t\t vec4 a0 = b0.xzyw + s0.xzyw*sh.xxyy ;\n\t\t vec4 a1 = b1.xzyw + s1.xzyw*sh.zzww ;\n\t\t vec3 p0 = vec3(a0.xy,h.x);\n\t\t vec3 p1 = vec3(a0.zw,h.y);\n\t\t vec3 p2 = vec3(a1.xy,h.z);\n\t\t vec3 p3 = vec3(a1.zw,h.w);\n\t\t vec4 norm = taylorInvSqrt(vec4(dot(p0,p0), dot(p1,p1), dot(p2, p2), dot(p3,p3)));\n\t\t p0 *= norm.x;\n\t\t p1 *= norm.y;\n\t\t p2 *= norm.z;\n\t\t p3 *= norm.w;\n\t\t vec4 m = max(0.6 - vec4(dot(x0,x0), dot(x1,x1), dot(x2,x2), dot(x3,x3)), 0.0);\n\t\t m = m * m;\n\t\t return 42.0 * dot( m*m, vec4( dot(p0,x0), dot(p1,x1), \n\t\t\t\t\t\t\t\t\t\tdot(p2,x2), dot(p3,x3) ) );\n\t\t}",[r,n]),a=new dC("vec4 mod289(vec4 x){return x - floor(x * (1.0 / 289.0)) * 289.0;}"),o=new dC("vec4 perm(vec4 x){return mod289(((x * 34.0) + 1.0) * x);}",[a]),l=new dC("float noise(vec3 p){\n\t\t\tvec3 a = floor(p);\n\t\t\tvec3 d = p - a;\n\t\t\td = d * d * (3.0 - 2.0 * d);\n\t\t\tvec4 b = a.xxyy + vec4(0.0, 1.0, 0.0, 1.0);\n\t\t\tvec4 k1 = perm(b.xyxy);\n\t\t\tvec4 k2 = perm(k1.xyxy + b.zzww);\n\t\t\tvec4 c = k2 + a.zzzz;\n\t\t\tvec4 k3 = perm(c);\n\t\t\tvec4 k4 = perm(c + 1.0);\n\t\t\tvec4 o1 = fract(k3 * (1.0 / 41.0));\n\t\t\tvec4 o2 = fract(k4 * (1.0 / 41.0));\n\t\t\tvec4 o3 = o2 * d.z + o1 * (1.0 - d.z);\n\t\t\tvec2 o4 = o3.yw * d.x + o3.xz * (1.0 - d.x);\n\t\t\treturn o4.y * d.y + o4.x * (1.0 - d.y);\n\t\t}",[o]),h=new dC("float fbm(vec3 x) {\n\t\t\tfloat v = 0.0;\n\t\t\tfloat a = 0.5;\n\t\t\tvec3 shift = vec3(100);\n\t\t\tfor (int i = 0; i < NUM_OCTAVES; ++i) {\n\t\t\t\tv += a * noise(x);\n\t\t\t\tx = x * 2.0 + shift;\n\t\t\t\ta *= 0.5;\n\t\t\t}\n\t\t\treturn v;\n\t\t}",[l]);h.keywords.NUM_OCTAVES=new fC("int NUM_OCTAVES 5");let c=new dC("vec3 fade(vec3 t) {return t*t*t*(t*(t*6.0-15.0)+10.0);}"),d=new dC("float perlin(vec3 P){\n\t\t vec3 Pi0 = floor(P);\n\t\t vec3 Pi1 = Pi0 + vec3(1.0);\n\t\t Pi0 = mod(Pi0, 289.0);\n\t\t Pi1 = mod(Pi1, 289.0);\n\t\t vec3 Pf0 = fract(P);\n\t\t vec3 Pf1 = Pf0 - vec3(1.0);\n\t\t vec4 ix = vec4(Pi0.x, Pi1.x, Pi0.x, Pi1.x);\n\t\t vec4 iy = vec4(Pi0.yy, Pi1.yy);\n\t\t vec4 iz0 = Pi0.zzzz;\n\t\t vec4 iz1 = Pi1.zzzz;\n\t\t vec4 ixy = permute(permute(ix) + iy);\n\t\t vec4 ixy0 = permute(ixy + iz0);\n\t\t vec4 ixy1 = permute(ixy + iz1);\n\t\t vec4 gx0 = ixy0 / 7.0;\n\t\t vec4 gy0 = fract(floor(gx0) / 7.0) - 0.5;\n\t\t gx0 = fract(gx0);\n\t\t vec4 gz0 = vec4(0.5) - abs(gx0) - abs(gy0);\n\t\t vec4 sz0 = step(gz0, vec4(0.0));\n\t\t gx0 -= sz0 * (step(0.0, gx0) - 0.5);\n\t\t gy0 -= sz0 * (step(0.0, gy0) - 0.5);\n\t\t vec4 gx1 = ixy1 / 7.0;\n\t\t vec4 gy1 = fract(floor(gx1) / 7.0) - 0.5;\n\t\t gx1 = fract(gx1);\n\t\t vec4 gz1 = vec4(0.5) - abs(gx1) - abs(gy1);\n\t\t vec4 sz1 = step(gz1, vec4(0.0));\n\t\t gx1 -= sz1 * (step(0.0, gx1) - 0.5);\n\t\t gy1 -= sz1 * (step(0.0, gy1) - 0.5);\n\t\t vec3 g000 = vec3(gx0.x,gy0.x,gz0.x);\n\t\t vec3 g100 = vec3(gx0.y,gy0.y,gz0.y);\n\t\t vec3 g010 = vec3(gx0.z,gy0.z,gz0.z);\n\t\t vec3 g110 = vec3(gx0.w,gy0.w,gz0.w);\n\t\t vec3 g001 = vec3(gx1.x,gy1.x,gz1.x);\n\t\t vec3 g101 = vec3(gx1.y,gy1.y,gz1.y);\n\t\t vec3 g011 = vec3(gx1.z,gy1.z,gz1.z);\n\t\t vec3 g111 = vec3(gx1.w,gy1.w,gz1.w);\n\t\t vec4 norm0 = taylorInvSqrt(vec4(dot(g000, g000), dot(g010, g010), dot(g100, g100), dot(g110, g110)));\n\t\t g000 *= norm0.x;\n\t\t g010 *= norm0.y;\n\t\t g100 *= norm0.z;\n\t\t g110 *= norm0.w;\n\t\t vec4 norm1 = taylorInvSqrt(vec4(dot(g001, g001), dot(g011, g011), dot(g101, g101), dot(g111, g111)));\n\t\t g001 *= norm1.x;\n\t\t g011 *= norm1.y;\n\t\t g101 *= norm1.z;\n\t\t g111 *= norm1.w;\n\t\t float n000 = dot(g000, Pf0);\n\t\t float n100 = dot(g100, vec3(Pf1.x, Pf0.yz));\n\t\t float n010 = dot(g010, vec3(Pf0.x, Pf1.y, Pf0.z));\n\t\t float n110 = dot(g110, vec3(Pf1.xy, Pf0.z));\n\t\t float n001 = dot(g001, vec3(Pf0.xy, Pf1.z));\n\t\t float n101 = dot(g101, vec3(Pf1.x, Pf0.y, Pf1.z));\n\t\t float n011 = dot(g011, vec3(Pf0.x, Pf1.yz));\n\t\t float n111 = dot(g111, Pf1);\n\t\t vec3 fade_xyz = fade(Pf0);\n\t\t vec4 n_z = mix(vec4(n000, n100, n010, n110), vec4(n001, n101, n011, n111), fade_xyz.z);\n\t\t vec2 n_yz = mix(n_z.xy, n_z.zw, fade_xyz.y);\n\t\t float n_xyz = mix(n_yz.x, n_yz.y, fade_xyz.x); \n\t\t return 2.2 * n_xyz;\n\t\t}",[r,n,c]),u=new dC("float hashwithoutsine13(vec3 p3)\n\t\t{\n\t\t\tp3 = fract(p3 * .1031);\n\t\t\tp3 += dot(p3, p3.yzx + 33.33);\n\t\t\treturn fract((p3.x + p3.y) * p3.z);\n\t\t}"),p=new dC("vec3 hashwithoutsine33(vec3 p3)\n\t\t{\n\t\t\tp3 = fract(p3 * vec3(.1031, .1030, .0973));\n\t\t\tp3 += dot(p3, p3.yxz+33.33);\n\t\t\treturn fract((p3.xxy + p3.yxx)*p3.zyx);\n\t\t}"),f=new dC("float metric(in vec3 p)\n\t\t{\n\t\t\t// L2 \n\t\t\treturn length(p);\n\n\t\t\t// Chebyshev \n\t\t\t// vec3 a = abs(p);\n\t\t\t// return max(a.x, max(a.y, a.z));\n\t\t}"),m=new dC("float smin( float a, float b, float k )\n\t\t{\n\t\t\tfloat h = smoothstep(0.0, 1.0, 0.5 + 0.5 * (b - a) / k);\n\t\t\tfloat correction = k * h * (1.0 - h);\n\t\t\treturn mix(b, a, h) - correction;\n\t\t}"),g=new dC("float smax( float a, float b, float k )\n\t\t{\n\t\t\tfloat h = smoothstep(1.0, 0.0, 0.5 + 0.5 * (a - b) / k);\n\t\t\tfloat correction = k * h * (1.0 - h);\n\t\t\treturn mix(a, b, h) + correction;\n\t\t}"),v=new dC("float remap(float value, float input_min, float input_max, float output_min, float output_max) {\n\t\t\t// Compute width of each interval\n\t\t\tfloat input_width = input_max - input_min;\n\t\t\tfloat output_width = output_max - output_min;\n\t\t\n\t\t\t// Convert input range into a 0-1 range \n\t\t\tfloat scaled = (value - input_min) / input_width;\n\t\t\n\t\t\t// Convert the 0-1 range into a value in output range\n\t\t\treturn output_min + (scaled * output_width);\n\t\t}");return{simplex:t,simplexFractal:i,simplexAshima:s,fbm:h,perlin:d,voronoi:new dC('float voronoi(in vec3 x, in int style, in float smoothness, in float seed, in int quality) \n\t\t{\n\t\t\t// Integer and fractional parts of this point\'s coordinates\n\t\t\tivec3 p = ivec3(floor(x));\n\t\t\tvec3 f = fract(x);\n\n\t\t\t// Different variables that we will use to construct noise:\n\t\t\t//\n\t\t\t// f1: distance to the closest feature point\n\t\t\t// f2: distance to the second closest feature point\n\t\t\t// e: distance to the closest edge (cell boundary)\n\t\t\t//\n\t\t\t// We also compute "smooth" versions of all of the above quantites, essentially\n\t\t\t// replacing "hard" minimums with "smooth" minimums (described by IQ)\n\t\t\tfloat f1_smooth = 8.0;\n\t\t\tfloat f1 = 8.0;\n\t\t\tfloat f2_smooth = 8.0;\n\t\t\tfloat f2 = 8.0;\n\t\t\tfloat e_smooth = 8.0;\n\t\t\tfloat e = 8.0;\n\n\t\t\t// Variables stored from closest cell\n\t\t\tivec3 mb;\n\t\t\tvec3 mr; \n\n\t\t\tint steps = quality;\n\t\t\t\n\t\t\tfor (int x = -steps; x <= steps; x++) \n\t\t\tfor (int y = -steps; y <= steps; y++)\n\t\t\tfor (int z = -steps; z <= steps; z++)\n\t\t\t{\n\t\t\t\tivec3 b = ivec3(x, y, z);\n\t\t\t\tvec3 r = vec3(b) + hashwithoutsine33(vec3(p + b) + seed) - f;\n\t\t\t\tfloat d = length(r);\n\t\t\t\t\n\t\t\t\tf1_smooth = smin(d, f1_smooth, smoothness);\n\n\t\t\t\t// Store un-smoothed distances too \n\t\t\t\tif (d < f1) \n\t\t\t\t{\n\t\t\t\t\tf2 = f1;\n\t\t\t\t\tf1 = d;\n\n\t\t\t\t\tmb = ivec3(x, y, z);\n\t\t\t\t\tmr = r;\n\t\t\t\t} \n\t\t\t\telse if (d < f2) \n\t\t\t\t{\n\t\t\t\t\tf2 = d;\n\t\t\t\t}\n\t\t\t}\t\n\t\t\t\n\t\t\tfloat id = hashwithoutsine13(vec3(p + mb) + seed);\n\n\t\t\t// Second pass for edge distance \n\t\t\tfor (int x = -steps; x <= steps; x++) \n\t\t\tfor (int y = -steps; y <= steps; y++)\n\t\t\tfor (int z = -steps; z <= steps; z++)\n\t\t\t{\n\t\t\t\t// Start search at the cell that contains the closest point to "x" (found in 1st pass)\n\t\t\t\tivec3 b = mb + ivec3(x, y, z);\n\t\t\t\tvec3 r = vec3(b) + hashwithoutsine33(vec3(p + b) + seed) - f;\n\t\t\t\tfloat d1 = dot(0.5 * (mr + r), (r - mr)); \t\t\t\t// IQ normalizes "r - mr" but that breaks things for the smooth version?\n\t\t\t\tfloat d2 = dot(0.5 * (mr + r), normalize(r - mr));\n\n\t\t\t\te_smooth = smin(d1, e_smooth, smoothness);\n\n\t\t\t\te = min(e, d2);\n\n\t\t\t\t// Also compute a smooth version of F2 in this pass\n\t\t\t\t{\n\t\t\t\t\tivec3 b = ivec3(x, y, z);\n\t\t\t\t\tif (b != mb) \n\t\t\t\t\t{\n\t\t\t\t\t\tvec3 r = vec3(b) + hashwithoutsine33(vec3(p + b) + seed) - f;\n\t\t\t\t\t\tfloat d = length(r);\n\n\t\t\t\t\t\tf2_smooth = smin(d, f2_smooth, smoothness);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Different visualization modes \n\t\t\tif (style == 0) \n\t\t\t{\n\t\t\t\treturn f1_smooth;\n\t\t\t}\n\t\t\tif (style == 1) \n\t\t\t{\n\t\t\t\treturn f2_smooth;\n\t\t\t}\n\t\t\tif (style == 2) \n\t\t\t{\n\t\t\t\treturn f2_smooth - f1_smooth;\n\t\t\t\t\n\t\t\t\t// "Pebbles" also cool\n\t\t\t\t//return step(0.2, f2_smooth - f1_smooth);\n\t\t\t}\n\t\t\tif (style == 3) \n\t\t\t{\n\t\t\t\t// This one is really good for rock / stone effects\n\t\t\t\tfloat a = f1; \n\t\t\t\tfloat b = f2;\n\t\t\t\tfloat k = 3.0;\n\t\t\t\tfloat h = max(k - abs(a - b), 0.0) / k;\n\t\t\t\tfloat final = min(a, b) - h * h * k * (1.0 / 4.0);\n\t\t\t\treturn final;\n\t\t\t}\n\t\t\tif (style == 4) \n\t\t\t{\n\t\t\t\t// Some random adjustments to make this style stand out more \n\t\t\t\treturn exp(5.0 * e_smooth);\n\t\t\t}\n\t\t\tif (style == 5) \n\t\t\t{\n\t\t\t\treturn pow(f1_smooth, 3.0);\n\t\t\t}\n\t\t\tif (style == 6) \n\t\t\t{\t\t\t\t\n\t\t\t\tconst float eps = 0.0125;\n\n\t\t\t\t// Thicker lines as the user increases the smoothness slider\n\t\t\t\tfloat thickness = smoothness * 0.25 + eps;\n\n\t\t\t\t// Blurrier lines as the user increases the smoothness slider\n\t\t\t\tfloat blur = pow(smoothness, 3.0) * 0.25 + eps;\n\n\t\t\t\treturn smoothstep(\n\t\t\t\t\tthickness - thickness * blur, \n\t\t\t\t\tthickness + thickness * blur, \n\t\t\t\t\te\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (style == 7) \n\t\t\t{\n\t\t\t\treturn hashwithoutsine13(vec3(p + mb) + seed);\n\t\t\t}\n\t\t}\n\t',[u,p,f,m,g,v])}}(),yT=class extends rC{constructor(e,t,i,r,n,s,a,o,l,h,c,d,u,p,f,m,g,v,y){super("v3"),this.nodeType="Noise",this.scale=e,this.size=t,this.move=i,this.fA=r,this.fB=n,this.distortion=s,this.colorA=a,this.colorB=o,this.colorC=l,this.colorD=h,this.noiseType=d,this.voronoiStyle=p,this.highCut=f,this.lowCut=m,this.smoothness=g,this.seed=v,this.quality=y,this.isMask=u,this.alpha=c,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(e,t,i,r,n){e.require("uv"),e.requires.uv=[!0],e.addFragmentVariable(this.calpha,"float");let s=Object.values(gT)[this.noiseType.value],a=new dC(`vec3 ${s}customNoise(float scale, vec3 size, float move, vec2 fA, vec2 fB, vec2 distortion, vec4 colorA, vec4 colorB, vec4 colorC, vec4 colorD, int voronoiStyle, float highCut, float lowCut, float smoothness, float seed, int quality, bool isMask, float mask, float alpha, out float calpha) \n\t\t\t{\n // Prevent scale of zero \n\t\t\t\tscale = max(abs(scale), 0.001);\n\n\t\t\t\tvec3 st = position / size;\n\t\t\t\tst /= scale;\n\n\t\t\t\t${"voronoi"==s?`\n\t\tfloat v = ${s}(st + move, voronoiStyle, smoothness, seed, quality);\n\n\t\t// Apply clipping to colors\n\t\tv = remap(v, lowCut, highCut, 0.0, 1.0);\n\t\tv = smax(v, 0.0, smoothness * 0.25);\n\t\tv = smin(v, 1.0, smoothness * 0.25);\n\n\t\t// Note that the voronoi mode only uses colors "A" and "C" from the UI \n\t\tvec4 color = mix(colorA, colorC, v); \n\t\t`:`\n\t\tvec3 q = vec3(${s}(st),\n\t\t\t\t\t ${s}(st + vec3(1.0)),\n\t\t\t\t\t ${s}(st + vec3(1.0)));\n\t\tvec3 r = vec3(${s}(st + vec3(distortion, 1.0) * q + vec3(fA, 1.0) + move),\n\t\t\t\t\t ${s}(st + vec3(distortion, 1.0) * q + vec3(fB, 1.0) + move), \n\t\t\t\t\t ${s}(st * q));\n\t\tfloat f = ${s}(st + r);\n\t\tvec4 color;\n\t\tcolor = mix(colorA, colorB, clamp((f * f) * 4.0, 0.0, 1.0));\n\t\tcolor = mix(color, colorC, clamp(length(q), 0.0, 1.0));\n\t\tcolor = mix(color, colorD, clamp(length(r.x), 0.0, 1.0));\n\t\t`}\n\n\t\t\t\tfloat lalpha = alpha * color.a * mask;\n\t\t\t\tcalpha = mix(lalpha / clamp(lalpha + accumAlpha, 0.00001, 1.0), lalpha, float(isMask));\n\t\t\t\taccumAlpha += (1.0 - accumAlpha) * lalpha * (1.0 - float(isMask));\n\n\t\t\t\treturn clamp(color, 0.0, 1.0).rgb;\n\t\t\t}`,[vT.simplex,vT.simplexFractal,vT.simplexAshima,vT.fbm,vT.perlin,vT.voronoi]),o=e.include(a),l=[];return l.push(this.scale.build(e,"f")),l.push(this.size.build(e,"v3")),l.push(this.move.build(e,"f")),l.push(this.fA.build(e,"v2")),l.push(this.fB.build(e,"v2")),l.push(this.distortion.build(e,"v2")),l.push(this.colorA.build(e,"v4")),l.push(this.colorB.build(e,"v4")),l.push(this.colorC.build(e,"v4")),l.push(this.colorD.build(e,"v4")),l.push(this.voronoiStyle.build(e,"i")),l.push(this.highCut.build(e,"f")),l.push(this.lowCut.build(e,"f")),l.push(this.smoothness.build(e,"f")),l.push(this.seed.build(e,"f")),l.push(this.quality.build(e,"i")),l.push(this.isMask.build(e,"b")),l.push(this.mask?`luminance(${this.mask.flow(e,"v3").result})`:"1.0"),l.push(this.alpha.build(e,"f")),l.push(this.calpha),e.format(o+"("+l.join(",")+")",this.getType(e),t)}};yT.numOctaves=5;var xT=class extends rC{constructor(e,t,i,r,n,s,a,o,l,h,c,d,u,p,f,m){super("v3"),this.nodeType="Outline",this.firstTime=!0,this.outlineColor=e,this.contourColor=t,this.outlineWidth=i,this.contourWidth=r,this.contourThreshold=n,this.outlineThreshold=s,this.contourFrequency=a,this.outlineSmoothing=o,this.contourDirection=l,this.positionalLines=h,this.compensation=c,this.resolution=d,this.normalMap=u,this.depthMap=p,this.pixelRatio=f,this.alpha=m,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(e,t){let i=`g${this.uuid.toString().replace(/-/g,"")}`;if(e.require("vWorldViewDir"),e.require("worldNormal"),e.extensions.derivatives=!0,this.compensation.value&&e.define("OUTLINE_COMPENSATION",`${i}_offset`),this.firstTime){let t=this.outlineWidth.build(e,"f"),r=this.resolution.build(e,"v2"),n=this.compensation.build(e,"b"),s=this.pixelRatio.build(e,"f");e.addVertexParsVariable("randomColor","attribute vec3"),e.addVertexParsVariable("extrudeNormal","attribute vec3"),e.addVertexParsVariable(t,"uniform float"),e.addVertexParsVariable(r,"uniform vec2"),e.addVertexParsVariable(n,"uniform bool"),e.addVertexParsVariable(s,"uniform float"),e.addVertexParsVariable("vID","flat out float"),e.addFragmentParsVariable("vID","flat in float"),e.addVertexFinalCode(`\n vID = randomColor.r;\n vec2 ${i}_offset = vec2(0.0);\n if (${n}) {\n vec4 ${i}_clipPosition = projectionMatrix * (modelViewMatrix * vec4(position, 1.0));\n // NOTE: For certain shapes, like spheres, we get incorrect extrusion when the\n // normals face the camera directly. So we hackily fix this by offsetting the normal\n // by a tiny amount.\n vec3 ${i}_clipNormal = mat3(projectionMatrix) * (mat3(modelViewMatrix) * extrudeNormal) + 0.0000001;\n ${i}_offset = normalize(${i}_clipNormal.xy) / ${r} * (${t} / 2.0) * ${i}_clipPosition.w * 2.0 * ${s};\n ${i}_clipPosition.xy += ${i}_offset;\n // TODO(MAX): To handle multiple outline layers, we only want to extrude\n // if this offset is the biggest of all the potential offsets\n gl_Position = ${i}_clipPosition;\n }\n `)}if(e.isShader("fragment")){e.require("uv"),e.requires.uv=[!0],e.addFragmentVariable(this.calpha,"float");let i=e.include(xT.Nodes.outline),r=[];return r.push(this.outlineColor.build(e,"c")),r.push(this.contourColor.build(e,"c")),r.push(this.outlineWidth.build(e,"f")),r.push(this.contourWidth.build(e,"f")),r.push(this.contourThreshold.build(e,"f")),r.push(this.outlineThreshold.build(e,"f")),r.push(this.contourFrequency.build(e,"f")),r.push(this.outlineSmoothing.build(e,"f")),r.push(this.contourDirection.build(e,"v3")),r.push(this.positionalLines.build(e,"b")),r.push(this.resolution.build(e,"v2")),r.push(this.normalMap.getTexture(e,"t")),r.push(this.depthMap.getTexture(e,"t")),r.push(this.pixelRatio.build(e,"f")),r.push(this.compensation.build(e,"b")),r.push(this.mask?`luminance(${this.mask.flow(e,"v3").result})`:"1.0"),r.push(this.alpha.build(e,"f")),r.push(this.calpha),this.firstTime=!this.firstTime,e.format(i+"("+r.join(",")+")",this.getType(e),t)}return console.warn("OutlineNode is not compatible with "+e.shader+" shader."),""}},bT=xT;bT.Nodes=function(){let e=new dC("\nfloat sobelSample(sampler2D t, sampler2D d, vec2 uv, vec2 resolution, float outlineWidth, float pixelRatio)\n{\n vec2 halton = haltonSequence[frameIndex];\n float temporalOffset = getNoiseInterleavedGradient(gl_FragCoord.xy + halton);\n float temporalAngle = temporalOffset * PI2;\n\n vec2 texelSize = (vec2(1.0) / resolution);\n vec2 offsetSize = texelSize * outlineWidth * pixelRatio;\n\n vec2 uvSamples[9];\n vec4 normalSamples[9];\n\n\tuvSamples[0] = uv + vec2( -offsetSize.x, -offsetSize.y) + (vogelDiskSample(0, 9, temporalAngle) * texelSize);\n\tuvSamples[1] = uv + vec2(0.0, -offsetSize.y) + (vogelDiskSample(1, 9, temporalAngle) * texelSize);\n\tuvSamples[2] = uv + vec2( offsetSize.x, -offsetSize.y) + (vogelDiskSample(2, 9, temporalAngle) * texelSize);\n\tuvSamples[3] = uv + vec2( -offsetSize.x, 0.0) + (vogelDiskSample(3, 9, temporalAngle) * texelSize);\n\tuvSamples[4] = uv;\n\tuvSamples[5] = uv + vec2( offsetSize.x, 0.0) + (vogelDiskSample(5, 9, temporalAngle) * texelSize);\n\tuvSamples[6] = uv + vec2( -offsetSize.x, offsetSize.y) + (vogelDiskSample(6, 9, temporalAngle) * texelSize);\n\tuvSamples[7] = uv + vec2(0.0, offsetSize.y) + (vogelDiskSample(7, 9, temporalAngle) * texelSize);\n\tuvSamples[8] = uv + vec2( offsetSize.x, offsetSize.y) + (vogelDiskSample(8, 9, temporalAngle) * texelSize);\n\n\n normalSamples[0] = texture2D(t, uvSamples[0]);\n normalSamples[1] = texture2D(t, uvSamples[1]);\n normalSamples[2] = texture2D(t, uvSamples[2]);\n normalSamples[3] = texture2D(t, uvSamples[3]);\n normalSamples[4] = texture2D(t, uvSamples[4]);\n normalSamples[5] = texture2D(t, uvSamples[5]);\n normalSamples[6] = texture2D(t, uvSamples[6]);\n normalSamples[7] = texture2D(t, uvSamples[7]);\n normalSamples[8] = texture2D(t, uvSamples[8]);\n\n float depthBias = 0.0001;\n // TODO(MAX): Can we somehow reduce the number of conditionals here with MATH?!\n if (normalSamples[0].a != vID && normalSamples[0].a != 0.0) {\n float depthAtSample = texture2D(d, uvSamples[0]).r + depthBias;\n if (gl_FragCoord.z > depthAtSample) {\n return 0.0;\n }\n }\n\n if (normalSamples[1].a != vID && normalSamples[1].a != 0.0) {\n float depthAtSample = texture2D(d, uvSamples[1]).r + depthBias;\n if (gl_FragCoord.z > depthAtSample) {\n return 0.0;\n }\n }\n\n if (normalSamples[2].a != vID && normalSamples[2].a != 0.0) {\n float depthAtSample = texture2D(d, uvSamples[2]).r + depthBias;\n if (gl_FragCoord.z > depthAtSample) {\n return 0.0;\n }\n }\n\n if (normalSamples[3].a != vID && normalSamples[3].a != 0.0) {\n float depthAtSample = texture2D(d, uvSamples[3]).r + depthBias;\n if (gl_FragCoord.z > depthAtSample) {\n return 0.0;\n }\n }\n\n\n if (normalSamples[4].a != vID && normalSamples[4].a != 0.0) {\n float depthAtSample = texture2D(d, uvSamples[4]).r + depthBias;\n if (gl_FragCoord.z > depthAtSample) {\n return 0.0;\n }\n }\n\n if (normalSamples[5].a != vID && normalSamples[5].a != 0.0) {\n float depthAtSample = texture2D(d, uvSamples[5]).r + depthBias;\n if (gl_FragCoord.z > depthAtSample) {\n return 0.0;\n }\n }\n\n if (normalSamples[6].a != vID && normalSamples[6].a != 0.0) {\n float depthAtSample = texture2D(d, uvSamples[6]).r + depthBias;\n if (gl_FragCoord.z > depthAtSample) {\n return 0.0;\n }\n }\n\n if (normalSamples[7].a != vID && normalSamples[7].a != 0.0) {\n float depthAtSample = texture2D(d, uvSamples[7]).r + depthBias;\n if (gl_FragCoord.z > depthAtSample) {\n return 0.0;\n }\n }\n\n if (normalSamples[8].a != vID && normalSamples[8].a != 0.0) {\n float depthAtSample = texture2D(d, uvSamples[8]).r + depthBias;\n if (gl_FragCoord.z > depthAtSample) {\n return 0.0;\n }\n }\n\n vec3 sobel_edge_h = normalSamples[2].rgb + (2.0*normalSamples[5].rgb) + normalSamples[8].rgb - (normalSamples[0].rgb + (2.0*normalSamples[3].rgb) + normalSamples[6].rgb);\n \tvec3 sobel_edge_v = normalSamples[0].rgb + (2.0*normalSamples[1].rgb) + normalSamples[2].rgb - (normalSamples[6].rgb + (2.0*normalSamples[7].rgb) + normalSamples[8].rgb);\n\n float edgeNormal = sqrt(dot(sobel_edge_h, sobel_edge_h) + dot(sobel_edge_v, sobel_edge_v));\n return edgeNormal;\n}\n");return{outline:new dC("vec3 outline(vec3 outlineColor, vec3 contourColor, float outlineWidth, float contourWidth, float outlineThreshold, float contourThreshold, float outlineSmoothing, float contourFrequency, vec3 contourDirection, bool positionalLines, vec2 resolution, sampler2D normalMap, sampler2D depthMap, float pixelRatio, bool compensation, float mask, float alpha, out float calpha) {\n vec3 result = outlineColor;\n float resultAlpha = 0.0;\n\n vec3 N = normalize(vWNormal);\n vec2 nuv = (gl_FragCoord.xy / resolution);\n float sobelSample = compensation ? sobelSample(normalMap, depthMap, nuv, resolution, outlineWidth / 2., pixelRatio) : sobelSample(normalMap, depthMap, nuv, resolution, outlineWidth, pixelRatio);\n resultAlpha = smoothstep(outlineThreshold - outlineSmoothing, outlineThreshold + outlineSmoothing, sobelSample);\n\n //resultAlpha = 1.0;\n //result = vec3(sobelSample);\n\n float t = 1.0 - contourThreshold;\n if(positionalLines) {\n vec3 NDir = position * contourDirection;\n float NT = NDir.x + NDir.y + NDir.z;\n float f = fract(NT * contourFrequency * 0.01);\n float df = fwidth(NT * contourFrequency);\n\n float g = smoothstep(df * (contourWidth * 0.01), df * (contourWidth * 0.01 * 2.0), f);\n if (g < 1.0 && resultAlpha == 0.0) {\n result = contourColor;\n resultAlpha = 1.0;\n }\n }\n else {\n vec3 NDir = N * contourDirection;\n float NT = NDir.x + NDir.y + NDir.z;\n float df = fwidth(NT * contourThreshold);\n float f = sin(NT * 1.0 * contourFrequency);\n float g = smoothstep(0.0, df * contourWidth, 1.0 - f);\n\n if (df > (t * 0.5) && g < 1.0 && resultAlpha == 0.0) {\n result = contourColor;\n resultAlpha = 1.0 - g;\n }\n }\n\n float lalpha = alpha * resultAlpha * mask;\n calpha = lalpha / clamp( lalpha + accumAlpha, 0.00001, 1.0 );\n accumAlpha += ( 1.0 - accumAlpha ) * lalpha;\n\t\t\t\t \n return result;\n }",[e])}}();var wT=class extends rC{constructor(e,t,i,r,n,s,a,o,l,h,c,d,u,p,f,m,g,v){super("v3"),this.nodeType="Pattern",this.style=e,this.projection=t,this.axis=i,this.blending=r,this.offset=n,this.colorA=s,this.colorB=a,this.frequency=o,this.size=l,this.variation=h,this.smoothness=c,this.zigzag=d,this.rotation=u,this.vertical=p,this.horizontal=f,this.sides=m,this.isMask=v,this.alpha=g,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(e,t){if(e.isShader("fragment")){let i;switch(e.require("position"),e.require("uv"),e.requires.uv=[!0],e.require("normal"),e.requires.normal=!0,e.addFragmentVariable(this.calpha,"float"),this.style.value){case 0:default:i="circle";break;case 1:i="ring";break;case 2:i="polygon";break;case 3:i="xcross";break;case 4:i="diamond";break;case 5:i="checkerboard";break;case 6:i="line";break;case 7:i="wave"}let r=`g${this.uuid.toString().replace(/-/g,"")}`,n=new dC("float hashwithoutsine12(vec2 p)\n\t\t\t\t{\n\t\t\t\t\tvec3 p3 = fract(vec3(p.xyx) * .1031);\n\t\t\t\t\tp3 += dot(p3, p3.yzx + 33.33);\n\t\t\t\t\treturn fract((p3.x + p3.y) * p3.z);\n\t\t\t\t}"),s=new dC("vec2 rotate_uv(in vec2 uv, float a, bool repeat) \n\t\t\t\t{\n\t\t\t\t\tconst float mid = 0.5;\n\t\t\t\t\tfloat radians = a * (PI / 180.0);\n\t\t\t\t\tvec2 rotated = vec2(\n\t\t\t\t\t\tcos(radians) * (uv.x - mid) + sin(radians) * (uv.y - mid) + mid,\n\t\t\t\t\t\tcos(radians) * (uv.y - mid) - sin(radians) * (uv.x - mid) + mid\n\t\t\t\t\t);\n\t\t\t\t\treturn repeat ? fract(rotated): rotated;\n\t\t\t\t}"),a="";if(4===this.projection.value){a=`\n\t\t\t\tvec3 p = position;\n\t\t\t\tfloat factor = 0.0125;\n\t\t\t\tvec2 uv0 = fract(p.xy * factor);\n\t\t\t\tvec2 uv1 = fract(p.zy * factor);\n\t\t\t\tvec2 uv2 = fract(p.xz * factor);\n\t\t\t\t\n\t\t\t\tuv0 = rotate_uv(uv0 + offset, rotation, true);\n\t\t\t\tuv1 = rotate_uv(uv1 + offset, rotation, true);\n\t\t\t\tuv2 = rotate_uv(uv2 + offset, rotation, true);\n\t\n\t\t\t\tfloat d0 = ${2===this.style.value?`${i}(uv0, frequency, size, variation, smoothness_remapped, zigzag, rotation, sides)`:`${i}(uv0, frequency, size, variation, smoothness_remapped, zigzag, rotation)`};\n\t\t\t\tfloat d1 = ${2===this.style.value?`${i}(uv1, frequency, size, variation, smoothness_remapped, zigzag, rotation, sides)`:`${i}(uv1, frequency, size, variation, smoothness_remapped, zigzag, rotation)`};\n\t\t\t\tfloat d2 = ${2===this.style.value?`${i}(uv2, frequency, size, variation, smoothness_remapped, zigzag, rotation, sides)`:`${i}(uv2, frequency, size, variation, smoothness_remapped, zigzag, rotation)`};\n\t\t\t\t\n\t\t\t\t// Range from 3 to 128 seems to be good\n\t\t\t\tfloat exponent = (1.0 - blending) * 125.0 + 3.0;\n\n\t\t\t\tvec3 n = vObjectNormal;\n\t\t\t\tvec3 weights = abs(normalize(n));\n\t\t\t\tweights = pow(weights, vec3(exponent));\n\t\t\t\tweights /= dot(weights, vec3(1.0));\n\t\t\t\td0 *= weights.z;\n\t\t\t\td1 *= weights.x;\n\t\t\t\td2 *= weights.y;\n\t\t\t\tfloat draw = d0 + d1 + d2;\n\t\n\t\t\t\tvec2 custom_uv = uv0 * weights.z + uv1 * weights.x + uv2 * weights.y;\n\t\t\t\t`}else{let e=2===this.style.value?`${i}(custom_uv, frequency, size, variation, smoothness_remapped, zigzag, rotation, sides)`:`${i}(custom_uv, frequency, size, variation, smoothness_remapped, zigzag, rotation)`,t="";0===this.axis.value?t="float radius = length(p);\n\t\t\t\t\tfloat theta = atan(p.y, p.z);\n\t\t\t\t\tfloat phi = acos(p.x / radius);":1===this.axis.value?t="float radius = length(p);\n\t\t\t\t\tfloat theta = atan(p.x, p.z);\n\t\t\t\t\tfloat phi = acos(p.y / radius);":(this.axis.value,t="float radius = length(p);\n\t\t\t\t\tfloat theta = atan(p.y, p.x);\n\t\t\t\t\tfloat phi = acos(p.z / radius);");let r="";switch(this.projection.value){case 0:r="custom_uv = vUv.st;";break;case 1:case 3:default:break;case 2:r=`\n\t\t\t\t\t\t\tvec3 p = position;\n\t\t\t\t\t\t\t${t}\n\t\t\t\t\t\t\tcustom_uv = vec2(theta, phi);\n\t\t\t\t\t\t\tcustom_uv /= PI;\n\t\t\t\t\t\t\t`}a=`\n\t\t\t\tvec2 custom_uv;\n\t\t\t\t${r}\n\t\n\t\t\t\tcustom_uv += offset;\n\t\t\t\tcustom_uv = fract(custom_uv);\n\t\t\t\tcustom_uv = rotate_uv(custom_uv, rotation, true);\n\t\n\t\t\t\tfloat draw = ${e};\n\t\t\t\t`}let o=new dC(`vec3 ${r}_pattern(vec3 normal, float blending, int style, vec2 offset, vec4 colorA, vec4 colorB, vec2 frequency, float size, float variation, float smoothness, float zigzag, float rotation, vec2 vertical, vec2 horizontal, int sides, bool isMask, float mask, float alpha, out float calpha) {\n\t\t\t\t\tconst float TWO_PI = PI * 2.0;\n\t\t\t\t\tfloat smoothness_remapped = pow(smoothness, 5.0);\t\n\n\t\t\t\t\t${a}\n\n\t\t\t\t\t// Construct final output color\n\t\t\t\t\tvec4 color = mix(colorA, colorB, draw);\n\t\t\t\t\tcolor.a = clamp(color.a, 0.0, 1.0);\n\n\t\t\t\t\t// Apply cuts\n\t\t\t\t\tcolor.a *= \n\t\t\t\t\t\tstep(vertical.x, custom_uv.y) * \n\t\t\t\t\t\tstep(custom_uv.y, vertical.y);\n\t\t\t\t\tcolor.a *= \n\t\t\t\t\t\tstep(horizontal.x, abs(custom_uv.x)) * \n\t\t\t\t\t\tstep(abs(custom_uv.x), horizontal.y);\n\n\t\t\t\t\t// Accumulate alpha \n\t\t\t\t\tfloat lalpha = alpha * clamp(color.a, 0.0, 1.0) * mask;\n\t\t\t\t\tcalpha = mix(lalpha / clamp(lalpha + accumAlpha, 0.00001, 1.0), lalpha, float(isMask));\n\t\t\t\t\taccumAlpha += (1.0 - accumAlpha) * lalpha * (1.0 - float(isMask));\n\n\t\t\t\t\treturn clamp(color, 0.0, 1.0).rgb;\n\t\t\t\t}`,[s,n,wT.DrawFunctions.circle,wT.DrawFunctions.ring,wT.DrawFunctions.polygon,wT.DrawFunctions.cross,wT.DrawFunctions.diamond,wT.DrawFunctions.checkerboard,wT.DrawFunctions.line,wT.DrawFunctions.wave]),l=e.include(o),h=[];return h.push("normal"),h.push(this.blending.build(e,"f")),h.push(this.style.build(e,"i")),h.push(this.offset.build(e,"v2")),h.push(this.colorA.build(e,"v4")),h.push(this.colorB.build(e,"v4")),h.push(this.frequency.build(e,"v2")),h.push(this.size.build(e,"f")),h.push(this.variation.build(e,"f")),h.push(this.smoothness.build(e,"f")),h.push(this.zigzag.build(e,"f")),h.push(this.rotation.build(e,"f")),h.push(this.vertical.build(e,"v2")),h.push(this.horizontal.build(e,"v2")),h.push(this.sides.build(e,"i")),h.push(this.isMask.build(e,"b")),h.push(this.mask?`luminance(${this.mask.flow(e,"v3").result})`:"1.0"),h.push(this.alpha.build(e,"f")),h.push(this.calpha),e.format(l+"("+h.join(",")+")",this.getType(e),t)}return console.warn("PatterNode is not compatible with "+e.shader+" shader."),e.format("vec3(0.0)",this.getType(e),t)}},_T=wT;_T.DrawFunctions=function(){let e=new dC("float hashwithoutsine12(vec2 p) {\n\t\t\t\tvec3 p3 = fract(vec3(p.xyx) * 0.1031);\n\t\t\t\tp3 += dot(p3, p3.yzx + 33.33);\n\t\t\t\treturn fract((p3.x + p3.y) * p3.z);\n\t\t\t}"),t=new dC("vec2 tile_and_center(in vec2 uv, in vec2 frequency, in float variation, in float zigzag, in float rotation) {\n // Create tiles in UV-space\n uv *= frequency;\n\n // Integer coords\n vec2 i = floor(uv);\n\n // Offset every other row based on zigzag param, then compute fractional coords\n float row_offset = mod(i.y, 2.0);\n uv.x += row_offset * zigzag;\n vec2 f = fract(uv);\n\n\t\t\t\t// Rotate the tile itself:\n\t\t\t\t// const float mid = 0.5;\n\t\t\t\t// f = vec2(\n\t\t\t\t// \tcos(rotation) * (f.x - mid) + sin(rotation) * (f.y - mid) + mid,\n\t\t\t\t// \tcos(rotation) * (f.y - mid) - sin(rotation) * (f.x - mid) + mid\n\t\t\t\t// );\n\t\t\t\t// f = fract(f);\n\n f = f * 2.0 - 1.0;\n\n\t\t\t\t// Recompute integer coords after shifting - then, random value per tile \n\t\t\t\ti = floor(uv);\n\t\t\t\tfloat rand = (hashwithoutsine12(i) * 5.0 + 1.0);\n\t\t\t\tfloat jitter = mix(1.0, rand, variation);\n\t\t\t\tf *= jitter;\n\n return f;\n }",[e]);return{tileAndCenter:t,circle:new dC("float circle(in vec2 uv, in vec2 frequency, in float size, in float variation, in float smoothness, in float zigzag, in float rotation) {\n vec2 f = tile_and_center(uv, frequency, variation, zigzag, rotation);\n return smoothstep(\n -smoothness, \n smoothness, \n length(f) - size\n );\n }",[t]),ring:new dC("float ring(in vec2 uv, in vec2 frequency, in float size, in float variation, in float smoothness, in float zigzag, in float rotation) {\n vec2 f = tile_and_center(uv, frequency, variation, zigzag, rotation);\n\n\t\t\t\tfloat d = length(f);\n const float inner_width = 0.5;\n\n float outer = smoothstep(-smoothness, smoothness, d - size);\n float inner = smoothstep(-smoothness, smoothness, d - size * inner_width);\n\t\t\t\treturn outer + (1.0 - inner); \n }",[t]),polygon:new dC("float sdf_ngon(in vec2 p, in float r, in int n) {\n float an = (PI * 2.0) / float(n);\n float he = r * tan(0.5 * an);\n \n // Rotate to first sector\n p = -p.yx; \n float bn = an * floor((atan(p.y, p.x) + 0.5 * an) / an);\n vec2 cs = vec2(cos(bn), sin(bn));\n p = mat2(cs.x, -cs.y, cs.y, cs.x)*p;\n \n // Side of polygon\n return length(p - vec2(r, clamp(p.y, -he, he))) * sign(p.x - r);\n }\n \n float polygon(in vec2 uv, in vec2 frequency, in float size, in float variation, in float smoothness, in float zigzag, in float rotation, in int sides) {\n vec2 f = tile_and_center(uv, frequency, variation, zigzag, rotation);\n return smoothstep(-smoothness, smoothness, sdf_ngon(f, size, sides));\n }",[t]),cross:new dC("float sdf_cross(in vec2 p, in vec2 b, float r ) {\n p = abs(p); \n\t\t\t\tp = (p.y > p.x) ? p.yx : p.xy;\n vec2 q = p - b;\n float k = max(q.y, q.x);\n vec2 w = (k > 0.0) ? q : vec2(b.y - p.x, -k);\n return sign(k) * length(max(w, 0.0)) + r;\n }\n \n // Avoid namespace conflicts \n float xcross(in vec2 uv, in vec2 frequency, in float size, in float variation, in float smoothness, in float zigzag, in float rotation) {\n vec2 f = tile_and_center(uv, frequency, variation, zigzag, rotation);\n return smoothstep(-smoothness, smoothness, sdf_cross(f, vec2(size, size * 0.25), smoothness));\n }",[t]),diamond:new dC("float ndot(vec2 a, vec2 b) { \n return a.x*b.x - a.y*b.y; \n }\n \n float sdf_diamond(in vec2 p, in vec2 b) {\n p = abs(p);\n float h = clamp(ndot(b - 2.0 * p, b) / dot(b, b), -1.0, 1.0);\n float d = length(p - 0.5 * b * vec2(1.0 - h, 1.0 + h));\n return d * sign(p.x * b.y + p.y * b.x - b.x * b.y);\n }\n\n float diamond(in vec2 uv, in vec2 frequency, in float size, in float variation, in float smoothness, in float zigzag, in float rotation) {\n vec2 f = tile_and_center(uv, frequency, variation, zigzag, rotation);\n\t return smoothstep(-smoothness, smoothness, sdf_diamond(f, vec2(size)));\n }",[t]),checkerboard:new dC("float checkerboard(in vec2 uv, in vec2 frequency, in float size, in float variation, in float smoothness, in float zigzag, in float rotation) {\n uv *= frequency;\n vec2 i = floor(uv);\n\n float offset = mod(i.y, 2.0);\n\n uv.x += offset + zigzag * offset;\n float x = floor(uv.x);\n \n return mod(x, 2.0);\n }"),line:new dC("float line(in vec2 uv, in vec2 frequency, in float size, in float variation, in float smoothness, in float zigzag, in float rotation) {\n vec2 f = tile_and_center(uv, frequency, 0.0, zigzag, rotation);\n\t\t\t\t\n\t\t\t\t// Different approach for variation param here\n\t\t\t\tfloat row = floor(uv * frequency).y;\n\t\t\t\tfloat rand = hashwithoutsine12(vec2(row));\n\t\t\t\tfloat s = mix(size, size * rand, variation);\n\n\t\t\t\treturn smoothstep(\n\t\t\t\t\ts - smoothness, \n\t\t\t\t\ts + smoothness, \n\t\t\t\t\tabs(f.y)\n\t\t\t\t);\n }",[t]),wave:new dC("// Uses bisection \n float udf_cos(in vec2 p, in float a, in float b, in float c, in float d) {\n // Convert all data to a primitive cosine wave\n p = c * (p - vec2(d, a));\n \n const float TWO_PI = PI * 2.0;\n\n // Reduce to principal half cycle\n p.x = mod(p.x, TWO_PI); \n if (p.x > PI) {\n p.x = TWO_PI - p.x;\n }\n \n // Find zero of derivative (minimize distance)\n float xa = 0.0;\n float xb = TWO_PI;\n\n // 24 bit precision\n for (int i = 0; i < 24; i++) {\n float x = 0.5 * (xa + xb);\n float y = x - p.x + b * c * sin(x) * (p.y - b * c * cos(x));\n if (y < 0.0) xa = x; \n else xb = x;\n }\n float x = 0.5 * (xa + xb);\n \n // Compute distance \n vec2 q = vec2(x, b * c * cos(x));\n return length(p - q) / c;\n }\n\n float wave(in vec2 uv, in vec2 frequency, in float size, in float variation, in float smoothness, in float zigzag, in float rotation) {\n float repeat = frequency.x;\n uv *= repeat;\n vec2 i = floor(uv);\n float row_offset = mod(i.y, 2.0);\n uv.x += row_offset * zigzag;\n vec2 f = vec2(uv.x, fract(uv.y));\n\n // Generalized cosine: y(x) = a + b * cos(cx + d)\n const float amplitude = 0.125;\n float wave_frequency = frequency.y * 0.1;\n float distance_estimate = udf_cos(f, 0.50, amplitude, wave_frequency * (2.0 * PI), 0.0);\n\n\t\t\t\t// Different approach for variation param here\n\t\t\t\tfloat rand = hashwithoutsine12(vec2(i.y));\n\t\t\t\tfloat s = mix(size, size * rand, variation);\n\n return smoothstep(-smoothness, smoothness, distance_estimate - s * 0.5);\n }")}}();var ST=class extends rC{constructor(e,t,i,r,n,s,a,o){super("v3"),this.nodeType="Rainbow",this.filmThickness=e,this.movement=t,this.wavelengths=i,this.noiseStrength=r,this.noiseScale=n,this.offset=s,this.isMask=o,this.alpha=a,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(e,t){if(e.require("vWorldViewDir"),e.require("worldNormal"),e.isShader("fragment")){e.require("uv"),e.requires.uv=[!0],e.addFragmentVariable(this.calpha,"float");let i=e.include(ST.Nodes.rainbow),r=[];return r.push(this.filmThickness.build(e,"f")),r.push(this.movement.build(e,"f")),r.push(this.wavelengths.build(e,"v3")),r.push(this.noiseStrength.build(e,"f")),r.push(this.noiseScale.build(e,"f")),r.push(this.offset.build(e,"v3")),r.push(this.isMask.build(e,"b")),r.push(this.mask?`luminance(${this.mask.flow(e,"v3").result})`:"1.0"),r.push(this.alpha.build(e,"f")),r.push(this.calpha),e.format(i+"("+r.join(",")+")",this.getType(e),t)}return console.warn("RainbowNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.getType(e),t)}},AT=ST;AT.Nodes=function(){let e=new dC("vec3 attenuation(vec3 wavelengths, float filmThickness, float movement, float noiseStrength, float noiseScale, vec3 offset) {\n vec3 st = position / noiseScale;\n\t\t\t\t vec3 q = vec3(simplex3d(st),\n\t\t\t\t\t\t\t simplex3d(st + vec3(1.0)),\n\t\t\t\t\t\t\t simplex3d(st + vec3(1.0)));\n\n\t\t\t\t vec3 r = vec3(simplex3d(st + vec3(1.4, 1.3, 1.0) * q + vec3(1.7, 9.2, 1.0)),\n\t\t\t\t\t\t\t simplex3d(st + vec3(2.0, 1.2, 1.0) * q + vec3(8.3, 2.8, 1.0)),\n\t\t\t\t\t\t\t simplex3d(st * q));\n\n float noise = simplex3d(st + r);\n\n return .5 + .5 * cos((((filmThickness + (noise * noiseStrength)) / (vec3(wavelengths.r * 1.0, wavelengths.g * 0.8, wavelengths.b * 0.6) + 1.0)) * dot(normalize(vWorldViewDir + (offset * -0.001)), normalize(vWNormal))) + movement);\n }",[vT.simplex]);return{rainbow:new dC("vec3 rainbow(float filmThickness, float movement, vec3 wavelengths, float noiseStrength, float noiseScale, vec3 offset, bool isMask, float mask, float alpha, out float calpha) {\n\t\t\t\tvec3 res = clamp(attenuation(wavelengths, filmThickness, movement, noiseStrength, noiseScale, offset), 0.0, 2.0);\n\n\t\t\t\tfloat rainbowContribution = clamp(res.r + res.g + res.b, 0.0, 1.0);\n\n\t\t\t\tfloat lalpha = alpha * rainbowContribution * mask;\n\t\t\t\tcalpha = mix(lalpha / clamp(lalpha + accumAlpha, 0.00001, 1.0), lalpha, float(isMask));\n\t\t\t\taccumAlpha += (1.0 - accumAlpha) * lalpha * (1.0 - float(isMask));\n\n\t\t\t\treturn res;\n }",[e])}}();var MT=class extends rC{constructor(e,t,i,r,n,s,a,o,l,h){super("v3"),this.nodeType="Toon",this.positioning=e,this.colors=t,this.steps=i,this.source=r,this.isWorldSpace=n,this.noiseStrength=s,this.noiseScale=a,this.shadowColor=o,this.offset=l,this.alpha=h,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(e,t){if(e.require("worldNormal"),e.require("worldPosition"),e.isShader("fragment")){e.define("COLORS_MAX",10),e.addFragmentVariable(this.calpha,"float");let i=e.include(MT.Nodes.toon),r=[];return r.push(this.positioning.build(e,"i")),r.push(this.colors.build(e,"v4[]")),r.push(this.steps.build(e,"f[]")),r.push(this.source.build(e,"v3")),r.push(this.isWorldSpace.build(e,"b")),r.push(this.noiseStrength.build(e,"f")),r.push(this.noiseScale.build(e,"f")),r.push(this.shadowColor.build(e,"v4")),r.push(this.offset.build(e,"v3")),r.push(this.mask?`luminance(${this.mask.flow(e,"v3").result})`:"1.0"),r.push(this.alpha.build(e,"f")),r.push(this.calpha),e.format(i+"("+r.join(",")+")",this.getType(e),t)}return console.warn("ToonNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.getType(e),t)}},ET=MT;ET.Nodes=function(){let e=new dC("float rand(float n) {\n\t\t\t\treturn fract(sin(n) * 43758.5453123);\n\t\t\t}"),t=new dC("float hash1(float p) { \n\t\t\t\tp = fract(p * 0.011); \n\t\t\t\tp *= p + 7.5; \n\t\t\t\tp *= p + p; \n\t\t\t\treturn fract(p); \n\t\t\t}"),i=new dC("float valueNoise(vec3 x) {\n\t\t\t\tconst vec3 step = vec3(110, 241, 171);\n\t\t\t\n\t\t\t\tvec3 i = floor(x);\n\t\t\t\tvec3 f = fract(x);\n\t\t\t \n\t\t\t\t// For performance, compute the base input to a 1D hash from the integer part of the argument and the \n\t\t\t\t// incremental change to the 1D based on the 3D -> 1D wrapping\n\t\t\t\tfloat n = dot(i, step);\n\t\t\t\n\t\t\t\tvec3 u = f * f * (3.0 - 2.0 * f);\n\t\t\t\treturn mix(mix(mix( hash1(n + dot(step, vec3(0, 0, 0))), hash1(n + dot(step, vec3(1, 0, 0))), u.x),\n\t\t\t\t\t\t\t mix( hash1(n + dot(step, vec3(0, 1, 0))), hash1(n + dot(step, vec3(1, 1, 0))), u.x), u.y),\n\t\t\t\t\t\t mix(mix( hash1(n + dot(step, vec3(0, 0, 1))), hash1(n + dot(step, vec3(1, 0, 1))), u.x),\n\t\t\t\t\t\t\t mix( hash1(n + dot(step, vec3(0, 1, 1))), hash1(n + dot(step, vec3(1, 1, 1))), u.x), u.y), u.z);\n\t\t\t}",[t]),r=new dC("vec3 hash3(vec3 x) {\n\t\t\t\tx = vec3(dot(x,vec3(127.1, 311.7, 74.7)),\n\t\t\t\t\t\t dot(x,vec3(269.5, 183.3, 246.1)),\n\t\t\t\t\t\t dot(x,vec3(113.5, 271.9, 124.6)));\n\t\t\t\n\t\t\t\treturn fract(sin(x)*43758.5453123);\n\t\t\t}"),n=new dC('vec3 voronoiNoise(in vec3 x)\n\t\t\t{\n\t\t\t\tvec3 p = floor(x);\n\t\t\t\tvec3 f = fract(x);\n\n\t\t\t\tfloat id = 0.0;\n\t\t\t\tvec2 res = vec2(100.0);\n\n\t\t\t\tfor(int k=-1; k<=1; k++)\n\t\t\t\tfor(int j=-1; j<=1; j++)\n\t\t\t\tfor(int i=-1; i<=1; i++)\n\t\t\t\t{\n\t\t\t\t\tvec3 b = vec3(float(i), float(j), float(k));\n\n\t\t\t\t\t// Comment out the "+ hash(p + b);" part below to get "square" cells\n\t\t\t\t\tvec3 r = vec3(b) - f + hash3(p + b);\n\t\t\t\t\tfloat d = dot(r, r);\n\n\t\t\t\t\tif (d < res.x)\n\t\t\t\t\t{\n\t\t\t\t\t\tid = dot(p + b, vec3(1.0, 57.0, 113.0));\n\t\t\t\t\t\tres = vec2(d, res.x);\t\t\t\n\t\t\t\t\t}\n\t\t\t\t\telse if (d < res.y)\n\t\t\t\t\t{\n\t\t\t\t\t\tres.y = d;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn vec3(sqrt(res), abs(id));\n\t\t\t}\n\t\t\t',[r]);return{toon:new dC('vec3 toon(int positioning, vec4 colors[COLORS_MAX], float steps[COLORS_MAX], vec3 source, bool isWorldSpace, float noiseStrength, float noiseScale, vec4 shadowColor, vec3 offset, float mask, float alpha, out float calpha) {\n\t\t\t\tfloat t = 0.0;\n\t\t\t\tfloat shadow = 1.0;\n\n\t\t\t\tif (positioning == 0) {\n\n\t\t\t\t\t// Can\'t do this mode if lighting is "none"\n\t\t\t\t\t#if (defined(PHONG) || defined(LAMBERT) || defined(STANDARD))\n\n\t\t\t\t\t\t// Algorithm from Chapter 10 of Graphics Shaders\n\t\t\t\t\t\tconst vec3 weights = vec3(0.2125, 0.7154, 0.0721);\n\t\t\t\t\t\tvec3 lpos;\n\t\t\t\t\t\tvec3 l;\n\t\t\t\t\t\tfloat dproduct;\n\n\t\t\t\t\t\t#if (NUM_POINT_LIGHTS > 0)\n\n\t\t\t\t\t\t\t#if defined(USE_SHADOWMAP) && (NUM_POINT_LIGHT_SHADOWS > 0)\n\t\t\t\t\t\t\t\tPointLightShadow pointLightShadow;\n\t\t\t\t\t\t\t#endif \n\n\t\t\t\t\t\t\t#pragma unroll_loop_start\n\t\t\t\t\t\t\tfor (int i = 0; i < NUM_POINT_LIGHTS; i++) {\n\t\t\t\t\t\t\t\t// Light positions are in view-space for some reason?\n\t\t\t\t\t\t\t\tlpos = (inverse(viewMatrix) * vec4(pointLights[UNROLLED_LOOP_INDEX].position, 1.0)).xyz;\n\t\t\t\t\t\t\t\tl = normalize(lpos - worldPosition);\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tdproduct = dot(l, normalize(worldNormal)) * 0.5 + 0.5;\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t// TODO: we want to use "intensity" but it isn\'t available in the shader code\n\t\t\t\t\t\t\t\t//dproduct += dot(pointLights[UNROLLED_LOOP_INDEX].color, weights);\n\n\t\t\t\t\t\t\t\tt = max(t, dproduct);\n\n\t\t\t\t\t\t\t\t// Accumulate shadow contribution\n\t\t\t\t\t\t\t\t#if defined(USE_SHADOWMAP) && (UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS)\n\t\t\t\t\t\t\t\t\tpointLightShadow = pointLightShadows[UNROLLED_LOOP_INDEX];\n\t\t\t\t\t\t\t\t\tshadow *= getPointShadow( \n\t\t\t\t\t\t\t\t\t\t\tpointShadowMap[UNROLLED_LOOP_INDEX], \n\t\t\t\t\t\t\t\t\t\t\tpointLightShadow.shadowMapSize, \n\t\t\t\t\t\t\t\t\t\t\tpointLightShadow.shadowBias, \n\t\t\t\t\t\t\t\t\t\t\tpointLightShadow.shadowRadius,\n\t\t\t\t\t\t\t\t\t\t\tvPointShadowCoord[UNROLLED_LOOP_INDEX], \n\t\t\t\t\t\t\t\t\t\t\tpointLightShadow.shadowCameraNear, \n\t\t\t\t\t\t\t\t\t\t\tpointLightShadow.shadowCameraFar);\n\t\t\t\t\t\t\t\t#endif\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t#pragma unroll_loop_end\n\n\t\t\t\t\t\t#endif\n\n\t\t\t\t\t\t#if NUM_DIR_LIGHTS > 0 \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t#if defined(USE_SHADOWMAP) && (NUM_DIR_LIGHT_SHADOWS > 0)\n\t\t\t\t\t\t\t\tDirectionalLightShadow directionalLightShadow;\n\t\t\t\t\t\t\t#endif \n\n\t\t\t\t\t\t\t#pragma unroll_loop_start\n\t\t\t\t\t\t\tfor (int i = 0; i < NUM_DIR_LIGHTS; i++) {\n\t\t\t\t\t\t\t\t// Use the direction vector for directional lights instead\n\t\t\t\t\t\t\t\tl = (inverse(viewMatrix) * vec4(directionalLights[UNROLLED_LOOP_INDEX].direction, 0.0)).xyz;\n\t\t\n\t\t\t\t\t\t\t\tdproduct = dot(l, normalize(worldNormal)) * 0.5 + 0.5;\n\t\t\t\t\t\t\t\tt = max(t, dproduct);\n\n\t\t\t\t\t\t\t\t// Accumulate shadow contribution\n\t\t\t\t\t\t\t\t#if defined(USE_SHADOWMAP) && (UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS)\n\t\t\t\t\t\t\t\t\tdirectionalLightShadow = directionalLightShadows[UNROLLED_LOOP_INDEX];\n\t\t\t\t\t\t\t\t\tshadow *= getShadow( \n\t\t\t\t\t\t\t\t\t\tUNROLLED_LOOP_INDEX,\n\t\t\t\t\t\t\t\t\t\tdirectionalShadowMap[UNROLLED_LOOP_INDEX], \n\t\t\t\t\t\t\t\t\t\tdirectionalLightShadow.shadowMapSize, \n\t\t\t\t\t\t\t\t\t\tdirectionalLightShadow.shadowBias, \n\t\t\t\t\t\t\t\t\t\tdirectionalLightShadow.shadowRadius, \n\t\t\t\t\t\t\t\t\t\tvDirectionalShadowCoord[UNROLLED_LOOP_INDEX]);\n\t\t\t\t\t\t\t\t#endif\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t#pragma unroll_loop_end\n\n\t\t\t\t\t\t#endif\n\n\t\t\t\t\t\t#if NUM_SPOT_LIGHTS > 0 \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t#if defined(USE_SHADOWMAP) && (NUM_SPOT_LIGHT_SHADOWS > 0)\n\t\t\t\t\t\t\t\tSpotLightShadow spotLightShadow;\n\t\t\t\t\t\t\t#endif \n\n\t\t\t\t\t\t\t#pragma unroll_loop_start\n\t\t\t\t\t\t\tfor (int i = 0; i < NUM_SPOT_LIGHTS; i++) {\n\t\t\t\t\t\t\t\tlpos = (inverse(viewMatrix) * vec4(spotLights[UNROLLED_LOOP_INDEX].position, 1.0)).xyz;\n\t\t\t\t\t\t\t\tl = normalize(lpos - worldPosition);\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tdproduct = dot(l, normalize(worldNormal)) * 0.5 + 0.5;\n\t\t\t\t\t\t\t\tt = max(t, dproduct);\n\n\t\t\t\t\t\t\t\t// Accumulate shadow contribution\n\t\t\t\t\t\t\t\t#if defined(USE_SHADOWMAP) && (UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS)\n\t\t\t\t\t\t\t\t\tspotLightShadow = spotLightShadows[UNROLLED_LOOP_INDEX];\n\t\t\t\t\t\t\t\t\tshadow *= getShadow(\n\t\t\t\t\t\t\t\t\t\tUNROLLED_LOOP_INDEX,\n\t\t\t\t\t\t\t\t\t\tspotShadowMap[UNROLLED_LOOP_INDEX], \n\t\t\t\t\t\t\t\t\t\tspotLightShadow.shadowMapSize, \n\t\t\t\t\t\t\t\t\t\tspotLightShadow.shadowBias, \n\t\t\t\t\t\t\t\t\t\tspotLightShadow.shadowRadius, \n\t\t\t\t\t\t\t\t\t\tvSpotLightCoord[UNROLLED_LOOP_INDEX]);\n\t\t\t\t\t\t\t\t#endif\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t#pragma unroll_loop_end\n\n\t\t\t\t\t\t#endif\n\n\t\t\t\t\t\tt = clamp(t, 0.0, 1.0);\n\t\t\t\t\n\t\t\t\t\t#endif\n\n\t\t\t\t} else if (positioning == 1) {\n\t\t\t\t\t\n\t\t\t\t\tvec3 origin = mix(position, worldPosition, float(isWorldSpace));\n\t\t\t\t\tvec3 direction = normalize(source - origin);\n\t\t\t\t\tt = dot(direction, normalize(worldNormal)) * 0.5 + 0.5;\t\n\n\t\t\t\t} else {\n\n\t\t\t\t\tvec3 origin = worldPosition;\n\t\t\t\t\tvec3 source = cameraPosition - offset;\n\t\t\t\t\tvec3 direction = normalize(source - origin);\n\t\t\t\t\tt = dot(direction, normalize(worldNormal)) * 0.5 + 0.5;\t\n\t\t\t\t\t\n\t\t\t\t}\n\n\t\t\t\tif (noiseStrength > 0.0) {\n\t\t\t\t\t// Distort with noise\n\t\t\t\t\tvec3 st = position / noiseScale;\n\t\t\t\t\t\n\t\t\t\t\t// Voronoi "smooth" noise\n\t\t\t\t\tfloat noise = 1.0 - voronoiNoise(st).x;\n\n\t\t\t\t\t// Voronoi cellular noise\n\t\t\t\t\t//float noise = 1.0 - rand(voronoiNoise(st).z);\n\n\t\t\t\t\t// Position warp noise\n\t\t\t\t\t// vec3 offset = vec3(\n\t\t\t\t\t// \tsimplex3d(st),\n\t\t\t\t\t// \tsimplex3d(st + vec3(111.1, 143.89, 217.19)),\n\t\t\t\t\t// \tsimplex3d(st + vec3(171.1, 247.89, 117.23))\n\t\t\t\t\t// );\n\t\t\t\t\t// st += offset;\n\t\t\t\t\t// float noise = valueNoise(st);\n\n\t\t\t\t\tt += noise * noiseStrength;\n\t\t\t\t}\n\n\t\t\t\tt = clamp(t, 0.0, 1.0);\n\n\t\t\t\t// Compute ramp color\n\t\t\t\tfloat p;\n\t\t\t\tvec4 color = colors[0];\n\t\t\t\tfor (int i = 1; i < COLORS_MAX; i++) {\n\t\t\t\t\tp = clamp((t - steps[i-1]) / (steps[i] - steps[i-1]), 0.0, 1.0);\n\t\t\t\t\tcolor = mix(color, colors[i], smoothstep(0.0, 1.0, p));\n\t\t\t\t}\n\n\t\t\t\t// Incorporate custom shadow color\n\t\t\t\tif (positioning == 0) {\n\n\t\t\t\t\tvec3 blendedShadow = mix(color.rgb, shadowColor.rgb, shadowColor.a);\n\t\t\t\t\tcolor.rgb = mix(blendedShadow, color.rgb, shadow);\n\t\t\t\t\n\t\t\t\t}\n\n\t\t\t\t// Accumulate alpha as usual\n\t\t\t\tfloat lalpha = alpha * color.a * mask;\n\t\t\t\tcalpha = lalpha / clamp(lalpha + accumAlpha, 0.00001, 1.0);\n\t\t\t\taccumAlpha += (1.0 - accumAlpha) * lalpha;\n\n\t\t\t\treturn color.xyz;\n\n }',[vT.simplex,e,i,n])}}();var CT={textureBicubic:new dC("float w0( float a ) {\n return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n }\n \n float w1( float a ) {\n return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n }\n \n float w2( float a ){\n return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n }\n \n float w3( float a ) {\n return ( 1.0 / 6.0 ) * ( a * a * a );\n }\n \n // g0 and g1 are the two amplitude functions\n float g0( float a ) {\n return w0( a ) + w1( a );\n }\n \n float g1( float a ) {\n return w2( a ) + w3( a );\n }\n \n // h0 and h1 are the two offset functions\n float h0( float a ) {\n return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n }\n \n float h1( float a ) {\n return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n }\n \n vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n uv = uv * texelSize.zw + 0.5;\n \n vec2 iuv = floor( uv );\n vec2 fuv = fract( uv );\n \n float g0x = g0( fuv.x );\n float g1x = g1( fuv.x );\n float h0x = h0( fuv.x );\n float h1x = h1( fuv.x );\n float h0y = h0( fuv.y );\n float h1y = h1( fuv.y );\n \n vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n \n return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) + \n g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n }\n\n vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n vec2 fLodSizeInv = 1.0 / fLodSize;\n vec2 cLodSizeInv = 1.0 / cLodSize;\n vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n return mix( fSample, cSample, fract( lod ) );\n }")};var TT=class extends rC{constructor(e,t,i,r,n,s,a,o){super("v3"),this.nodeType="Transmission",this.thickness=e,this.ior=t,this.roughness=i,this.transmissionSamplerSize=r,this.transmissionSamplerMap=n,this.transmissionDepthMap=s,this.aspectRatio=a,this.alpha=o,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(e,t){if(e.extensions.shaderTextureLOD=!0,e.extensions.derivatives=!0,e.isShader("fragment")){e.define("NUM_SAMPLES",6),e.define("BLUR_SLOD",Math.pow(2,RT.transmissionLod.value)),e.require("worldPosition"),e.requires.worldNormal=!0,e.requires.modelMatrix=!0,e.requires.projectionMatrix=!0,e.addFragmentVariable(this.calpha,"float");let i=e.include(TT.Nodes.transmission),r=[];return r.push(this.thickness.build(e,"f")),r.push(this.ior.build(e,"f")),r.push(this.roughness.build(e,"f")),r.push(this.transmissionSamplerSize.build(e,"v2")),r.push(this.transmissionSamplerMap.getTexture(e,"t")),r.push(this.transmissionDepthMap.getTexture(e,"t")),r.push(this.aspectRatio.build(e,"v2")),r.push("normal"),r.push(this.mask?`luminance(${this.mask.flow(e,"v3").result})`:"1.0"),r.push(this.alpha.build(e,"f")),r.push(this.calpha),e.format(i+"("+r.join(",")+")",this.getType(e),t)}return console.warn("TransmissionNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.getType(e),t)}},DT=TT;DT.Nodes=function(){let e=new dC("vec3 blur(sampler2D sp, vec2 U, vec2 scale, float lod, sampler2D dm, vec2 unrefractedU, vec2 aspectRatio) {\n // Slightly modified version of this:\n // https://www.shadertoy.com/view/ltScRG\n\n\t\t\t\t// Special case for blur == 0.0\n\t\t\t\tif (lod == 0.0) {\n\t\t\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\t\treturn texture2DLodEXT( sp, U, 0.0).rgb;\n\t\t\t\t\t#else\n\t\t\t\t\treturn textureLod( sp, U, 0.0).rgb;\n\t\t\t\t\t#endif\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tvec2 texelSize = vec2(1.0) / resolution;\n vec2 halton = haltonSequence[frameIndex];\n float temporalOffset = getNoiseInterleavedGradient(gl_FragCoord.xy + halton);\n float temporalAngle = temporalOffset * PI2;\n\t\t\t\tvec3 res = vec3(0.0);\n vec2 uv = vec2(0.0);\n vec2 offset = vec2(0.0);\n vec2 vogelSample = vec2(0.0);\n for (int i = 0; i < NUM_SAMPLES; i++) {\n vogelSample = vogelDiskSample(i, NUM_SAMPLES, temporalAngle) * texelSize;\n offset = vogelSample * scale * (lod * 10.0); // TODO: used to be hardcoded to 20\n uv = U + offset;\n float opaqueDepth = unpackRGBAToDepth(textureLod(dm, uv, lod));\n if (opaqueDepth != 0.0 && opaqueDepth < gl_FragCoord.z) {\n uv = unrefractedU;\n lod = lod > 4.0 ? lod : lod / 2.0;\n }\n res += textureLod(sp, uv, lod).rgb;\n }\n return res / float(NUM_SAMPLES);\n }"),t=new dC("vec3 getVolumeTransmissionRay( vec3 n, vec3 v, float thickness, float ior, mat4 modelMatrix ) {\n\t\t // Direction of refracted light.\n\t\t vec3 refractionVector = refract( -v, n, 1.0 / ior );\n\t\t \n\t\t\t\t// Compute rotation-independant scaling of the model matrix.\n\t\t vec3 modelScale;\n\t\t modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\t modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\t modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\n\t\t // The thickness is specified in local space\n\t\t return normalize( refractionVector ) * thickness * modelScale;\n\t }"),i=new dC("float applyIorToRoughness( float roughness, float ior ) {\n\t\t\t\t// Scale roughness with IOR so that an IOR of 1.0 results in no microfacet refraction and\n\t\t\t\t// an IOR of 1.5 results in the default amount of microfacet refraction.\n\t\t\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t\t\t}"),r=new dC('vec3 getTransmissionSample( vec2 fragCoord, float roughness, float ior, vec2 transmissionSamplerSize, sampler2D transmissionSamplerMap, sampler2D transmissionDepthMap, vec2 unrefractedCoords, vec2 aspectRatio) {\n\t\t\t\t// Threejs exports do not pass a depth map to this shader, so we have to fallback to the "Threejs method of blurring" - see\n\t\t\t\t// also the code in convertTransmission.ts, which runs during export\n\t\t\t\t#ifdef IS_THREEJS_EXPORT\n\t\t\t\t\tfloat lod = log2(transmissionSamplerSize.x) * applyIorToRoughness(roughness / 5.0, ior);\n\t\t\t\t\treturn textureBicubic(transmissionSamplerMap, fragCoord.xy, lod).rgb;\n\t\t\t\t#else\n\t\t\t\t\tfloat framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\t\t\t\tfloat lod = applyIorToRoughness(roughness, ior);\n\t\t\t\t\treturn blur(transmissionSamplerMap, fragCoord, vec2(lod), min(framebufferLod / 5.5, 8.5), transmissionDepthMap, unrefractedCoords, aspectRatio);\n\t\t\t\t#endif\n\t\t\t}',[CT.textureBicubic,i,e]),n=new dC("vec3 getIBLVolumeRefraction( vec3 n, vec3 v, float roughness, vec3 position, mat4 modelMatrix, mat4 viewMatrix, mat4 projMatrix, float ior, float thickness, vec2 transmissionSamplerSize, sampler2D transmissionSamplerMap, sampler2D transmissionDepthMap, vec2 aspectRatio ) {\n\t\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\n\t\t\t\t// Project refracted vector on the framebuffer, while mapping to normalized device coordinates.\n\t\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\t\trefractionCoords += 1.0;\n\t\t\t\trefractionCoords /= 2.0;\n\n\t\t\t\tvec4 ndcPosUnrefracted = projMatrix * viewMatrix * vec4(position, 1.0 );\n\t\t\t\tvec2 unrefractedCoords = ndcPosUnrefracted.xy / ndcPosUnrefracted.w;\n\t\t\t\tunrefractedCoords += 1.0;\n\t\t\t\tunrefractedCoords /= 2.0;\n\n\t\t\t\t// Sample framebuffer to get pixel the refracted ray hits.\n\t\t\t\treturn getTransmissionSample( refractionCoords, roughness, ior, transmissionSamplerSize, transmissionSamplerMap, transmissionDepthMap, unrefractedCoords, aspectRatio );\n \t\t}",[r,t]);return{transmission:new dC("vec3 transmission(float thickness, float ior, float roughness, vec2 transmissionSamplerSize, sampler2D transmissionSamplerMap, sampler2D transmissionDepthMap, vec2 aspectRatio, vec3 normal, float mask, float alpha, out float calpha) {\n vec3 v = vec3(0.);\n if (isOrthographic) {\n v = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n } else {\n v = normalize(vWPosition - cameraPosition);\n }\n vec3 transmission = getIBLVolumeRefraction(vWNormal, -v, roughness, vWPosition, modelMatrix, viewMatrix, projectionMatrix, ior, thickness, transmissionSamplerSize, transmissionSamplerMap, transmissionDepthMap, aspectRatio );\n \n\t\t\t\tfloat lalpha = alpha * mask;\n\t\t\t\tcalpha = lalpha / clamp( lalpha + accumAlpha, 0.00001, 1.0 );\n\t\t\t\taccumAlpha += ( 1.0 - accumAlpha ) * alpha;\n\n\t\t\t\treturn transmission;\n }",[n])}}();var PT=(e=>(e.NOISE="noise",e.MAP="map",e))(PT||{}),IT=class extends rC{constructor(e,t,i,r,n,s,a,o,l,h,c){super("v3"),this.displacementTypeIndex=new WC(0),this.nodeType="VertexDisplacement",this.intensity=e,this.movementOrTexture=t,"map"===Object.values(PT)[this.displacementTypeIndex.value]&&(this.mat=new KC(this.movementOrTexture.value.matrix)),this.cropOrOffset=i,this.scale=h,this.noiseFunctionIndex=c,this.voronoiStyle=r,this.smoothness=n,this.seed=s,this.highCut=a,this.lowCut=o,this.quality=l}generate(e,t){if(e.isShader("vertex")){e.define("USE_LAYER_DISPLACE");let i,r=[];switch(r.push("displaced_position"),r.push("displaced_normal"),Object.values(PT)[this.displacementTypeIndex.value]){case"map":i=e.include(IT.Nodes.map),r.push(this.movementOrTexture.getTexture(e,"t")),r.push("uv"),r.push(this.cropOrOffset.build(e,"f")),this.mat&&r.push(this.mat.build(e,"mat3"));break;case"noise":{let t=Object.values(gT)[this.noiseFunctionIndex.value],n=new dC("vec3 orthogonal(vec3 v) {\n\t\t\t\t\t\t\treturn normalize(abs(v.x) > abs(v.z) ? vec3(-v.y, v.x, 0.0) : vec3(0.0, -v.z, v.y));\n\t\t\t\t\t\t}"),s=new dC(`vec3 distorted(vec3 p, vec3 n, float scale, float intensity, vec3 offset, float neighbour_offset, float movement, int voronoiStyle, float smoothness, float seed, float highCut, float lowCut, int quality) {\n\t\t\t\t\t\t\t${"voronoi"==t?`\n\t\t\t\t\tfloat v = ${t}((p + offset) * scale * 0.001 + neighbour_offset + (movement * 0.1), voronoiStyle, smoothness, seed, quality);\n\t\t\t\t\tv = remap(v, lowCut, highCut, 0.0, 1.0);\n\t\t\t\t\tv = smax(v, 0.0, smoothness * 0.25);\n\t\t\t\t\tv = smin(v, 1.0, smoothness * 0.25);\n\n\t\t\t\t\treturn p + n * v * intensity;\n\t\t\t\t\t`:`\n\t\t\t\t\treturn p + n * ${t}((p + offset) * scale * 0.001 + neighbour_offset + (movement * 0.1)) * intensity;\n\t\t\t\t\t`}\n\t\t\t\t\t\t}`,[vT.simplex,vT.simplexFractal,vT.simplexAshima,vT.fbm,vT.perlin,vT.voronoi]),a=new dC("vec3 vertexDisplacementNoise(vec3 position, vec3 normal, float scale, vec3 offset, float movement, int voronoiStyle, float smoothness, float seed, float highCut, float lowCut, int quality, float intensity, out vec3 displaced_normal) {\n\t\t\t\t\t\t\tvec3 displaced_position = distorted(position, normal, scale, intensity, offset, neighbor_offset, movement, voronoiStyle, smoothness, seed, highCut, lowCut, quality);\n\t\t\t\t\t\t\tvec3 tangent1 = orthogonal(normal);\n\t\t\t\t\t\t\tvec3 tangent2 = normalize(cross(normal, tangent1));\n\n // TODO(Max): The distance to the neighbors was originally scaled by 0.1.\n // This caused some small oval/circular visual artifacts in the lighting.\n // For now, simply using neighbors further away betters the problem,\n // but we should figure out the underlying cause when we have some time.\n // Maybe its related to how we calculate the tangent and bitangent?\n\t\t\t\t\t\t\tvec3 nearby1 = position + tangent1;\n\t\t\t\t\t\t\tvec3 nearby2 = position + tangent2;\n\t\t\t\t\t\t\tvec3 distorted1 = distorted(nearby1, normal, scale, intensity, offset, neighbor_offset, movement, voronoiStyle, smoothness, seed, highCut, lowCut, quality);\n\t\t\t\t\t\t\tvec3 distorted2 = distorted(nearby2, normal, scale, intensity, offset, neighbor_offset, movement, voronoiStyle, smoothness, seed, highCut, lowCut, quality);\n\t\t\t\t\t\t\tdisplaced_normal = normalize(cross(distorted1 - displaced_position, distorted2 - displaced_position));\n\t\t\t\t\t\t\treturn displaced_position;\n\t\t\t\t\t\t}",[s,n]);i=e.include(a),r.push(this.scale.build(e,"f")),r.push(this.cropOrOffset.build(e,"v3")),r.push(this.movementOrTexture.build(e,"f")),r.push(this.voronoiStyle.build(e,"i")),r.push(this.smoothness.build(e,"f")),r.push(this.seed.build(e,"f")),r.push(this.highCut.build(e,"f")),r.push(this.lowCut.build(e,"f")),r.push(this.quality.build(e,"i"));break}}return r.push(this.intensity.build(e,"f")),r.push("displaced_normal"),e.format(i+"("+r.join(",")+")",this.getType(e),t)}return console.warn("VertexDisplacementNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.getType(e),t)}},OT=IT;OT.Nodes=function(){let e=new dC("vec3 orthogonal(vec3 v) {\n\t\t\t\treturn normalize(abs(v.x) > abs(v.z) ? vec3(-v.y, v.x, 0.0) : vec3(0.0, -v.z, v.y));\n\t\t\t}"),t=new dC("float displacementMapTexture(sampler2D tex, float crop, vec2 uv, mat3 mat, vec2 offset) {\n\t\t\t\tvec2 uvs = (mat * vec3(uv * 2.0 - 1.0, 1.0) / 2.0 + 0.5).xy + offset;\n\t\t\t\tvec4 tmp = texture2D(tex, uvs);\n\t\t\t\tvec3 col = tmp.rgb;\n\t\t\t\tif (crop > 0.5) {\n\t\t\t\t\tif ( uvs.x < 0.0 || uvs.x > 1.0 || uvs.y < 0.0 || uvs.y > 1.0 ) {\n\t\t\t\t\t\treturn 0.0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn col.r;\n\t\t\t}");return{map:new dC("vec3 vertexDisplacementMap(vec3 position, vec3 normal, sampler2D tex, vec2 uv, float crop, mat3 mat, float intensity, out vec3 displaced_normal) {\n\t\t\t\tvec3 displaced_position = position + normal * displacementMapTexture(tex, crop, uv, mat, vec2(0.0)) * intensity;\n\t\t\t\tvec3 tangent1 = normalize(orthogonal(normal));\n\t\t\t\tvec3 tangent2 = normalize(cross(normal, tangent1));\n\t\t\t\tvec3 nearby1 = position + tangent1 * 0.1;\n\t\t\t\tvec3 nearby2 = position + tangent2 * 0.1;\n\t\t\t\tvec3 distorted1 = nearby1 + normal * displacementMapTexture(tex, crop, uv, mat, vec2(neighbor_offset)) * intensity;\n\t\t\t\tvec3 distorted2 = nearby2 + normal * displacementMapTexture(tex, crop, uv, mat, vec2(neighbor_offset)) * intensity;\n\t\t\t\tdisplaced_normal = normalize(cross(distorted1 - displaced_position, distorted2 - displaced_position));\n\t\t\t\treturn displaced_position;\n\t\t\t}",[e,t])}}();var RT={normalRenderTarget:new _C,normalRenderTargetDepth:new _C,transmissionRenderTarget:new _C,aspectRatio:new sC,transmissionSize:new sC(2048,2048),transmissionRenderTargetDepth:new _C,aoRenderTarget:new _C,aoEnabled:new qC,pixelRatioNode:new SC(1),resolution:new sC,penumbraSize:new YC(5,.5),frameIndex:new WC(0),transmissionLod:new WC(2)};for(let bV of Object.values(RT))bV.isRenderGlobal=!0;var LT,BT=class extends tC{constructor(){super("basic"),this.nodeType="Basic",this.color=new HC($x),this.shadingAlpha=new SC(1),this.shadingBlend=new WC(0),this.previousModelViewMatrix=new JC,this.previouseProjectionMatrix=new JC}get category(){return"phong"}generate(e){let t;if(e.isShader("vertex")){let i=this.position?this.position.analyzeAndFlow(e,"v3",{cache:"position"}):void 0;e.mergeUniform({frameIndex:RT.frameIndex}),e.mergeUniform({resolution:RT.resolution}),e.mergeUniform({previousModelViewMatrix:this.previousModelViewMatrix}),e.mergeUniform({previousProjectionMatrix:this.previouseProjectionMatrix}),e.mergeUniform(qn.merge([ds.fog])),e.addParsCode(["varying vec3 vViewPosition;","varying vec3 vWPosition;","#include ","#include "].join("\n"));let r=["#include ","\n\t\t\t\t#if !defined( USE_LAYER_DISPLACE )\n\t\t\t\t\t#include \n\t\t\t\t#endif\n\n\t\t\t\tvec3 displaced_position = position;\n\t\t\t\tvec3 displaced_normal = normal;\n\n\t\t\t\t#if defined( USE_LAYER_DISPLACE )\n\t\t\t\t\tvec3 transformed;\n\t\t\t\t\tvec3 transformedNormal;\n\t\t\t\t#endif\n\t\t\t\t","#include ","\n\t\t\t\t#if !defined( USE_LAYER_DISPLACE )\n\t\t\t\t\t#include \n\t\t\t\t#endif /* !USE_LAYER_DISPLACE */\n\t\t\t\t"];i&&r.push(i.code,i.result?"displaced_position = "+i.result+";":""),r.push("transformed = displaced_position;","transformedNormal = normalMatrix * displaced_normal;","#ifndef FLAT_SHADED","\tvNormal = transformedNormal;","#endif"),r.push("#include ","#include ","#include ","\tvViewPosition = - mvPosition.xyz;","#include "),r.push("vWPosition = ( modelMatrix * vec4( transformed, 1.0 ) ).xyz;"),t=r.join("\n")}else{void 0===this.color&&(this.color=new HC($x)),this.color.analyze(e,{slot:"color"}),this.alpha&&this.alpha.analyze(e),this.afterColor&&this.afterColor.analyze(e,{slot:"afterColor"});let i=this.color.flow(e,"c",{slot:"color"}),r=this.alpha?this.alpha.flow(e,"f"):void 0,n=this.alphaOverride?this.alphaOverride.flow(e,"f"):void 0,s=this.afterColor?this.afterColor.flow(e,"c",{slot:"afterColor"}):void 0;e.requires.transparent=void 0!==r,e.addParsCode(["varying vec3 vWPosition;","#include ","#include ","varying vec3 vViewPosition;","#include "].join("\n"));let a=["#include ",i.code];r&&a.push(r.code,"#ifdef ALPHATEST"," if ( "+r.result+" <= ALPHATEST ) discard;","#endif"),s?a.push(s.code,`vec3 outgoingLight = ${i.result};`,`vec3 finalColor = spe_blend(outgoingLight, ${s.result}, 1.0, SPE_BLENDING_NORMAL);`):a.push(`vec3 finalColor = ${i.result};`);let o="1.0";this.mask&&(this.mask.analyze(e),o=`luminance(${this.mask.flow(e,"v3").result})`),r?a.push(`gl_FragColor = vec4( finalColor, accumAlpha * ${r.result} * ${o} );`):a.push("gl_FragColor = vec4("+i.result+", 1.0 );"),n&&a.push(`gl_FragColor.a *= ${n.result};`),a.push("#include ","#include "),t=a.join("\n")}return t}},zT=class extends tC{constructor(){super("lambert"),this.nodeType="Lambert",this.color=new HC($x),this.emissive=new HC(0),this.emissiveIntensity=new SC(1),this.previousModelViewMatrix=new JC,this.previouseProjectionMatrix=new JC,this.shadingAlpha=new SC(1),this.shadingBlend=new WC(0),this.occlusion=new qC(!0)}get category(){return"lambert"}build(e){let t;if(e.define("LAMBERT"),e.requires.lights=!0,e.extensions.derivatives=!0,e.isShader("vertex")){let i=this.position?this.position.analyzeAndFlow(e,"v3",{cache:"position"}):void 0;e.mergeUniform({frameIndex:RT.frameIndex}),e.mergeUniform({resolution:RT.resolution}),e.mergeUniform({previousModelViewMatrix:this.previousModelViewMatrix}),e.mergeUniform({previousProjectionMatrix:this.previouseProjectionMatrix}),e.mergeUniform(qn.merge([ds.fog,ds.lights])),e.addParsCode(["varying vec3 vViewPosition;","varying vec3 vWPosition;","varying vec3 vLightFront;","varying vec3 vIndirectFront;","#ifndef DOUBLE_SIDED"," #define DOUBLE_SIDED","#endif","#ifdef DOUBLE_SIDED","\tvarying vec3 vLightBack;","\tvarying vec3 vIndirectBack;","#endif","#include ","#include ","#include ","#include ","#include ","#include ","#include "].join("\n"));let r=["#include ","\n\t\t\t\t#ifndef USE_LAYER_DISPLACE\n\t\t\t\t\t#include \n\t\t\t\t#endif\n\n\t\t\t\tvec3 displaced_position = position;\n\t\t\t\tvec3 displaced_normal = normal;\n\n\t\t\t\t#ifdef USE_LAYER_DISPLACE\n\t\t\t\t\tvec3 transformed;\n\t\t\t\t\tvec3 transformedNormal;\n\t\t\t\t#endif\n\t\t\t\t","#include ","\n\t\t\t\t#ifndef USE_LAYER_DISPLACE\n\t\t\t\t\t#include \n\t\t\t\t#endif\n\t\t\t\t"];i&&r.push(i.code,i.result?"displaced_position = "+i.result+";":""),r.push("transformed = displaced_position;","transformedNormal = normalMatrix * displaced_normal;","#ifndef FLAT_SHADED"," vNormal = transformedNormal;","#endif"),r.push("\t#include ","\t#include ","\tvViewPosition = - mvPosition.xyz;","\t#include ","\n\t\t\t\t\tvec3 diffuse = vec3( 1.0 );\n\t\t\t\t\tGeometricContext geometry;\n\t\t\t\t\tgeometry.position = mvPosition.xyz;\n\t\t\t\t\tgeometry.normal = normalize( transformedNormal );\n\t\t\t\t\tgeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );\n\t\t\t\t"),r.push("\n\t\t\t\t\tGeometricContext backGeometry;\n\t\t\t\t\tbackGeometry.position = geometry.position;\n\t\t\t\t\tbackGeometry.normal = -geometry.normal;\n\t\t\t\t\tbackGeometry.viewDir = geometry.viewDir;\n\t\t\t\t\tvLightFront = vec3( 0.0 );\n\t\t\t\t\tvIndirectFront = vec3( 0.0 );\n\t\t\t\t\t#ifdef DOUBLE_SIDED\n\t\t\t\t\t\tvLightBack = vec3( 0.0 );\n\t\t\t\t\t\tvIndirectBack = vec3( 0.0 );\n\t\t\t\t\t#endif\n\t\t\t\t\tIncidentLight directLight;\n\t\t\t\t\tfloat dotNL;\n\t\t\t\t\tvec3 directLightColor_Diffuse;\n\t\t\t\t\tvIndirectFront += getAmbientLightIrradiance( ambientLightColor );\n\t\t\t\t\tvIndirectFront += getLightProbeIrradiance( lightProbe, geometry.normal );\n\t\t\t\t\t#ifdef DOUBLE_SIDED\n\t\t\t\t\t\tvIndirectBack += getAmbientLightIrradiance( ambientLightColor );\n\t\t\t\t\t\tvIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry.normal );\n\t\t\t\t\t#endif\n\t\t\t\t\t#if NUM_POINT_LIGHTS > 0\n\t\t\t\t\t\t#pragma unroll_loop_start\n\t\t\t\t\t\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\t\t\t\t\t\tgetPointLightInfo( pointLights[ i ], geometry, directLight );\n\t\t\t\t\t\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\t\t\t\t\t\tdirectLightColor_Diffuse = directLight.color;\n\t\t\t\t\t\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t\t\t\t\t\t#ifdef DOUBLE_SIDED\n\t\t\t\t\t\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t\t\t\t\t\t#endif\n\t\t\t\t\t\t}\n\t\t\t\t\t\t#pragma unroll_loop_end\n\t\t\t\t\t#endif\n\t\t\t\t\t#if NUM_SPOT_LIGHTS > 0\n\t\t\t\t\t\t#pragma unroll_loop_start\n\t\t\t\t\t\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\t\t\t\t\t\tgetSpotLightInfo( spotLights[ i ], geometry, directLight );\n\t\t\t\t\t\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\t\t\t\t\t\tdirectLightColor_Diffuse = directLight.color;\n\t\t\t\t\t\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t\t\t\t\t\t#ifdef DOUBLE_SIDED\n\t\t\t\t\t\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t\t\t\t\t\t#endif\n\t\t\t\t\t\t}\n\t\t\t\t\t\t#pragma unroll_loop_end\n\t\t\t\t\t#endif\n\t\t\t\t\t#if NUM_DIR_LIGHTS > 0\n\t\t\t\t\t\t#pragma unroll_loop_start\n\t\t\t\t\t\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\t\t\t\t\t\tgetDirectionalLightInfo( directionalLights[ i ], geometry, directLight );\n\t\t\t\t\t\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\t\t\t\t\t\tdirectLightColor_Diffuse = directLight.color;\n\t\t\t\t\t\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t\t\t\t\t\t#ifdef DOUBLE_SIDED\n\t\t\t\t\t\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t\t\t\t\t\t#endif\n\t\t\t\t\t\t}\n\t\t\t\t\t\t#pragma unroll_loop_end\n\t\t\t\t\t#endif\n\t\t\t\t\t#if NUM_HEMI_LIGHTS > 0\n\t\t\t\t\t\t#pragma unroll_loop_start\n\t\t\t\t\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\t\t\t\t\tvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\n\t\t\t\t\t\t\t#ifdef DOUBLE_SIDED\n\t\t\t\t\t\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry.normal );\n\t\t\t\t\t\t\t#endif\n\t\t\t\t\t\t}\n\t\t\t\t\t\t#pragma unroll_loop_end\n\t\t\t\t\t#endif\n\t\t\t\t","\t#include ","\t#include "),r.push("vWPosition = ( modelMatrix * vec4( transformed, 1.0 ) ).xyz;"),t=r.join("\n")}else{e.mergeUniform({penumbraSize:RT.penumbraSize}),e.mergeUniform({frameIndex:RT.frameIndex}),e.mergeUniform({aoMap:RT.aoRenderTarget}),e.mergeUniform({aoEnabled:RT.aoEnabled}),void 0===this.color&&(this.color=new HC($x)),this.color.analyze(e,{slot:"color"}),this.shadingAlpha.analyze(e),this.shadingBlend.analyze(e),this.afterColor&&this.afterColor.analyze(e,{slot:"afterColor"}),this.alpha&&this.alpha.analyze(e);let i=this.color.flow(e,"c",{slot:"color"}),r=this.emissive.flow(e,"c",{slot:"emissive"}),n=this.emissiveIntensity.flow(e,"f",{slot:"emissive"}),s=this.occlusion.flow(e,"b",{slot:"occlusion"}),a=this.shadingAlpha.flow(e,"f"),o=this.shadingBlend.flow(e,"i"),l=this.afterColor?this.afterColor.flow(e,"c",{slot:"afterColor"}):void 0,h=this.alpha?this.alpha.flow(e,"f"):void 0,c=this.alphaOverride?this.alphaOverride.flow(e,"f"):void 0;e.requires.transparent=void 0!==h,e.addParsCode(["uniform float penumbraSize[5];","uniform sampler2D aoMap;","uniform bool aoEnabled;","varying vec3 vViewPosition;","varying vec3 vWPosition;","varying vec3 vLightFront;","varying vec3 vIndirectFront;","#ifndef DOUBLE_SIDED"," #define DOUBLE_SIDED","#endif","#include ","#ifdef DOUBLE_SIDED","\tvarying vec3 vLightBack;","\tvarying vec3 vIndirectBack;","#endif","#include ","#include ","#include ","#include ","#include ","#include ","#include "].join("\n"));let d=["#include ","\n\t\t\t\t// NOTE: gl_FrontFacing alternative using face normal estimation.\n\t\t\t\tvec3 viewdx = dFdx(vViewPosition);\n\t\t\t\tvec3 viewdy = dFdy(vViewPosition);\n\t\t\t\tvec3 faceNormal = normalize(cross(viewdx, viewdy));\n\t\t\t\tbool isFrontFacing = (dot(normal, faceNormal) >= 0.0);\n\t\t\t\t","#include "];d.push(i.code,"vec3 diffuseColor = "+i.result+";","ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );"),h&&d.push(h.code,"#ifdef ALPHATEST","if ( "+h.result+" <= ALPHATEST ) discard;","#endif"),d.push("#ifdef DOUBLE_SIDED","\treflectedLight.indirectDiffuse += ( isFrontFacing ) ? vIndirectFront : vIndirectBack;","#else","\treflectedLight.indirectDiffuse += vIndirectFront;","#endif","#include ","reflectedLight.indirectDiffuse *= BRDF_Lambert( diffuseColor.rgb );","#ifdef DOUBLE_SIDED","\treflectedLight.directDiffuse = ( isFrontFacing ) ? vLightFront : vLightBack;","#else","\treflectedLight.directDiffuse = vLightFront;","#endif","reflectedLight.directDiffuse *= BRDF_Lambert( diffuseColor.rgb ) * getShadowMask();"),r&&d.push(r.code,"reflectedLight.directDiffuse += "+r.result+" * "+n.result+";"),d.push("vec3 ao = aoEnabled && "+s.result+" ? tex2D(aoMap, gl_FragCoord.xy / resolution).rgb : vec3(1.0);","vec3 outgoingLight = (reflectedLight.directDiffuse + reflectedLight.indirectDiffuse) ;");let u="1.0";this.mask&&(this.mask.analyze(e),u=`luminance(${this.mask.flow(e,"v3").result})`),d.push(`\n\t\t\t\tif (outgoingLight != diffuseColor) {\n\t\t\t\t\tfloat lightAccu = clamp( length( reflectedLight.directSpecular + reflectedLight.indirectSpecular ), 0.0, 1.0 );\n\t\t\t\t\taccumAlpha += ( 1.0 - accumAlpha ) * ${a.result} * ${u} * lightAccu;\n\t\t\t\t\toutgoingLight = spe_blend( diffuseColor, outgoingLight, ${a.result} * ${u}, ${o.result} );\n\n\t\t\t\t\toutgoingLight *= ao;\n\t\t\t\t}\n\t\t\t\t`),l&&d.push(l.code,`outgoingLight = spe_blend(outgoingLight, ${l.result}, 1.0, SPE_BLENDING_NORMAL);`),h?d.push(`gl_FragColor = vec4( outgoingLight, accumAlpha * ${h.result} );`):d.push("gl_FragColor = vec4( outgoingLight, 1.0 );"),c&&d.push(`gl_FragColor.a *= ${c.result};`),d.push("#include ","#include ","#include "),t=d.join("\n")}return t}},kT={dHdxy:new dC("vec2 dHdxy(sampler2D bumpMap, vec2 bumpMapUv, float bumpScale) {\n\n // Gradient of UVs w.r.t. X coordinate (in screen-space)\n vec2 dSTdx = dFdx(bumpMapUv);\n\n // Gradient of UVs w.r.t. Y coordinate (in screen-space)\n vec2 dSTdy = dFdy(bumpMapUv);\n \n // Forward differencing\n float Hll = bumpScale * luminance(texture(bumpMap, bumpMapUv).rgb);\n float dBx = bumpScale * luminance(texture(bumpMap, bumpMapUv + dSTdx).rgb) - Hll;\n float dBy = bumpScale * luminance(texture(bumpMap, bumpMapUv + dSTdy).rgb) - Hll;\n \n return vec2( dBx, dBy );\n }"),perturbNormalArb:new dC("vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n vec3 vSigmaX = dFdx( surf_pos.xyz );\n vec3 vSigmaY = dFdy( surf_pos.xyz );\n vec3 vN = surf_norm; // normalized\n \n vN = normalize(vN);\n\n vec3 R1 = cross( vSigmaY, vN );\n vec3 R2 = cross( vN, vSigmaX );\n\n R1 = normalize(R1);\n R2 = normalize(R2);\n \n float fDet = dot( vSigmaX, R1 ) * faceDirection;\n \n vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n return normalize( abs( fDet ) * vN - vGrad );\n }")},NT=class extends tC{constructor(){super("phong"),this.nodeType="Phong",this.color=new HC($x),this.specular=new HC(1118481),this.shininess=new SC(30),this.previousModelViewMatrix=new JC,this.previouseProjectionMatrix=new JC,this.shadingAlpha=new SC(1),this.shadingBlend=new WC(0),this.occlusion=new qC(!0)}get category(){return"phong"}build(e){let t;if(e.define("PHONG"),e.requires.lights=!0,e.extensions.derivatives=!0,e.isShader("vertex")){let i=this.position?this.position.analyzeAndFlow(e,"v3",{cache:"position"}):void 0;e.mergeUniform({frameIndex:RT.frameIndex}),e.mergeUniform({resolution:RT.resolution}),e.mergeUniform({previousModelViewMatrix:this.previousModelViewMatrix}),e.mergeUniform({previousProjectionMatrix:this.previouseProjectionMatrix}),e.mergeUniform(qn.merge([ds.fog,ds.lights])),e.addParsCode(["varying vec3 vViewPosition;","varying vec3 vWPosition;","#include ","#include ","#include ","#include ","#include "].join("\n"));let r=["#include ","\n\t\t\t\t#include \n\t\t\t\t#include \n\t\t\t\t#ifndef USE_LAYER_DISPLACE\n\t\t\t\t\t#include \n\t\t\t\t#endif\n\n\n\t\t\t\tvec3 displaced_position = position;\n\t\t\t\tvec3 displaced_normal = objectNormal;\n\n\t\t\t\t#ifdef USE_LAYER_DISPLACE\n\t\t\t\t\tvec3 transformed;\n\t\t\t\t\tvec3 transformedNormal;\n\t\t\t\t#endif\n\t\t\t\t","#include ","\n\t\t\t\t#ifndef USE_LAYER_DISPLACE\n\t\t\t\t\t#include \n\t\t\t\t#endif\n\t\t\t\t"];i&&r.push(i.code,i.result?"displaced_position = "+i.result+";":""),r.push("transformed = displaced_position;","#include ","transformedNormal = normalMatrix * displaced_normal;","#ifndef FLAT_SHADED"," vNormal = transformedNormal;","#endif"),r.push("\t#include ","\t#include ","\tvViewPosition = - mvPosition.xyz;","\t#include ","\t#include ","\t#include "),r.push("vWPosition = ( modelMatrix * vec4( transformed, 1.0 ) ).xyz;"),t=r.join("\n")}else{e.mergeUniform({penumbraSize:RT.penumbraSize}),e.mergeUniform({frameIndex:RT.frameIndex}),e.mergeUniform({aoMap:RT.aoRenderTarget}),e.mergeUniform({aoEnabled:RT.aoEnabled}),void 0===this.color&&(this.color=new HC($x)),this.color.analyze(e,{slot:"color"}),this.specular.analyze(e),this.shininess.analyze(e);let i=this.occlusion.flow(e,"b",{slot:"occlusion"});this.shadingAlpha.analyze(e),this.shadingBlend.analyze(e),this.afterColor&&this.afterColor.analyze(e,{slot:"afterColor"}),this.alpha&&this.alpha.analyze(e);let r=this.color.flow(e,"c",{slot:"color"}),n=this.specular.flow(e,"c"),s=this.shininess.flow(e,"f"),a=this.shadingAlpha.flow(e,"f"),o=this.shadingBlend.flow(e,"i"),l=this.afterColor?this.afterColor.flow(e,"c",{slot:"afterColor"}):void 0,h=this.alpha?this.alpha.flow(e,"f"):void 0,c=this.alphaOverride?this.alphaOverride.flow(e,"f"):void 0;e.requires.transparent=void 0!==h,e.addParsCode(["varying vec3 vWPosition;","uniform vec3 emissive;","uniform float penumbraSize[5];","uniform sampler2D aoMap;","uniform bool aoEnabled;","#include ","#include ","#include ","#include ","#include ","#include ","#include "].join("\n"));let d=["#include ","\n\t\t\t\t// NOTE: gl_FrontFacing alternative using face normal estimation.\n\t\t\t\tvec3 viewdx = dFdx(vViewPosition);\n\t\t\t\tvec3 viewdy = dFdy(vViewPosition);\n\t\t\t\tvec3 faceNormal = normalize(cross(viewdx,viewdy));\n\t\t\t\tif (dot(normal, faceNormal) < 0.0) {\n\t\t\t\t\tnormal *= -1.0;\n\t\t\t\t}\n\t\t\t\t","\tBlinnPhongMaterial material;"];if(this.bumpMap){e.include(kT.dHdxy),e.include(kT.perturbNormalArb);let t=this.bumpMap.texture.flow(e,"t"),i=this.bumpMap.flow(e,"v3"),r=this.bumpMapIntensity?this.bumpMapIntensity.flow(e,"f").result:"1.0",n="";n=4===this.bumpMap.projection.value?`\n\t\t\t\t\tvec3 bumpNormal = vec3(0.0);\n\t\t\t\t\t{\n\t\t\t\t\t\tvec2 uv0 = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_writeUvs0;\n\t\t\t\t\t\tvec2 uv1 = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_writeUvs1;\n\t\t\t\t\t\tvec2 uv2 = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_writeUvs2;\n\t\t\t\t\t\tvec3 weights = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_triplanarWeights;\n\n\t\t\t\t\t\tvec2 grad0 = dHdxy(${t.result}, uv0, ${r});\n\t\t\t\t\t\tvec3 n0 = perturbNormalArb(-vViewPosition, normal, grad0, faceDirection);\n\n\t\t\t\t\t\tvec2 grad1 = dHdxy(${t.result}, uv1, ${r});\n\t\t\t\t\t\tvec3 n1 = perturbNormalArb(-vViewPosition, normal, grad1, faceDirection);\n\n\t\t\t\t\t\tvec2 grad2 = dHdxy(${t.result}, uv2, ${r});\n\t\t\t\t\t\tvec3 n2 = perturbNormalArb(-vViewPosition, normal, grad2, faceDirection);\n\t\t\t\t\t\t\n\t\t\t\t\t\tbumpNormal = n0 * weights.z + n1 * weights.x + n2 * weights.y;\n\t\t\t\t\t\tbumpNormal = normalize(bumpNormal);\n\t\t\t\t\t}\n\n\t\t\t\t\tnormal = bumpNormal;\n\t\t\t\t\t`:`\n\t\t\t\t\tvec2 bumpMapCachedUv = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_writeUvs;\n\t\t\t\t\tvec2 grad = dHdxy(${t.result}, bumpMapCachedUv, ${r});\n\t\t\t\t\tnormal = perturbNormalArb( - vViewPosition, normal, grad, faceDirection );\n\t\t\t\t\t`,d.push(`// Call the Texture Layer's function once here so that it writes out its procedural UV coordinates\n\t\t\t\t\t${i.result};\n\t\t\t\t\t${n}\n\t\t\t\t\t`)}d.push(r.code,"\tvec3 diffuseColor = "+r.result+";","\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );","\tvec3 totalEmissiveRadiance = emissive;",n.code,"\tvec3 specular = "+n.result+";",s.code,"\tfloat shininess = max( 0.0001, "+s.result+" );","\tfloat specularStrength = 1.0;"),h&&d.push(h.code,"#ifdef ALPHATEST","if ( "+h.result+" <= ALPHATEST ) discard;","#endif"),d.push("material.diffuseColor = diffuseColor;"),d.push("material.specularColor = specular;","material.specularShininess = shininess;","material.specularStrength = specularStrength;","#include ","#include "),d.push("vec3 ao = aoEnabled && "+i.result+" ? tex2D(aoMap, gl_FragCoord.xy / resolution).rgb : vec3(1.0);","vec3 outgoingLight = ((reflectedLight.directDiffuse + reflectedLight.indirectDiffuse)) + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;");let u="1.0";this.mask&&(this.mask.analyze(e),u=`luminance(${this.mask.flow(e,"v3").result})`),d.push(`\n\t\t\t\tif (outgoingLight != diffuseColor) {\n\t\t\t\t\tfloat lightAccu = clamp( length( reflectedLight.directSpecular + reflectedLight.indirectSpecular ), 0.0, 1.0 );\n\t\t\t\t\taccumAlpha += ( 1.0 - accumAlpha ) * ${a.result} * ${u} * lightAccu;\n\t\t\t\t\toutgoingLight = spe_blend( diffuseColor, outgoingLight, ${a.result} * ${u}, ${o.result} );\n\t\t\t\t\t\n\t\t\t\t\toutgoingLight *= ao;\n\t\t\t\t}\n\t\t\t\t`),l&&d.push(l.code,`outgoingLight = spe_blend(outgoingLight, ${l.result}, 1.0, SPE_BLENDING_NORMAL);`),h?d.push(`gl_FragColor = vec4( outgoingLight, accumAlpha * ${h.result});`):d.push("gl_FragColor = vec4( outgoingLight, 1.0 );"),c&&d.push(`gl_FragColor.a *= ${c.result};`),d.push("#include ","#include ","#include "),t=d.join("\n")}return t}},FT=class extends tC{constructor(){super("standard"),this.nodeType="Standard",this.color=new HC($x),this.roughness=new SC(.3),this.metalness=new SC(0),this.reflectivity=new SC(.5),this.previousModelViewMatrix=new JC,this.previouseProjectionMatrix=new JC,this.shadingAlpha=new SC(1),this.shadingBlend=new WC(0),this.occlusion=new qC(!0)}get category(){return"physical"}build(e){let t;if(e.define("STANDARD"),e.requires.lights=!0,e.extensions.derivatives=!0,e.extensions.shaderTextureLOD=!0,e.isShader("vertex")){let i=this.position?this.position.analyzeAndFlow(e,"v3",{cache:"position"}):void 0;e.mergeUniform({frameIndex:RT.frameIndex}),e.mergeUniform({resolution:RT.resolution}),e.mergeUniform({previousModelViewMatrix:this.previousModelViewMatrix}),e.mergeUniform({previousProjectionMatrix:this.previouseProjectionMatrix}),e.mergeUniform(qn.merge([ds.fog,ds.lights])),ds.LTC_1&&(e.uniforms.ltc_1={value:void 0},e.uniforms.ltc_2={value:void 0}),e.addParsCode(["varying vec3 vViewPosition;","varying vec3 vWPosition;","#include ","#include ","#include ","#include "].join("\n"));let r=["#include ","\n\t\t\t\t#if !defined( USE_LAYER_DISPLACE )\n\t\t\t\t\t#include \n\t\t\t\t#endif\n\n\t\t\t\tvec3 displaced_position = position;\n\t\t\t\tvec3 displaced_normal = normal;\n\n\t\t\t\t#if defined( USE_LAYER_DISPLACE )\n\t\t\t\t\tvec3 transformed;\n\t\t\t\t\tvec3 transformedNormal;\n\t\t\t\t#endif\n\t\t\t\t","#include ","\n\t\t\t\t#if !defined( USE_LAYER_DISPLACE )\n\t\t\t\t\t#include \n\t\t\t\t#endif /* !USE_LAYER_DISPLACE */\n\t\t\t\t"];i&&r.push(i.code,i.result?"displaced_position = "+i.result+";":""),r.push("transformed = displaced_position;","transformedNormal = normalMatrix * displaced_normal;","#ifndef FLAT_SHADED"," vNormal = transformedNormal;","#endif"),r.push("#include ","#include ","#include ","\tvViewPosition = - mvPosition.xyz;","#include ","#include "),r.push("vWPosition = ( modelMatrix * vec4( transformed, 1.0 ) ).xyz;"),t=r.join("\n")}else{e.mergeUniform({penumbraSize:RT.penumbraSize}),e.mergeUniform({frameIndex:RT.frameIndex}),e.mergeUniform({aoMap:RT.aoRenderTarget}),e.mergeUniform({aoEnabled:RT.aoEnabled});let i={gamma:!0};void 0===this.color&&(this.color=new HC($x)),this.color.analyze(e,{slot:"color",context:i}),this.roughness.analyze(e),this.metalness.analyze(e);let r=this.occlusion.flow(e,"b",{slot:"occlusion"});this.shadingAlpha.analyze(e),this.shadingBlend.analyze(e),this.afterColor&&this.afterColor.analyze(e,{slot:"afterColor"}),this.alpha&&this.alpha.analyze(e),this.reflectivity&&this.reflectivity.analyze(e);let n=this.color.flow(e,"c",{slot:"color",context:i}),s=this.roughness.flow(e,"f"),a=this.metalness.flow(e,"f"),o=this.shadingAlpha.flow(e,"f"),l=this.shadingBlend.flow(e,"i"),h=this.afterColor?this.afterColor.flow(e,"c",{slot:"afterColor"}):void 0,c=this.alpha?this.alpha.flow(e,"f"):void 0,d=this.alphaOverride?this.alphaOverride.flow(e,"f"):void 0,u=this.reflectivity?this.reflectivity.flow(e,"f"):void 0;e.requires.transparent=void 0!==c,e.addParsCode(["varying vec3 vViewPosition;","varying vec3 vWPosition;","uniform float penumbraSize[5];","uniform sampler2D aoMap;","uniform bool aoEnabled;","#include ","#include ","#include ","#include ","#include ","#include ","#include "].join("\n"));let p=["#include ","\t#include ","\n\t\t\t\t// NOTE: gl_FrontFacing alternative using face normal estimation.\n\t\t\t\tvec3 viewdx = dFdx(vViewPosition);\n\t\t\t\tvec3 viewdy = dFdy(vViewPosition);\n\t\t\t\tvec3 faceNormal = normalize(cross(viewdx,viewdy));\n\t\t\t\tif (dot(normal, faceNormal) < 0.0) {\n\t\t\t\t\tnormal *= -1.0;\n\t\t\t\t}\n\t\t\t\t","\tPhysicalMaterial material;","\tmaterial.diffuseColor = vec3( 1.0 );"];if(this.bumpMap){e.include(kT.dHdxy),e.include(kT.perturbNormalArb);let t=this.bumpMap.texture.flow(e,"t"),i=this.bumpMap.flow(e,"v3"),r=this.bumpMapIntensity?this.bumpMapIntensity.flow(e,"f").result:"1.0",n="";n=4===this.bumpMap.projection.value?`\n\t\t\t\t\tvec3 bumpNormal = vec3(0.0);\n\t\t\t\t\t{\n\t\t\t\t\t\tvec2 uv0 = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_writeUvs0;\n\t\t\t\t\t\tvec2 uv1 = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_writeUvs1;\n\t\t\t\t\t\tvec2 uv2 = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_writeUvs2;\n\t\t\t\t\t\tvec3 weights = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_triplanarWeights;\n\n\t\t\t\t\t\tvec2 grad0 = dHdxy(${t.result}, uv0, ${r});\n\t\t\t\t\t\tvec3 n0 = perturbNormalArb(-vViewPosition, normal, grad0, faceDirection);\n\n\t\t\t\t\t\tvec2 grad1 = dHdxy(${t.result}, uv1, ${r});\n\t\t\t\t\t\tvec3 n1 = perturbNormalArb(-vViewPosition, normal, grad1, faceDirection);\n\n\t\t\t\t\t\tvec2 grad2 = dHdxy(${t.result}, uv2, ${r});\n\t\t\t\t\t\tvec3 n2 = perturbNormalArb(-vViewPosition, normal, grad2, faceDirection);\n\t\t\t\t\t\t\n\t\t\t\t\t\tbumpNormal = n0 * weights.z + n1 * weights.x + n2 * weights.y;\n\t\t\t\t\t\tbumpNormal = normalize(bumpNormal);\n\t\t\t\t\t}\n\n\t\t\t\t\tnormal = bumpNormal;\n\t\t\t\t\t`:`\n\t\t\t\t\tvec2 bumpMapCachedUv = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_writeUvs;\n\t\t\t\t\tvec2 grad = dHdxy(${t.result}, bumpMapCachedUv, ${r});\n\t\t\t\t\tnormal = perturbNormalArb( - vViewPosition, normal, grad, faceDirection );\n\t\t\t\t\t`,p.push(`// Call the Texture Layer's function once here so that it writes out its procedural UV coordinates\n\t\t\t\t\t${i.result};\n\t\t\t\t\t${n}\n\t\t\t\t\t`)}if(p.push(n.code,"\tvec3 diffuseColor = "+n.result+";","\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );",a.code,"\tfloat metalnessFactor = "+a.result+";"),this.roughnessMap){let t=this.roughnessMap.texture.flow(e,"t"),i=this.roughnessMap.flow(e,"v3"),r="";r=4===this.roughnessMap.projection.value?`\n\t\t\t\t\tfloat roughnessChange = 1.0;\n\t\t\t\t\t{\n\t\t\t\t\t\tvec2 uv0 = g${this.roughnessMap.uuid.toString().replace(/-/g,"")}_writeUvs0;\n\t\t\t\t\t\tvec2 uv1 = g${this.roughnessMap.uuid.toString().replace(/-/g,"")}_writeUvs1;\n\t\t\t\t\t\tvec2 uv2 = g${this.roughnessMap.uuid.toString().replace(/-/g,"")}_writeUvs2;\n\t\t\t\t\t\tvec3 weights = g${this.roughnessMap.uuid.toString().replace(/-/g,"")}_triplanarWeights;\n\n\t\t\t\t\t\tfloat r0 = luminance(texture(${t.result}, uv0).rgb) * roughnessScale;\n\t\t\t\t\t\tfloat r1 = luminance(texture(${t.result}, uv1).rgb) * roughnessScale;\n\t\t\t\t\t\tfloat r2 = luminance(texture(${t.result}, uv2).rgb) * roughnessScale;\n\n\t\t\t\t\t\troughnessChange = (r0 * weights.z + r1 * weights.x + r2 * weights.y);\n\t\t\t\t\t}\n\t\t\t\t\tfloat roughnessFactor = roughnessChange * ${s.result};\n\t\t\t\t\t`:`\n\t\t\t\t\tvec2 roughnessMapCachedUv = g${this.roughnessMap.uuid.toString().replace(/-/g,"")}_writeUvs;\n\n\t\t\t\t\tvec4 vals = texture(${t.result}, roughnessMapCachedUv);\n\t\t\t\t\tfloat roughnessFactor = luminance(vals.rgb) * ${s.result};\n\t\t\t\t\t`,p.push(`// Call the Texture Layer's function once here so that it writes out its procedural UV coordinates\n\t\t\t\t\t${i.result};\n\n\t\t\t\t\tconst float roughnessScale = 1.0;\n\n\t\t\t\t\t${r}\n\t\t\t\t`)}else p.push(s.code,"\tfloat roughnessFactor = "+s.result+";");c&&p.push(c.code,"#ifdef ALPHATEST","\tif ( "+c.result+" <= ALPHATEST ) discard;","#endif"),p.push("vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );","float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );"),p.push("material.diffuseColor = diffuseColor * ( 1.0 - metalnessFactor );","material.roughness = max( roughnessFactor, 0.0525 );","material.roughness += geometryRoughness;","material.roughness = min( material.roughness, 1.0 );","material.roughness = clamp( roughnessFactor, 0.04, 1.0 );"),u?p.push(u.code,"material.specularColor = mix( vec3( 0.16 * pow2( "+u.result+" ) ), diffuseColor, metalnessFactor );"):p.push("material.specularColor = mix( vec3( 0.04 ), diffuseColor, metalnessFactor );"),p.push("#include "),p.push("#include "),p.push("vec3 ao = aoEnabled && "+r.result+" ? tex2D(aoMap, gl_FragCoord.xy / resolution).rgb : vec3(1.0);","vec3 outgoingLight = ((reflectedLight.directDiffuse + reflectedLight.indirectDiffuse)) + reflectedLight.directSpecular + reflectedLight.indirectSpecular;");let f="1.0";this.mask&&(this.mask.analyze(e),f=`luminance(${this.mask.flow(e,"v3").result})`),p.push(`\n\t\t\t\tif (outgoingLight != diffuseColor) {\n\t\t\t\t\tfloat lightAccu = clamp( length( reflectedLight.directSpecular + reflectedLight.indirectSpecular ), 0.0, 1.0 );\n\t\t\t\t\taccumAlpha += ( 1.0 - accumAlpha ) * ${o.result} * ${f} * lightAccu;\n\t\t\t\t\toutgoingLight = spe_blend( diffuseColor, outgoingLight, ${o.result} * ${f}, ${l.result} );\n\t\t\t\t\t\n\t\t\t\t\toutgoingLight *= ao;\n\t\t\t\t}\n\t\t\t\t`),h&&p.push(h.code,`outgoingLight = spe_blend(outgoingLight, ${h.result}, 1.0, SPE_BLENDING_NORMAL);`),c?p.push(`gl_FragColor = vec4( outgoingLight, accumAlpha * ${c.result} );`):p.push("gl_FragColor = vec4( outgoingLight, 1.0 );"),d&&p.push(`gl_FragColor.a *= ${d.result};`),p.push("#include ","#include ","#include "),t=p.join("\n")}return t}},UT=class extends tC{constructor(){super("toon"),this.nodeType="Toon",this.color=new HC($x),this.specular=new HC(1118481),this.shininess=new SC(30),this.previousModelViewMatrix=new JC,this.previouseProjectionMatrix=new JC,this.shadingAlpha=new SC(1),this.shadingBlend=new WC(0)}get category(){return"toon"}build(e){let t;if(e.define("TOON"),e.requires.lights=!0,e.extensions.derivatives=!0,e.isShader("vertex")){let i=this.position?this.position.analyzeAndFlow(e,"v3",{cache:"position"}):void 0;e.mergeUniform({frameIndex:RT.frameIndex}),e.mergeUniform({resolution:RT.resolution}),e.mergeUniform({previousModelViewMatrix:this.previousModelViewMatrix}),e.mergeUniform({previousProjectionMatrix:this.previouseProjectionMatrix}),e.mergeUniform(qn.merge([ds.fog,ds.lights])),e.addParsCode(["varying vec3 vViewPosition;","varying vec3 vWPosition;","#include ","#include ","#include ","#include "].join("\n"));let r=["#include ","\n\t\t\t\t#ifndef USE_LAYER_DISPLACE\n\t\t\t\t\t#include \n\t\t\t\t#endif\n\n\t\t\t\tvec3 displaced_position = position;\n\t\t\t\tvec3 displaced_normal = normal;\n\n\t\t\t\t#ifdef USE_LAYER_DISPLACE\n\t\t\t\t\tvec3 transformed;\n\t\t\t\t\tvec3 transformedNormal;\n\t\t\t\t#endif\n\t\t\t\t","#include ","\n\t\t\t\t#ifndef USE_LAYER_DISPLACE\n\t\t\t\t\t#include \n\t\t\t\t#endif\n\t\t\t\t"];i&&r.push(i.code,i.result?"displaced_position = "+i.result+";":""),r.push("transformed = displaced_position;","transformedNormal = normalMatrix * displaced_normal;","#ifndef FLAT_SHADED"," vNormal = transformedNormal;","#endif"),r.push("\t#include ","\t#include ","\t#include ","\tvViewPosition = - mvPosition.xyz;","\t#include ","\t#include ","\t#include "),r.push("vWPosition = ( modelMatrix * vec4( transformed, 1.0 ) ).xyz;"),t=r.join("\n")}else{e.mergeUniform({penumbraSize:RT.penumbraSize}),e.mergeUniform({frameIndex:RT.frameIndex}),e.mergeUniform({aoMap:RT.aoRenderTarget}),e.mergeUniform({aoEnabled:RT.aoEnabled}),void 0===this.color&&(this.color=new HC($x)),this.color.analyze(e,{slot:"color"}),this.specular.analyze(e),this.shininess.analyze(e),this.shadingAlpha.analyze(e),this.shadingBlend.analyze(e),this.afterColor&&this.afterColor.analyze(e,{slot:"afterColor"}),this.alpha&&this.alpha.analyze(e);let i=this.color.flow(e,"c",{slot:"color"}),r=this.specular.flow(e,"c"),n=this.shininess.flow(e,"f"),s=this.shadingAlpha.flow(e,"f"),a=this.shadingBlend.flow(e,"i"),o=this.afterColor?this.afterColor.flow(e,"c",{slot:"afterColor"}):void 0,l=this.alpha?this.alpha.flow(e,"f"):void 0,h=this.alphaOverride?this.alphaOverride.flow(e,"f"):void 0;e.requires.transparent=void 0!==l,e.addParsCode(["uniform float penumbraSize[5];","uniform sampler2D aoMap;","uniform bool aoEnabled;","varying vec3 vWPosition;","#include ","#include ","#include ","#include ","#include ","#include ","\n\t\t\t\t\tvarying vec3 vViewPosition;\n\t\t\t\t\tstruct ToonMaterial {\n\t\t\t\t\t\tvec3\tdiffuseColor;\n\t\t\t\t\t\tvec3\tspecularColor;\n\t\t\t\t\t\tfloat\tspecularShininess;\n\t\t\t\t\t\tfloat\tspecularStrength;\n\t\t\t\t\t};\n\t\t\t\t\tvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\t\t\t\t\t\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t\t\t\n\t\t\t\t\t\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\t\t\t\t\t\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength;\n\t\t\t\t\t}\n\t\t\t\t\tvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\t\t\t\t\t\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\t\t\t\t\t}\n\t\t\t\t\t#define RE_Direct\t\t\t\tRE_Direct_Toon\n\t\t\t\t\t#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon\n\t\t\t\t\t#define Material_LightProbeLOD( material )\t(0)\n\t\t\t\t\t","#include ","#include ","#include "].join("\n"));let c=["#include ","\n\t\t\t\t// NOTE: gl_FrontFacing alternative using face normal estimation.\n\t\t\t\tvec3 viewdx = dFdx(vViewPosition);\n\t\t\t\tvec3 viewdy = dFdy(vViewPosition);\n\t\t\t\tvec3 faceNormal = normalize(cross(viewdx,viewdy));\n\t\t\t\tif (dot(normal, faceNormal) < 0.0) {\n\t\t\t\t\tnormal *= -1.0;\n\t\t\t\t}\n\t\t\t\t","\tToonMaterial material;"];if(this.bumpMap){e.include(kT.dHdxy),e.include(kT.perturbNormalArb);let t=this.bumpMap.texture.flow(e,"t"),i=this.bumpMap.flow(e,"v3"),r=this.bumpMapIntensity?this.bumpMapIntensity.flow(e,"f").result:"1.0",n="";n=4===this.bumpMap.projection.value?`\n\t\t\t\t\tvec3 bumpNormal = vec3(0.0);\n\t\t\t\t\t{\n\t\t\t\t\t\tvec2 uv0 = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_writeUvs0;\n\t\t\t\t\t\tvec2 uv1 = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_writeUvs1;\n\t\t\t\t\t\tvec2 uv2 = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_writeUvs2;\n\t\t\t\t\t\tvec3 weights = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_triplanarWeights;\n\n\t\t\t\t\t\tvec2 grad0 = dHdxy(${t.result}, uv0, ${r});\n\t\t\t\t\t\tvec3 n0 = perturbNormalArb(-vViewPosition, normal, grad0, faceDirection);\n\n\t\t\t\t\t\tvec2 grad1 = dHdxy(${t.result}, uv1, ${r});\n\t\t\t\t\t\tvec3 n1 = perturbNormalArb(-vViewPosition, normal, grad1, faceDirection);\n\n\t\t\t\t\t\tvec2 grad2 = dHdxy(${t.result}, uv2, ${r});\n\t\t\t\t\t\tvec3 n2 = perturbNormalArb(-vViewPosition, normal, grad2, faceDirection);\n\t\t\t\t\t\t\n\t\t\t\t\t\tbumpNormal = n0 * weights.z + n1 * weights.x + n2 * weights.y;\n\t\t\t\t\t\tbumpNormal = normalize(bumpNormal);\n\t\t\t\t\t}\n\n\t\t\t\t\tnormal = bumpNormal;\n\t\t\t\t\t`:`\n\t\t\t\t\tvec2 bumpMapCachedUv = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_writeUvs;\n\t\t\t\t\tvec2 grad = dHdxy(${t.result}, bumpMapCachedUv, ${r});\n\t\t\t\t\tnormal = perturbNormalArb( - vViewPosition, normal, grad, faceDirection );\n\t\t\t\t\t`,c.push(`// Call the Texture Layer's function once here so that it writes out its procedural UV coordinates\n\t\t\t\t\t${i.result};\n\t\t\t\t\t${n}\n\t\t\t\t\t`)}c.push(i.code,"\tvec3 diffuseColor = "+i.result+";","\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );",r.code,"\tvec3 specular = "+r.result+";",n.code,"\tfloat shininess = max( 0.0001, "+n.result+" );","\tfloat specularStrength = 1.0;"),l&&c.push(l.code,"#ifdef ALPHATEST","if ( "+l.result+" <= ALPHATEST ) discard;","#endif"),c.push("material.diffuseColor = diffuseColor;"),c.push("material.specularColor = specular;","material.specularShininess = shininess;","material.specularStrength = specularStrength;","#include ","#include "),c.push("vec3 ao = aoEnabled ? tex2D(aoMap, gl_FragCoord.xy / resolution).rgb : vec3(1.0);","vec3 outgoingLight = ((reflectedLight.directDiffuse + reflectedLight.indirectDiffuse) * ao) + reflectedLight.directSpecular;");let d="1.0";this.mask&&(this.mask.analyze(e),d=`luminance(${this.mask.flow(e,"v3").result})`),c.push(`\n\t\t\t\tif (outgoingLight != diffuseColor) {\n\t\t\t\t\tfloat lightAccu = clamp( length( reflectedLight.directSpecular + reflectedLight.indirectSpecular ), 0.0, 1.0 );\n\t\t\t\t\taccumAlpha += ( 1.0 - accumAlpha ) * ${s.result} * ${d} * lightAccu;\n\t\t\t\t\toutgoingLight = spe_blend( diffuseColor, outgoingLight, ${s.result} * ${d}, ${a.result} );\n\t\t\t\t}\n\t\t\t\t`),o&&c.push(o.code,`outgoingLight = spe_blend(outgoingLight, ${o.result}, 1.0, SPE_BLENDING_NORMAL);`),l?c.push(`gl_FragColor = vec4( outgoingLight, accumAlpha * ${l.result} );`):c.push("gl_FragColor = vec4( outgoingLight, 1.0 );"),h&&c.push(`gl_FragColor.a *= ${h.result};`),c.push("#include ","#include ","#include "),t=c.join("\n")}return t}},VT=class{constructor(e=1e4){this.timeout=e,this.cache=new Map,this.head={data:null,time:0,src:null,next:null,prev:null},this.tail={data:null,time:1/0,src:null,next:null,prev:null},this.hasClean=!1,this.head.next=this.tail,this.tail.prev=this.head}log(...e){}remove(e){let t=this.cache.get(e);t&&(this.dispose(e,t.data),this.cache.delete(e),t.prev.next=t.next,t.next.prev=t.prev)}scheduleCleanup(){this.hasClean||(this.log("scheduled cleanup"),this.hasClean=!0,setTimeout((()=>{this.hasClean=!1,this.log("cleaning");let e=Date.now(),t=this.head.next;for(;t.time"u")return;this.disposeTextures(),this.loaded=!1;let t=()=>{this.loaded=!0;let e=[1e3,1001,1002];for(let t of e){let e=this[t];e&&(e.image=this.img,e.needsUpdate=!0)}this.shared.requestRender()};if(this.isVideo){if(this.img=document.createElement("video"),this.img.preload="auto",this.img.playsInline=!0,this.img.currentTime=.01,"string"!=typeof e){var i=new FileReader;let t;i.readAsDataURL(new Blob([e],{type:"video/mp4"})),await new Promise((e=>{i.onloadend=i=>{t=i.target?.result,e(null)}})),this.img.src=t}else this.img.src=e;this.img.onloadeddata=()=>{t()}}else this.img=new Image,this.img.src=function(e){return"string"==typeof e?e:(LT||(LT=new jT),LT.load(e))}(e),this.img.onload=t}getTexture(e){let t=this[e];if(t)return t;{let t;return t=this.isVideo?new cl(this.img,void 0,e,e):new Hi(this.img,void 0,e,e),this.loaded&&(t.needsUpdate=!0),this[e]=t,t}}disposeTextures(){this[1e3]?.dispose(),this[1e3]=void 0,this[1001]?.dispose(),this[1001]=void 0,this[1002]?.dispose(),this[1002]=void 0}dispose(){super.dispose(),this.disposeTextures()}},qT=class extends WT{};function YT(e,t){var i=function(e){if(!QT[e]){var t=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:"America/New_York",year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date("2014-06-25T04:00:00.123Z")),i="06/25/2014, 00:00:00"===t||"\u200e06\u200e/\u200e25\u200e/\u200e2014\u200e \u200e00\u200e:\u200e00\u200e:\u200e00"===t;QT[e]=i?new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:e,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:e,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})}return QT[e]}(t);return i.formatToParts?function(e,t){try{for(var i=e.formatToParts(t),r=[],n=0;n=0&&(r[s]=parseInt(i[n].value,10))}return r}catch(Ox){if(Ox instanceof RangeError)return[NaN];throw Ox}}(i,e):function(e,t){var i=e.format(t).replace(/\u200E/g,""),r=/(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(i);return[r[3],r[1],r[2],r[4],r[5],r[6]]}(i,e)}var XT={year:0,month:1,day:2,hour:3,minute:4,second:5};var QT={};function ZT(e,t,i,r,n,s,a){var o=new Date(0);return o.setUTCFullYear(e,t,i),o.setUTCHours(r,n,s,a),o}var KT=36e5,JT=6e4,$T={timezone:/([Z+-].*)$/,timezoneZ:/^(Z)$/,timezoneHH:/^([+-]\d{2})$/,timezoneHHMM:/^([+-]\d{2}):?(\d{2})$/};function eD(e,t,i){var r,n,s;if(!e||(r=$T.timezoneZ.exec(e)))return 0;if(r=$T.timezoneHH.exec(e))return iD(s=parseInt(r[1],10))?-s*KT:NaN;if(r=$T.timezoneHHMM.exec(e)){s=parseInt(r[1],10);var a=parseInt(r[2],10);return iD(s,a)?(n=Math.abs(s)*KT+a*JT,s>0?-n:n):NaN}if(function(e){if(rD[e])return!0;try{return new Intl.DateTimeFormat(void 0,{timeZone:e}),rD[e]=!0,!0}catch{return!1}}(e)){t=new Date(t||Date.now());var o=i?t:function(e){return ZT(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}(t),l=tD(o,e),h=i?l:function(e,t,i){var r=e.getTime(),n=r-t,s=tD(new Date(n),i);if(t===s)return t;n-=s-t;var a=tD(new Date(n),i);return s===a?s:Math.max(s,a)}(t,l,e);return-h}return NaN}function tD(e,t){var i=YT(e,t),r=ZT(i[0],i[1]-1,i[2],i[3]%24,i[4],i[5],0).getTime(),n=e.getTime(),s=n%1e3;return r-(n-=s>=0?s:1e3+s)}function iD(e,t){return-23<=e&&e<=23&&(null==t||0<=t&&t<=59)}var rD={};var nD=d(v(),1),sD=d(y(),1),aD=36e5,oD=6e4,lD=2,hD={dateTimePattern:/^([0-9W+-]+)(T| )(.*)/,datePattern:/^([0-9W+-]+)(.*)/,plainTime:/:/,YY:/^(\d{2})$/,YYY:[/^([+-]\d{2})$/,/^([+-]\d{3})$/,/^([+-]\d{4})$/],YYYY:/^(\d{4})/,YYYYY:[/^([+-]\d{4})/,/^([+-]\d{5})/,/^([+-]\d{6})/],MM:/^-(\d{2})$/,DDD:/^-?(\d{3})$/,MMDD:/^-?(\d{2})-?(\d{2})$/,Www:/^-?W(\d{2})$/,WwwD:/^-?W(\d{2})-?(\d{1})$/,HH:/^(\d{2}([.,]\d*)?)$/,HHMM:/^(\d{2}):?(\d{2}([.,]\d*)?)$/,HHMMSS:/^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/,timeZone:/(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/};function cD(e,t){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");if(null===e)return new Date(NaN);var i=t||{},r=null==i.additionalDigits?lD:(0,nD.default)(i.additionalDigits);if(2!==r&&1!==r&&0!==r)throw new RangeError("additionalDigits must be 0, 1 or 2");if(e instanceof Date||"object"==typeof e&&"[object Date]"===Object.prototype.toString.call(e))return new Date(e.getTime());if("number"==typeof e||"[object Number]"===Object.prototype.toString.call(e))return new Date(e);if("string"!=typeof e&&"[object String]"!==Object.prototype.toString.call(e))return new Date(NaN);var n=function(e){var t,i={},r=hD.dateTimePattern.exec(e);if(r?(i.date=r[1],t=r[3]):(r=hD.datePattern.exec(e),r?(i.date=r[1],t=r[2]):(i.date=null,t=e)),t){var n=hD.timeZone.exec(t);n?(i.time=t.replace(n[1],""),i.timeZone=n[1].trim()):i.time=t}return i}(e),s=function(e,t){var i,r=hD.YYY[t],n=hD.YYYYY[t];if(i=hD.YYYY.exec(e)||n.exec(e),i){var s=i[1];return{year:parseInt(s,10),restDateString:e.slice(s.length)}}if(i=hD.YY.exec(e)||r.exec(e),i){var a=i[1];return{year:100*parseInt(a,10),restDateString:e.slice(a.length)}}return{year:null}}(n.date,r),a=s.year,o=function(e,t){if(null===t)return null;var i,r,n,s;if(0===e.length)return r=new Date(0),r.setUTCFullYear(t),r;if(i=hD.MM.exec(e),i)return r=new Date(0),n=parseInt(i[1],10)-1,mD(t,n)?(r.setUTCFullYear(t,n),r):new Date(NaN);if(i=hD.DDD.exec(e),i){r=new Date(0);var a=parseInt(i[1],10);return function(e,t){if(t<1)return!1;var i=fD(e);return!(i&&t>366||!i&&t>365)}(t,a)?(r.setUTCFullYear(t,0,a),r):new Date(NaN)}if(i=hD.MMDD.exec(e),i){r=new Date(0),n=parseInt(i[1],10)-1;var o=parseInt(i[2],10);return mD(t,n,o)?(r.setUTCFullYear(t,n,o),r):new Date(NaN)}if(i=hD.Www.exec(e),i)return s=parseInt(i[1],10)-1,gD(t,s)?dD(t,s):new Date(NaN);if(i=hD.WwwD.exec(e),i){s=parseInt(i[1],10)-1;var l=parseInt(i[2],10)-1;return gD(t,s,l)?dD(t,s,l):new Date(NaN)}return null}(s.restDateString,a);if(isNaN(o))return new Date(NaN);if(o){var l,h=o.getTime(),c=0;if(n.time&&(c=function(e){var t,i,r;if(t=hD.HH.exec(e),t)return i=parseFloat(t[1].replace(",",".")),vD(i)?i%24*aD:NaN;if(t=hD.HHMM.exec(e),t)return i=parseInt(t[1],10),r=parseFloat(t[2].replace(",",".")),vD(i,r)?i%24*aD+r*oD:NaN;if(t=hD.HHMMSS.exec(e),t){i=parseInt(t[1],10),r=parseInt(t[2],10);var n=parseFloat(t[3].replace(",","."));return vD(i,r,n)?i%24*aD+r*oD+1e3*n:NaN}return null}(n.time),isNaN(c)))return new Date(NaN);if(n.timeZone||i.timeZone){if(l=eD(n.timeZone||i.timeZone,new Date(h+c)),isNaN(l))return new Date(NaN)}else l=(0,sD.default)(new Date(h+c)),l=(0,sD.default)(new Date(h+c+l));return new Date(h+c+l)}return new Date(NaN)}function dD(e,t,i){t=t||0,i=i||0;var r=new Date(0);r.setUTCFullYear(e,0,4);var n=7*t+i+1-(r.getUTCDay()||7);return r.setUTCDate(r.getUTCDate()+n),r}var uD=[31,28,31,30,31,30,31,31,30,31,30,31],pD=[31,29,31,30,31,30,31,31,30,31,30,31];function fD(e){return e%400==0||e%4==0&&e%100!=0}function mD(e,t,i){if(t<0||t>11)return!1;if(null!=i){if(i<1)return!1;var r=fD(e);if(r&&i>pD[t]||!r&&i>uD[t])return!1}return!0}function gD(e,t,i){return!(t<0||t>52||null!=i&&(i<0||i>6))}function vD(e,t,i){return!(null!=e&&(e<0||e>=25)||null!=t&&(t<0||t>=60)||null!=i&&(i<0||i>=60))}function yD(e,t){return t.color(e)}function xD(e=new Date,t){let i=t.format,r=e.getSeconds(),n=e;t&&null!==t.timeZone&&(n=function(e,t,i){var r=cD(e,i),n=eD(t,r,!0),s=new Date(r.getTime()-n),a=new Date(0);return a.setFullYear(s.getUTCFullYear(),s.getUTCMonth(),s.getUTCDate()),a.setHours(s.getUTCHours(),s.getUTCMinutes(),s.getUTCSeconds(),s.getUTCMilliseconds()),a}(new Date,t.timeZone));let s,a=n.getHours(),o=n.getMinutes();"12ampm"===t.format12h24h&&(s=a>=12?"PM":"AM");let l,h,c=a;switch("24"!==t.format12h24h&&(c=a%12,0===c&&(c=12)),i){case"HH:mm:ss":l=[c,o,r];break;case"HH:mm":l=[c,o];break;case"HH":l=[c],s=void 0;break;case"mm":l=[o],s=void 0;break;case"ss":l=[r],s=void 0;break;case"year":h=n.getFullYear();break;case"month":h=n.getMonth()+1;break;case"dayOfYear":h=Math.floor((n.getTime()-new Date(n.getFullYear(),0,0).getTime())/864e5);break;case"dayOfMonth":h=n.getDate();break;case"secondOfDay":h=60*a*60+60*o+r;break;default:console.error("Unknown time format",i),h=0}return void 0!==l?{textValue:l,suffix:s}:h}function bD(e,t){switch(e.type){case"fresnel":return function(e,t){let{bias:i,scale:r,intensity:n,factor:s,color:a}=e;return{..._D(e,t),color:yD(a,t),bias:i,scale:r,intensity:n,factor:s}}(e,t);case"gradient":return function(e,t){let{gradientType:i,smooth:r,colors:n,steps:s,angle:a,offset:o,morph:l}=e;return{..._D(e,t),gradientType:i,smooth:r,colors:n.map((e=>new Wi(e[0],e[1],e[2],e[3]))),num:n.length,steps:s,offset:new wi(...o),morph:new wi(...l),angle:a}}(e,t);case"depth":return function(e,t){let{gradientType:i,near:r,far:n,isVector:s,isWorldSpace:a,origin:o,direction:l,colors:h,steps:c,smooth:d}=e;return{..._D(e,t),gradientType:i,near:r,far:n,isVector:s,isWorldSpace:a,origin:new Zi(...o),direction:l?new Zi(...l):new Zi(1,0,0),colors:h.map((e=>void 0!==e?new Wi(e[0],e[1],e[2],e[3]):new Wi(0,0,0,0))),steps:c.slice(0,h.length),smooth:d}}(e,t);case"normal":return function(e,t){let{cnormal:i}=e;return{..._D(e,t),cnormal:new Zi(i[0],i[1],i[2])}}(e,t);case"noise":return function(e,t){return{..._D(e,t),scale:e.scale,move:e.move,fA:new wi(...e.fA),fB:new wi(...e.fB),size:new Zi(...e.size),distortion:new wi(...e.distortion),colorA:yD(e.colorA,t),colorB:yD(e.colorB,t),colorC:yD(e.colorC,t),colorD:yD(e.colorD,t),noiseType:e.noiseType,voronoiStyle:e.voronoiStyle,highCut:e.highCut,lowCut:e.lowCut,smoothness:e.smoothness,seed:e.seed,quality:e.quality}}(e,t);case"rainbow":return function(e,t){return{..._D(e,t),filmThickness:e.filmThickness,movement:e.movement,wavelengths:new Zi(...e.wavelengths),noiseStrength:e.noiseStrength,noiseScale:e.noiseScale,offset:new Zi(...e.offset)}}(e,t);case"toon":return function(e,t){return{..._D(e,t),positioning:e.positioning,colors:e.colors.map((e=>new Wi(e[0],e[1],e[2],e[3]))),num:e.colors.length,steps:e.steps,source:new Zi(...e.source),isWorldSpace:e.isWorldSpace,noiseStrength:e.noiseStrength,noiseScale:e.noiseScale,shadowColor:yD(e.shadowColor,t),offset:new Zi(...e.offset)}}(e,t);case"outline":return function(e,t){return{..._D(e,t),outlineColor:yD(e.outlineColor,t),contourColor:yD(e.contourColor,t),outlineWidth:e.outlineWidth,contourWidth:e.contourWidth,outlineThreshold:e.outlineThreshold,contourThreshold:e.contourThreshold,outlineSmoothing:e.outlineSmoothing,contourFrequency:e.contourFrequency,contourDirection:new Zi(...e.contourDirection),positionalLines:e.positionalLines,compensation:e.compensation}}(e,t);case"transmission":return function(e,t){return{..._D(e,t),thickness:e.thickness,ior:e.ior,roughness:e.roughness}}(e,t);case"color":return function(e,t){return{..._D(e,t),color:yD(e.color,t)}}(e,t);case"pattern":return function(e,t){return{..._D(e,t),style:e.style,projection:e.projection,axis:e.axis,blending:e.blending,offset:new wi(...e.offset),colorA:yD(e.colorA,t),colorB:yD(e.colorB,t),frequency:new wi(...e.frequency),size:e.size,variation:e.variation,smoothness:e.smoothness,zigzag:e.zigzag,rotation:e.rotation,vertical:new wi(...e.vertical),horizontal:new wi(...e.horizontal),sides:e.sides}}(e,t)}}function wD(e){return{type:e.type}}function _D(e,t){let{alpha:i,mode:r,isMask:n}=e,s="string"==typeof i?(Number(t.getVariable(i))??100)/100:i;return{...wD(e),alpha:s,mode:r,isMask:n}}var SD=class extends oC{},AD={noise:["noiseType"],texture:["projection","axis","side"],video:["projection","axis","side"],displace:["noiseType"],light:["roughnessMap","bumpMap"],depth:["smooth","isWorldSpace","gradientType","isVector"],pattern:["style","projection","axis"]},MD={depth:["colors"]};function ED(e,t,i){if("isMask"===t)return!0;let r=AD[e.type],n=MD[e.type];if(void 0!==n){let r=e.color;if(n.includes(t)){let e=r[t]?.value?.length;if(void 0!==e&&e!==i.length)return!0}}return void 0!==r&&r.includes(t)}function CD(e,t,i){let r=i.uniforms[`f${i.id}_texture`];if(!r)return!1;let n=e;if("image"in n){let e=n.image,i=t.image(e),s=r;s.image instanceof qT||s.image.deref(),s.image=i}if("video"in n){let e=n.video,i=t.video(e),s=r;s.image instanceof qT||s.image.deref(),s.image=i}if("wrapping"in n){r.wrap=n.wrapping}if("repeat"in n||"offset"in n){let e="mat",t=i.uniforms[`f${i.id}_${e}`];"repeat"in n&&(t.repeat=n.repeat),"offset"in n&&(t.offset=n.offset),t.updateMatrix()}return!1}var TD=(e,t,i)=>Math.max(0,Math.min(1,Number(t.getVariable("number"==typeof e?100*e:e,i)??100)/100))??1,DD=class{constructor(e,t,i,r,n){this.id=e,this.uuid=t,this.data=i,this.uniforms={};for(let s in r)this.uniforms[`f${this.id}_${s}`]=r[s];for(let s in i)LD(s,this,i,n)}get type(){return this.data.type}static create(e,t,i,r){if("light"===i.type)return OD.createLigherLayer(e,t,i,r);if("texture"===i.type||"video"===i.type){let n="texture"===i.type?r.image(i.texture.image):r.video(i.texture.video),s=new ZC(n,i.texture.wrapping),a=new QC(n),o=new eT(i.texture.repeat,i.texture.offset),l=new SC(i.crop?1:0),h=new WC(i.projection??0),c=new WC(["x","y","z"].indexOf(i.axis)??0),d=new WC(i.side??0),u=new sC(i.size?new wi(i.size[0],i.size[1]):new wi(100,100)),p=new SC(i.blending??0),f=new SC(TD(i.alpha,r)),m=new WC(i.mode??0),g=new qC(i.isMask??!1),v=new lT(s,a,l,h,c,d,u,p,o,f,m,g),y=new wC(v.calpha,"f");return new PD(e,t,i,{texture:s,textureSize:a,crop:l,projection:h,axis:c,side:d,size:u,blending:p,mat:o,alpha:f,mode:m,isMask:g},v,m,y,g,r)}if("matcap"===i.type){let n=r.image(i.texture.image),s=new ZC(n,i.texture.wrapping),a=new SC(TD(i.alpha,r)),o=new WC(i.mode??0),l=new qC(i.isMask??!1),h=new mT(s,a,o,l),c=new wC(h.calpha,"f");return new PD(e,t,i,{texture:s,alpha:a,mode:o,isMask:l},h,o,c,l,r)}if("displace"===i.type){if("noise"===i.displacementType){let n=new aC(new Zi(...i.offset)),s=new SC(i.scale??10),a=new SC(i.intensity??8),o=new SC(i.movement??1),l=new WC(i.noiseType??0),h=new WC(i.voronoiStyle??0),c=new SC(i.smoothness??.5),d=new SC(i.seed??0),u=new SC(i.highCut??1),p=new SC(i.lowCut??0),f=new WC(i.quality??1),m=new OT(a,o,n,h,c,d,u,p,f,s,l);return new ID(e,t,i,{offset:n,scale:s,intensity:a,movement:o,noiseType:l,voronoiStyle:h,smoothness:c,seed:d,highCut:u,lowCut:p,quality:f},m,r)}throw new Error}return function(e,t,i,r){let n=bD(i,r);return function(e,t,i,r,n){switch(e.type){case"color":{let s=new HC(r.color??$x),a=RD(r),o=new nT(s,a.alpha),l=new wC(o.calpha,"f");return new PD(t,i,e,{color:s,...a},o,a.mode,l,a.isMask,n)}case"fresnel":{let s=new HC(r.color??16777215),a=new SC(r.bias??.1),o=new SC(r.scale??1),l=new SC(r.intensity??2),h=new SC(r.factor??1),c=RD(r),d=new dT(s,a,o,l,h,c.alpha,c.mode,c.isMask),u=new wC(d.calpha,"f");return new PD(t,i,e,{color:s,bias:a,scale:o,intensity:l,factor:h,...c},d,c.mode,u,c.isMask,n)}case"rainbow":{let s=new SC(r.filmThickness??30),a=new SC(r.movement??0),o=new aC(r.wavelengths??new Zi(0,0,0)),l=new SC(r.noiseStrength??0),h=new SC(r.noiseScale??1),c=new aC(r.offset??new Zi(0,0,0)),d=RD(r),u=new AT(s,a,o,l,h,c,d.alpha,d.isMask),p=new wC(u.calpha,"f");return new PD(t,i,e,{filmThickness:s,movement:a,wavelengths:o,noiseStrength:l,noiseScale:h,offset:c,...d},u,d.mode,p,d.isMask,n)}case"transmission":{let s=new SC(r.thickness??10),a=new SC(r.ior??1.5),o=new SC(r.roughness??.5),l=RT.transmissionSize,h=RT.transmissionRenderTarget,c=RT.transmissionRenderTargetDepth,d=window.innerWidth,u=window.innerHeight,p=d>=u?new sC(u/d,1):new sC(1,d/u),f=RD(r),m=new DT(s,a,o,l,h,c,p,f.alpha),g=new wC(m.calpha,"f");return new PD(t,i,e,{thickness:s,ior:a,roughness:o,aspectRatio:p,...f},m,f.mode,g,f.isMask,n)}case"toon":{let s,a,o=new WC(r.positioning??0);r.colors?s=new tT(r.colors.length,r.colors):(s=new tT(10,new Wi(0,0,0,1)),s.value[1]=new Wi(1,1,1,1)),r.steps?a=new YC(r.steps.length,r.steps):(a=new YC(10,1),a.value[0]=0);let l=new aC(r.source??new Zi(0,0,0)),h=new qC(r.isWorldSpace??!0),c=new SC(r.noiseStrength??0),d=new SC(r.noiseScale??1),u=new lC(r.shadowColor),p=new aC(r.offset??new Zi(0,0,0)),f=RD(r),m=new ET(o,s,a,l,h,c,d,u,p,f.alpha),g=new wC(m.calpha,"f");return new PD(t,i,e,{positioning:o,colors:s,steps:a,source:l,isWorldSpace:h,noiseStrength:c,noiseScale:d,shadowColor:u,offset:p,...f},m,f.mode,g,f.isMask,n)}case"outline":{let s=new HC(r.outlineColor??16777215),a=new HC(r.contourColor??16777215),o=new SC(r.outlineWidth??.1),l=new SC(r.contourWidth??.1),h=new SC(r.outlineThreshold??.1),c=new SC(r.contourThreshold??.1),d=new SC(r.outlineSmoothing??.1),u=new SC(r.contourFrequency??.1),p=new aC(r.contourDirection??new Zi(0,1,0)),f=new qC(r.positionalLines??!1),m=new qC(r.compensation??!0),g=RT.normalRenderTarget,v=RT.normalRenderTargetDepth,y=RT.pixelRatioNode,x=RT.resolution,b=RD(r),w=new bT(s,a,o,l,h,c,d,u,p,f,m,x,g,v,y,b.alpha),_=new wC(w.calpha,"f");return new PD(t,i,e,{outlineColor:s,contourColor:a,outlineWidth:o,contourWidth:l,outlineThreshold:h,contourThreshold:c,outlineSmoothing:d,contourFrequency:u,contourDirection:p,positionalLines:f,compensation:m,...b},w,b.mode,_,b.isMask,n)}case"depth":{let s,a,o=new WC(r.gradientType??0),l=new qC(r.smooth??!1),h=new SC(r.near??50),c=new SC(r.far??200),d=new SC(r.isVector??1),u=new SC(r.isWorldSpace??0),p=new aC(r.origin??new Zi),f=new aC(r.direction??new Zi);r.colors?s=new tT(r.colors.length,r.colors):(s=new tT(2,new Wi(0,0,0,1)),s.value[1]=new Wi(1,1,1,1)),r.steps?a=new YC(r.steps.length,r.steps):(a=new YC(2,1),a.value[0]=0);let m=RD(r),g=new cT(o,l,h,c,d,u,p,f,s,a,m.alpha,m.isMask),v=new wC(g.calpha,"f");return new PD(t,i,e,{gradientType:o,smooth:l,near:h,far:c,isVector:d,isWorldSpace:u,origin:p,direction:f,colors:s,steps:a,...m},g,m.mode,v,m.isMask,n)}case"noise":{let s=new SC(r.scale??1),a=new aC(r.size??new Zi(100,100,100)),o=new SC(r.move??1),l=new sC(r.fA??new wi(1.7,9.2)),h=new sC(r.fB??new wi(8.3,2.8)),c=new sC(r.distortion??new wi(1,1)),d=new lC(r.colorA),u=new lC(r.colorB),p=new lC(r.colorC),f=new lC(r.colorD),m=new WC(r.noiseType??0),g=new WC(r.voronoiStyle??0),v=new SC(r.highCut??1),y=new SC(r.lowCut??0),x=new SC(r.smoothness??.5),b=new SC(r.seed??.5),w=new WC(r.quality??1),_=RD(r),S=new yT(s,a,o,l,h,c,d,u,p,f,_.alpha,m,_.isMask,g,v,y,x,b,w),A=new wC(S.calpha,"f");return new PD(t,i,e,{scale:s,size:a,move:o,fA:l,fB:h,distortion:c,colorA:d,colorB:u,colorC:p,colorD:f,noiseType:m,..._,voronoiStyle:g,highCut:v,lowCut:y,smoothness:x,seed:b,quality:w},S,_.mode,A,_.isMask,n)}case"normal":{let s=new aC(r.cnormal??new Zi(1,1,1)),a=RD(r),o=new aT(s,a.alpha),l=new wC(o.calpha,"f");return new PD(t,i,e,{cnormal:s,...a},o,a.mode,l,a.isMask,n)}case"gradient":{let s,a,o=new WC(r.gradientType??0),l=new qC(r.smooth??!1);r.colors?s=new tT(r.colors.length,r.colors):(s=new tT(10,new Wi(0,0,0,1)),s.value[1]=new Wi(1,1,1,1)),r.steps?a=new YC(r.steps.length,r.steps):(a=new YC(10,1),a.value[0]=0);let h=new sC(r.offset??new wi(0,0)),c=new sC(r.morph??new wi(0,0)),d=new SC(r.angle??0),u=RD(r),p=new pT(o,l,s,a,h,c,d,u.alpha,u.isMask),f=new wC(p.calpha,"f");return new PD(t,i,e,{gradientType:o,smooth:l,colors:s,steps:a,offset:h,morph:c,angle:d,...u},p,u.mode,f,u.isMask,n)}case"pattern":{let s=new WC(r.style??0),a=new WC(r.projection??0),o=new WC(["x","y","z"].indexOf(r.axis)??0),l=new SC(r.blending??0),h=new sC(r.offset??new wi(0,0)),c=new lC(r.colorA),d=new lC(r.colorB),u=new sC(r.frequency??new wi(10,10)),p=new SC(r.size??.5),f=new SC(r.variation??0),m=new SC(r.smoothness??.5),g=new SC(r.zigzag??0),v=new SC(r.rotation??0),y=new sC(r.vertical??new wi(0,1)),x=new sC(r.horizontal??new wi(0,1)),b=new WC(r.sides??6),w=RD(r),_=new _T(s,a,o,l,h,c,d,u,p,f,m,g,v,y,x,b,w.alpha,w.isMask),S=new wC(_.calpha,"f");return new PD(t,i,e,{style:s,projection:a,axis:o,blending:l,offset:h,colorA:c,colorB:d,frequency:u,size:p,variation:f,smoothness:m,zigzag:g,rotation:v,vertical:y,horizontal:x,sides:b,...w},_,w.mode,S,w.isMask,n)}default:{let s=new HC(1,0,0,1),a=RD(r),o=new nT(s,a.alpha),l=new wC(o.calpha,"f");return new PD(t,i,e,{color:s,...a},o,a.mode,l,a.isMask,n)}}}(i,e,t,n,r)}(e,t,i,r)}updateByOp(e,t,i){let r=e;if(void 0===r.path[0]){if(0===r.type)return"type"in r.props||"category"in r.props||"visible"in r.props?(i.scene.markNeedsUpdateRendererDirty(),!0):function(e,t,i,r){let n=!1;for(let[s,a]of Object.entries(e)){if("bumpMap"===s||"roughnessMap"===s){n=!0;continue}if(!s||void 0===a)continue;if(LD(s,i,r,t)){"visible"===s&&"light"===i.type&&(n=!0);continue}i.visible=r.visible;let e=i.uniforms[`f${i.id}_${s}`];if(e&&!(e instanceof XC))switch(n=n||ED(i,s,a),e.constructor){case HC:if("string"==typeof a){let i=t.getColor(a);i&&(e.value=i);break}{let t=a;e.value instanceof SD?e.value=new oC(t.r,t.g,t.b,t.a):e.setRGBA(t);break}case lC:if("string"==typeof a){let i=t.getColor(a);i&&(e.value=i);break}{let t=a;e.value instanceof SD?e.value=new oC(t.r,t.g,t.b,t.a):e.value.setRGBA(t.r,t.g,t.b,t.a);break}case sC:{let t=a;e.value.setX(t[0]),e.value.setY(t[1]);break}case aC:{let t=a;e.value.setX(t[0]),e.value.setY(t[1]),e.value.setZ(t[2]);break}case _C:CD(a,t,i);break;case tT:e.value=a.map((e=>new Wi(...e)));break;default:e.value=a}}return n}(r.props,i.shared,this,t)}else if("texture"===r.path[0])return!("texture"in t)&&!("video"in t)||CD(r.props,i.shared,this);return!1}dispose(){if(function(e){let t=e instanceof DD?e.type:e;return"texture"===t||"video"===t||"displace_map"===t||"matcap"===t}(this)){let e=this.uniforms[`f${this.id}_texture`];if(!e)return!1;let t=e;t.image instanceof qT||t.image.deref()}}hasValueByKey(e){return void 0!==this.uniforms[e]}hasValue(e){return this.hasValueByKey(`f${this.id}_${e}`)}setValue(e,t){let i=`f${this.id}_${e}`;this.hasValueByKey(i)&&void 0!==t&&(this.uniforms[i].value=t)}getNode(e){let t=`f${this.id}_${e}`;if(this.hasValueByKey(t))return this.uniforms[t]}getValue(e){let t=`f${this.id}_${e}`;if(this.hasValueByKey(t))return this.uniforms[t].value}getName(e){let t=/f\d+_(.*)/.exec(e);if(t&&t.length>1)return t[1];console.log(`Layer.getName: error ${e}`)}getNames(){let e=[];for(let t in this.uniforms){let i=this.getName(t);i&&e.push(i)}return e}},PD=class extends DD{constructor(e,t,i,r,n,s,a,o,l){super(e,t,i,r,l),this.params=r,this.color=n,this.mode=s,this.alpha=a,this.isMask=o}},ID=class extends DD{constructor(e,t,i,r,n,s){super(e,t,i,r,s),this.position=n}},OD=class extends DD{constructor(e,t,i,r,n,s){super(e,t,i,n,s),this.node=r}static createLigherLayer(e,t,i,r){let n,s,a=new SC(TD(i.alpha,r)),o=new WC(i.mode),l=new SC(i.bumpMapIntensity),h=new SC(TD(i.alphaOverride,r));if(i.visible)if("lambert"===i.category){n=new zT;let e=new HC(r.color(i.emissive)??0),t=new qC(i.occlusion??!0);s={emissive:e,occlusion:t},n.emissive=e,n.occlusion=t}else if("toon"===i.category){n=new UT;let e=new SC(i.shininess??30),t=new HC(r.color(i.specular)??1118481);s={shininess:e,specular:t},n.shininess=e,n.specular=t}else if("physical"===i.category){n=new FT;let e=new SC(i.roughness??.3),t=new SC(i.metalness??0),r=new SC(i.reflectivity??.5),a=new qC(i.occlusion??!0);s={roughness:e,metalness:t,reflectivity:r,occlusion:a},n.roughness=e,n.metalness=t,n.reflectivity=r,n.occlusion=a}else{n=new NT;let e=new SC(i.shininess??30),t=new HC(void 0!==i.specular?r.color(i.specular)??1118481:1118481),a=new qC(i.occlusion??!0);s={shininess:e,specular:t,occlusion:a},n.shininess=e,n.specular=t,n.occlusion=a}else n=new BT,s={};return n.alpha=new SC(1),n.shadingAlpha=a,n.shadingBlend=o,n.bumpMapIntensity=l,n.alphaOverride=h,s.alpha=n.shadingAlpha,s.mode=n.shadingBlend,s.bumpMapIntensity=n.bumpMapIntensity,s.alphaOverride=n.alphaOverride,new OD(e,t,i,n,s,r)}get category(){return this.node.category}};function RD(e){return{alpha:new SC(e.alpha??1),mode:new WC(e.mode??0),isMask:new qC(e.isMask??!1)}}function LD(e,t,i,r){if("displace"===i.type&&("intensity"===e||"visible"===e)){let e=t.uniforms[`f${t.id}_intensity`];return e?(e.value=i.intensity*(i.visible?1:0),e):void 0}if("displace"!==i.type&&("alpha"===e||"visible"===e)){let n=t.uniforms[`f${t.id}_alpha`];if(!n)return;if(n.value=TD(i.alpha,r)*(i.visible?1:0),"outline"===i.type&&"visible"===e){let e=t.uniforms[`f${t.id}_compensation`];e&&(e.value=i.compensation&&i.visible)}return n}}function BD(e,t){let i=0,r=e.layers.find((e=>"light"===e.data.type));if(r){let e=r.data,i=Number(t.getVariable(e.alphaOverride));if(("string"==typeof e.alphaOverride?i/100:e.alphaOverride)<1)return!0}for(let n of e.layers){if("displace"!==n.data.type&&n.data.isMask)return!0;if("displace"!==n.data.type&&"alpha"in n.data&&"light"!==n.data.type&&"fresnel"!==n.data.type&&"texture"!==n.data.type&&"matcap"!==n.data.type&&"rainbow"!==n.data.type&&"outline"!==n.data.type&&"pattern"!==n.data.type){let e=n.data.visible?n.data.alpha:0;if("string"==typeof e&&(e=Math.max(0,Math.min(1,Number(t.getVariable(e)??100)/100))),1===e&&"depth"===n.data.type||"gradient"===n.data.type){for(let t of n.data.colors)if(t[3]<1){e=t[3];break}}else if(1===e&&"noise"===n.data.type){let i=t.color(n.data.colorA).a,r=t.color(n.data.colorB).a,s=t.color(n.data.colorC).a,a=t.color(n.data.colorD).a,o=Math.min(i,Math.min(r,Math.min(s,a)));o<1&&(e=o)}i+=(1-i)*e}}return i<1}var zD=class extends Yn{constructor(){super(void 0),this.flatShading=!1,this.needsJitter=!0,this.cacheKey="",this.fog=!0,this.dithering=!0,this.vertexColors=!0,this.transparent=!0}customProgramCacheKey(){return this.cacheKey}},kD=class extends zD{constructor(e,t,i,r){super(),this.flatShading=e,this.side=t,this.wireframe=i,this.root=r}updateAfterBuild(){let e=this.root;this.lights=e.lights,this.vertexShader=e.vertexShader,this.fragmentShader=e.fragmentShader,this.defines=e.defines,this.uniforms=e.uniforms,this.extensions=e.extensions,this.transparent=e.transparent,this.cacheKey=e.customProgramCacheKey()+"flat"+this.flatShading+this.side}onBeforeCompile(e,t){this.root.onBeforeCompile(e)}get data(){return this.root.data}get category(){return this.root.category}get hasAO(){return this.root.hasAO}getFlavor(e,t,i){return this.root.getFlavor(e,t,i)}get layers(){return this.root.layers}get fragment(){return this.root.fragment}getLayersOfType(e){return this.root.getLayersOfType(e)}getLayerByUuid(e){return this.root.getLayerByUuid(e)}updateByOp(e,t,i){this.root.updateByOp(e,t,i)}nodeMaterialDispose(){this.root.nodeMaterialDispose()}},ND=class extends zD{constructor(e,t,i=!0){super(),this.data=e,this.allowVariableSaves=i,this.layerIdGen=0,this.flavors=[],this.masks={},this.type="NodeMaterial",this.updaters=[],this.reset0(e,t)}get nodeMaterial(){return this}getFlavor(e,t,i){let r=i?6:(e?3:0)+t;if(0===r)return this;void 0===this.flavors&&(this.flavors=[]),r-=1;let n=this.flavors[r];return void 0===n&&(n=new kD(e,t,i,this),this.flavors[r]=n,n.flatShading=e,n.side=t,n.updateAfterBuild()),n}get fragment(){return this.lightLayer.node}get category(){return this.lightLayer.category}get hasAO(){return this.lightLayer.getNode("occlusion")?.value??!1}reset(e,t){this.data!==e&&this.reset0(e,t)}reset0(e,t){this.data=e;let i=e.layers??yb.defaultTwoLayerData("phong").layers;try{this.layers=i.map((e=>DD.create(this.layerIdGen++,e.id,e.data,t.shared)))}catch{this.layers=[]}this.layers.reverse(),this.name=e.name??"Untitled Material",this.onUpdate(t.shared),this.transparent=BD(e,t.shared),this.saveVariableLocations(t)}onVariableUpdate(e,t,i){if("alphaOverride"===e[0])this.transparent=BD(this.data,i.shared),this.lightLayer.setValue("alphaOverride",Math.max(0,Math.min(Number(t)/100,1)));else if("layer"===e[0]){let r=e[1],n=e[2];if(r&&n){let e=this.layers.find((e=>e.uuid===r));e?.hasValue(n)&&("alpha"===n?(this.transparent=BD(this.data,i.shared),e.setValue(n,Math.max(0,Math.min(Number(t)/100,1)))):e.setValue(n,t))}}}saveVariableLocations(e){if(!this.allowVariableSaves)return;let t=this.data.layers.find((e=>"light"===e.data.type));t&&e.shared.getVariable(t.data.alphaOverride,["material",this.uuid,"alphaOverride"]),this.data.layers.forEach((t=>{"alpha"in t.data&&"string"==typeof t.data.alpha&&e.shared.getVariable(t.data.alpha,["material",this.uuid,"layer",t.id,"alpha"])}))}getLayersOfType(e){return this.layers.filter((t=>t.type===e))}getLayerByUuid(e){return this.layers.find((t=>t.uuid===e))}onUpdate(e){this.cacheKey=this.computeCacheKey(),this.lightLayer=this.layers.find((e=>e instanceof OD)),void 0===this.lightLayer&&(this.lightLayer=new OD(0,"",{...vb.defaultData("light","phong"),visible:!1},new BT,{},e)),this.dispose();for(let t of this.flavors)t&&t.dispose();this.applyTextureMaps(),this.applyMasks(),this.blendColors(),this.blendAfterColors(),this.blendPositions()}applyTextureMaps(){let e=this.layers.find((e=>e instanceof OD));if(!e)return;let t=e.data,i=t.bumpMap,r=t.roughnessMap;e.node.bumpMap=void 0,e.node.roughnessMap=void 0;for(let n=0;nt.uuid===e.id)),r=this.layers[t];this.layers.splice(t,1),this.layers.splice(e.localIndex,0,r),i.scene.markNeedsUpdateRendererDirty()}this.layers.reverse(),this.onUpdate(i.shared)}else{0===e.type&&void 0!==e.props.occlusion&&i.scene.markNeedsUpdateRendererDirty();let s=this.layers.find((e=>e.uuid===n));if(s){let a,o=t.layers.data(n);if(0===e.type&&("alpha"in e.props||"alphaOverride"in e.props)&&(a="alpha"in e.props?{...e.props,alpha:TD(e.props.alpha,r,["material",this.uuid,"layer",n,"alpha"])}:{...e.props,alphaOverride:TD(e.props.alphaOverride,r,["material",this.uuid,"alphaOverride"])}),s.updateByOp({...e,...a?{props:a}:{},path:e.path.slice(2)},o,i)){let e=DD.create(this.layerIdGen++,n,o,r);this.layers.splice(this.layers.findIndex((e=>e.uuid===n)),1,e),this.onUpdate(i.shared)}}}}else this.reset(t,i)}applyMasks(){for(let e=0;e0){let i=e-1,r=this.layers[i];r instanceof OD?r.node.mask=new EC(t.color,t.alpha,EC.MUL):r instanceof PD&&(r.isMask.value||(r.color.mask=new EC(t.color,t.alpha,EC.MUL)))}}}blendColors(){let e=this.layers.findIndex((e=>e instanceof PD)),t=this.layers.findIndex((e=>e instanceof OD));if(-1!==e&&ee instanceof OD));if(this.layers.length>t+1){for(let i=t+1;ie instanceof ID));if(e.length>0){let t=e[0].position;for(let i=1;iMath.min(Math.max(e,t),i);for(let r of this.layers)if("displace"===r.type){let n=i(r.uniforms[`f${r.id}_intensity`].value,e,t);r.uniforms[`f${r.id}_intensity`].value=n}}computeCacheKey(){let e="[";for(let{data:t}of this.data.layers)if("light"===t.type)e+=`"${t.visible?t.category.toUpperCase():"Basic"}"`;else{let i=[...(AD[t.type]??[]).map((e=>t[e])),...(MD[t.type]??[]).map((e=>t[e]?.length??0))],r="isMask"in t&&t.isMask,n=`"${t.type}-${t.visible}-${r}"`;i.length?e+=`[${n}, "${i.join('","')}"],`:e+=n}return e=e.slice(0,-1)+"]",e}updateFrame(e){for(let t=0;te.dispose())),super.dispose();for(let e of this.flavors)e&&e.dispose()}assetsLoaded(){for(let e of this.layers)if(e instanceof PD){let t=e.params.texture;if(t instanceof ZC&&!t.image.loaded)return!1}return!0}getHash(){let e="{";return e+='"fragment":'+this.fragment.getHash(),e+="}",e}};Object.defineProperties(zD.prototype,{properties:{get:function(){return this.fragment.properties}}});var FD=class extends ND{constructor(e,t,i){super(e,t,!1),this.uuid=i,this.allowVariableSaves=!0,this.saveVariableLocations(t)}},UD=d(x()),VD=new Map;function jD(e){if("string"==typeof e)return e;let t=VD.get(e);return t||(t={url:URL.createObjectURL(new Blob([e]))},VD.set(e,t)),t.url}var GD,HD,WD=class{constructor({src:e,volume:t,delay:i,loop:r}){let n;this._volume=1,this.delay=0,this._loop=1,this.loopsRemaining=0,this._status="stopped",this.onEnd=()=>{this.loopsRemaining===1/0?this.replay():this.loopsRemaining>1?(this.replay(),this.loopsRemaining--):(this._status="stopped",this.loopsRemaining=this._loop)},n="string"==typeof e?{src:e}:{src:jD(e),format:"wav"},this.sound=new UD.Howl(n),this.sound.on("end",this.onEnd),this.src=e,void 0!==t&&(this.volume=t),void 0!==i&&(this.delay=i),void 0!==r&&(this.loop=r)}get status(){return this._status}get volume(){return this._volume}set volume(e){this._volume=e,this.sound.volume(e)}get loop(){return this._loop}set loop(e){this._loop=e,this.loopsRemaining=e}replay(){this.clearDelay(),this.delayTimerId=window.setTimeout((()=>{this.sound.play(),this.clearDelay()}),this.delay)}fade(e,t=1e3){e?(this.sound.volume(this._volume),this.clearFade(),this.fadeTimerId=window.setTimeout((()=>{this.sound.fade(this._volume,0,t),this.clearFade()}),e)):this.sound.fade(this._volume,0,t)}on(e,t,i){this.sound.on(e,t,i)}off(e,t,i){this.sound.off(e,t,i)}play(){"playing"===this._status||this.sound.playing()||("paused"===this._status?(0===this.sound.seek()?this.replay():this.sound.play(),this._status="playing"):"stopped"===this._status&&(this.replay(),this._status="playing"))}pause(){"playing"===this._status&&(this.sound.pause(),this.clearFade(),this.clearDelay(),this._status="paused")}stop(){this.sound.stop(),this.loopsRemaining=this._loop,this.clearFade(),this.clearDelay(),this._status="stopped"}clearFade(){this.fadeTimerId&&(clearTimeout(this.fadeTimerId),delete this.fadeTimerId)}clearDelay(){this.delayTimerId&&(clearTimeout(this.delayTimerId),delete this.delayTimerId)}dispose(e=!1){this.off(),this.stop(),this.clearFade(),this.clearDelay()}},qD=class{constructor(){this.type="ShapePath",this.color=new Ni,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new Dl,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath?.lineTo(e,t),this}quadraticCurveTo(e,t,i,r){return this.currentPath?.quadraticCurveTo(e,t,i,r),this}bezierCurveTo(e,t,i,r,n,s){return this.currentPath?.bezierCurveTo(e,t,i,r,n,s),this}splineThru(e){return this.currentPath?.splineThru(e),this}toShapes(){let e=0,t=1,i=2,r=3,n=4,s=5,a=6,o={loc:e,t:0};function l(t,r,n,s){let a=t.x,l=r.x,c=n.x,d=s.x,u=t.y,p=r.y,f=n.y,m=s.y,g=(d-c)*(u-f)-(m-f)*(a-c),v=(m-f)*(l-a)-(d-c)*(p-u),y=g/v,x=((l-a)*(u-f)-(p-u)*(a-c))/v;if(0===v&&0!==g||y<=0||y>=1||x<0||x>1)return null;if(0===g&&0===v){for(let c=0;c<2;c++){if(h(0===c?n:s,t,r),o.loc===e){let e=0===c?n:s;return{x:e.x,y:e.y,t:o.t}}if(o.loc===i){return{x:+(a+o.t*(l-a)).toPrecision(10),y:+(u+o.t*(p-u)).toPrecision(10),t:o.t}}}return null}for(let i=0;i<2;i++)if(h(0===i?n:s,t,r),o.loc===e){let e=0===i?n:s;return{x:e.x,y:e.y,t:o.t}}return{x:+(a+y*(l-a)).toPrecision(10),y:+(u+y*(p-u)).toPrecision(10),t:y}}function h(l,h,c){let d,u=c.x-h.x,p=c.y-h.y,f=l.x-h.x,m=l.y-h.y,g=u*m-f*p;return l.x===h.x&&l.y===h.y?(o.loc=e,void(o.t=0)):l.x===c.x&&l.y===c.y?(o.loc=t,void(o.t=1)):void(g<-Number.EPSILON?o.loc=r:g>Number.EPSILON?o.loc=n:u*f<0||p*m<0?o.loc=s:Math.sqrt(u*u+p*p){t.boundingBox.containsPoint(r)&&function(e,t){let i=[],r=[];for(let n=1;ne.t<=n.t+Number.EPSILON&&e.t>=n.t-Number.EPSILON))&&(i.push(n),r.push(new wi(n.x,n.y)))}}return r}(e,t.points).forEach((e=>{n.push({identifier:t.identifier,isCW:t.isCW,point:e})}))})),n.sort(((e,t)=>e.point.x-t.point.x)),n}let d=0,u=999999999,p=-999999999,f=[];this.subPaths.forEach((e=>{let t=e.getPoints(),i=-999999999,r=999999999,n=-999999999,s=999999999;for(let a=0;ai&&(i=e.y),e.yn&&(n=e.x),e.x=s&&(u=s-1),t.length&&f.push({curves:e.curves,points:t,isCW:oh.isClockWise(t),identifier:d++,boundingBox:new Ec(new wi(s,r),new wi(n,i))})}));let m=f.map((e=>function(e,t,i,r,n){(null==n||""===n)&&(n="nonzero");let s=new wi;e.boundingBox.getCenter(s);let a=c([new wi(i,s.y),new wi(r,s.y)],e.boundingBox,t);a.sort(((e,t)=>e.point.x-t.point.x));let o=[],l=[];a.forEach((t=>{t.identifier===e.identifier?o.push(t):l.push(t)}));let h=o[0].point.x,d=[],u=0;for(;u0&&d[d.length-1]===l[u].identifier?d.pop():d.push(l[u].identifier),u++;if(d.push(e.identifier),"evenodd"===n){let t=d.length%2==0,i=d[d.length-2];return{identifier:e.identifier,isHole:t,for:i}}if("nonzero"===n){let i=!0,r=null,n=null;for(let e=0;e{let t=m[e.identifier];if(t&&!t.isHole){let t=new Bl;t.curves=e.curves,m.filter((t=>t?.isHole&&t.for===e.identifier)).forEach((e=>{if(e){let i=f[e.identifier],r=new Dl;r.curves=i.curves,t.holes.push(r)}})),g.push(t)}})),g}},YD=new Promise((e=>{GD=e})),XD=!1;function QD(){if(!XD)return HD||(HD=async function(){let e=await i.e(856).then(i.bind(i,856));GD(e),XD=!0}(),HD)}var ZD=new class{async load(e,t,i=(()=>{})){let{load:r}=await YD;r(e,((e,r)=>{e||!r?i(e??"Something went wrong"):t(r)}))}async parse(e){let{parse:t,Bidi:i}=await YD;try{let r=t(e),n=new i,s=e=>r.charToGlyphIndex(e.char);return n.registerModifier("glyphIndex",null,s),n.applyFeatures(r,r.defaultRenderOptions.features),{font:r,bidi:n}}catch(Ux){console.error(Ux)}}};async function KD(e){let t,i,r=!1;if(e.url?(t=await async function(e){return await(await fetch(e)).arrayBuffer()}(e.url),i=e.url,r=e.url.startsWith("/")):e.data&&(t=e.data.buffer.slice(e.data.byteOffset,e.data.byteOffset+e.data.byteLength)),t){let e=await ZD.parse(t);if(e)return{font:e.font,url:i,intercepted:r,arr:t,bidi:e.bidi}}}function JD(e,t){return t.state.glyphIndex===e||t.state.fina===e||t.state.medi===e||t.state.init===e}var $D=class{constructor(e){this._arrayBuffer=new ArrayBuffer(1),this._isLoaded=!1,this._intercepted=!1,this._isUserFont=e.isUserFont??!1,this._loadingPromise=KD(e).then((e=>{e&&(this._arrayBuffer=e.arr,this._url=e.url,this.font=e.font,this._intercepted=e.intercepted,this._isLoaded=!0,this._bidi=e.bidi)}))}update(e){this._isLoaded=!1,this._isUserFont=e.isUserFont??!1,this._loadingPromise=KD(e).then((e=>{e&&(this._arrayBuffer=e.arr,this._url=e.url,this.font=e.font,this._intercepted=e.intercepted,this._isLoaded=!0,this._bidi=e.bidi)}))}get url(){return this._url}get intercepted(){return this._intercepted}get isLoaded(){return this._isLoaded}get loadingPromise(){return this._loadingPromise}reverseLigaturesTable(e,t,i){if(!this._bidi)return[];let r=this._bidi;r.getTextGlyphs(t);let n=r.tokenizer.tokens,s=[],a=0,o=i.length===n.length;for(let l=0;lt.length&&(d=!0);s.push({char:h,index:r,replacements:o,replacementChars:Array.from(i)}),a++}}return s}generateShapes(e,t){if(!this._isLoaded)return;let i,r=this.font,n=t.fontSize/this.unitsPerEm,s=t.fontSize*t.lineHeight,a=e.map((e=>this.getTextWidth(e,t))),o=t.width,l=this.getCharWidth("\n",t),h=1===t.horizontalAlign?l:0,c=this.computeSpaceWidthForLine(e,0,t),d=this.getLineInitialOffsetX(a[0],o,t.horizontalAlign,e[0],l),u=this.getLineInitialOffsetY(s,e.length,t.height,n,t.verticalAlign),p=[],f=e.map((e=>[])),m=e.map((e=>[]));for(let y=0;y(r.glyphs.get(e).advanceWidth??0)*n)),t=e.reduce(((e,t)=>e+t),0),i=e.map((e=>e/t)),s=d;for(let r=0;r=0&&(e-=n),3===i?.5*t-.5*e:2===i?t-e:0}getLineInitialOffsetY(e,t,i,r,n){let s=t*e,a=e-Math.abs(this.ascender-this.descender)*r,o=-this.ascender*r-a/2;return 3===n?-(i-s-o):2===n?-(.5*i-.5*s-o):o}createPath(e,t,i,r,n){let s=e.getPath(i,-r,n.fontSize,{kerning:!1,letterSpacing:n.letterSpacing});if(!s)return void console.error('THREE.Font: character "'+e+'" does not exists in font family '+this.familyName+".");let a=new qD,o=(e.advanceWidth??1)*t;if(e)for(let l of s.commands){let e=a.currentPath?.currentPoint;if(!e||"Z"===l.type||e.x!==l.x||-e.y!==l.y)switch(l.type){case"M":a.moveTo(l.x,-l.y);break;case"L":a.lineTo(l.x,-l.y);break;case"Q":a.quadraticCurveTo(l.x1,-l.y1,l.x,-l.y);break;case"C":a.bezierCurveTo(l.x1,-l.y1,l.x2,-l.y2,l.x,-l.y)}}return a.subPaths.forEach((e=>{let t=function(e){if(e.length){let t=e[0];if(t instanceof Sl)return t.v1;if(t instanceof wl||t instanceof Ml)return t.v0}}(e.curves);void 0!==t&&e.currentPoint.distanceTo(t)>0&&e.lineTo(t.x,t.y)})),{offsetX:o+n.fontSize*n.letterSpacing,path:a}}getCharWidth(e,t){return this.font?.getAdvanceWidth(e,t.fontSize,{kerning:!0,letterSpacing:t.letterSpacing})??0}getTextWidth(e,t){return this.font?.getAdvanceWidth(e,t.fontSize,{kerning:!0,letterSpacing:t.letterSpacing})??0}computeSpaceWidthForLine(e,t,i){let r=this.getCharWidth(" ",i),n=e[t];if(n){let s=this.countSpaces(n.trimEnd());if(4===i.horizontalAlign&&t{this.disposeObject(this.objects.get(e)),this.objects.delete(e)})),this.unreachable.clear()}dispose(){this.objects.forEach((e=>{this.disposeObject(e)})),this.objects.clear()}},tP=class extends eP{constructor(e){super(),this.flatShading=e}disposeObject(e){e.dispose()}createObject(e,t,i){let r=fE(e,t,this.flatShading,i);return r.computeBoundingSphere(),r}},iP={markNeedsUpdateRendererDirty:()=>{}},rP=class extends HT{constructor(e){super(),this.shared=e}create(e){return new WT(e,this.shared)}},nP=class{constructor(e,t={}){if(this.data=e,this.geometryCache=new tP(!0),this.geometryCache2=new tP(!1),this.imageHolderCache=new rP(this),this.thisContext={scene:iP,shared:this},this.deletedMaterial=new FD(yb.defaultTwoLayerData("phong"),this.thisContext,""),this.deletedImage=new qT(sw.emptyImage,this),this.deletedVideo=new qT(lb.defaultVideo,this),this.materials={},this.images={},this.videos={},this.colors={},this.audios={},this.fonts={},this.variables={},this.mouseProperty=null,this.raycastProperty=null,this.requestRender=()=>{this._requestRender&&this._requestRender()},t.images)for(let[i,r]of Object.entries(t.images))this.addImage(i,r);if(t.videos)for(let[i,r]of Object.entries(t.videos))this.addVideo(i,r);if(t.audios)for(let[i,r]of Object.entries(t.audios))this.addAudio(i,r);this.reset(e)}setRequestRender(e){this._requestRender=e}setEntityOpContext(e){this.entityOpContext=e}reset(e,t=!1){this.resetLib(e.lib);for(let{id:i,data:r}of e.variables)this.addVariableHolder(i,r),t&&this.updateVariableHolder(i,r);for(let[i,r]of Object.entries(e.images))this.addImage(i,r);for(let[i,r]of Object.entries(e.videos))this.addVideo(i,r);for(let[i,r]of Object.entries(e.colors))this.addColor(i,r);for(let[i,r]of Object.entries(e.materials))this.addMaterial(i,r);for(let[i,r]of Object.entries(e.audios))this.addAudio(i,r);for(let[i,r]of Object.entries(e.fonts))this.addFont(i,r)}addMaterial(e,t){if(this.materials[e]){let i=this.materials[e];i.reset(t,this.thisContext),i.dispose()}else{let i=new FD(t,this.thisContext,e);this.materials[e]=i}}deleteMaterial(e){this.materials[e]&&(this.materials[e].nodeMaterialDispose(),delete this.materials[e])}getMaterial(e){return this.materials[e]}getMaterialOrDeletedPlaceholder(e){return this.materials[e]??this.deletedMaterial}material(e){return"string"==typeof e?this.getMaterialOrDeletedPlaceholder(e):null==e?(console.error("material is undefined or null"),this.deletedMaterial):new ND(e,this.thisContext)}getMaterials(){return this.materials}addImage(e,t){return this.images[e]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),this.images[e].updateSrc(t.data),!0):(this.images[e]=new qT(t,this),!1)}deleteImage(e){let t=this.images[e];t&&(t.dispose(),delete this.images[e])}getDefaultImage(){return this.images.image_0}getImage(e){return this.images[e]??this.deletedImage}image(e){return"string"==typeof e?this.getImage(e):this.imageHolderCache.load(e)}addVideo(e,t){return this.videos[e]?(this.videos[e].updateSrc(t.data),!0):(this.videos[e]=new qT(t,this),!1)}deleteVideo(e){let t=this.videos[e];t&&(t.dispose(),delete this.videos[e])}getVideo(e){return this.videos[e]??this.deletedVideo}video(e){return"string"==typeof e?this.getVideo(e):this.imageHolderCache.load(e)}addColor(e,t){return this.colors[e]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),"a"in t?this.colors[e].setRGBA(t.r,t.g,t.b,t.a):this.colors[e].setRGBA(t.r,t.g,t.b,1),!0):(this.colors[e]=new SD(t.r,t.g,t.b,"a"in t?t.a:1),!1)}updateColor(e,t){if(this.colors[e]){this.onColorOrImageUpdate&&this.onColorOrImageUpdate();let i=this.colors[e];return this.colors[e].r=t.r??i.r,this.colors[e].g=t.g??i.g,this.colors[e].b=t.b??i.b,this.colors[e].a=t.a??i.a,!0}return!1}deleteColor(e){this.colors[e]&&delete this.colors[e]}getColor(e){return this.colors[e]}color(e){let t;if("string"!=typeof e)return new oC(e.r,e.g,e.b,"a"in e?e.a:1);{let i=this.getColor(e);i?t=i:(console.warn("Tried to create color layer params with a color key that does not exist in the assets manager"),t=new oC(0,0,0,0))}return t}addAudio(e,t){this.audios[e]=t}getAudio(e){let t=this.audios[e];if(t instanceof WD)return t;{let i=new WD({src:t.data});return this.audios[e]=i,i}}deleteAudio(e){let t=this.audios[e];t&&(t instanceof WD&&t.dispose(),delete this.audios[e])}addFont(e,t){this.fonts[e]=new $D(t),this.fonts[e].loadingPromise.then((()=>this.requestRender()))}getFont(e){return this.fonts[e]}deleteFont(e){this.fonts[e]&&delete this.fonts[e]}dispose(){Object.keys(this.materials).forEach((e=>this.deleteMaterial(e))),this._requestRender=void 0,Object.values(this.audios).forEach((e=>{e instanceof WD&&e.dispose()})),this.audios={},this.geometryCache.dispose(),this.geometryCache2.dispose()}addVariableHolder(e,t){return void 0===this.variables[e]?(this.variables[e]={value:t.value,locations:[]},"dynamicVariableType"in t&&(this.variables[e].dynamicVariablePlayState="Playing",this.variables[e].dynamicVariableToggleIsForward=void 0),!0):(this.variables[e].value=t.value,!1)}resetDynamicVariablePlayState(){for(let e in this.variables)void 0!==this.variables[e].dynamicVariablePlayState&&(this.variables[e].dynamicVariablePlayState="Playing",this.variables[e].dynamicVariableToggleIsForward=void 0)}updateVariableHolder(e,t){this.updateVariable(e,t.value)}updateVariable(e,t){if(void 0===this.variables[e])return!1;this.variables[e].value=t;let i=t;for(;"string"==typeof i;)i=this.variables[i].value;let r=this.entityOpContext.scene;for(let n=this.variables[e].locations.length-1;n>=0;n--){let t=this.variables[e].locations[n];if("material"===t[0]){let e=t[1],n=i,s={scene:r,shared:this},a=t.slice(2);r.traverseMaterial((t=>{let i=t.root??t;i.uuid===e&&i.onVariableUpdate(a,n,s)}));let o=this.materials[e];o&&o.onVariableUpdate(a,n,s)}else{let s=r.find(t[0]);if(void 0===s){this.variables[e].locations.splice(n,1);continue}if("geometry"!==t[1]){for(let e=1;e{let t=e.dataPatched;e.chooseGeoemtryCache(this).forceDelete(t.geometry),e.createGeometryDelayed(this.entityOpContext),e.onVariableUpdate(!0)}))}}}return!0}deleteVariable(e){this.variables[e]&&delete this.variables[e]}getVariable(e,t){if(Array.isArray(e)){if("mouse"===e[0])return this.mouseProperty?.[e[1]]??0;if("raycast"===e[0])return this.raycastProperty?.[e[1]]??0;let t=this.entityOpContext.scene.find(e[0]);if("width"===e[1]||"height"===e[1]||"depth"===e[1])return t.geometry.userData.parameters[e[1]];for(let i=1;izv.equal(e,t)));void 0!==r&&-1!==r&&e.locations.splice(r,1)}if("string"==typeof e){let i=e,r=e;do{if(r=i,void 0===this.variables[i])break;i=this.variables[i].value}while("string"==typeof i);return t&&void 0!==this.variables[r]&&this.variables[r].locations.push(t),i}return e}getVariables(){return this.variables}getDynamicVariablePlayState(e){return this.variables[e]?.dynamicVariablePlayState}setDynamicVariablePlayState(e,t){void 0!==this.variables[e]&&(this.variables[e].dynamicVariablePlayState=t)}getDynamicVariableToggleIsForward(e){return this.variables[e]?.dynamicVariableToggleIsForward}setDynamicVariableToggleIsForward(e,t){void 0!==this.variables[e]&&(this.variables[e].dynamicVariableToggleIsForward=t)}resetLib(e){for(let[t,i]of Object.entries(e.images))this.addImage(t,i.asset);for(let[t,i]of Object.entries(e.audios))this.addAudio(t,i.asset);for(let[t,i]of Object.entries(e.colors))this.addColor(t,i.asset);for(let[t,i]of Object.entries(e.fonts))this.addFont(t,i.asset);for(let[t,i]of Object.entries(e.materials))this.addMaterial(t,i.asset);for(let[t,i]of Object.entries(e.videos))this.addVideo(t,i.asset);for(let[t,i]of Object.entries(e.variables))this.addVariableHolder(t,i.asset)}updateLibByOp(e,t){"images"===e.path[0]?1===e.path.length&&1===e.type?this.addImage(e.id,e.data.asset):1===e.path.length&&2===e.type&&this.deleteImage(e.id):"videos"===e.path[0]?1===e.path.length&&1===e.type?this.addVideo(e.id,e.data.asset):1===e.path.length&&2===e.type&&this.deleteVideo(e.id):"audios"===e.path[0]?1===e.path.length&&1===e.type?this.addAudio(e.id,e.data.asset):1===e.path.length&&2===e.type&&this.deleteAudio(e.id):"colors"===e.path[0]?1===e.path.length&&1===e.type?this.addColor(e.id,e.data.asset):1===e.path.length&&2===e.type&&this.deleteColor(e.id):"materials"===e.path[0]?1===e.path.length&&1===e.type?this.addMaterial(e.id,e.data.asset):1===e.path.length&&2===e.type&&this.deleteMaterial(e.id):"fonts"===e.path[0]?1===e.path.length&&1===e.type?this.addFont(e.id,e.data.asset):1===e.path.length&&2===e.type&&this.deleteFont(e.id):"variables"===e.path[0]?1===e.path.length&&1===e.type?this.addVariableHolder(e.id,e.data.asset):1===e.path.length&&2===e.type&&this.deleteVariable(e.id):"components"===e.path[0]&&t.updateByLibOp(e,this)}updateByOp(e,t,i){this.data=t,"images"===e.path[0]?2===e.path.length&&0===e.type?e.props.data&&this.getImage(e.path[1]).updateSrc(e.props.data):1===e.path.length&&1===e.type?this.addImage(e.id,e.data):1===e.path.length&&2===e.type&&this.deleteImage(e.id):"videos"===e.path[0]?2===e.path.length&&0===e.type?e.props.data&&this.getVideo(e.path[1]).updateSrc(e.props.data):1===e.path.length&&1===e.type?this.addVideo(e.id,e.data):1===e.path.length&&2===e.type&&this.deleteVideo(e.id):"audios"===e.path[0]?2===e.path.length&&0===e.type?e.props.data&&this.addAudio(e.path[1],t.audios[e.path[1]]):1===e.path.length&&1===e.type?this.addAudio(e.id,e.data):1===e.path.length&&2===e.type&&this.deleteAudio(e.id):"colors"===e.path[0]?2===e.path.length&&0===e.type?this.updateColor(e.path[1],e.props):1===e.path.length&&1===e.type?this.addColor(e.id,e.data):1===e.path.length&&2===e.type&&this.deleteColor(e.id):"materials"===e.path[0]?1===e.path.length&&1===e.type?this.addMaterial(e.id,e.data):1===e.path.length&&2===e.type?this.deleteMaterial(e.id):e.path.length>1&&this.getMaterial(e.path[1]).updateByOp(pv.drop(e,2),t.materials[e.path[1]],{shared:this,scene:i}):"fonts"===e.path[0]?2===e.path.length&&0===e.type?this.updateFont(e.path[1],e,i):1===e.path.length&&1===e.type?this.addFont(e.id,e.data):1===e.path.length&&2===e.type&&this.deleteFont(e.id):"variables"===e.path[0]?2===e.path.length&&0===e.type&&"value"in e.props?this.updateVariable(e.path[1],e.props.value):1===e.path.length&&4===e.type?this.addVariableHolder(e.id,e.data):1===e.path.length&&5===e.type&&this.deleteVariable(e.id):"lib"===e.path[0]&&this.updateLibByOp(pv.drop(e,1),i)}updateFont(e,t,i){if(t.props.url){let r=this.getFont(e),n={...this.data.fonts[e],url:t.props.url};r.update(n),r.loadingPromise.then((()=>this.requestRender())),i.updateFont(e,this)}}},sP=(new nP(dw.emptyData()),class extends $E{updateByPatchedOp(e,t,i){if(super.updateByPatchedOp(e,t,i),null!==function(e,t){let i=[];if(t.length!==e.length)return null;for(var r=0;rt.shared.material(e).getFlavor(i.flatShading,i.side,i.wireframe))),t.scene.markNeedsUpdateRendererDirty()):"material"in e&&void 0!==e.material&&(this.disposeMaterial(),this.material=[t.shared.material(e.material).getFlavor(i.flatShading,i.side,i.wireframe)],t.scene.markNeedsUpdateRendererDirty())),void 0!==e.flatShading||void 0!==e.wireframe||void 0!==e.side)if(Array.isArray(this.material))for(let r=0;r{e instanceof zD&&(e instanceof FD||e.nodeMaterialDispose())}))}dispose(){this.disposeMaterial(),super.dispose()}}),aP=new Zi,oP=new Wi,lP=new Wi,hP=new Zi,cP=new Er,dP=class extends sP{constructor(e,t,i){super(e,t),this.data=t,this.isSkinnedMesh=!1,this.localGeometry=void 0,t.bindMode&&t.bindMatrix&&(this.bindMode=t.bindMode,this.bindMatrix=(new Er).fromArray(t.bindMatrix),this.bindMatrixInverse=new Er)}chooseGeoemtryCache(e){return e.geometryCache}markGeometryAsReachable(e){this.geometryCreateDeleyed instanceof En&&this.chooseGeoemtryCache(e).markAsReachable(this.dataPatched.geometry,this.geometryCreateDeleyed)}get geometry(){if(void 0!==this.localGeometry)return this.localGeometry;if(this.geometryCreateDeleyed instanceof nP){let e=this.geometryCreateDeleyed,t=this.chooseGeoemtryCache(e);this.geometryCreateDeleyed=t.get(this.dataPatched.geometry,e,this)}return this.geometryCreateDeleyed}set geometry(e){this.localGeometry=e}get is2DAndNoDepth(){let e=this.dataPatched.geometry;return Mb.is2DParametricMesh(e.type)&&0===e.depth}get is2DType(){return Mb.is2DParametricMesh(this.geometry.userData.type)}get isNonParametric(){return"NonParametricGeometry"===this.geometry.userData.type}updateByPatchedOp(e,t,i){super.updateByPatchedOp(e,t,i),jv(e.path,["geometry"])&&this.updateByPatchedOpGeometry(pv.drop(e,1),t.geometry,i)}removeInteractionGeometry(){this.localGeometry?.dispose(),this.localGeometry=void 0}updateGeometryInteractions(e,t){this.invalidateDownstreamBooleanData();let i=this.data.geometry.type;if("NonParametricGeometry"===i||"SubdivGeometry"===i){let i,r,n,s=e;if(void 0===this.localGeometry){let e={...this.data.geometry,...s};this.localGeometry=fE(e,t,this.data.flatShading,this)}s.scaleBaked?[i,r,n]=s.scaleBaked:({width:i,height:r,depth:n}=s);let a=this.localGeometry.userData;void 0!==a.sxPrev&&gE(this.localGeometry.attributes,i/a.sxPrev,r/a.syPrev,n/a.szPrev),a.sxPrev=i,a.syPrev=r,a.szPrev=n}else{let i={...this.data.geometry,...e};this.localGeometry?.dispose(),this.localGeometry=fE(i,t,this.data.flatShading,this)}}refreshAttachedCloners(e){for(let t of this.attachedSurfaceCloners)e.scene.addPendingUpdateCloner(t.object)}refreshAttachedPaths(e){for(let t of this.attachedPaths)e.scene.addPendingCommand((()=>t.updateShape()))}createGeometryDelayed(e){this.geometryCreateDeleyed=e.shared,this.refreshAttachedCloners(e),this.refreshAttachedPaths(e)}updateByPatchedOpGeometry(e,t,i){let r=!1;0===e.type&&0===e.path.length&&Object.keys(e.props).includes("scaleBaked")&&this.geometryCreateDeleyed instanceof SE&&this.chooseGeoemtryCache(i.shared).mutateIfUnique(this.geometryCreateDeleyed.data,t)===this.geometryCreateDeleyed&&(r=!0,this.geometryCreateDeleyed.mutateDirectlyScaleBaked(t,e.props.scaleBaked),this.refreshAttachedCloners(i),this.refreshAttachedPaths(i)),r||(i.scene?.markGeometryCacheDirty(),this.createGeometryDelayed(i)),this.resetBBoxNeedsUpdate(),this.invalidateDownstreamBooleanData()}updateGeometryOnStateUpdate(e,t){this.createGeometryDelayed(t)}updateState(e,t){void 0!==e.geometry&&this.updateGeometryOnStateUpdate(e.geometry,t),super.updateState(e,t)}updateGeometryGroupsIfNeeded(){Array.isArray(this.material)&&0===this.geometry.groups.length&&this.geometry.addGroup(0,Math.max(this.geometry.getIndex()?.count??0,this.geometry.getAttribute("position").count),0)}updateEntityBoxSize(e,t){let i=this.geometry.userData.parameters;this.is2DType?e.set(0,0,.5*i.depth):this.isNonParametric?(e.setScalar(0),this.geometry.boundingSphere&&e.copy(this.geometry.boundingSphere.center),t.set(i.width,i.height,i.depth??0).multiplyScalar(.5)):e.setScalar(0),t.set(i.width,i.height,i.depth??0).multiplyScalar(.5)}updateMatrixWorld(e){super.updateMatrixWorld(e),"attached"===this.bindMode?this.bindMatrixInverse.copy(this.matrixWorld).invert():"detached"===this.bindMode&&this.bindMatrixInverse.copy(this.bindMatrix).invert()}bind(e,t){this.skeleton=e,this.isSkinnedMesh=!0,void 0===t&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(e){let t=new Wi,i=this.geometry.attributes.skinWeight;for(let r=0,n=i.count;r{for(let i of e.normals)e.result.add(i);e.result.divideScalar(e.normals.length)}));for(let a=0;a{e}));var fP=new $i,mP=new Zi;function gP(e){let t=!1;return e.scene.objects.traverse(((e,i)=>{"Mesh"===i.type&&"SubdivGeometry"===i.geometry.type&&(t=!0)})),t}var vP=class extends dP{constructor(e,t,i){super(e,t,i),this.data=t,this.hiddenMatrixOld=new Er,this.smoothShading=!0,this.skipReactionUpdate=!1}chooseGeoemtryCache(e){return this.dataPatched.flatShading?e.geometryCache:e.geometryCache2}get subdivPointerNew(){return void 0!==this.localGeometry?this.subdivPointer:this.geometry.ensureSubdivPointer()}get originalGeometryNew(){return void 0!==this.localGeometry?this.originalGeometry:this.geometry.originalGeometry}get phongAngle(){return this.data.geometry.phongAngle??45}updateEntityBoxSize(e,t){let i=this.geometry.userData.parameters;e.copy(this.originalGeometryNew.boundingSphere.center),t.set(i.width,i.height,i.depth??0).multiplyScalar(.5)}createGeometryByControls(e){if(!0===this.skipReactionUpdate)return;let t=this.localGeometry?.uuid,{originalGeometry:i,subdividedGeometry:r,subdivPointer:n}=SE.build(e,this.subdivPointer,this.smoothShading,this.hasNonUniformScale?this.shearScale:void 0);this.subdivPointer=n,void 0!==i&&(this.originalGeometry?.dispose(),this.originalGeometry=i),void 0!==r&&(this.subdividedGeometry?.dispose(),this.subdividedGeometry=r??void 0),this.localGeometry=this.subdividedGeometry??this.originalGeometry,uP(this),pP(this),this.calcBoundingBox(),t&&(this.localGeometry.uuid=t)}updateState(e,t){if(super.updateState(e,t),void 0!==e.flatShading){let i=this.material;this.material=i.getFlavor(!1,i.side,i.wireframe),this.smoothShading=!e.flatShading,this.createGeometryDelayed(t)}}updateMesh(e=!1){SE.buildLevel(this.subdivPointer,!0,this.smoothShading?this.phongAngle:-1,this.originalGeometry,e&&this.hasNonUniformScale?this.shearScaleInv:void 0),this.subdividedGeometry&&SE.buildLevel(this.subdivPointer,!1,this.smoothShading?this.phongAngle:-1,this.subdividedGeometry,e&&this.hasNonUniformScale?this.shearScaleInv:void 0)}updateTopology(){this.originalGeometry.dispose(),this.originalGeometry=SE.buildLevel(this.subdivPointer,!0,this.smoothShading?this.phongAngle:-1),this.subdividedGeometry&&(this.subdividedGeometry.dispose(),this.subdividedGeometry=SE.buildLevel(this.subdivPointer,!1,this.smoothShading?this.phongAngle:-1)),this.localGeometry=this.subdividedGeometry??this.originalGeometry}raycast(e,t){let i=this.localGeometry;this.localGeometry=this.originalGeometryNew,$E.prototype.raycast.call(this,e,t),this.localGeometry=i}activateSVDCompensation(){!this.hasNonUniformScale||(this.matrix.copy(this.matrixWorldRigid),this.hiddenMatrixOld.copy(this.hiddenMatrix),this.hiddenMatrix.copy(this.parent.matrixWorld).invert())}deactivateSVDCompensation(){!this.hasNonUniformScale||(this.updateMatrix(),this.hasNonUniformScale=void 0,this.hiddenMatrix.copy(this.hiddenMatrixOld))}calcBoundingBox(){let e=this.originalGeometry;null===e.boundingSphere&&(e.boundingSphere=new vr,this.subdividedGeometry&&(this.subdividedGeometry.boundingSphere=e.boundingSphere));let t=e.attributes.position,i=e.boundingSphere.center;fP.setFromBufferAttribute(t),fP.getCenter(i),e.boundingSphere.radius=i.distanceTo(fP.max),isNaN(e.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),fP.getSize(mP),this.hasNonUniformScale&&mP.divide(this.scale);let r={width:mP.x,height:mP.y,depth:mP.z};return this.geometry.userData.parameters=r,r}updateBoundingSphere(e){let t=this.originalGeometry;fP.min.set(e[0],e[2],e[4]),fP.max.set(e[1],e[3],e[5]),this.hasNonUniformScale&&(fP.min.applyMatrix4(this.shearScaleInv),fP.max.applyMatrix4(this.shearScaleInv)),null===t.boundingSphere&&(t.boundingSphere=new vr);let i=t.boundingSphere.center;fP.getCenter(i),t.boundingSphere.radius=i.distanceTo(fP.max)}freeSubdivPointer(){this.subdivPointer&&(SE.freeSubdivPointer(this.subdivPointer),this.subdivPointer=0),this.localGeometry=void 0,this.originalGeometry?.dispose(),this.subdividedGeometry?.dispose()}dispose(){super.dispose(),this.freeSubdivPointer()}updateByPatchedOpGeometry(e,t,i){super.updateByPatchedOpGeometry(e,t,i),this.localGeometry&&this.createGeometryByControls(t)}},yP={x:[1,0,0],"-x":[-1,0,0],y:[0,1,0],"-y":[0,-1,0],z:[0,0,1],"-z":[0,0,-1]},xP={polygon_center:0,edge:1,vertex:2},bP=(e,t)=>(i,r)=>t&&0!==i&&0!==e?e*r/100:0,wP=(e,t)=>{let i=Math.abs(t),r=-1*i;return(e- -1)*(i-r)/2+r};var _P=new Zi,SP=new Zi,AP=new Zi,MP=new Zi;function EP(e,t){let i=AP.fromArray(e),r=MP.fromArray(t);SP.copy(r).sub(i);let n=SP.length();return SP.normalize().multiplyScalar(.5*n),_P.copy(i).add(SP).toArray()}var CP=new hn,TP=new Zi,DP=new Zi,PP=new Zi;var IP=e=>.5*(1-Math.cos(e*Math.PI)),OP=class{constructor(){this.perlin=new Array(4096)}noise(e,t=0,i=0){if(null==this.perlin){this.perlin=new Array(4096);for(let e=0;e<4096;e++)this.perlin[e]=Math.random()}e<0&&(e=-e),t<0&&(t=-t),i<0&&(i=-i);let r,n,s,a,o,l=Math.floor(e),h=Math.floor(t),c=Math.floor(i),d=e-l,u=t-h,p=i-c,f=0,m=.5;for(let g=0;g<4;g++){let e=l+(h<<4)+(c<<8);r=IP(d),n=IP(u),s=this.perlin[4095&e],s+=r*(this.perlin[e+1&4095]-s),a=this.perlin[e+16&4095],a+=r*(this.perlin[e+16+1&4095]-a),s+=n*(a-s),e+=256,a=this.perlin[4095&e],a+=r*(this.perlin[e+1&4095]-a),o=this.perlin[e+16&4095],o+=r*(this.perlin[e+16+1&4095]-o),a+=n*(o-a),s+=IP(p)*(a-s),f+=s*m,m*=.5,l<<=1,d*=2,h<<=1,u*=2,c<<=1,p*=2,d>=1&&(l++,d--),u>=1&&(h++,u--),p>=1&&(c++,p--)}return f}noiseSeed(e){let t=(()=>{let e,t;return{setSeed(i){t=e=(i??4294967296*Math.random())>>>0},getSeed:()=>e,rand:()=>(t=(1664525*t+1013904223)%4294967296,t/4294967296)}})();t.setSeed(e),this.perlin=new Array(4096);for(let i=0;i<4096;i++)this.perlin[i]=t.rand()}},RP=new Zi,LP=new Er,BP=new Mr;function zP(e){let t=!1;return e.scene.objects.traverse(((e,i)=>{"Mesh"===i.type&&"TextGeometry"===i.geometry.type&&(t=!0)})),t}var kP,NP,FP,UP,VP=class extends dP{constructor(e,t,i){super(e,t,i),this.data=t}get textGeometry(){return this.geometry}get charWidths(){return this.textGeometry.charWidths}get charCoords(){return this.textGeometry.charCoords}get wrappedText(){return this.textGeometry.wrappedText}get font(){return this.textGeometry.font}get initialOffsetY(){let e=this.dataPatched;return this.font?.getLineInitialOffsetY(this.lineHeight,this.wrappedText.length,e.geometry.height,this.fontScale,e.geometry.verticalAlign)??0}get fontScale(){let e=this.dataPatched;return this.font?e.geometry.fontSize/this.font.unitsPerEm:1}get AD(){return Math.abs(this.ascender-this.descender)}get ascender(){return(this.font?.ascender??1)*this.fontScale}get descender(){return(this.font?.descender??1)*this.fontScale}get lineHeight(){let e=this.dataPatched;return e.geometry.fontSize*e.geometry.lineHeight}raycast(e,t){let{matrixWorld:i}=this;if(!isNaN(e.ray.origin.x)&&0!==this.scale.x&&0!==this.scale.y&&0!==this.scale.z&&(LP.copy(i).invert(),BP.copy(e.ray).applyMatrix4(LP),BP.intersectBox(this.singleBBox,RP))){let r=RP.applyMatrix4(i),n=e.ray.origin.distanceTo(r);t.push({distance:n,point:r.clone(),object:this})}}},jP=1e-4,GP=new Zi,HP=new Zi;dE.then((e=>{NP=[(kP=e).get_face_center,kP.get_edge_midpoint,kP.get_vertex_position],FP=[kP.get_face_normal,kP.get_edge_normal,kP.get_vertex_normal],UP=[kP.face_count,kP.edge_count,kP.vertex_count]}));var WP=new Er,qP=new Er,YP=new Zi,XP=new Zi,QP=new Zi,ZP=new Zi,KP=new Zi,JP=new Zi,$P=new OP,eI=class extends(yS(Kr)){constructor(e,t){super(),this.parameters=t,this.objectForSample=void 0,this._pendingMediaLoad=!1,this.object=e}resetOnMove(){this.removeFromParent(),this.parent=null}expandClones(e){if(null===this.parent)this.updateState(this.parameters,e);else for(let t of this.children)t instanceof bS&&t.expand()}invalidateTransform(e){this.matrixWorldNeedsUpdate=!0,this.traverse((t=>{t instanceof bS&&t.object===e&&(t.matrixWorldNeedsUpdate=!0)}))}onObjUpdateMatrix(){"toObject"!==this.parameters.type&&(this.matrixWorldNeedsUpdate=!0)}update(){switch(this._updateCount(),this.parameters.type){case"radial":this._updateRadial(this.parameters);break;case"linear":this._updateLinear(this.parameters);break;case"grid":this._updateGrid(this.parameters);break;case"toObject":this._updateToObject(this.parameters)}for(let e of this.children)e.updateMatrix(),e.hasNonUniformScale&&(e.updateMatrixWorld(),e.updateMatrixWorldSVD())}_updateCount(e){let t;if(t=void 0!==e?e:"grid"===this.parameters.type?Math.round(this.parameters.grid.count[0])*Math.round(this.parameters.grid.count[1])*Math.round(this.parameters.grid.count[2]):this.parameters.count,"toObject"===this.parameters.type&&!this.parameters.toObject.object&&(t=0),"toObject"===this.parameters.type&&this.objectForSample){for(let t=0,i=this.children.length;toS[e%12*3])),r=new Float64Array(t).map((e=>oS[e%12*3+1])),n=new Float64Array(t).map((e=>oS[e%12*3+2]));return function(e,s,a){let o,l,h,c,d,u,p,f,m,g,v=.3333333333333333*(e+s+a),y=sS(e+v),x=sS(s+v),b=sS(a+v),w=(y+x+b)*nS,_=e-(y-w),S=s-(x-w),A=a-(b-w);_>=S?S>=A?(d=1,u=0,p=0,f=1,m=1,g=0):_>=A?(d=1,u=0,p=0,f=1,m=0,g=1):(d=0,u=0,p=1,f=1,m=0,g=1):S{let t=e.length;return[e.map((e=>e[0])).reduce(((e,t)=>e+t),0)/t,e.map((e=>e[1])).reduce(((e,t)=>e+t),0)/t,e.map((e=>e[2])).reduce(((e,t)=>e+t),0)/t]},c=e=>Math.round(1e6*e)/1e6;o.forEach((e=>{let t=o.filter((t=>c(e.pos[0])===c(t.pos[0])&&c(e.pos[1])===c(t.pos[1])&&c(e.pos[2])===c(t.pos[2])));t.length>1?l.push({pos:e.pos,norm:h(t.map((e=>e.norm)))}):l.push(e)}));let d=function(e){let t=[],i={};for(var r=0,n=e.length;rMath.round(1e4*e)/1e4)));i[s]||(t.push(e[r]),i[s]=!0)}return t}(l);if(d.length>0){let e=Math.round(d.length*t.count/100);this._updateCount(e)}else{let e=this.objectForSample.geometry.getAttribute("position");if(!e||isNaN(e.count)||0===e.count)return void console.warn(`Oh no! The object "${this.object.name}" (${this.object.uuid}) cannot be cloned on the surface of "${this.objectForSample.name}" (${this.objectForSample.uuid}) because the latter does not have a valid geometry.`)}this.objectForSample.updateMatrixWorld();let u=new uS(this.objectForSample).build(),p=yP[t.axis],f=this.children;u.setRandomGenerator((0,tS.default)(this.object.uuid+t.seed));for(let[m,g]of f.entries()){let e=m*(r.freqScale/10)+r.movement,o=n?$P.noise(e):s(e,e),l=m+1,h=a(l,wP(o,r.rotation[0])),c=a(l,wP(o,r.rotation[1])),f=a(l,wP(o,r.rotation[2]));"random"===t.spreadType?u.sample(QP,ZP):(d.length&&(QP.fromArray(d[m].pos),ZP.fromArray(d[m].norm)),this.objectForSample instanceof vP&&QP.applyMatrix4(WP.copy(this.objectForSample.matrixWorld).invert())),QP.applyMatrix4(this.object.hiddenMatrix.clone().invert()),g.position.copy(QP),YP.fromArray(p);let v="normal"===t.align?ZP:this.object.getWorldDirection(JP),y=XP.fromArray(t.position);XP.x+=XP.x+a(l,wP(o,r.position[0])),XP.y+=XP.y+a(l,wP(o,r.position[1])),XP.z+=XP.z+a(l,wP(o,r.position[2]));let x=Math.acos(v.dot(YP)),b=KP.crossVectors(YP,v).normalize(),w=qP.makeRotationAxis(b,x),_=v.clone().cross(this.object.up).normalize(),S=_.clone().cross(v).normalize(),A=(new Er).makeBasis(_,v,S),M=new Zi(YP.y,YP.z,YP.x).normalize(),E=M.clone().cross(YP).normalize(),C=(new Er).makeBasis(M,YP,E).invert(),T=(new Er).multiplyMatrices(A,C);g.rotation.setFromRotationMatrix(T),y.applyMatrix4(w),g.position.add(y),g.rotation.x=g.rotation.x+i.x+h,g.rotation.y=g.rotation.y+i.y+c,g.rotation.z=g.rotation.z+i.z+f,g.scale.setScalar(1),g.scale.x=g.scale.x+t.scale[0]+a(l,wP(o,r.scale[0]))||jP,g.scale.y=g.scale.y+t.scale[1]+a(l,wP(o,r.scale[1]))||jP,g.scale.z=g.scale.z+t.scale[2]+a(l,wP(o,r.scale[2]))||jP,g.scale.multiply(this.object.scale),g.hiddenMatrix=this.object.hiddenMatrix}}getSubdivData(){if(!this.objectForSample)return[];let e=this.parameters.toObject.spreadType;if("random"===e)return[];if(this.objectForSample instanceof vP){let t=this.objectForSample,i=xP[e],r=UP[i],n=NP[i],s=FP[i],a=[],o=r(t.subdivPointerNew);for(let e=0;e<=o-1;e++){let i=n(t.subdivPointerNew,e),r=s(t.subdivPointerNew,e);GP.fromArray(i).applyMatrix4(t.matrixWorld),HP.fromArray(r),a.push({pos:GP.toArray(),norm:HP.toArray()})}return a}return(this.objectForSample.geometry.index?function(e){let t=[];for(let i=0;i<=e.index.count;i++)if(TP.fromArray(e.index.array,3*i),CP.setFromAttributeAndIndices(e.attributes.position,TP.x,TP.y,TP.z),CP.getNormal(DP),CP.getMidpoint(PP),!(isNaN(PP.x)||isNaN(PP.y)||isNaN(PP.z))){let{a:e,b:i,c:r}=CP,n=e.toArray(),s=i.toArray(),a=r.toArray(),o=e.distanceTo(i),l=i.distanceTo(r),h=r.distanceTo(e),c=EP(n,s),d=EP(s,a),u=EP(a,n),p=[o,l,h],f=Math.max(...p),m=p.filter((e=>Math.round(e)===Math.round(f))).length>1,g=[],v=CP.getMidpoint(PP).toArray();f===o&&!m&&(g=[d,u,u],v=c),f===l&&!m&&(g=[c,u,u],v=d),f===h&&!m&&(g=[c,d,d],v=u),m&&(g=[c,d,u]),t.push({vertices:[n,s,a],faceCenters:g,midpoint:v,norm:CP.getNormal(DP).toArray()})}return t}(this.objectForSample.geometry):function(e){let t=[],{position:i}=e.attributes;for(let r=0;r"polygon_center"===e?{pos:t.midpoint,norm:t.norm}:"vertex"===e?[{pos:t.vertices[0],norm:t.norm},{pos:t.vertices[1],norm:t.norm},{pos:t.vertices[2],norm:t.norm}]:"edge"===e?[{pos:t.faceCenters[0],norm:t.norm},{pos:t.faceCenters[1],norm:t.norm},{pos:t.faceCenters[2],norm:t.norm}]:[])).flat()}updateState(e,t){if(this.parameters=Fm(e),"toObject"!==this.parameters.type)(null===this.parent||this.parent!==this.object)&&(this.removeFromParent(),this.object.parent?.add(this),this.matrix=this.object.matrix,this.hiddenMatrix=this.object.hiddenMatrix,this.matrixWorldNeedsUpdate=!0,this.matrixAutoUpdate=!1);else if(null===this.parent||this.parent.uuid!==this.parameters.toObject.object){this.removeFromParent();let e=t.find(this.parameters.toObject.object);this.objectForSample=e instanceof $E?e:void 0,this.matrix=new Er,this.hiddenMatrix=new Er,this.matrixWorldNeedsUpdate=!0,this.matrixAutoUpdate=!1,e&&e.add(this)}this.update()}get pendingMediaLoad(){return this._pendingMediaLoad}},tI=e=>{var t;return(t=class extends e{}).geometryHelper=new jn(30,30,30),t},iI=new Mr,rI=new vr,nI=new Er,sI=(e,t,i,r,n=!1)=>{let s=t,a=e.matrixWorld;if(null===s.boundingSphere&&s.computeBoundingSphere(),rI.copy(s.boundingSphere),rI.applyMatrix4(a),!1===i.ray.intersectsSphere(rI)||(nI.copy(a).invert(),iI.copy(i.ray).applyMatrix4(nI),null!==s.boundingBox&&!1===iI.intersectsBox(s.boundingBox)))return;let o,l,h,c,d,u,p=s.index,f=s.attributes.position,m=s.drawRange;if(!1===n){for(d=Math.max(0,m.start),u=Math.min(p.count,m.start+m.count);dd)continue;l.applyMatrix4(e.matrixWorld);let h=i.ray.origin.distanceTo(l);hi.far||r.push({distance:h,point:o.clone().applyMatrix4(e.matrixWorld),object:e})}}function g(e,t,i,r,n,s,a){let o=new Zi,l=new Zi,h=new Zi,c=new Zi,d=new Zi;if(o.fromBufferAttribute(r,n),l.fromBufferAttribute(r,s),h.fromBufferAttribute(r,a),null===i.intersectTriangle(o,l,h,!1,c))return null;d.copy(c),d.applyMatrix4(e.matrixWorld);let u=t.ray.origin.distanceTo(d);return ut.far?null:{faceIndex:1,distance:u,point:d.clone(),object:e}}},aI=new Zi,oI=new Xn,lI=class extends hl{constructor(e){let t=new En,i=new el({color:16777215,vertexColors:!0,toneMapped:!1}),r=[],n=[],s={},a=new Ni(15711266),o=new Ni(15711266),l=new Ni(2857471);function h(e,t,i){c(e,i),c(t,i)}function c(e,t){r.push(0,0,0),n.push(t.r,t.g,t.b),void 0===s[e]&&(s[e]=[]),s[e].push(r.length/3-1)}h("n1","n2",a),h("n2","n4",a),h("n4","n3",a),h("n3","n1",a),h("f1","f2",a),h("f2","f4",a),h("f4","f3",a),h("f3","f1",a),h("n1","f1",a),h("n2","f2",a),h("n3","f3",a),h("n4","f4",a),h("p","n1",o),h("p","n2",o),h("p","n3",o),h("p","n4",o),h("u1","u2",l),h("u2","u3",l),h("u3","u1",l),t.setAttribute("position",new yn(r,3)),t.setAttribute("color",new yn(n,3)),super(t,i),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=s,this.update()}update(){let e=this.geometry,t=this.pointMap;oI.projectionMatrixInverse.elements=[.5112609807824982,-0,-0,-0,-0,.41421356237309503,-0,-0,-0,-0,-0,-.099999,-0,-0,-1.0000000000000002,.100001];let i=.8;hI("n1",t,e,oI,-1,-1,i),hI("n2",t,e,oI,1,-1,i),hI("n3",t,e,oI,-1,1,i),hI("n4",t,e,oI,1,1,i);let r=i;hI("f1",t,e,oI,-1,-1,r),hI("f2",t,e,oI,1,-1,r),hI("f3",t,e,oI,-1,1,r),hI("f4",t,e,oI,1,1,r);hI("u1",t,e,oI,.35,1.1,.8),hI("u2",t,e,oI,-.35,1.1,.8),hI("u3",t,e,oI,0,1.55,.8),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}};function hI(e,t,i,r,n,s,a){aI.set(n,s,a).unproject(r);let o=t[e];if(void 0!==o){let e=i.getAttribute("position");for(let t=0,i=o.length;t{e.is=e=>"objectHelper"in e})(cI||(cI={}));var uI=(e,t)=>class extends(US(e)){constructor(){super(...arguments),this.objectHelper=new t(this),this.gizmos={}}get geometryHelper(){return t.geometryHelper}raycast(e,t){this.objectHelper.raycast(e,t)}showGizmos(){for(let e in this.gizmos){let t=this.gizmos[e];t instanceof Vc&&(t.visible=!0)}}updateEntityBoxSize(e,t){this.objectHelper.visible&&this.geometryHelper instanceof jn?(e.setScalar(0),t.set(this.geometryHelper.parameters.width,this.geometryHelper.parameters.height,this.geometryHelper.parameters.height).multiplyScalar(.5)):super.updateEntityBoxSize(e,t)}hideGizmos(){for(let e in this.gizmos){let t=this.gizmos[e];t instanceof Vc&&(t.visible=!1)}}},pI=new Zi,fI=new Zi,mI=new Qi,gI=new Zi,vI=new Zi,yI=new Zi,xI=class extends(uI(Xn,dI)){constructor(e="",t={...Hb.defaultData,name:""}){super(),this._cameraType="OrthographicCamera",this.targetOffset=Xx.DefaultTargetOffset,this.isUpVectorFlipped=!1,this.angleOffsetFromUp=0,this.wasMovedByUser=!1,this.wasMovedBySwitchCameraAction=!1,this.super_Entity(e,t),this.previousProjectionMatrix=new Er,this.matrixAutoUpdate=!0,this.width=window.innerWidth,this.height=window.innerHeight;let i=this.width,r=this.height;this.orthoCamera=new bs(-.5*i,.5*i,.5*r,-.5*r,-5e4,1e4),this.perspCamera=new Qn(45,i/r,50,1e4),this.left=this.orthoCamera.left,this.right=this.orthoCamera.right,this.top=this.orthoCamera.top,this.bottom=this.orthoCamera.bottom,this.far=this.orthoCamera.far,this.view=this.orthoCamera.view,this.aspect=this.perspCamera.aspect,this.focus=this.perspCamera.focus,this.filmGauge=this.perspCamera.filmGauge,this.filmOffset=this.perspCamera.filmOffset,this.objectHelper.update()}get isPerspectiveCamera(){return"PerspectiveCamera"===this.cameraType}get isOrthographicCamera(){return!this.isPerspectiveCamera}get cameraType(){return this._cameraType}set fov(e){this.perspCamera.fov=e}get fov(){return this.perspCamera.fov}setNear(e,t){"PerspectiveCamera"===e?this.perspCamera.near=t:this.orthoCamera.near=t}setZoom(e,t){t>=0&&("PerspectiveCamera"===e?this.perspCamera.zoom=t:this.orthoCamera.zoom=t)}set cameraType(e){"PerspectiveCamera"===e?this.toPerspective():"OrthographicCamera"===e&&this.toOrthographic()}get near(){return"PerspectiveCamera"===this._cameraType?this.perspCamera.near:this.orthoCamera.near}set near(e){"PerspectiveCamera"===this._cameraType?this.perspCamera.near=e:this.orthoCamera.near=e}get zoom(){return"PerspectiveCamera"===this._cameraType?this.perspCamera.zoom:this.orthoCamera.zoom}set zoom(e){e>=0&&("PerspectiveCamera"===this._cameraType?this.perspCamera.zoom=e:this.orthoCamera.zoom=e)}lookAt(e,t,i){"number"==typeof e&&(e=new Zi(e,t,i)),super.lookAt(e),this.getWorldPosition(pI),this.targetOffset=pI.distanceTo(e)}getTarget(e=new Zi){return this.getWorldDirection(fI),this.getWorldPosition(pI),fI.multiplyScalar(this.targetOffset),e.copy(pI).add(fI),e}getDistanceToTarget(){let e=this.getTarget();return this.getWorldPosition(pI),pI.distanceTo(e)}updateUp(){this.getWorldQuaternion(mI),gI.set(0,0,1).applyQuaternion(mI),vI.copy(Kr.DEFAULT_UP),this.isUpVectorFlipped&&vI.negate(),vI.applyQuaternion(mI),yI.copy(Kr.DEFAULT_UP).projectOnPlane(gI),this.angleOffsetFromUp=yI.angleTo(vI),this.angleOffsetFromUp*=yI.cross(vI).dot(gI)>=0?1:-1}updateTransformState(e,t){let i=super.updateTransformState(e,t);return void 0!==e.isUpVectorFlipped&&(this.isUpVectorFlipped=e.isUpVectorFlipped),this.updateUp(),i}getViewFrontToObject(e){let t=e.getWorldPosition(new Zi),i=e.getWorldDirection(new Zi).multiplyScalar(this.targetOffset);return{position:t.clone().add(i),target:t}}getViewToTarget(e){let t=this.getWorldDirection(new Zi).multiplyScalar(this.targetOffset);return{position:e.clone().sub(t),target:e}}getViewToObject(e){let t=new Zi;e.getWorldPosition(t);return this.getViewToTarget(t)}setViewplaneSize(e,t,i=!1){if(this.aspect=e/t,i){let i=e>t?this.aspect:1,r=e>t?1:this.aspect;this.left=-395*i,this.right=395*i,this.top=1/r*395,this.bottom=1/r*-395}else this.left=.5*-e,this.right=.5*e,this.top=.5*t,this.bottom=.5*-t;this.updateProjectionMatrix()}copyViewPlaneSize(e){this.aspect=e.aspect,this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.updateProjectionMatrix()}toOrthographic(){this.orthoCamera.left=this.left,this.orthoCamera.right=this.right,this.orthoCamera.top=this.top,this.orthoCamera.bottom=this.bottom,this.orthoCamera.view=this.view,this.orthoCamera.far=this.far,this.orthoCamera.updateProjectionMatrix(),this.projectionMatrix=this.orthoCamera.projectionMatrix,this.projectionMatrixInverse=this.orthoCamera.projectionMatrixInverse,this._cameraType="OrthographicCamera",this.objectHelper&&this.objectHelper.update()}toPerspective(){this.perspCamera.aspect=this.aspect,this.perspCamera.fov=this.fov,this.perspCamera.view=this.view,this.perspCamera.far=this.far,this.perspCamera.updateProjectionMatrix(),this.projectionMatrix=this.perspCamera.projectionMatrix,this.projectionMatrixInverse=this.perspCamera.projectionMatrixInverse,this._cameraType="PerspectiveCamera",this.objectHelper&&this.objectHelper.update()}setFocalLength(e){this.perspCamera.setFocalLength(e),this.toPerspective()}getFocalLength(){return this.perspCamera.getFocalLength()}getEffectiveFOV(){return this.perspCamera.getEffectiveFOV()}getFilmWidth(){return this.perspCamera.getFilmWidth()}getFilmHeight(){return this.perspCamera.getFilmHeight()}setViewOffset(e,t,i,r,n,s){"PerspectiveCamera"===this._cameraType?this.perspCamera.setViewOffset(e,t,i,r,n,s):this.orthoCamera.setViewOffset(e,t,i,r,n,s)}clearViewOffset(){"PerspectiveCamera"===this._cameraType?(this.perspCamera.clearViewOffset(),this.toPerspective()):(this.orthoCamera.clearViewOffset(),this.toOrthographic())}copyHistory(){this.previousProjectionMatrix&&this.previousProjectionMatrix.copy(this.projectionMatrix)}updateProjectionMatrix(){"PerspectiveCamera"===this._cameraType?this.toPerspective():"OrthographicCamera"===this._cameraType&&this.toOrthographic()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}copy(e,t){return super.copy(e,t),this.parent=e.parent,this.orthoCamera.copy(e.orthoCamera),this.perspCamera.copy(e.perspCamera),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.far=e.far,this.view=null===e.view?null:Object.assign({},e.view),this._cameraType=e._cameraType,this.aspect=e.aspect,this.fov=e.fov,this.focus=e.focus,this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this.targetOffset=e.targetOffset,this.updateProjectionMatrix(),this}toCameraState(e=[]){let t={type:this.cameraType,far:this.far,orthographic:{near:this.orthoCamera.near,zoom:this.orthoCamera.zoom},perspective:{near:this.perspCamera.near,fov:this.perspCamera.fov,zoom:this.perspCamera.zoom},up:this.up.toArray(),targetOffset:this.targetOffset,isUpVectorFlipped:this.isUpVectorFlipped};return xg(t,e)}updateCameraSubtype(e,t){let i="perspective"===e?"PerspectiveCamera":"OrthographicCamera";void 0!==t.zoom&&this.setZoom(i,t.zoom),void 0!==t.near&&this.setNear(i,t.near),void 0!==t.fov&&"PerspectiveCamera"===i&&(this.fov=t.fov)}updateState(e,t){this.updateCameraState(e,t)}updateCameraState(e,t){this.updateState_Entity(e,t),void 0!==e.far&&(this.far=e.far),void 0!==e.orthographic&&this.updateCameraSubtype("orthographic",e.orthographic),void 0!==e.perspective&&this.updateCameraSubtype("perspective",e.perspective),void 0!==e.type&&(this.cameraType=e.type),void 0!==e.up&&this.up.fromArray(e.up),void 0!==e.targetOffset&&(this.targetOffset=e.targetOffset),void 0!==e.isUpVectorFlipped&&(this.isUpVectorFlipped=e.isUpVectorFlipped),this.updateProjectionMatrix()}updateByPatchedOp(e,t,i){super.updateByPatchedOp(e,t,i),1===e.path.length&&0===e.type&&this.updateCameraSubtype(e.path[0],e.props)}toState(e){return{...super.toState(e),...this.toCameraState(e),type:this.cameraType}}},bI=new Er,wI=new Er,_I=new Er,SI=new Zi,AI=new Zi;function MI(e){let t=!1;return e.scene.objects.traverse(((e,i)=>{"BooleanGeometry"===i.geometry?.type&&(t=!0)})),t}var EI,CI=class extends sP{constructor(e,t,i){super(e,t),this.data=t,this.meshSetAddresses=[],this.needsTransformForDownstream=!1,this.geometry=new En,this.onAfterRender=(e,t,i,r,n,s)=>{super.onAfterRender(e,t,i,r,n,s),this.recomputeBoolean()},this.geometry.userData.parameters={width:0,height:0,depth:0}}get booleanOp(){return this.data.geometry.operation}get phongAngle(){return this.data.geometry.phongAngle??45}get isLOD(){return this.recomputeBoolean(),!1}updateByPatchedOp(e,t,i){super.updateByPatchedOp(e,t,i),1===e.path.length&&"geometry"===e.path[0]&&0===e.type&&void 0!==e.props.operation&&(this.freeBooleanPointer(),this.resetBBoxNeedsUpdate())}freeBooleanPointer(){super.freeBooleanPointer(),this.geometry.dispose()}recomputeBoolean(e,t=!0){if(-1!==this.booleanMeshSetAddress&&!e)return;for(let n=0;n0&&i.geometry.drawRange.count>0){if(bI.multiplyMatrices(i.hiddenMatrix,i.matrix),-1===i.booleanMeshSetAddress){if((i.geometry.index??i.geometry.getAttribute("position")).count/3<15e5&&(i.booleanMeshSetAddress=BE.getMeshSet(i.geometry,!0===e,t)),-1===i.booleanMeshSetAddress)return;BE.transformMeshSet(i.booleanMeshSetAddress,bI),i.booleanMatrixInvOld.copy(bI).invert(),i.booleanWasTransformed=!1}else i instanceof CI&&!0===i.needsTransformForDownstream?(BE.transformMeshSet(i.booleanMeshSetAddress,bI),i.needsTransformForDownstream=!1):!0===i.booleanWasTransformed&&(BE.transformMeshSet(i.booleanMeshSetAddress,wI.multiplyMatrices(bI,i.booleanMatrixInvOld)),i.booleanMatrixInvOld.copy(bI).invert(),i.booleanWasTransformed=!1);!1===BE.hasOpenEdges(i.booleanMeshSetAddress)||n===this.children.length-1&&2===this.booleanOp?(this.meshSetAddresses.push(i.booleanMeshSetAddress),i.geometry.userData.wasFilteredFromBoolean=!1):i.geometry.userData.wasFilteredFromBoolean=!0}}if(0===this.meshSetAddresses.length)return this.geometry.setAttribute("position",new yn([],0)),void this.geometry.setDrawRange(0,0);if(!0===e)return BE.calcBooleanTopological(this.meshSetAddresses,this.booleanOp);let i=this.geometry;i.dispose(),this.geometry=new En,this.geometry.userData=i.userData,this.geometry.boundingSphere=i.boundingSphere;try{this.booleanMeshSetAddress=BE.calcBoolean(this.meshSetAddresses,this.booleanOp,this.geometry,this.phongAngle)}catch(r){this.booleanMeshSetAddress=0,console.error(r)}this.booleanMatrixInvOld.copy(this.matrix).invert(),this.needsTransformForDownstream=!0,uP(this),pP(this)}dispose(){super.dispose(),this.geometry.dispose()}get recursiveBBox(){let e=super.recursiveBBox;return-1===this.geometry.boundingSphere?.radius&&(e.getCenter(this.geometry.boundingSphere.center),_I.copy(this.matrixWorld).invert(),this.geometry.boundingSphere.center.applyMatrix4(_I),SI.copy(e.max).applyMatrix4(_I),AI.copy(e.min).applyMatrix4(_I),this.geometry.boundingSphere.radius=SI.distanceTo(AI)/2),e}};(e=>{e.is=function(e){return vS.is(e)&&e instanceof Uh}})(EI||(EI={}));var TI=(e,t)=>class extends(uI(e,t)){updateState_Light(e,t){this.updateState_Entity(e,t),void 0!==e.color&&(this.color=t.shared.color(e.color)),void 0!==e.intensity&&(this.intensity=e.intensity),void 0!==e.depth&&(this.shadow.camera.far=e.depth,this.shadow.needsUpdate=!0),void 0!==e.shadows&&(this.castShadow=e.shadows)}},DI=e=>e instanceof $E,PI=e=>null!==e&&e instanceof CI,II=e=>cI.is(e),OI=class extends(tI(jc)){constructor(e,t=15){super(t),this.object=e,this.object.updateMatrixWorld(),this.name=`EmptyObjectHelper: ${e.uuid}`,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.object.isBone&&(this.visible=!1)}raycast(e,t){sI(this.object,OI.geometryHelper,e,t)}update(){}},RI=class extends(uI(Bo,OI)){constructor(e,t){super(),this.super_Entity(e,t),this.objectHelper.update()}updateState(e,t){this.updateState_Entity(e,t),"buffer"in e&&1===Object.keys(e).length&&t.scene.reloadSplats()}},LI=0,BI=1,zI="varying vec2 vUv;void main(){vUv=position.xy*0.5+0.5;gl_Position=vec4(position.xy,1.0,1.0);}",kI=class extends Yn{constructor(e=!1,t=!1){super({name:"BokehMaterial",defines:{PASS:e?"2":"1"},uniforms:{kernel64:new bc(null),kernel16:new bc(null),inputBuffer:new bc(null),cocBuffer:new bc(null),texelSize:new bc(new wi),scale:new bc(1)},blending:G,depthWrite:!1,depthTest:!1,fragmentShader:"#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D inputBuffer;\n#else\nuniform lowp sampler2D inputBuffer;\n#endif\nuniform lowp sampler2D cocBuffer;uniform vec2 texelSize;uniform float scale;\n#if PASS == 1\nuniform vec4 kernel64[32];\n#else\nuniform vec4 kernel16[8];\n#endif\nvarying vec2 vUv;void main(){\n#ifdef FOREGROUND\nvec2 CoCNearFar=texture2D(cocBuffer,vUv).rg;float CoC=CoCNearFar.r*scale;\n#else\nfloat CoC=texture2D(cocBuffer,vUv).g*scale;\n#endif\nif(CoC==0.0){gl_FragColor=texture2D(inputBuffer,vUv);}else{\n#ifdef FOREGROUND\nvec2 step=texelSize*max(CoC,CoCNearFar.g*scale);\n#else\nvec2 step=texelSize*CoC;\n#endif\n#if PASS == 1\nvec4 acc=vec4(0.0);for(int i=0;i<32;++i){vec4 kernel=kernel64[i];vec2 uv=step*kernel.xy+vUv;acc+=texture2D(inputBuffer,uv);uv=step*kernel.zw+vUv;acc+=texture2D(inputBuffer,uv);}gl_FragColor=acc/64.0;\n#else\nvec4 maxValue=texture2D(inputBuffer,vUv);for(int i=0;i<8;++i){vec4 kernel=kernel16[i];vec2 uv=step*kernel.xy+vUv;maxValue=max(texture2D(inputBuffer,uv),maxValue);uv=step*kernel.zw+vUv;maxValue=max(texture2D(inputBuffer,uv),maxValue);}gl_FragColor=maxValue;\n#endif\n}}",vertexShader:zI}),this.toneMapped=!1,t&&(this.defines.FOREGROUND="1"),this.generateKernel()}set inputBuffer(e){this.uniforms.inputBuffer.value=e}setInputBuffer(e){this.uniforms.inputBuffer.value=e}set cocBuffer(e){this.uniforms.cocBuffer.value=e}setCoCBuffer(e){this.uniforms.cocBuffer.value=e}get scale(){return this.uniforms.scale.value}set scale(e){this.uniforms.scale.value=e}getScale(e){return this.uniforms.scale.value=e}setScale(e){this.uniforms.scale.value=e}generateKernel(){let e=new Float32Array(128),t=new Float32Array(32),i=0,r=0;for(let a=0;a<80;++a){let n=2.39996323*a,s=Math.sqrt(a)/Math.sqrt(80),o=s*Math.cos(n),l=s*Math.sin(n);a%5==0?(t[r++]=o,t[r++]=l):(e[i++]=o,e[i++]=l)}let n=[],s=[];for(let a=0;a<128;)n.push(new Wi(e[a++],e[a++],e[a++],e[a++]));for(let a=0;a<32;)s.push(new Wi(t[a++],t[a++],t[a++],t[a++]));this.uniforms.kernel64.value=n,this.uniforms.kernel16.value=s}setTexelSize(e,t){this.uniforms.texelSize.value.set(e,t)}setSize(e,t){this.uniforms.texelSize.value.set(1/e,1/t)}};function NI(e,t,i){return e*(t-i)-t}function FI(e,t,i){return Math.min(Math.max((e+t)/(t-i),0),1)}var UI=class extends Yn{constructor(e){super({name:"CircleOfConfusionMaterial",defines:{DEPTH_PACKING:"0"},uniforms:{depthBuffer:new bc(null),focusDistance:new bc(0),focusRange:new bc(0),cameraNear:new bc(.3),cameraFar:new bc(1e3)},blending:G,depthWrite:!1,depthTest:!1,fragmentShader:"#include \n#include \n#ifdef GL_FRAGMENT_PRECISION_HIGH\nuniform highp sampler2D depthBuffer;\n#else\nuniform mediump sampler2D depthBuffer;\n#endif\nuniform float focusDistance;uniform float focusRange;uniform float cameraNear;uniform float cameraFar;varying vec2 vUv;float readDepth(const in vec2 uv){\n#if DEPTH_PACKING == 3201\nreturn unpackRGBAToDepth(texture2D(depthBuffer,uv));\n#else\nreturn texture2D(depthBuffer,uv).r;\n#endif\n}void main(){float depth=readDepth(vUv);\n#ifdef PERSPECTIVE_CAMERA\nfloat viewZ=perspectiveDepthToViewZ(depth,cameraNear,cameraFar);float linearDepth=viewZToOrthographicDepth(viewZ,cameraNear,cameraFar);\n#else\nfloat linearDepth=depth;\n#endif\nfloat signedDistance=linearDepth-focusDistance;float magnitude=smoothstep(0.0,focusRange,abs(signedDistance));gl_FragColor.rg=magnitude*vec2(step(signedDistance,0.0),step(0.0,signedDistance));}",vertexShader:zI}),this.toneMapped=!1,this.uniforms.focalLength=this.uniforms.focusRange,this.adoptCameraSettings(e)}get near(){return this.uniforms.cameraNear.value}get far(){return this.uniforms.cameraFar.value}set depthBuffer(e){this.uniforms.depthBuffer.value=e}set depthPacking(e){this.defines.DEPTH_PACKING=e.toFixed(0),this.needsUpdate=!0}setDepthBuffer(e,t=Zt){this.depthBuffer=e,this.depthPacking=t}get focusDistance(){return this.uniforms.focusDistance.value}set focusDistance(e){this.uniforms.focusDistance.value=e}get worldFocusDistance(){return-NI(this.focusDistance,this.near,this.far)}set worldFocusDistance(e){this.focusDistance=FI(-e,this.near,this.far)}getFocusDistance(e){this.uniforms.focusDistance.value=e}setFocusDistance(e){this.uniforms.focusDistance.value=e}get focalLength(){return this.focusRange}set focalLength(e){this.focusRange=e}get focusRange(){return this.uniforms.focusRange.value}set focusRange(e){this.uniforms.focusRange.value=e}get worldFocusRange(){return-NI(this.focusRange,this.near,this.far)}set worldFocusRange(e){this.focusRange=FI(-e,this.near,this.far)}getFocalLength(e){return this.focusRange}setFocalLength(e){this.focusRange=e}adoptCameraSettings(e){e&&(this.uniforms.cameraNear.value=e.near,this.uniforms.cameraFar.value=e.far,e instanceof Qn?this.defines.PERSPECTIVE_CAMERA="1":delete this.defines.PERSPECTIVE_CAMERA,this.needsUpdate=!0)}},VI=class extends Yn{constructor(e=new wi){super({name:"KawaseBlurMaterial",uniforms:{inputBuffer:new bc(null),texelSize:new bc(new wi),halfTexelSize:new bc(new wi),kernel:new bc(0),scale:new bc(1)},blending:G,depthWrite:!1,depthTest:!1,fragmentShader:"#include \n#include \n#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D inputBuffer;\n#else\nuniform lowp sampler2D inputBuffer;\n#endif\nvarying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;void main(){vec4 sum=texture2D(inputBuffer,vUv0);sum+=texture2D(inputBuffer,vUv1);sum+=texture2D(inputBuffer,vUv2);sum+=texture2D(inputBuffer,vUv3);gl_FragColor=sum*0.25;\n#include \n#include \n}",vertexShader:"uniform vec2 texelSize;uniform vec2 halfTexelSize;uniform float kernel;uniform float scale;varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;void main(){vec2 uv=position.xy*0.5+0.5;vec2 dUv=(texelSize*vec2(kernel)+halfTexelSize)*scale;vUv0=vec2(uv.x-dUv.x,uv.y+dUv.y);vUv1=vec2(uv.x+dUv.x,uv.y+dUv.y);vUv2=vec2(uv.x+dUv.x,uv.y-dUv.y);vUv3=vec2(uv.x-dUv.x,uv.y-dUv.y);gl_Position=vec4(position.xy,1.0,1.0);}"}),this.toneMapped=!1,this.setTexelSize(e.x,e.y)}set inputBuffer(e){this.uniforms.inputBuffer.value=e}setInputBuffer(e){this.inputBuffer=e}get scale(){return this.uniforms.scale.value}set scale(e){this.uniforms.scale.value=e}getScale(){return this.uniforms.scale.value}setScale(e){this.uniforms.scale.value=e}getKernel(){return null}get kernel(){return this.uniforms.kernel.value}set kernel(e){this.uniforms.kernel.value=e}setKernel(e){this.kernel=e}setTexelSize(e,t){this.uniforms.texelSize.value.set(e,t),this.uniforms.halfTexelSize.value.set(e,t).multiplyScalar(.5)}setSize(e,t){let i=this.uniforms;i.texelSize.value.set(1/e,1/t),i.halfTexelSize.value.copy(i.texelSize.value).multiplyScalar(.5)}},jI=class extends Yn{constructor(){super({name:"CopyMaterial",uniforms:{inputBuffer:new bc(null),opacity:new bc(1)},blending:G,depthWrite:!1,depthTest:!1,fragmentShader:"#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D inputBuffer;\n#else\nuniform lowp sampler2D inputBuffer;\n#endif\nuniform float opacity;varying vec2 vUv;void main(){vec4 texel=texture2D(inputBuffer,vUv);gl_FragColor=opacity*texel;\n#include \n}",vertexShader:zI}),this.toneMapped=!1}set inputBuffer(e){this.uniforms.inputBuffer.value=e}setInputBuffer(e){this.uniforms.inputBuffer.value=e}getOpacity(e){return this.uniforms.opacity.value}setOpacity(e){this.uniforms.opacity.value=e}},GI=2,HI=0,WI=class extends Yn{constructor(e=new wi,t=GI){super({name:"EdgeDetectionMaterial",defines:{THREE_REVISION:D.replace(/\D+/g,""),LOCAL_CONTRAST_ADAPTATION_FACTOR:"2.0",EDGE_THRESHOLD:"0.1",DEPTH_THRESHOLD:"0.01",PREDICATION_MODE:"0",PREDICATION_THRESHOLD:"0.01",PREDICATION_SCALE:"2.0",PREDICATION_STRENGTH:"1.0",DEPTH_PACKING:"0"},uniforms:{inputBuffer:new bc(null),depthBuffer:new bc(null),predicationBuffer:new bc(null),texelSize:new bc(e)},blending:G,depthWrite:!1,depthTest:!1,fragmentShader:"varying vec2 vUv;varying vec2 vUv0;varying vec2 vUv1;\n#if THREE_REVISION < 143\n#define luminance(v) linearToRelativeLuminance(v)\n#endif\n#if EDGE_DETECTION_MODE != 0\nvarying vec2 vUv2;varying vec2 vUv3;varying vec2 vUv4;varying vec2 vUv5;\n#endif\n#if EDGE_DETECTION_MODE == 1\n#include \n#endif\n#if EDGE_DETECTION_MODE == 0 || PREDICATION_MODE == 1\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nuniform highp sampler2D depthBuffer;\n#else\nuniform mediump sampler2D depthBuffer;\n#endif\nfloat readDepth(const in vec2 uv){\n#if DEPTH_PACKING == 3201\nreturn unpackRGBAToDepth(texture2D(depthBuffer,uv));\n#else\nreturn texture2D(depthBuffer,uv).r;\n#endif\n}vec3 gatherNeighbors(){float p=readDepth(vUv);float pLeft=readDepth(vUv0);float pTop=readDepth(vUv1);return vec3(p,pLeft,pTop);}\n#elif PREDICATION_MODE == 2\nuniform sampler2D predicationBuffer;vec3 gatherNeighbors(){float p=texture2D(predicationBuffer,vUv).r;float pLeft=texture2D(predicationBuffer,vUv0).r;float pTop=texture2D(predicationBuffer,vUv1).r;return vec3(p,pLeft,pTop);}\n#endif\n#if PREDICATION_MODE != 0\nvec2 calculatePredicatedThreshold(){vec3 neighbours=gatherNeighbors();vec2 delta=abs(neighbours.xx-neighbours.yz);vec2 edges=step(PREDICATION_THRESHOLD,delta);return PREDICATION_SCALE*EDGE_THRESHOLD*(1.0-PREDICATION_STRENGTH*edges);}\n#endif\n#if EDGE_DETECTION_MODE != 0\nuniform sampler2D inputBuffer;\n#endif\nvoid main(){\n#if EDGE_DETECTION_MODE == 0\nconst vec2 threshold=vec2(DEPTH_THRESHOLD);\n#elif PREDICATION_MODE != 0\nvec2 threshold=calculatePredicatedThreshold();\n#else\nconst vec2 threshold=vec2(EDGE_THRESHOLD);\n#endif\n#if EDGE_DETECTION_MODE == 0\nvec3 neighbors=gatherNeighbors();vec2 delta=abs(neighbors.xx-vec2(neighbors.y,neighbors.z));vec2 edges=step(threshold,delta);if(dot(edges,vec2(1.0))==0.0){discard;}gl_FragColor=vec4(edges,0.0,1.0);\n#elif EDGE_DETECTION_MODE == 1\nfloat l=luminance(texture2D(inputBuffer,vUv).rgb);float lLeft=luminance(texture2D(inputBuffer,vUv0).rgb);float lTop=luminance(texture2D(inputBuffer,vUv1).rgb);vec4 delta;delta.xy=abs(l-vec2(lLeft,lTop));vec2 edges=step(threshold,delta.xy);if(dot(edges,vec2(1.0))==0.0){discard;}float lRight=luminance(texture2D(inputBuffer,vUv2).rgb);float lBottom=luminance(texture2D(inputBuffer,vUv3).rgb);delta.zw=abs(l-vec2(lRight,lBottom));vec2 maxDelta=max(delta.xy,delta.zw);float lLeftLeft=luminance(texture2D(inputBuffer,vUv4).rgb);float lTopTop=luminance(texture2D(inputBuffer,vUv5).rgb);delta.zw=abs(vec2(lLeft,lTop)-vec2(lLeftLeft,lTopTop));maxDelta=max(maxDelta.xy,delta.zw);float finalDelta=max(maxDelta.x,maxDelta.y);edges.xy*=step(finalDelta,LOCAL_CONTRAST_ADAPTATION_FACTOR*delta.xy);gl_FragColor=vec4(edges,0.0,1.0);\n#elif EDGE_DETECTION_MODE == 2\nvec4 delta;vec3 c=texture2D(inputBuffer,vUv).rgb;vec3 cLeft=texture2D(inputBuffer,vUv0).rgb;vec3 t=abs(c-cLeft);delta.x=max(max(t.r,t.g),t.b);vec3 cTop=texture2D(inputBuffer,vUv1).rgb;t=abs(c-cTop);delta.y=max(max(t.r,t.g),t.b);vec2 edges=step(threshold,delta.xy);if(dot(edges,vec2(1.0))==0.0){discard;}vec3 cRight=texture2D(inputBuffer,vUv2).rgb;t=abs(c-cRight);delta.z=max(max(t.r,t.g),t.b);vec3 cBottom=texture2D(inputBuffer,vUv3).rgb;t=abs(c-cBottom);delta.w=max(max(t.r,t.g),t.b);vec2 maxDelta=max(delta.xy,delta.zw);vec3 cLeftLeft=texture2D(inputBuffer,vUv4).rgb;t=abs(c-cLeftLeft);delta.z=max(max(t.r,t.g),t.b);vec3 cTopTop=texture2D(inputBuffer,vUv5).rgb;t=abs(c-cTopTop);delta.w=max(max(t.r,t.g),t.b);maxDelta=max(maxDelta.xy,delta.zw);float finalDelta=max(maxDelta.x,maxDelta.y);edges*=step(finalDelta,LOCAL_CONTRAST_ADAPTATION_FACTOR*delta.xy);gl_FragColor=vec4(edges,0.0,1.0);\n#endif\n}",vertexShader:"uniform vec2 texelSize;varying vec2 vUv;varying vec2 vUv0;varying vec2 vUv1;\n#if EDGE_DETECTION_MODE != 0\nvarying vec2 vUv2;varying vec2 vUv3;varying vec2 vUv4;varying vec2 vUv5;\n#endif\nvoid main(){vUv=position.xy*0.5+0.5;vUv0=vUv+texelSize*vec2(-1.0,0.0);vUv1=vUv+texelSize*vec2(0.0,-1.0);\n#if EDGE_DETECTION_MODE != 0\nvUv2=vUv+texelSize*vec2(1.0,0.0);vUv3=vUv+texelSize*vec2(0.0,1.0);vUv4=vUv+texelSize*vec2(-2.0,0.0);vUv5=vUv+texelSize*vec2(0.0,-2.0);\n#endif\ngl_Position=vec4(position.xy,1.0,1.0);}"}),this.toneMapped=!1,this.edgeDetectionMode=t}set depthBuffer(e){this.uniforms.depthBuffer.value=e}set depthPacking(e){this.defines.DEPTH_PACKING=e.toFixed(0),this.needsUpdate=!0}setDepthBuffer(e,t=Zt){this.depthBuffer=e,this.depthPacking=t}get edgeDetectionMode(){return Number(this.defines.EDGE_DETECTION_MODE)}set edgeDetectionMode(e){this.defines.EDGE_DETECTION_MODE=e.toFixed(0),this.needsUpdate=!0}getEdgeDetectionMode(){return this.edgeDetectionMode}setEdgeDetectionMode(e){this.edgeDetectionMode=e}get localContrastAdaptationFactor(){return Number(this.defines.LOCAL_CONTRAST_ADAPTATION_FACTOR)}set localContrastAdaptationFactor(e){this.defines.LOCAL_CONTRAST_ADAPTATION_FACTOR=e.toFixed("6"),this.needsUpdate=!0}getLocalContrastAdaptationFactor(){return this.localContrastAdaptationFactor}setLocalContrastAdaptationFactor(e){this.localContrastAdaptationFactor=e}get edgeDetectionThreshold(){return Number(this.defines.EDGE_THRESHOLD)}set edgeDetectionThreshold(e){this.defines.EDGE_THRESHOLD=e.toFixed("6"),this.defines.DEPTH_THRESHOLD=(.1*e).toFixed("6"),this.needsUpdate=!0}getEdgeDetectionThreshold(){return this.edgeDetectionThreshold}setEdgeDetectionThreshold(e){this.edgeDetectionThreshold=e}get predicationMode(){return Number(this.defines.PREDICATION_MODE)}set predicationMode(e){this.defines.PREDICATION_MODE=e.toFixed(0),this.needsUpdate=!0}getPredicationMode(){return this.predicationMode}setPredicationMode(e){this.predicationMode=e}set predicationBuffer(e){this.uniforms.predicationBuffer.value=e}setPredicationBuffer(e){this.uniforms.predicationBuffer.value=e}get predicationThreshold(){return Number(this.defines.PREDICATION_THRESHOLD)}set predicationThreshold(e){this.defines.PREDICATION_THRESHOLD=e.toFixed("6"),this.needsUpdate=!0}getPredicationThreshold(){return this.predicationThreshold}setPredicationThreshold(e){this.predicationThreshold=e}get predicationScale(){return Number(this.defines.PREDICATION_SCALE)}set predicationScale(e){this.defines.PREDICATION_SCALE=e.toFixed("6"),this.needsUpdate=!0}getPredicationScale(){return this.predicationScale}setPredicationScale(e){this.predicationScale=e}get predicationStrength(){return Number(this.defines.PREDICATION_STRENGTH)}set predicationStrength(e){this.defines.PREDICATION_STRENGTH=e.toFixed("6"),this.needsUpdate=!0}getPredicationStrength(){return this.predicationStrength}setPredicationStrength(e){this.predicationStrength=e}setSize(e,t){this.uniforms.texelSize.value.set(1/e,1/t)}},qI="#include \n#include \n#include \n#define packFloatToRGBA(v) packDepthToRGBA(v)\n#define unpackRGBAToFloat(v) unpackRGBAToDepth(v)\n#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D inputBuffer;\n#else\nuniform lowp sampler2D inputBuffer;\n#endif\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nuniform highp sampler2D depthBuffer;\n#else\nuniform mediump sampler2D depthBuffer;\n#endif\nuniform vec2 resolution;uniform vec2 texelSize;uniform float cameraNear;uniform float cameraFar;uniform float aspect;uniform float time;varying vec2 vUv;\n#if THREE_REVISION < 143\n#define luminance(v) linearToRelativeLuminance(v)\n#endif\n#if THREE_REVISION >= 137\nvec4 sRGBToLinear(const in vec4 value){return vec4(mix(pow(value.rgb*0.9478672986+vec3(0.0521327014),vec3(2.4)),value.rgb*0.0773993808,vec3(lessThanEqual(value.rgb,vec3(0.04045)))),value.a);}\n#endif\nfloat readDepth(const in vec2 uv){\n#if DEPTH_PACKING == 3201\nreturn unpackRGBAToDepth(texture2D(depthBuffer,uv));\n#else\nreturn texture2D(depthBuffer,uv).r;\n#endif\n}float getViewZ(const in float depth){\n#ifdef PERSPECTIVE_CAMERA\nreturn perspectiveDepthToViewZ(depth,cameraNear,cameraFar);\n#else\nreturn orthographicDepthToViewZ(depth,cameraNear,cameraFar);\n#endif\n}FRAGMENT_HEADvoid main(){FRAGMENT_MAIN_UVvec4 color0=texture2D(inputBuffer,UV);vec4 color1=vec4(0.0);FRAGMENT_MAIN_IMAGEgl_FragColor=color0;\n#ifdef ENCODE_OUTPUT\n#include \n#endif\n#include \n}",YI={FRAGMENT_HEAD:"FRAGMENT_HEAD",FRAGMENT_MAIN_UV:"FRAGMENT_MAIN_UV",FRAGMENT_MAIN_IMAGE:"FRAGMENT_MAIN_IMAGE",VERTEX_HEAD:"VERTEX_HEAD",VERTEX_MAIN_SUPPORT:"VERTEX_MAIN_SUPPORT"},XI=class extends Yn{constructor(e,t,i,r,n=!1){super({name:"EffectMaterial",defines:{THREE_REVISION:D.replace(/\D+/g,""),DEPTH_PACKING:"0",ENCODE_OUTPUT:"1"},uniforms:{inputBuffer:new bc(null),depthBuffer:new bc(null),resolution:new bc(new wi),texelSize:new bc(new wi),cameraNear:new bc(.3),cameraFar:new bc(1e3),aspect:new bc(1),time:new bc(0)},blending:G,depthWrite:!1,depthTest:!1,dithering:n}),this.toneMapped=!1,e&&this.setShaderParts(e),t&&this.setDefines(t),i&&this.setUniforms(i),this.adoptCameraSettings(r)}set inputBuffer(e){this.uniforms.inputBuffer.value=e}setInputBuffer(e){this.uniforms.inputBuffer.value=e}get depthBuffer(){return this.uniforms.depthBuffer.value}set depthBuffer(e){this.uniforms.depthBuffer.value=e}get depthPacking(){return Number(this.defines.DEPTH_PACKING)}set depthPacking(e){this.defines.DEPTH_PACKING=e.toFixed(0),this.needsUpdate=!0}setDepthBuffer(e,t=Zt){this.depthBuffer=e,this.depthPacking=t}setShaderParts(e){return this.fragmentShader=qI.replace(YI.FRAGMENT_HEAD,e.get(YI.FRAGMENT_HEAD)).replace(YI.FRAGMENT_MAIN_UV,e.get(YI.FRAGMENT_MAIN_UV)).replace(YI.FRAGMENT_MAIN_IMAGE,e.get(YI.FRAGMENT_MAIN_IMAGE)),this.vertexShader="uniform vec2 resolution;uniform vec2 texelSize;uniform float cameraNear;uniform float cameraFar;uniform float aspect;uniform float time;varying vec2 vUv;VERTEX_HEADvoid main(){vUv=position.xy*0.5+0.5;VERTEX_MAIN_SUPPORTgl_Position=vec4(position.xy,1.0,1.0);}".replace(YI.VERTEX_HEAD,e.get(YI.VERTEX_HEAD)).replace(YI.VERTEX_MAIN_SUPPORT,e.get(YI.VERTEX_MAIN_SUPPORT)),this.needsUpdate=!0,this}setDefines(e){for(let t of e.entries())this.defines[t[0]]=t[1];return this.needsUpdate=!0,this}setUniforms(e){for(let t of e.entries())this.uniforms[t[0]]=t[1];return this}setExtensions(e){this.extensions={};for(let t of e)this.extensions[t]=!0;return this}get encodeOutput(){return void 0!==this.defines.ENCODE_OUTPUT}set encodeOutput(e){this.encodeOutput!==e&&(e?this.defines.ENCODE_OUTPUT="1":delete this.defines.ENCODE_OUTPUT,this.needsUpdate=!0)}isOutputEncodingEnabled(e){return this.encodeOutput}setOutputEncodingEnabled(e){this.encodeOutput=e}get time(){return this.uniforms.time.value}set time(e){this.uniforms.time.value=e}setDeltaTime(e){this.uniforms.time.value+=e}adoptCameraSettings(e){e&&(this.uniforms.cameraNear.value=e.near,this.uniforms.cameraFar.value=e.far,e instanceof Qn?this.defines.PERSPECTIVE_CAMERA="1":delete this.defines.PERSPECTIVE_CAMERA,this.needsUpdate=!0)}setSize(e,t){let i=this.uniforms;i.resolution.value.set(e,t),i.texelSize.value.set(1/e,1/t),i.aspect.value=e/t}static get Section(){return YI}},QI=class extends Yn{constructor(e=!1,t=null){super({name:"LuminanceMaterial",defines:{THREE_REVISION:D.replace(/\D+/g,"")},uniforms:{inputBuffer:new bc(null),threshold:new bc(0),smoothing:new bc(1),range:new bc(null)},blending:G,depthWrite:!1,depthTest:!1,fragmentShader:"#include \n#if THREE_REVISION < 143\n#define luminance(v) linearToRelativeLuminance(v)\n#endif\n#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D inputBuffer;\n#else\nuniform lowp sampler2D inputBuffer;\n#endif\n#ifdef RANGE\nuniform vec2 range;\n#elif defined(THRESHOLD)\nuniform float threshold;uniform float smoothing;\n#endif\nvarying vec2 vUv;void main(){vec4 texel=texture2D(inputBuffer,vUv);float l=luminance(texel.rgb);\n#ifdef RANGE\nfloat low=step(range.x,l);float high=step(l,range.y);l*=low*high;\n#elif defined(THRESHOLD)\nl=smoothstep(threshold,threshold+smoothing,l);\n#endif\n#ifdef COLOR\ngl_FragColor=vec4(texel.rgb*l,l);\n#else\ngl_FragColor=vec4(l);\n#endif\n}",vertexShader:zI}),this.toneMapped=!1,this.colorOutput=e,this.luminanceRange=t}set inputBuffer(e){this.uniforms.inputBuffer.value=e}setInputBuffer(e){this.uniforms.inputBuffer.value=e}get threshold(){return this.uniforms.threshold.value}set threshold(e){this.smoothing>0||e>0?this.defines.THRESHOLD="1":delete this.defines.THRESHOLD,this.uniforms.threshold.value=e}getThreshold(){return this.threshold}setThreshold(e){this.threshold=e}get smoothing(){return this.uniforms.smoothing.value}set smoothing(e){this.threshold>0||e>0?this.defines.THRESHOLD="1":delete this.defines.THRESHOLD,this.uniforms.smoothing.value=e}getSmoothingFactor(){return this.smoothing}setSmoothingFactor(e){this.smoothing=e}get useThreshold(){return this.threshold>0||this.smoothing>0}set useThreshold(e){}get colorOutput(){return void 0!==this.defines.COLOR}set colorOutput(e){e?this.defines.COLOR="1":delete this.defines.COLOR,this.needsUpdate=!0}isColorOutputEnabled(e){return this.colorOutput}setColorOutputEnabled(e){this.colorOutput=e}get useRange(){return null!==this.luminanceRange}set useRange(e){this.luminanceRange=null}get luminanceRange(){return this.uniforms.range.value}set luminanceRange(e){null!==e?this.defines.RANGE="1":delete this.defines.RANGE,this.uniforms.range.value=e,this.needsUpdate=!0}getLuminanceRange(){return this.luminanceRange}setLuminanceRange(e){this.luminanceRange=e}},ZI=0,KI=1,JI=class extends Yn{constructor(e=null){super({name:"MaskMaterial",uniforms:{maskTexture:new bc(e),inputBuffer:new bc(null),strength:new bc(1)},blending:G,depthWrite:!1,depthTest:!1,fragmentShader:"#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D inputBuffer;\n#else\nuniform lowp sampler2D inputBuffer;\n#endif\n#ifdef MASK_PRECISION_HIGH\nuniform mediump sampler2D maskTexture;\n#else\nuniform lowp sampler2D maskTexture;\n#endif\n#if MASK_FUNCTION != 0\nuniform float strength;\n#endif\nvarying vec2 vUv;void main(){\n#if COLOR_CHANNEL == 0\nfloat mask=texture2D(maskTexture,vUv).r;\n#elif COLOR_CHANNEL == 1\nfloat mask=texture2D(maskTexture,vUv).g;\n#elif COLOR_CHANNEL == 2\nfloat mask=texture2D(maskTexture,vUv).b;\n#else\nfloat mask=texture2D(maskTexture,vUv).a;\n#endif\n#if MASK_FUNCTION == 0\n#ifdef INVERTED\nmask=step(mask,0.0);\n#else\nmask=1.0-step(mask,0.0);\n#endif\n#else\nmask=clamp(mask*strength,0.0,1.0);\n#ifdef INVERTED\nmask=1.0-mask;\n#endif\n#endif\n#if MASK_FUNCTION == 2\ngl_FragColor=vec4(mask*texture2D(inputBuffer,vUv).rgb,mask);\n#else\ngl_FragColor=mask*texture2D(inputBuffer,vUv);\n#endif\n}",vertexShader:zI}),this.toneMapped=!1,this.setColorChannel(LI),this.setMaskFunction(ZI)}set inputBuffer(e){this.uniforms.inputBuffer.value=e}setInputBuffer(e){this.uniforms.inputBuffer.value=e}set maskTexture(e){this.uniforms.maskTexture.value=e,delete this.defines.MASK_PRECISION_HIGH,e.type!==je&&(this.defines.MASK_PRECISION_HIGH="1"),this.needsUpdate=!0}setMaskTexture(e){this.maskTexture=e}set colorChannel(e){this.defines.COLOR_CHANNEL=e.toFixed(0),this.needsUpdate=!0}setColorChannel(e){this.colorChannel=e}set maskFunction(e){this.defines.MASK_FUNCTION=e.toFixed(0),this.needsUpdate=!0}setMaskFunction(e){this.maskFunction=e}get inverted(){return void 0!==this.defines.INVERTED}set inverted(e){this.inverted&&!e?delete this.defines.INVERTED:e&&(this.defines.INVERTED="1"),this.needsUpdate=!0}isInverted(){return this.inverted}setInverted(e){this.inverted=e}get strength(){return this.uniforms.strength.value}set strength(e){this.uniforms.strength.value=e}getStrength(){return this.strength}setStrength(e){this.strength=e}},$I=class extends Yn{constructor(e=new wi,t=new wi){super({name:"SMAAWeightsMaterial",defines:{MAX_SEARCH_STEPS_INT:"16",MAX_SEARCH_STEPS_FLOAT:"16.0",MAX_SEARCH_STEPS_DIAG_INT:"8",MAX_SEARCH_STEPS_DIAG_FLOAT:"8.0",CORNER_ROUNDING:"25",CORNER_ROUNDING_NORM:"0.25",AREATEX_MAX_DISTANCE:"16.0",AREATEX_MAX_DISTANCE_DIAG:"20.0",AREATEX_PIXEL_SIZE:"(1.0 / vec2(160.0, 560.0))",AREATEX_SUBTEX_SIZE:"(1.0 / 7.0)",SEARCHTEX_SIZE:"vec2(66.0, 33.0)",SEARCHTEX_PACKED_SIZE:"vec2(64.0, 16.0)"},uniforms:{inputBuffer:new bc(null),searchTexture:new bc(null),areaTexture:new bc(null),resolution:new bc(t),texelSize:new bc(e)},blending:G,depthWrite:!1,depthTest:!1,fragmentShader:"#define sampleLevelZeroOffset(t, coord, offset) texture2D(t, coord + offset * texelSize)\n#if __VERSION__ < 300\n#define round(v) floor(v + 0.5)\n#endif\n#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D inputBuffer;\n#else\nuniform lowp sampler2D inputBuffer;\n#endif\nuniform lowp sampler2D areaTexture;uniform lowp sampler2D searchTexture;uniform vec2 texelSize;uniform vec2 resolution;varying vec2 vUv;varying vec4 vOffset[3];varying vec2 vPixCoord;void movec(const in bvec2 c,inout vec2 variable,const in vec2 value){if(c.x){variable.x=value.x;}if(c.y){variable.y=value.y;}}void movec(const in bvec4 c,inout vec4 variable,const in vec4 value){movec(c.xy,variable.xy,value.xy);movec(c.zw,variable.zw,value.zw);}vec2 decodeDiagBilinearAccess(in vec2 e){e.r=e.r*abs(5.0*e.r-5.0*0.75);return round(e);}vec4 decodeDiagBilinearAccess(in vec4 e){e.rb=e.rb*abs(5.0*e.rb-5.0*0.75);return round(e);}vec2 searchDiag1(const in vec2 texCoord,const in vec2 dir,out vec2 e){vec4 coord=vec4(texCoord,-1.0,1.0);vec3 t=vec3(texelSize,1.0);for(int i=0;i0.9)){break;}coord.xyz=t*vec3(dir,1.0)+coord.xyz;e=texture2D(inputBuffer,coord.xy).rg;coord.w=dot(e,vec2(0.5));}return coord.zw;}vec2 searchDiag2(const in vec2 texCoord,const in vec2 dir,out vec2 e){vec4 coord=vec4(texCoord,-1.0,1.0);coord.x+=0.25*texelSize.x;vec3 t=vec3(texelSize,1.0);for(int i=0;i0.9)){break;}coord.xyz=t*vec3(dir,1.0)+coord.xyz;e=texture2D(inputBuffer,coord.xy).rg;e=decodeDiagBilinearAccess(e);coord.w=dot(e,vec2(0.5));}return coord.zw;}vec2 areaDiag(const in vec2 dist,const in vec2 e,const in float offset){vec2 texCoord=vec2(AREATEX_MAX_DISTANCE_DIAG,AREATEX_MAX_DISTANCE_DIAG)*e+dist;texCoord=AREATEX_PIXEL_SIZE*texCoord+0.5*AREATEX_PIXEL_SIZE;texCoord.x+=0.5;texCoord.y+=AREATEX_SUBTEX_SIZE*offset;return texture2D(areaTexture,texCoord).rg;}vec2 calculateDiagWeights(const in vec2 texCoord,const in vec2 e,const in vec4 subsampleIndices){vec2 weights=vec2(0.0);vec4 d;vec2 end;if(e.r>0.0){d.xz=searchDiag1(texCoord,vec2(-1.0,1.0),end);d.x+=float(end.y>0.9);}else{d.xz=vec2(0.0);}d.yw=searchDiag1(texCoord,vec2(1.0,-1.0),end);if(d.x+d.y>2.0){vec4 coords=vec4(-d.x+0.25,d.x,d.y,-d.y-0.25)*texelSize.xyxy+texCoord.xyxy;vec4 c;c.xy=sampleLevelZeroOffset(inputBuffer,coords.xy,vec2(-1,0)).rg;c.zw=sampleLevelZeroOffset(inputBuffer,coords.zw,vec2(1,0)).rg;c.yxwz=decodeDiagBilinearAccess(c.xyzw);vec2 cc=vec2(2.0)*c.xz+c.yw;movec(bvec2(step(0.9,d.zw)),cc,vec2(0.0));weights+=areaDiag(d.xy,cc,subsampleIndices.z);}d.xz=searchDiag2(texCoord,vec2(-1.0,-1.0),end);if(sampleLevelZeroOffset(inputBuffer,texCoord,vec2(1,0)).r>0.0){d.yw=searchDiag2(texCoord,vec2(1.0),end);d.y+=float(end.y>0.9);}else{d.yw=vec2(0.0);}if(d.x+d.y>2.0){vec4 coords=vec4(-d.x,-d.x,d.y,d.y)*texelSize.xyxy+texCoord.xyxy;vec4 c;c.x=sampleLevelZeroOffset(inputBuffer,coords.xy,vec2(-1,0)).g;c.y=sampleLevelZeroOffset(inputBuffer,coords.xy,vec2(0,-1)).r;c.zw=sampleLevelZeroOffset(inputBuffer,coords.zw,vec2(1,0)).gr;vec2 cc=vec2(2.0)*c.xz+c.yw;movec(bvec2(step(0.9,d.zw)),cc,vec2(0.0));weights+=areaDiag(d.xy,cc,subsampleIndices.w).gr;}return weights;}float searchLength(const in vec2 e,const in float offset){vec2 scale=SEARCHTEX_SIZE*vec2(0.5,-1.0);vec2 bias=SEARCHTEX_SIZE*vec2(offset,1.0);scale+=vec2(-1.0,1.0);bias+=vec2(0.5,-0.5);scale*=1.0/SEARCHTEX_PACKED_SIZE;bias*=1.0/SEARCHTEX_PACKED_SIZE;return texture2D(searchTexture,scale*e+bias).r;}float searchXLeft(in vec2 texCoord,const in float end){vec2 e=vec2(0.0,1.0);for(int i=0;iend&&e.g>0.8281&&e.r==0.0)){break;}e=texture2D(inputBuffer,texCoord).rg;texCoord=vec2(-2.0,0.0)*texelSize+texCoord;}float offset=-(255.0/127.0)*searchLength(e,0.0)+3.25;return texelSize.x*offset+texCoord.x;}float searchXRight(vec2 texCoord,const in float end){vec2 e=vec2(0.0,1.0);for(int i=0;i0.8281&&e.r==0.0)){break;}e=texture2D(inputBuffer,texCoord).rg;texCoord=vec2(2.0,0.0)*texelSize.xy+texCoord;}float offset=-(255.0/127.0)*searchLength(e,0.5)+3.25;return-texelSize.x*offset+texCoord.x;}float searchYUp(vec2 texCoord,const in float end){vec2 e=vec2(1.0,0.0);for(int i=0;iend&&e.r>0.8281&&e.g==0.0)){break;}e=texture2D(inputBuffer,texCoord).rg;texCoord=-vec2(0.0,2.0)*texelSize.xy+texCoord;}float offset=-(255.0/127.0)*searchLength(e.gr,0.0)+3.25;return texelSize.y*offset+texCoord.y;}float searchYDown(vec2 texCoord,const in float end){vec2 e=vec2(1.0,0.0);for(int i=0;i0.8281&&e.g==0.0)){break;}e=texture2D(inputBuffer,texCoord).rg;texCoord=vec2(0.0,2.0)*texelSize.xy+texCoord;}float offset=-(255.0/127.0)*searchLength(e.gr,0.5)+3.25;return-texelSize.y*offset+texCoord.y;}vec2 area(const in vec2 dist,const in float e1,const in float e2,const in float offset){vec2 texCoord=vec2(AREATEX_MAX_DISTANCE)*round(4.0*vec2(e1,e2))+dist;texCoord=AREATEX_PIXEL_SIZE*texCoord+0.5*AREATEX_PIXEL_SIZE;texCoord.y=AREATEX_SUBTEX_SIZE*offset+texCoord.y;return texture2D(areaTexture,texCoord).rg;}void detectHorizontalCornerPattern(inout vec2 weights,const in vec4 texCoord,const in vec2 d){\n#if !defined(DISABLE_CORNER_DETECTION)\nvec2 leftRight=step(d.xy,d.yx);vec2 rounding=(1.0-CORNER_ROUNDING_NORM)*leftRight;rounding/=leftRight.x+leftRight.y;vec2 factor=vec2(1.0);factor.x-=rounding.x*sampleLevelZeroOffset(inputBuffer,texCoord.xy,vec2(0,1)).r;factor.x-=rounding.y*sampleLevelZeroOffset(inputBuffer,texCoord.zw,vec2(1,1)).r;factor.y-=rounding.x*sampleLevelZeroOffset(inputBuffer,texCoord.xy,vec2(0,-2)).r;factor.y-=rounding.y*sampleLevelZeroOffset(inputBuffer,texCoord.zw,vec2(1,-2)).r;weights*=clamp(factor,0.0,1.0);\n#endif\n}void detectVerticalCornerPattern(inout vec2 weights,const in vec4 texCoord,const in vec2 d){\n#if !defined(DISABLE_CORNER_DETECTION)\nvec2 leftRight=step(d.xy,d.yx);vec2 rounding=(1.0-CORNER_ROUNDING_NORM)*leftRight;rounding/=leftRight.x+leftRight.y;vec2 factor=vec2(1.0);factor.x-=rounding.x*sampleLevelZeroOffset(inputBuffer,texCoord.xy,vec2(1,0)).g;factor.x-=rounding.y*sampleLevelZeroOffset(inputBuffer,texCoord.zw,vec2(1,1)).g;factor.y-=rounding.x*sampleLevelZeroOffset(inputBuffer,texCoord.xy,vec2(-2,0)).g;factor.y-=rounding.y*sampleLevelZeroOffset(inputBuffer,texCoord.zw,vec2(-2,1)).g;weights*=clamp(factor,0.0,1.0);\n#endif\n}void main(){vec4 weights=vec4(0.0);vec4 subsampleIndices=vec4(0.0);vec2 e=texture2D(inputBuffer,vUv).rg;if(e.g>0.0){\n#if !defined(DISABLE_DIAG_DETECTION)\nweights.rg=calculateDiagWeights(vUv,e,subsampleIndices);if(weights.r==-weights.g){\n#endif\nvec2 d;vec3 coords;coords.x=searchXLeft(vOffset[0].xy,vOffset[2].x);coords.y=vOffset[1].y;d.x=coords.x;float e1=texture2D(inputBuffer,coords.xy).r;coords.z=searchXRight(vOffset[0].zw,vOffset[2].y);d.y=coords.z;d=round(resolution.xx*d+-vPixCoord.xx);vec2 sqrtD=sqrt(abs(d));float e2=sampleLevelZeroOffset(inputBuffer,coords.zy,vec2(1,0)).r;weights.rg=area(sqrtD,e1,e2,subsampleIndices.y);coords.y=vUv.y;detectHorizontalCornerPattern(weights.rg,coords.xyzy,d);\n#if !defined(DISABLE_DIAG_DETECTION)\n}else{e.r=0.0;}\n#endif\n}if(e.r>0.0){vec2 d;vec3 coords;coords.y=searchYUp(vOffset[1].xy,vOffset[2].z);coords.x=vOffset[0].x;d.x=coords.y;float e1=texture2D(inputBuffer,coords.xy).g;coords.z=searchYDown(vOffset[1].zw,vOffset[2].w);d.y=coords.z;d=round(resolution.yy*d-vPixCoord.yy);vec2 sqrtD=sqrt(abs(d));float e2=sampleLevelZeroOffset(inputBuffer,coords.xz,vec2(0,1)).g;weights.ba=area(sqrtD,e1,e2,subsampleIndices.x);coords.x=vUv.x;detectVerticalCornerPattern(weights.ba,coords.xyxz,d);}gl_FragColor=weights;}",vertexShader:"uniform vec2 texelSize;uniform vec2 resolution;varying vec2 vUv;varying vec4 vOffset[3];varying vec2 vPixCoord;void main(){vUv=position.xy*0.5+0.5;vPixCoord=vUv*resolution;vOffset[0]=vUv.xyxy+texelSize.xyxy*vec4(-0.25,-0.125,1.25,-0.125);vOffset[1]=vUv.xyxy+texelSize.xyxy*vec4(-0.125,-0.25,-0.125,1.25);vOffset[2]=vec4(vOffset[0].xz,vOffset[1].yw)+vec4(-2.0,2.0,-2.0,2.0)*texelSize.xxyy*MAX_SEARCH_STEPS_FLOAT;gl_Position=vec4(position.xy,1.0,1.0);}"}),this.toneMapped=!1}set inputBuffer(e){this.uniforms.inputBuffer.value=e}setInputBuffer(e){this.uniforms.inputBuffer.value=e}get searchTexture(){return this.uniforms.searchTexture.value}set searchTexture(e){this.uniforms.searchTexture.value=e}get areaTexture(){return this.uniforms.areaTexture.value}set areaTexture(e){this.uniforms.areaTexture.value=e}setLookupTextures(e,t){this.searchTexture=e,this.areaTexture=t}get orthogonalSearchSteps(){return Number(this.defines.MAX_SEARCH_STEPS_INT)}set orthogonalSearchSteps(e){let t=Math.min(Math.max(e,0),112);this.defines.MAX_SEARCH_STEPS_INT=t.toFixed("0"),this.defines.MAX_SEARCH_STEPS_FLOAT=t.toFixed("1"),this.needsUpdate=!0}setOrthogonalSearchSteps(e){this.orthogonalSearchSteps=e}get diagonalSearchSteps(){return Number(this.defines.MAX_SEARCH_STEPS_DIAG_INT)}set diagonalSearchSteps(e){let t=Math.min(Math.max(e,0),20);this.defines.MAX_SEARCH_STEPS_DIAG_INT=t.toFixed("0"),this.defines.MAX_SEARCH_STEPS_DIAG_FLOAT=t.toFixed("1"),this.needsUpdate=!0}setDiagonalSearchSteps(e){this.diagonalSearchSteps=e}get diagonalDetection(){return void 0===this.defines.DISABLE_DIAG_DETECTION}set diagonalDetection(e){e?delete this.defines.DISABLE_DIAG_DETECTION:this.defines.DISABLE_DIAG_DETECTION="1",this.needsUpdate=!0}isDiagonalDetectionEnabled(){return this.diagonalDetection}setDiagonalDetectionEnabled(e){this.diagonalDetection=e}get cornerRounding(){return Number(this.defines.CORNER_ROUNDING)}set cornerRounding(e){let t=Math.min(Math.max(e,0),100);this.defines.CORNER_ROUNDING=t.toFixed("4"),this.defines.CORNER_ROUNDING_NORM=(t/100).toFixed("4"),this.needsUpdate=!0}setCornerRounding(e){this.cornerRounding=e}get cornerDetection(){return void 0===this.defines.DISABLE_CORNER_DETECTION}set cornerDetection(e){e?delete this.defines.DISABLE_CORNER_DETECTION:this.defines.DISABLE_CORNER_DETECTION="1",this.needsUpdate=!0}isCornerRoundingEnabled(){return this.cornerDetection}setCornerRoundingEnabled(e){this.cornerDetection=e}setSize(e,t){let i=this.uniforms;i.texelSize.value.set(1/e,1/t),i.resolution.value.set(e,t)}},eO=new Xn,tO=null;var iO=class{constructor(e="Pass",t=new Ho,i=eO){this.name=e,this.renderer=null,this.scene=t,this.camera=i,this.screen=null,this.rtt=!0,this.needsSwap=!0,this.needsDepthTexture=!1,this.enabled=!0}get renderToScreen(){return!this.rtt}set renderToScreen(e){if(this.rtt===e){let t=this.getFullscreenMaterial();null!==t&&(t.needsUpdate=!0),this.rtt=!e}}setRenderer(e){this.renderer=e}isEnabled(){return this.enabled}setEnabled(e){this.enabled=e}get fullscreenMaterial(){return null!==this.screen?this.screen.material:null}set fullscreenMaterial(e){let t=this.screen;null!==t?t.material=e:(t=new Un(function(){if(null===tO){let e=new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),t=new Float32Array([0,0,2,0,0,2]);void 0!==(tO=new En).setAttribute?(tO.setAttribute("position",new mn(e,3)),tO.setAttribute("uv",new mn(t,2))):(tO.addAttribute("position",new mn(e,3)),tO.addAttribute("uv",new mn(t,2)))}return tO}(),e),t.frustumCulled=!1,null===this.scene&&(this.scene=new Ho),this.scene.add(t),this.screen=t)}getFullscreenMaterial(){return this.fullscreenMaterial}setFullscreenMaterial(e){this.fullscreenMaterial=e}getDepthTexture(){return null}setDepthTexture(e,t=Zt){}render(e,t,i,r,n){throw new Error("Render method not implemented!")}setSize(e,t){}initialize(e,t,i){}dispose(){for(let e of Object.keys(this)){let t=this[e];if(null!==t&&"function"==typeof t.dispose){if(t instanceof Ho||t===this.renderer)continue;this[e].dispose()}}}},rO=class extends iO{constructor(e,t=!0){super("CopyPass"),this.fullscreenMaterial=new jI,this.needsSwap=!1,this.renderTarget=e,void 0===e&&(this.renderTarget=new qi(1,1,{minFilter:Fe,magFilter:Fe,stencilBuffer:!1,depthBuffer:!1}),this.renderTarget.texture.name="CopyPass.Target"),this.autoResize=t}get resize(){return this.autoResize}set resize(e){this.autoResize=e}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}setAutoResizeEnabled(e){this.autoResize=e}render(e,t,i,r,n){this.fullscreenMaterial.inputBuffer=t.texture,e.setRenderTarget(this.renderToScreen?null:this.renderTarget),e.render(this.scene,this.camera)}setSize(e,t){this.autoResize&&this.renderTarget.setSize(e,t)}initialize(e,t,i){void 0!==i&&(this.renderTarget.texture.type=i,i!==je?this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1":e.outputEncoding===Qt&&(this.renderTarget.texture.encoding=Qt))}},nO=class extends iO{constructor(){super("ClearMaskPass",null,null),this.needsSwap=!1}render(e,t,i,r,n){let s=e.state.buffers.stencil;s.setLocked(!1),s.setTest(!1)}},sO=new Ni,aO=class extends iO{constructor(e=!0,t=!0,i=!1){super("ClearPass",null,null),this.needsSwap=!1,this.color=e,this.depth=t,this.stencil=i,this.overrideClearColor=null,this.overrideClearAlpha=-1}setClearFlags(e,t,i){this.color=e,this.depth=t,this.stencil=i}getOverrideClearColor(){return this.overrideClearColor}setOverrideClearColor(e){this.overrideClearColor=e}getOverrideClearAlpha(){return this.overrideClearAlpha}setOverrideClearAlpha(e){this.overrideClearAlpha=e}render(e,t,i,r,n){let s=this.overrideClearColor,a=this.overrideClearAlpha,o=e.getClearAlpha(),l=null!==s,h=a>=0;l?(sO.copy(e.getClearColor(sO)),e.setClearColor(s,h?a:o)):h&&e.setClearAlpha(a),e.setRenderTarget(this.renderToScreen?null:t),e.clear(this.color,this.depth,this.stencil),l?e.setClearColor(sO,o):h&&e.setClearAlpha(o)}},oO=-1,lO=class extends ai{constructor(e,t=-1,i=-1,r=1){super(),this.resizable=e,this.base=new wi(1,1),this.preferred=new wi(t,i),this.target=this.preferred,this.s=r}get width(){let e,{base:t,preferred:i,scale:r}=this;return e=i.width!==oO?i.width:i.height!==oO?Math.round(i.height*(t.width/Math.max(t.height,1))):Math.round(t.width*r),e}set width(e){this.preferredWidth=e}get height(){let e,{base:t,preferred:i,scale:r}=this;return e=i.height!==oO?i.height:i.width!==oO?Math.round(i.width/Math.max(t.width/Math.max(t.height,1),1)):Math.round(t.height*r),e}set height(e){this.preferredHeight=e}getWidth(){return this.width}getHeight(){return this.height}get scale(){return this.s}set scale(e){this.s!==e&&(this.s=e,this.preferred.setScalar(oO),this.dispatchEvent({type:"change"}),this.resizable.setSize(this.base.width,this.base.height))}getScale(){return this.scale}setScale(e){this.scale=e}get baseWidth(){return this.base.width}set baseWidth(e){this.base.width!==e&&(this.base.width=e,this.dispatchEvent({type:"change"}),this.resizable.setSize(this.base.width,this.base.height))}getBaseWidth(){return this.base.width}setBaseWidth(e){this.base.width!==e&&(this.base.width=e,this.dispatchEvent({type:"change"}),this.resizable.setSize(this.base.width,this.base.height))}get baseHeight(){return this.base.height}set baseHeight(e){this.base.height!==e&&(this.base.height=e,this.dispatchEvent({type:"change"}),this.resizable.setSize(this.base.width,this.base.height))}getBaseHeight(){return this.baseHeight}setBaseHeight(e){this.baseHeight=e}setBaseSize(e,t){(this.base.width!==e||this.base.height!==t)&&(this.base.set(e,t),this.dispatchEvent({type:"change"}),this.resizable.setSize(this.base.width,this.base.height))}get preferredWidth(){return this.preferred.width}set preferredWidth(e){this.preferred.width!==e&&(this.preferred.width=e,this.dispatchEvent({type:"change"}),this.resizable.setSize(this.base.width,this.base.height))}getPreferredWidth(){return this.preferredWidth}setPreferredWidth(e){this.preferredWidth=e}get preferredHeight(){return this.preferred.height}set preferredHeight(e){this.preferred.height!==e&&(this.preferred.height=e,this.dispatchEvent({type:"change"}),this.resizable.setSize(this.base.width,this.base.height))}getPreferredHeight(){return this.preferredHeight}setPreferredHeight(e){this.preferredHeight=e}setPreferredSize(e,t){(this.preferred.width!==e||this.preferred.height!==t)&&(this.preferred.set(e,t),this.dispatchEvent({type:"change"}),this.resizable.setSize(this.base.width,this.base.height))}copy(e){this.base.set(e.getBaseWidth(),e.getBaseHeight()),this.preferred.set(e.getPreferredWidth(),e.getPreferredHeight()),this.dispatchEvent({type:"change"}),this.resizable.setSize(this.base.width,this.base.height)}static get AUTO_SIZE(){return oO}},hO=!1,cO=class{constructor(e=null){this.originalMaterials=new Map,this.material=null,this.materials=null,this.materialsBackSide=null,this.materialsDoubleSide=null,this.materialsFlatShaded=null,this.materialsFlatShadedBackSide=null,this.materialsFlatShadedDoubleSide=null,this.setMaterial(e),this.meshCount=0,this.replaceMaterial=e=>{if(e.isMesh){let t;if(e.material.flatShading)switch(e.material.side){case j:t=this.materialsFlatShadedDoubleSide;break;case V:t=this.materialsFlatShadedBackSide;break;default:t=this.materialsFlatShaded}else switch(e.material.side){case j:t=this.materialsDoubleSide;break;case V:t=this.materialsBackSide;break;default:t=this.materials}this.originalMaterials.set(e,e.material),e.isSkinnedMesh?e.material=t[2]:e.isInstancedMesh?e.material=t[1]:e.material=t[0],++this.meshCount}}}setMaterial(e){if(this.disposeMaterials(),this.material=e,null!==e){let t=this.materials=[e.clone(),e.clone(),e.clone()];for(let i of t)i.uniforms=Object.assign({},e.uniforms),i.side=U;t[2].skinning=!0,this.materialsBackSide=t.map((t=>{let i=t.clone();return i.uniforms=Object.assign({},e.uniforms),i.side=V,i})),this.materialsDoubleSide=t.map((t=>{let i=t.clone();return i.uniforms=Object.assign({},e.uniforms),i.side=j,i})),this.materialsFlatShaded=t.map((t=>{let i=t.clone();return i.uniforms=Object.assign({},e.uniforms),i.flatShading=!0,i})),this.materialsFlatShadedBackSide=t.map((t=>{let i=t.clone();return i.uniforms=Object.assign({},e.uniforms),i.flatShading=!0,i.side=V,i})),this.materialsFlatShadedDoubleSide=t.map((t=>{let i=t.clone();return i.uniforms=Object.assign({},e.uniforms),i.flatShading=!0,i.side=j,i}))}}render(e,t,i){let r=e.shadowMap.enabled;if(e.shadowMap.enabled=!1,hO){let r=this.originalMaterials;this.meshCount=0,t.traverse(this.replaceMaterial),e.render(t,i);for(let e of r)e[0].material=e[1];this.meshCount!==r.size&&r.clear()}else{let r=t.overrideMaterial;t.overrideMaterial=this.material,e.render(t,i),t.overrideMaterial=r}e.shadowMap.enabled=r}disposeMaterials(){if(null!==this.material){let e=this.materials.concat(this.materialsBackSide).concat(this.materialsDoubleSide).concat(this.materialsFlatShaded).concat(this.materialsFlatShadedBackSide).concat(this.materialsFlatShadedDoubleSide);for(let t of e)t.dispose()}}dispose(){this.originalMaterials.clear(),this.disposeMaterials()}static get workaroundEnabled(){return hO}static set workaroundEnabled(e){hO=e}},dO=class extends iO{constructor(e,t,i=null){super("RenderPass",e,t),this.needsSwap=!1,this.clearPass=new aO,this.overrideMaterialManager=null===i?null:new cO(i),this.ignoreBackground=!1,this.skipShadowMapUpdate=!1,this.selection=null}get renderToScreen(){return super.renderToScreen}set renderToScreen(e){super.renderToScreen=e,this.clearPass.renderToScreen=e}get overrideMaterial(){let e=this.overrideMaterialManager;return null!==e?e.material:null}set overrideMaterial(e){let t=this.overrideMaterialManager;null!==e?null!==t?t.setMaterial(e):this.overrideMaterialManager=new cO(e):null!==t&&(t.dispose(),this.overrideMaterialManager=null)}getOverrideMaterial(){return this.overrideMaterial}setOverrideMaterial(e){this.overrideMaterial=e}get clear(){return this.clearPass.enabled}set clear(e){this.clearPass.enabled=e}getSelection(){return this.selection}setSelection(e){this.selection=e}isBackgroundDisabled(){return this.ignoreBackground}setBackgroundDisabled(e){this.ignoreBackground=e}isShadowMapDisabled(){return this.skipShadowMapUpdate}setShadowMapDisabled(e){this.skipShadowMapUpdate=e}getClearPass(){return this.clearPass}render(e,t,i,r,n){let s=this.scene,a=this.camera,o=this.selection,l=a.layers.mask,h=s.background,c=e.shadowMap.autoUpdate,d=this.renderToScreen?null:t;null!==o&&a.layers.set(o.getLayer()),this.skipShadowMapUpdate&&(e.shadowMap.autoUpdate=!1),(this.ignoreBackground||null!==this.clearPass.overrideClearColor)&&(s.background=null),this.clearPass.enabled&&this.clearPass.render(e,t),e.setRenderTarget(d),null!==this.overrideMaterialManager?this.overrideMaterialManager.render(e,s,a):e.render(s,a),a.layers.mask=l,s.background=h,e.shadowMap.autoUpdate=c}},uO=class extends iO{constructor(e,t,{resolutionScale:i=1,width:r=lO.AUTO_SIZE,height:n=lO.AUTO_SIZE,renderTarget:s}={}){super("DepthPass"),this.needsSwap=!1,this.renderPass=new dO(e,t,new Eo({depthPacking:Kt}));let a=this.renderPass;a.skipShadowMapUpdate=!0,a.ignoreBackground=!0;let o=a.getClearPass();o.overrideClearColor=new Ni(16777215),o.overrideClearAlpha=1,this.renderTarget=s,void 0===this.renderTarget&&(this.renderTarget=new qi(1,1,{minFilter:ze,magFilter:ze,stencilBuffer:!1}),this.renderTarget.texture.name="DepthPass.Target");let l=this.resolution=new lO(this,r,n,i);l.addEventListener("change",(e=>this.setSize(l.baseWidth,l.baseHeight)))}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}getResolution(){return this.resolution}getResolutionScale(){return this.resolution.scale}setResolutionScale(e){this.resolution.scale=e}render(e,t,i,r,n){let s=this.renderToScreen?null:this.renderTarget;this.renderPass.render(e,s)}setSize(e,t){let i=this.resolution;i.setBaseSize(e,t),this.renderTarget.setSize(i.width,i.height)}},pO=(new Float32Array([255/256/256**3,255/256/65536,255/256/256,255/256]),{SKIP:0,ADD:1,ALPHA:2,AVERAGE:3,COLOR_BURN:4,COLOR_DODGE:5,DARKEN:6,DIFFERENCE:7,EXCLUSION:8,LIGHTEN:9,MULTIPLY:10,DIVIDE:11,NEGATION:12,NORMAL:13,OVERLAY:14,REFLECT:15,SCREEN:16,SOFT_LIGHT:17,SUBTRACT:18}),fO=new Map([[pO.SKIP,null],[pO.ADD,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return min(x+y,1.0)*opacity+x*(1.0-opacity);}"],[pO.ALPHA,"vec3 blend(const in vec3 x,const in vec3 y,const in float opacity){return y*opacity+x*(1.0-opacity);}vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){float a=min(y.a,opacity);return vec4(blend(x.rgb,y.rgb,a),max(x.a,a));}"],[pO.AVERAGE,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return(x+y)*0.5*opacity+x*(1.0-opacity);}"],[pO.COLOR_BURN,"float blend(const in float x,const in float y){return(y==0.0)?y:max(1.0-(1.0-x)/y,0.0);}vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=vec4(blend(x.r,y.r),blend(x.g,y.g),blend(x.b,y.b),blend(x.a,y.a));return z*opacity+x*(1.0-opacity);}"],[pO.COLOR_DODGE,"float blend(const in float x,const in float y){return(y==1.0)?y:min(x/(1.0-y),1.0);}vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=vec4(blend(x.r,y.r),blend(x.g,y.g),blend(x.b,y.b),blend(x.a,y.a));return z*opacity+x*(1.0-opacity);}"],[pO.DARKEN,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return min(x,y)*opacity+x*(1.0-opacity);}"],[pO.DIFFERENCE,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return abs(x-y)*opacity+x*(1.0-opacity);}"],[pO.EXCLUSION,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return(x+y-2.0*x*y)*opacity+x*(1.0-opacity);}"],[pO.LIGHTEN,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return max(x,y)*opacity+x*(1.0-opacity);}"],[pO.MULTIPLY,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return x*y*opacity+x*(1.0-opacity);}"],[pO.DIVIDE,"float blend(const in float x,const in float y){return(y>0.0)?min(x/y,1.0):1.0;}vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=vec4(blend(x.r,y.r),blend(x.g,y.g),blend(x.b,y.b),blend(x.a,y.a));return z*opacity+x*(1.0-opacity);}"],[pO.NEGATION,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return(1.0-abs(1.0-x-y))*opacity+x*(1.0-opacity);}"],[pO.NORMAL,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return y*opacity+x*(1.0-opacity);}"],[pO.OVERLAY,"float blend(const in float x,const in float y){return(x<0.5)?(2.0*x*y):(1.0-2.0*(1.0-x)*(1.0-y));}vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=vec4(blend(x.r,y.r),blend(x.g,y.g),blend(x.b,y.b),blend(x.a,y.a));return z*opacity+x*(1.0-opacity);}"],[pO.REFLECT,"float blend(const in float x,const in float y){return(y==1.0)?y:min(x*x/(1.0-y),1.0);}vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=vec4(blend(x.r,y.r),blend(x.g,y.g),blend(x.b,y.b),blend(x.a,y.a));return z*opacity+x*(1.0-opacity);}"],[pO.SCREEN,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return(1.0-(1.0-x)*(1.0-y))*opacity+x*(1.0-opacity);}"],[pO.SOFT_LIGHT,"float blend(const in float x,const in float y){return(y<0.5)?(2.0*x*y+x*x*(1.0-2.0*y)):(sqrt(x)*(2.0*y-1.0)+2.0*x*(1.0-y));}vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=vec4(blend(x.r,y.r),blend(x.g,y.g),blend(x.b,y.b),blend(x.a,y.a));return z*opacity+x*(1.0-opacity);}"],[pO.SUBTRACT,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return max(x+y-1.0,0.0)*opacity+x*(1.0-opacity);}"]]),mO=class extends ai{constructor(e,t=1){super(),this.f=e,this.opacity=new bc(t)}getOpacity(){return this.opacity.value}setOpacity(e){this.opacity.value=e}get blendFunction(){return this.f}set blendFunction(e){this.f=e,this.dispatchEvent({type:"change"})}getBlendFunction(){return this.blendFunction}setBlendFunction(e){this.blendFunction=e}getShaderCode(){return fO.get(this.blendFunction)}},gO=0,vO=1,yO=2,xO=class extends ai{constructor(e,t,{attributes:i=gO,blendFunction:r=pO.SCREEN,defines:n=new Map,uniforms:s=new Map,extensions:a=null,vertexShader:o=null}={}){super(),this.name=e,this.renderer=null,this.attributes=i,this.fragmentShader=t,this.vertexShader=o,this.defines=n,this.uniforms=s,this.extensions=a,this.blendMode=new mO(r),this.blendMode.addEventListener("change",(e=>this.setChanged()))}getName(){return this.name}setRenderer(e){this.renderer=e}getDefines(){return this.defines}getUniforms(){return this.uniforms}getExtensions(){return this.extensions}getBlendMode(){return this.blendMode}getAttributes(){return this.attributes}setAttributes(e){this.attributes=e,this.setChanged()}getFragmentShader(){return this.fragmentShader}setFragmentShader(e){this.fragmentShader=e,this.setChanged()}getVertexShader(){return this.vertexShader}setVertexShader(e){this.vertexShader=e,this.setChanged()}setChanged(){this.dispatchEvent({type:"change"})}setDepthTexture(e,t=Zt){}update(e,t,i){}setSize(e,t){}initialize(e,t,i){}dispose(){for(let e of Object.keys(this)){let t=this[e];if(null!==t&&"function"==typeof t.dispose){if(t instanceof Ho||t===this.renderer)continue;this[e].dispose()}}}};function bO(e,t,i){for(let r of t){let t="$1"+e+r.charAt(0).toUpperCase()+r.slice(1),n=new RegExp("([^\\.])(\\b"+r+"\\b)","g");for(let e of i.entries())null!==e[1]&&i.set(e[0],e[1].replace(n,t))}}function wO(e,t,i,r,n,s,a){let o=new Map([["fragment",t.getFragmentShader()],["vertex",t.getVertexShader()]]),l=void 0!==o.get("fragment")&&/mainImage/.test(o.get("fragment")),h=void 0!==o.get("fragment")&&/mainUv/.test(o.get("fragment")),c=[],d=[],u=!1,p=!1;if(void 0===o.get("fragment"))console.error("Missing fragment shader",t);else if(h&&0!=(a&yO))console.error("Effects that transform UV coordinates are incompatible with convolution effects",t);else if(l||h){let f=/(?:\w+\s+(\w+)\([\w\s,]*\)\s*{[^}]+})/g,m=XI.Section;if(h){let t=`\t${e}MainUv(UV);\n`;i.set(m.FRAGMENT_MAIN_UV,i.get(m.FRAGMENT_MAIN_UV)+t),u=!0}if(null!==o.get("vertex")&&/mainSupport/.test(o.get("vertex"))){let t=`\t${e}MainSupport(`;t+=/mainSupport *\([\w\s]*?uv\s*?\)/.test(o.get("vertex"))?"vUv);\n":");\n",i.set(m.VERTEX_MAIN_SUPPORT,i.get(m.VERTEX_MAIN_SUPPORT)+t),c=c.concat([...o.get("vertex").matchAll(/(?:varying\s+\w+\s+(\w*))/g)].map((e=>e[1]))),d=d.concat(c).concat([...o.get("vertex").matchAll(f)].map((e=>e[1])))}d=d.concat([...o.get("fragment").matchAll(f)].map((e=>e[1]))),d=d.concat([...t.defines.keys()].map((e=>e.replace(/\([\w\s,]*\)/g,"")))),d=d.concat([...t.uniforms.keys()]),t.uniforms.forEach(((t,i)=>s.set(e+i.charAt(0).toUpperCase()+i.slice(1),t))),t.defines.forEach(((t,i)=>n.set(e+i.charAt(0).toUpperCase()+i.slice(1),t))),bO(e,d,n),bO(e,d,o);let g=t.blendMode;if(r.set(g.blendFunction,g),l){let t=`${e}MainImage(color0, UV, `;0!=(a&vO)&&/MainImage *\([\w\s,]*?depth[\w\s,]*?\)/.test(o.get("fragment"))&&(t+="depth, ",p=!0),t+="color1);\n\t";let r=e+"BlendOpacity";s.set(r,g.opacity),t+=`color0 = blend${g.blendFunction}(color0, color1, ${r});\n\n\t`,i.set(m.FRAGMENT_MAIN_IMAGE,i.get(m.FRAGMENT_MAIN_IMAGE)+t),t=`uniform float ${r};\n\n`,i.set(m.FRAGMENT_HEAD,i.get(m.FRAGMENT_HEAD)+t)}i.set(m.FRAGMENT_HEAD,i.get(m.FRAGMENT_HEAD)+o.get("fragment")+"\n"),null!==o.get("vertex")&&i.set(m.VERTEX_HEAD,i.get(m.VERTEX_HEAD)+o.get("vertex")+"\n")}else console.error("The fragment shader contains neither a mainImage nor a mainUv function",t);return{varyings:c,transformedUv:u,readDepth:p}}var _O=class extends iO{constructor(e,...t){super("EffectPass"),this.fullscreenMaterial=new XI(null,null,null,e),this.effects=t.sort(((e,t)=>t.attributes-e.attributes)),this.skipRendering=!1,this.uniformCount=0,this.varyingCount=0,this.minTime=1,this.maxTime=Number.POSITIVE_INFINITY}get encodeOutput(){return this.fullscreenMaterial.encodeOutput}set encodeOutput(e){this.fullscreenMaterial.encodeOutput=e}get dithering(){return this.fullscreenMaterial.dithering}set dithering(e){let t=this.fullscreenMaterial;t.dithering=e,t.needsUpdate=!0}verifyResources(){let e=this.renderer.capabilities,t=Math.min(e.maxFragmentUniforms,e.maxVertexUniforms);this.uniformCount>t&&console.warn("The current rendering context doesn't support more than "+t+" uniforms, but "+this.uniformCount+" were defined"),t=e.maxVaryings,this.varyingCount>t&&console.warn("The current rendering context doesn't support more than "+t+" varyings, but "+this.varyingCount+" were defined")}updateMaterial(){let e=XI.Section,t=new Map([[e.FRAGMENT_HEAD,""],[e.FRAGMENT_MAIN_UV,""],[e.FRAGMENT_MAIN_IMAGE,""],[e.VERTEX_HEAD,""],[e.VERTEX_MAIN_SUPPORT,""]]),i=new Map,r=new Map,n=new Map,s=new Set,a=0,o=0,l=0,h=!1,c=!1;for(let u of this.effects)if(u.blendMode.blendFunction===pO.SKIP)l|=u.getAttributes()&vO;else if(0!=(l&u.getAttributes()&yO))console.error("Convolution effects cannot be merged",u);else{l|=u.getAttributes();let e=wO("e"+a++,u,t,i,r,n,l);if(o+=e.varyings.length,h=h||e.transformedUv,c=c||e.readDepth,null!==u.extensions)for(let t of u.extensions)s.add(t)}let d=/\bblend\b/g;for(let u of i.values()){let i=u.getShaderCode().replace(d,`blend${u.blendFunction}`);t.set(e.FRAGMENT_HEAD,t.get(e.FRAGMENT_HEAD)+i+"\n")}if(0!=(l&vO)){if(c){let i="float depth = readDepth(UV);\n\n\t";t.set(e.FRAGMENT_MAIN_IMAGE,i+t.get(e.FRAGMENT_MAIN_IMAGE))}this.needsDepthTexture=null===this.getDepthTexture()}else this.needsDepthTexture=!1;if(h){let i="vec2 transformedUv = vUv;\n";t.set(e.FRAGMENT_MAIN_UV,i+t.get(e.FRAGMENT_MAIN_UV)),r.set("UV","transformedUv")}else r.set("UV","vUv");t.forEach(((e,t,i)=>i.set(t,e.trim().replace(/^#/,"\n#")))),this.uniformCount=n.size,this.varyingCount=o,this.skipRendering=0===a,this.needsSwap=!this.skipRendering,this.fullscreenMaterial.setShaderParts(t).setExtensions(s).setUniforms(n).setDefines(r)}recompile(){this.updateMaterial(),this.verifyResources()}getDepthTexture(){return this.fullscreenMaterial.depthBuffer}setDepthTexture(e,t=Zt){this.fullscreenMaterial.depthBuffer=e,this.fullscreenMaterial.depthPacking=t;for(let i of this.effects)i.setDepthTexture(e,t)}render(e,t,i,r,n){for(let s of this.effects)s.update(e,t,r);if(!this.skipRendering||this.renderToScreen){let n=this.fullscreenMaterial;n.inputBuffer=t.texture,n.time+=r,e.setRenderTarget(this.renderToScreen?null:i),e.render(this.scene,this.camera)}}setSize(e,t){this.fullscreenMaterial.setSize(e,t);for(let i of this.effects)i.setSize(e,t)}initialize(e,t,i){this.renderer=e;for(let r of this.effects)r.initialize(e,t,i),r.addEventListener("change",(e=>this.handleEvent(e)));this.updateMaterial(),this.verifyResources(),void 0!==i&&i!==je&&(this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1")}dispose(){super.dispose();for(let e of this.effects)e.dispose()}handleEvent(e){if("change"===e.type)this.recompile()}},SO=[new Float32Array([0,0]),new Float32Array([0,1,1]),new Float32Array([0,1,1,2]),new Float32Array([0,1,2,2,3]),new Float32Array([0,1,2,3,4,4,5]),new Float32Array([0,1,2,3,4,5,7,8,9,10])],AO=class extends iO{constructor({resolutionScale:e=.5,width:t=lO.AUTO_SIZE,height:i=lO.AUTO_SIZE,kernelSize:r=PO.LARGE}={}){super("KawaseBlurPass"),this.renderTargetA=new qi(1,1,{minFilter:Fe,magFilter:Fe,stencilBuffer:!1,depthBuffer:!1}),this.renderTargetA.texture.name="Blur.Target.A",this.renderTargetB=this.renderTargetA.clone(),this.renderTargetB.texture.name="Blur.Target.B";let n=this.resolution=new lO(this,t,i,e);n.addEventListener("change",(e=>this.setSize(n.baseWidth,n.baseHeight))),this.blurMaterial=new VI,this.ditheredBlurMaterial=new VI,this.ditheredBlurMaterial.uniforms.scale=this.blurMaterial.uniforms.scale,this.ditheredBlurMaterial.dithering=!0,this.dithering=!1,this.kernelSize=r}getResolution(){return this.resolution}get width(){return this.resolution.width}set width(e){this.resolution.preferredWidth=e}get height(){return this.resolution.height}set height(e){this.resolution.preferredHeight=e}get scale(){return this.blurMaterial.scale}set scale(e){this.blurMaterial.scale=e}getScale(){return this.blurMaterial.scale}setScale(e){this.blurMaterial.scale=e}getKernelSize(){return this.kernelSize}setKernelSize(e){this.kernelSize=e}getResolutionScale(){return this.resolution.scale}setResolutionScale(e){this.resolution.scale=e}render(e,t,i,r,n){let s,a,o=this.scene,l=this.camera,h=this.renderTargetA,c=this.renderTargetB,d=SO[this.kernelSize],u=this.blurMaterial,p=t;for(this.fullscreenMaterial=u,s=0,a=d.length-1;sthis.setSize(s.baseWidth,s.baseHeight)))}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}getResolution(){return this.resolution}render(e,t,i,r,n){this.fullscreenMaterial.inputBuffer=t.texture,e.setRenderTarget(this.renderToScreen?null:this.renderTarget),e.render(this.scene,this.camera)}setSize(e,t){let i=this.resolution;i.setBaseSize(e,t),this.renderTarget.setSize(i.width,i.height)}initialize(e,t,i){void 0!==i&&i!==je&&(this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1")}},EO=class extends iO{constructor(e,t){super("MaskPass",e,t),this.needsSwap=!1,this.clearPass=new aO(!1,!1,!0),this.inverse=!1}get inverted(){return this.inverse}set inverted(e){this.inverse=e}get clear(){return this.clearPass.enabled}set clear(e){this.clearPass.enabled=e}getClearPass(){return this.clearPass}isInverted(){return this.inverted}setInverted(e){this.inverted=e}render(e,t,i,r,n){let s=e.getContext(),a=e.state.buffers,o=this.scene,l=this.camera,h=this.clearPass,c=this.inverted?0:1,d=1-c;a.color.setMask(!1),a.depth.setMask(!1),a.color.setLocked(!0),a.depth.setLocked(!0),a.stencil.setTest(!0),a.stencil.setOp(s.REPLACE,s.REPLACE,s.REPLACE),a.stencil.setFunc(s.ALWAYS,c,4294967295),a.stencil.setClear(d),a.stencil.setLocked(!0),this.clearPass.enabled&&(this.renderToScreen?h.render(e,null):(h.render(e,t),h.render(e,i))),this.renderToScreen?(e.setRenderTarget(null),e.render(o,l)):(e.setRenderTarget(t),e.render(o,l),e.setRenderTarget(i),e.render(o,l)),a.color.setLocked(!1),a.depth.setLocked(!1),a.stencil.setLocked(!1),a.stencil.setFunc(s.EQUAL,1,4294967295),a.stencil.setOp(s.KEEP,s.KEEP,s.KEEP),a.stencil.setLocked(!0)}},CO=class extends iO{constructor(e,t="inputBuffer"){super("ShaderPass"),this.fullscreenMaterial=e,this.inputBufferUniform=null,this.setInput(t)}setInput(e){if(this.inputBufferUniform=null,null!==this.fullscreenMaterial){let t=this.fullscreenMaterial.uniforms;void 0!==t&&void 0!==t[e]&&(this.inputBufferUniform=t[e])}}render(e,t,i,r,n){null!==this.inputBufferUniform&&null!==t&&(this.inputBufferUniform.value=t.texture),e.setRenderTarget(this.renderToScreen?null:i),e.render(this.scene,this.camera)}initialize(e,t,i){void 0!==i&&i!==je&&(this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1")}},TO=.001,DO=class{constructor(){this.previousTime=0,this.currentTime=0,this.delta=0,this.fixedDelta=1e3/60,this.elapsed=0,this.timescale=1,this.fixedDeltaEnabled=!1,this.autoReset=!1}setFixedDeltaEnabled(e){return this.fixedDeltaEnabled=e,this}isAutoResetEnabled(e){return this.autoReset}setAutoResetEnabled(e){return typeof document<"u"&&void 0!==document.hidden&&(e?document.addEventListener("visibilitychange",this):document.removeEventListener("visibilitychange",this),this.autoReset=e),this}getDelta(){return this.delta*TO}getFixedDelta(){return this.fixedDelta*TO}setFixedDelta(e){return this.fixedDelta=1e3*e,this}getElapsed(){return this.elapsed*TO}getTimescale(){return this.timescale}setTimescale(e){return this.timescale=e,this}update(e){return this.fixedDeltaEnabled?this.delta=this.fixedDelta:(this.previousTime=this.currentTime,this.currentTime=void 0!==e?e:performance.now(),this.delta=this.currentTime-this.previousTime),this.delta*=this.timescale,this.elapsed+=this.delta,this}reset(){return this.delta=0,this.elapsed=0,this.currentTime=performance.now(),this}handleEvent(e){document.hidden||(this.currentTime=performance.now())}dispose(){this.setAutoResetEnabled(!1)}},PO={VERY_SMALL:0,SMALL:1,MEDIUM:2,LARGE:3,VERY_LARGE:4,HUGE:5},IO=class extends xO{constructor({blendFunction:e=pO.SCREEN,luminanceThreshold:t=.9,luminanceSmoothing:i=.025,resolutionScale:r=.5,intensity:n=1,width:s=lO.AUTO_SIZE,height:a=lO.AUTO_SIZE,kernelSize:o=PO.LARGE}={}){super("BloomEffect","#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D map;\n#else\nuniform lowp sampler2D map;\n#endif\nuniform float intensity;void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){outputColor=clamp(texture2D(map,uv)*intensity,0.0,1.0);}",{blendFunction:e,uniforms:new Map([["map",new bc(null)],["intensity",new bc(n)]])}),this.renderTarget=new qi(1,1,{minFilter:Fe,magFilter:Fe,stencilBuffer:!1,depthBuffer:!1}),this.renderTarget.texture.name="Bloom.Target",this.renderTarget.texture.generateMipmaps=!1,this.uniforms.get("map").value=this.renderTarget.texture,this.luminancePass=new MO({renderTarget:this.renderTarget,colorOutput:!0}),this.luminanceMaterial.threshold=t,this.luminanceMaterial.smoothingFactor=i,this.blurPass=new AO({resolutionScale:r,width:s,height:a,kernelSize:o});let l=this.blurPass.getResolution();l.addEventListener("change",(e=>this.setSize(l.baseWidth,l.baseHeight)))}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}get resolution(){return this.blurPass.resolution}getResolution(){return this.blurPass.resolution}getBlurPass(){return this.blurPass}getLuminancePass(){return this.luminancePass}get luminanceMaterial(){return this.luminancePass.fullscreenMaterial}getLuminanceMaterial(){return this.luminancePass.fullscreenMaterial}get width(){return this.resolution.width}set width(e){this.resolution.preferredWidth=e}get height(){return this.resolution.height}set height(e){this.resolution.preferredHeight=e}get dithering(){return this.blurPass.dithering}set dithering(e){this.blurPass.dithering=e}get kernelSize(){return this.blurPass.kernelSize}set kernelSize(e){this.blurPass.kernelSize=e}get distinction(){return console.warn(this.name,"distinction was removed"),1}set distinction(e){console.warn(this.name,"distinction was removed")}get intensity(){return this.uniforms.get("intensity").value}set intensity(e){this.uniforms.get("intensity").value=e}getIntensity(){return this.intensity}setIntensity(e){this.intensity=e}getResolutionScale(){return this.resolution.scale}setResolutionScale(e){this.resolution.scale=e}update(e,t,i){let r=this.renderTarget;this.luminancePass.enabled?(this.luminancePass.render(e,t,r),this.blurPass.render(e,r,r)):this.blurPass.render(e,t,r)}setSize(e,t){let i=this.resolution;i.setBaseSize(e,t),this.renderTarget.setSize(i.width,i.height),this.luminancePass.resolution.copy(i)}initialize(e,t,i){this.blurPass.initialize(e,t,i),void 0!==i&&(this.renderTarget.texture.type=i,e.outputEncoding===Qt&&(this.renderTarget.texture.encoding=Qt))}},OO=class extends xO{constructor({blendFunction:e=pO.NORMAL,brightness:t=0,contrast:i=0}={}){super("BrightnessContrastEffect","uniform float brightness;uniform float contrast;void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){vec3 color=inputColor.rgb+vec3(brightness-0.5);if(contrast>0.0){color/=vec3(1.0-contrast);}else{color*=vec3(1.0+contrast);}outputColor=vec4(min(color+vec3(0.5),1.0),inputColor.a);}",{blendFunction:e,uniforms:new Map([["brightness",new bc(t)],["contrast",new bc(i)]])})}get brightness(){return this.uniforms.get("brightness").value}set brightness(e){this.uniforms.get("brightness").value=e}getBrightness(e){return this.brightness}setBrightness(e){this.brightness=e}get contrast(){return this.uniforms.get("contrast").value}set contrast(e){this.uniforms.get("contrast").value=e}getContrast(e){return this.contrast}setContrast(e){this.contrast=e}},RO=class extends xO{constructor(e=pO.NORMAL){super("ColorAverageEffect","void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){outputColor=vec4(vec3(average(inputColor.rgb)),inputColor.a);}",{blendFunction:e})}},LO=class extends xO{constructor({blendFunction:e=pO.NORMAL,offset:t=new wi(.001,5e-4)}={}){super("ChromaticAberrationEffect","varying vec2 vUvR;varying vec2 vUvB;void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){vec2 ra=texture2D(inputBuffer,vUvR).ra;vec2 ba=texture2D(inputBuffer,vUvB).ba;outputColor=vec4(ra.x,inputColor.g,ba.x,max(max(ra.y,ba.y),inputColor.a));}",{vertexShader:"uniform vec2 offset;varying vec2 vUvR;varying vec2 vUvB;void mainSupport(const in vec2 uv){vec2 shift=offset*vec2(1.0,aspect);vUvR=uv+shift;vUvB=uv-shift;}",blendFunction:e,attributes:yO,uniforms:new Map([["offset",new bc(t)]])})}get offset(){return this.uniforms.get("offset").value}set offset(e){this.uniforms.get("offset").value=e}getOffset(){return this.offset}setOffset(e){this.offset=e}},BO=class extends xO{constructor(e,{blendFunction:t=pO.NORMAL,worldFocusDistance:i,worldFocusRange:r,focusDistance:n=0,focalLength:s=.1,focusRange:a=s,bokehScale:o=1,width:l=lO.AUTO_SIZE,height:h=lO.AUTO_SIZE}={}){super("DepthOfFieldEffect","#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D nearColorBuffer;uniform mediump sampler2D farColorBuffer;\n#else\nuniform lowp sampler2D nearColorBuffer;uniform lowp sampler2D farColorBuffer;\n#endif\nuniform lowp sampler2D nearCoCBuffer;uniform float scale;void mainImage(const in vec4 inputColor,const in vec2 uv,const in float depth,out vec4 outputColor){vec4 colorNear=texture2D(nearColorBuffer,uv);vec4 colorFar=texture2D(farColorBuffer,uv);float CoCNear=texture2D(nearCoCBuffer,uv).r;CoCNear=min(CoCNear*scale,1.0);vec4 result=inputColor*(1.0-colorFar.a)+colorFar;result=mix(result,colorNear,CoCNear);outputColor=result;}",{blendFunction:t,attributes:vO,uniforms:new Map([["nearColorBuffer",new bc(null)],["farColorBuffer",new bc(null)],["nearCoCBuffer",new bc(null)],["scale",new bc(1)]])}),this.camera=e,this.renderTarget=new qi(1,1,{minFilter:Fe,magFilter:Fe,stencilBuffer:!1,depthBuffer:!1}),this.renderTarget.texture.name="DoF.Intermediate",this.renderTarget.texture.generateMipmaps=!1,this.renderTargetMasked=this.renderTarget.clone(),this.renderTargetMasked.texture.name="DoF.Masked.Far",this.renderTargetNear=this.renderTarget.clone(),this.renderTargetNear.texture.name="DoF.Bokeh.Near",this.uniforms.get("nearColorBuffer").value=this.renderTargetNear.texture,this.renderTargetFar=this.renderTarget.clone(),this.renderTargetFar.texture.name="DoF.Bokeh.Far",this.uniforms.get("farColorBuffer").value=this.renderTargetFar.texture,this.renderTargetCoC=this.renderTarget.clone(),this.renderTargetCoC.texture.name="DoF.CoC",this.renderTargetCoCBlurred=this.renderTargetCoC.clone(),this.renderTargetCoCBlurred.texture.name="DoF.CoC.Blurred",this.uniforms.get("nearCoCBuffer").value=this.renderTargetCoCBlurred.texture,this.cocPass=new CO(new UI(e));let c=this.cocMaterial;c.focusDistance=n,c.focusRange=a,void 0!==i&&(c.worldFocusDistance=i),void 0!==r&&(c.worldFocusRange=r),this.blurPass=new AO({kernelSize:PO.MEDIUM,width:l,height:h});let d=this.blurPass.getResolution();d.addEventListener("change",(e=>this.setSize(d.getBaseWidth(),d.getBaseHeight()))),this.maskPass=new CO(new JI(this.renderTargetCoC.texture));let u=this.maskPass.fullscreenMaterial;u.maskFunction=KI,u.colorChannel=BI,this.bokehNearBasePass=new CO(new kI(!1,!0)),this.bokehNearBasePass.fullscreenMaterial.cocBuffer=this.renderTargetCoCBlurred.texture,this.bokehNearFillPass=new CO(new kI(!0,!0)),this.bokehNearFillPass.fullscreenMaterial.cocBuffer=this.renderTargetCoCBlurred.texture,this.bokehFarBasePass=new CO(new kI(!1,!1)),this.bokehFarBasePass.fullscreenMaterial.cocBuffer=this.renderTargetCoC.texture,this.bokehFarFillPass=new CO(new kI(!0,!1)),this.bokehFarFillPass.fullscreenMaterial.cocBuffer=this.renderTargetCoC.texture,this.target=null,this.bokehScale=o}get cocTexture(){return this.renderTargetCoC.texture}get cocMaterial(){return this.cocPass.fullscreenMaterial}get circleOfConfusionMaterial(){return this.cocMaterial}getCircleOfConfusionMaterial(){return this.circleOfConfusionMaterial}getBlurPass(){return this.blurPass}get resolution(){return this.blurPass.getResolution()}getResolution(){return this.blurPass.getResolution()}get bokehScale(){return this.uniforms.get("scale").value}set bokehScale(e){let t=[this.bokehNearBasePass,this.bokehNearFillPass,this.bokehFarBasePass,this.bokehFarFillPass];for(let i of t)i.fullscreenMaterial.setScale(e);this.maskPass.fullscreenMaterial.setStrength(e),this.uniforms.get("scale").value=e}getBokehScale(){return this.bokehScale}setBokehScale(e){this.bokehScale=e}getTarget(){return this.target}setTarget(e){this.target=e}calculateFocusDistance(e){let t=this.camera;return FI(-t.position.distanceTo(e),t.near,t.far)}setDepthTexture(e,t=Zt){this.circleOfConfusionMaterial.depthBuffer=e,this.circleOfConfusionMaterial.depthPacking=t}update(e,t,i){let r=this.renderTarget,n=this.renderTargetCoC,s=this.renderTargetCoCBlurred,a=this.renderTargetMasked;if(null!==this.target){let e=this.calculateFocusDistance(this.target);this.circleOfConfusionMaterial.focusDistance=e}this.cocPass.render(e,null,n),this.blurPass.render(e,n,s),this.maskPass.render(e,t,a),this.bokehFarBasePass.render(e,a,r),this.bokehFarFillPass.render(e,r,this.renderTargetFar),this.bokehNearBasePass.render(e,t,r),this.bokehNearFillPass.render(e,r,this.renderTargetNear)}setSize(e,t){let i=this.resolution;i.setBaseSize(e,t);let r=i.width,n=i.height,s=[this.cocPass,this.blurPass,this.maskPass,this.bokehNearBasePass,this.bokehNearFillPass,this.bokehFarBasePass,this.bokehFarFillPass];s.push(this.renderTargetCoC,this.renderTargetMasked),s.forEach((i=>i.setSize(e,t))),s=[this.renderTarget,this.renderTargetNear,this.renderTargetFar,this.renderTargetCoCBlurred],s.forEach((e=>e.setSize(r,n))),[this.bokehNearBasePass,this.bokehNearFillPass,this.bokehFarBasePass,this.bokehFarFillPass].forEach((e=>e.fullscreenMaterial.setSize(r,n)))}initialize(e,t,i){[this.cocPass,this.maskPass,this.bokehNearBasePass,this.bokehNearFillPass,this.bokehFarBasePass,this.bokehFarFillPass].forEach((r=>r.initialize(e,t,i))),this.blurPass.initialize(e,t,je),void 0!==i&&(this.renderTarget.texture.type=i,this.renderTargetNear.texture.type=i,this.renderTargetFar.texture.type=i,this.renderTargetMasked.texture.type=i,e.outputEncoding===Qt&&(this.renderTarget.texture.encoding=Qt,this.renderTargetNear.texture.encoding=Qt,this.renderTargetFar.texture.encoding=Qt,this.renderTargetMasked.texture.encoding=Qt))}},zO=(new Zi,new Er,class extends xO{constructor({blendFunction:e=pO.NORMAL,hue:t=0,saturation:i=0}={}){super("HueSaturationEffect","uniform vec3 hue;uniform float saturation;void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){vec3 color=vec3(dot(inputColor.rgb,hue.xyz),dot(inputColor.rgb,hue.zxy),dot(inputColor.rgb,hue.yzx));float average=(color.r+color.g+color.b)/3.0;vec3 diff=average-color;if(saturation>0.0){color+=diff*(1.0-1.0/(1.001-saturation));}else{color+=diff*-saturation;}outputColor=vec4(min(color,1.0),inputColor.a);}",{blendFunction:e,uniforms:new Map([["hue",new bc(new Zi)],["saturation",new bc(i)]])}),this.hue=t}get saturation(){return this.uniforms.get("saturation").value}set saturation(e){this.uniforms.get("saturation").value=e}getSaturation(){return this.saturation}setSaturation(e){this.saturation=e}get hue(){let e=this.uniforms.get("hue").value;return Math.acos((3*e.x-1)/2)}set hue(e){let t=Math.sin(e),i=Math.cos(e);this.uniforms.get("hue").value.set((2*i+1)/3,(-Math.sqrt(3)*t-i+1)/3,(Math.sqrt(3)*t-i+1)/3)}getHue(){return this.hue}setHue(e){this.hue=e}}),kO=(new Ni,class extends xO{constructor({blendFunction:e=pO.SCREEN,premultiply:t=!1}={}){super("NoiseEffect","void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){vec3 noise=vec3(rand(uv*time));\n#ifdef PREMULTIPLY\noutputColor=vec4(min(inputColor.rgb*noise,vec3(1.0)),inputColor.a);\n#else\noutputColor=vec4(noise,inputColor.a);\n#endif\n}",{blendFunction:e}),this.premultiply=t}get premultiply(){return this.defines.has("PREMULTIPLY")}set premultiply(e){this.premultiply!==e&&(e?this.defines.set("PREMULTIPLY","1"):this.defines.delete("PREMULTIPLY"),this.setChanged())}isPremultiplied(){return this.premultiply}setPremultiplied(e){this.premultiply=e}}),NO=class extends xO{constructor(e=30){super("PixelationEffect","uniform bool active;uniform vec2 d;void mainUv(inout vec2 uv){if(active){uv=vec2(d.x*(floor(uv.x/d.x)+0.5),d.y*(floor(uv.y/d.y)+0.5));}}",{uniforms:new Map([["active",new bc(!1)],["d",new bc(new wi)]])}),this.resolution=new wi,this.d=0,this.granularity=e}get granularity(){return this.d}set granularity(e){let t=Math.floor(e);t%2>0&&(t+=1),this.d=t,this.uniforms.get("active").value=t>0,this.setSize(this.resolution.width,this.resolution.height)}getGranularity(){return this.granularity}setGranularity(e){this.granularity=e}setSize(e,t){this.resolution.set(e,t),this.uniforms.get("d").value.setScalar(this.d).divide(this.resolution)}},FO=(Math.PI,new Zi,new Zi,"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAAAQCAYAAACm53kpAAAAeElEQVRYR+2XSwqAMAxEJ168ePEqwRSKhIIiuHjJqiU0gWE+1CQdApcVAMUAuARaMGCX1MIL/Ow13++9lW2s3mW9MWvsnWc/2fvGygwPAN4E8QzAA4CXAB6AHjG4JTHYI1ey3pcx6FHnEfhLDOIBKAmUBK6/ANUDTlROXAHd9EC1AAAAAElFTkSuQmCC"),UO="data:image/png;base64,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",VO=0,jO=1,GO=2,HO=3,WO=class extends xO{constructor({preset:e=jO,edgeDetectionMode:t=GI,predicationMode:i=HI}={}){let r,n;super("SMAAEffect","uniform sampler2D weightMap;varying vec2 vOffset0;varying vec2 vOffset1;void movec(const in bvec2 c,inout vec2 variable,const in vec2 value){if(c.x){variable.x=value.x;}if(c.y){variable.y=value.y;}}void movec(const in bvec4 c,inout vec4 variable,const in vec4 value){movec(c.xy,variable.xy,value.xy);movec(c.zw,variable.zw,value.zw);}void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){vec4 a;a.x=texture2D(weightMap,vOffset0).a;a.y=texture2D(weightMap,vOffset1).g;a.wz=texture2D(weightMap,uv).rb;vec4 color=inputColor;if(dot(a,vec4(1.0))>=1e-5){bool h=max(a.x,a.z)>max(a.y,a.w);vec4 blendingOffset=vec4(0.0,a.y,0.0,a.w);vec2 blendingWeight=a.yw;movec(bvec4(h),blendingOffset,vec4(a.x,0.0,a.z,0.0));movec(bvec2(h),blendingWeight,a.xz);blendingWeight/=dot(blendingWeight,vec2(1.0));vec4 blendingCoord=blendingOffset*vec4(texelSize,-texelSize)+uv.xyxy;color=blendingWeight.x*texture2D(inputBuffer,blendingCoord.xy);color+=blendingWeight.y*texture2D(inputBuffer,blendingCoord.zw);}outputColor=color;}",{vertexShader:"varying vec2 vOffset0;varying vec2 vOffset1;void mainSupport(const in vec2 uv){vOffset0=uv+texelSize*vec2(1.0,0.0);vOffset1=uv+texelSize*vec2(0.0,1.0);}",blendFunction:pO.NORMAL,attributes:yO|vO,uniforms:new Map([["weightMap",new bc(null)]])}),arguments.length>1&&(r=arguments[0],n=arguments[1],arguments.length>2&&(e=arguments[2]),arguments.length>3&&(t=arguments[3])),this.renderTargetEdges=new qi(1,1,{minFilter:Fe,stencilBuffer:!1,depthBuffer:!1}),this.renderTargetEdges.texture.name="SMAA.Edges",this.renderTargetWeights=this.renderTargetEdges.clone(),this.renderTargetWeights.texture.name="SMAA.Weights",this.uniforms.get("weightMap").value=this.renderTargetWeights.texture,this.clearPass=new aO(!0,!1,!1),this.clearPass.overrideClearColor=new Ni(0),this.clearPass.overrideClearAlpha=1,this.edgeDetectionPass=new CO(new WI),this.edgeDetectionMaterial.edgeDetectionMode=t,this.edgeDetectionMaterial.predicationMode=i,this.weightsPass=new CO(new $I);let s=new Lh;s.onLoad=()=>{let e=new Hi(r);e.name="SMAA.Search",e.magFilter=ze,e.minFilter=ze,e.generateMipmaps=!1,e.needsUpdate=!0,e.flipY=!0,this.weightsMaterial.searchTexture=e;let t=new Hi(n);t.name="SMAA.Area",t.magFilter=Fe,t.minFilter=Fe,t.generateMipmaps=!1,t.needsUpdate=!0,t.flipY=!1,this.weightsMaterial.areaTexture=t,this.dispatchEvent({type:"load"})},s.itemStart("search"),s.itemStart("area"),void 0!==r&&void 0!==n?(s.itemEnd("search"),s.itemEnd("area")):typeof Image<"u"&&(r=new Image,n=new Image,r.addEventListener("load",(()=>s.itemEnd("search"))),n.addEventListener("load",(()=>s.itemEnd("area"))),r.src=FO,n.src=UO),this.applyPreset(e)}get edgesTexture(){return this.renderTargetEdges.texture}getEdgesTexture(){return this.edgesTexture}get weightsTexture(){return this.renderTargetWeights.texture}getWeightsTexture(){return this.weightsTexture}get edgeDetectionMaterial(){return this.edgeDetectionPass.fullscreenMaterial}get colorEdgesMaterial(){return this.edgeDetectionMaterial}getEdgeDetectionMaterial(){return this.edgeDetectionMaterial}get weightsMaterial(){return this.weightsPass.fullscreenMaterial}getWeightsMaterial(){return this.weightsMaterial}setEdgeDetectionThreshold(e){this.edgeDetectionMaterial.edgeDetectionThreshold=e}setOrthogonalSearchSteps(e){this.weightsMaterial.orthogonalSearchSteps=e}applyPreset(e){let t=this.edgeDetectionMaterial,i=this.weightsMaterial;switch(e){case VO:t.edgeDetectionThreshold=.15,i.orthogonalSearchSteps=4,i.diagonalDetection=!1,i.cornerDetection=!1;break;case jO:t.edgeDetectionThreshold=.1,i.orthogonalSearchSteps=8,i.diagonalDetection=!1,i.cornerDetection=!1;break;case GO:t.edgeDetectionThreshold=.1,i.orthogonalSearchSteps=16,i.diagonalSearchSteps=8,i.cornerRounding=25,i.diagonalDetection=!0,i.cornerDetection=!0;break;case HO:t.edgeDetectionThreshold=.05,i.orthogonalSearchSteps=32,i.diagonalSearchSteps=16,i.cornerRounding=25,i.diagonalDetection=!0,i.cornerDetection=!0}}setDepthTexture(e,t=Zt){this.edgeDetectionMaterial.depthBuffer=e,this.edgeDetectionMaterial.depthPacking=t}update(e,t,i){this.clearPass.render(e,this.renderTargetEdges),this.edgeDetectionPass.render(e,t,this.renderTargetEdges),this.weightsPass.render(e,this.renderTargetEdges,this.renderTargetWeights)}setSize(e,t){this.edgeDetectionMaterial.setSize(e,t),this.weightsMaterial.setSize(e,t),this.renderTargetEdges.setSize(e,t),this.renderTargetWeights.setSize(e,t)}dispose(){let{searchTexture:e,areaTexture:t}=this.weightsMaterial;null!==e&&null!==t&&(e.dispose(),t.dispose()),super.dispose()}static get searchImageDataURL(){return FO}static get areaImageDataURL(){return UO}},qO=0,YO=1,XO=class extends xO{constructor({blendFunction:e=pO.NORMAL,technique:t=qO,eskil:i=!1,offset:r=.5,darkness:n=.5}={}){super("VignetteEffect","uniform float offset;uniform float darkness;void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){const vec2 center=vec2(0.5);vec3 color=inputColor.rgb;\n#if VIGNETTE_TECHNIQUE == 0\nfloat d=distance(uv,center);color*=smoothstep(0.8,offset*0.799,d*(darkness+offset));\n#else\nvec2 coord=(uv-center)*vec2(offset);color=mix(color,vec3(1.0-darkness),dot(coord,coord));\n#endif\noutputColor=vec4(color,inputColor.a);}",{blendFunction:e,defines:new Map([["VIGNETTE_TECHNIQUE",t.toFixed(0)]]),uniforms:new Map([["offset",new bc(r)],["darkness",new bc(n)]])})}get technique(){return Number(this.defines.get("VIGNETTE_TECHNIQUE"))}set technique(e){this.technique!==e&&(this.defines.set("VIGNETTE_TECHNIQUE",e.toFixed(0)),this.setChanged())}get eskil(){return this.technique===YO}set eskil(e){this.technique=e?YO:qO}getTechnique(){return this.technique}setTechnique(e){this.technique=e}get offset(){return this.uniforms.get("offset").value}set offset(e){this.uniforms.get("offset").value=e}getOffset(){return this.offset}setOffset(e){this.offset=e}get darkness(){return this.uniforms.get("darkness").value}set darkness(e){this.uniforms.get("darkness").value=e}getDarkness(){return this.darkness}setDarkness(e){this.darkness=e}};new Float32Array(3),new Float32Array(3),new Float32Array(3),new Float32Array(3),new Float32Array(3),new Float32Array(3),new Float32Array([0,0,0]),new Float32Array([1,0,0]),new Float32Array([1,1,0]),new Float32Array([1,1,1]),new Float32Array([0,0,0]),new Float32Array([1,0,0]),new Float32Array([1,0,1]),new Float32Array([1,1,1]),new Float32Array([0,0,0]),new Float32Array([0,0,1]),new Float32Array([1,0,1]),new Float32Array([1,1,1]),new Float32Array([0,0,0]),new Float32Array([0,1,0]),new Float32Array([1,1,0]),new Float32Array([1,1,1]),new Float32Array([0,0,0]),new Float32Array([0,1,0]),new Float32Array([0,1,1]),new Float32Array([1,1,1]),new Float32Array([0,0,0]),new Float32Array([0,0,1]),new Float32Array([0,1,1]),new Float32Array([1,1,1]),new Float32Array(2),new Float32Array(2),new Float32Array([0,-.25,.25,-.125,.125,-.375,.375]),new Float32Array([0,0]),new Float32Array([.25,-.25]),new Float32Array([-.25,.25]),new Float32Array([.125,-.125]),new Float32Array([-.125,.125]),new Uint8Array([0,0]),new Uint8Array([3,0]),new Uint8Array([0,3]),new Uint8Array([3,3]),new Uint8Array([1,0]),new Uint8Array([4,0]),new Uint8Array([1,3]),new Uint8Array([4,3]),new Uint8Array([0,1]),new Uint8Array([3,1]),new Uint8Array([0,4]),new Uint8Array([3,4]),new Uint8Array([1,1]),new Uint8Array([4,1]),new Uint8Array([1,4]),new Uint8Array([4,4]),new Uint8Array([0,0]),new Uint8Array([1,0]),new Uint8Array([0,2]),new Uint8Array([1,2]),new Uint8Array([2,0]),new Uint8Array([3,0]),new Uint8Array([2,2]),new Uint8Array([3,2]),new Uint8Array([0,1]),new Uint8Array([1,1]),new Uint8Array([0,3]),new Uint8Array([1,3]),new Uint8Array([2,1]),new Uint8Array([3,1]),new Uint8Array([2,3]),new Uint8Array([3,3]),new Map([[ZO(0,0,0,0),new Float32Array([0,0,0,0])],[ZO(0,0,0,1),new Float32Array([0,0,0,1])],[ZO(0,0,1,0),new Float32Array([0,0,1,0])],[ZO(0,0,1,1),new Float32Array([0,0,1,1])],[ZO(0,1,0,0),new Float32Array([0,1,0,0])],[ZO(0,1,0,1),new Float32Array([0,1,0,1])],[ZO(0,1,1,0),new Float32Array([0,1,1,0])],[ZO(0,1,1,1),new Float32Array([0,1,1,1])],[ZO(1,0,0,0),new Float32Array([1,0,0,0])],[ZO(1,0,0,1),new Float32Array([1,0,0,1])],[ZO(1,0,1,0),new Float32Array([1,0,1,0])],[ZO(1,0,1,1),new Float32Array([1,0,1,1])],[ZO(1,1,0,0),new Float32Array([1,1,0,0])],[ZO(1,1,0,1),new Float32Array([1,1,0,1])],[ZO(1,1,1,0),new Float32Array([1,1,1,0])],[ZO(1,1,1,1),new Float32Array([1,1,1,1])]]);function QO(e,t,i){return e+(t-e)*i}function ZO(e,t,i,r){let n=QO(e,t,.75),s=QO(i,r,.75);return QO(n,s,.875)}var KO=class{constructor(e,t){this.enabled=!1,this.effect=new e(t),Object.defineProperty(this,"opacity",{enumerable:!0,set(e){this.effect.blendMode.opacity.value=e},get(){return this.effect.blendMode.opacity.value}}),Object.defineProperty(this,"blendFunction",{enumerable:!0,set(e){this.effect.blendMode.setBlendFunction(Number(e))},get(){return this.effect.blendMode.blendFunction}}),this.blendFunction=pO.NORMAL}},JO=class extends KO{constructor(){super(IO),this.blendFunction=pO.SCREEN}set intensity(e){this.effect.intensity=e}get intensity(){return this.effect.intensity}set luminanceThreshold(e){this.effect.luminanceMaterial.threshold=e}get luminanceThreshold(){return this.effect.luminanceMaterial.threshold}set luminanceSmoothing(e){this.effect.luminanceMaterial.smoothing=e}get luminanceSmoothing(){return this.effect.luminanceMaterial.smoothing}set blurScale(e){this.effect.blurPass.scale=e}get blurScale(){return this.effect.blurPass.scale}set kernelSize(e){this.effect.blurPass.kernelSize=e}get kernelSize(){return this.effect.blurPass.kernelSize}},$O=class extends KO{constructor(){super(OO)}set contrast(e){this.effect.uniforms.get("contrast").value=e}get contrast(){return this.effect.uniforms.get("contrast").value}set brightness(e){this.effect.uniforms.get("brightness").value=e}get brightness(){return this.effect.uniforms.get("brightness").value}},eR=class extends KO{constructor(){super(LO),this.effect.offset=new wi(.01,.01)}set offset(e){this.effect.offset.set(e[0]/1e3,e[1]/1e3)}get offset(){return[1e3*this.effect.offset.x,1e3*this.effect.offset.y]}},tR=class extends KO{constructor(){super(RO)}},iR=class extends KO{constructor(){super(zO),this._hue=0}set hue(e){this._hue=e,this.effect.setHue(e)}get hue(){return this._hue}set saturation(e){this.effect.uniforms.get("saturation").value=e}get saturation(){return this.effect.uniforms.get("saturation").value}},rR=class extends KO{constructor(){super(kO),this.blendFunction=pO.OVERLAY}},nR=class extends KO{constructor(){super(XO)}get eskil(){return this.effect.eskil}set eskil(e){this.effect.eskil=e}get darkness(){return this.effect.uniforms.get("darkness").value}set darkness(e){this.effect.uniforms.get("darkness").value=e}get offset(){return this.effect.uniforms.get("offset").value}set offset(e){this.effect.uniforms.get("offset").value=e}},sR=class extends KO{constructor(e){super(BO,e)}set focalLength(e){this.effect.circleOfConfusionMaterial.uniforms.focalLength.value=e}get focalLength(){return this.effect.circleOfConfusionMaterial.uniforms.focalLength.value}set focusDistance(e){this.effect.circleOfConfusionMaterial.uniforms.focusDistance.value=e}get focusDistance(){return this.effect.circleOfConfusionMaterial.uniforms.focusDistance.value}get bokehScale(){return this.effect.bokehScale}set bokehScale(e){this.effect.bokehScale=e}},aR=class extends KO{constructor(){super(NO)}get granularity(){return this.effect.getGranularity()}set granularity(e){this.effect.setGranularity(e)}},oR=class extends Yn{constructor(){super({name:"PassthroughMaterial",uniforms:{inputBuffer:new bc(null)},blending:G,depthWrite:!1,depthTest:!1,vertexShader:"#define GLSLIFY 1\nvarying vec2 vUv;void main(){gl_Position=vec4(position.xy,1.0,1.0);vUv=position.xy*0.5+0.5;}",fragmentShader:"#define GLSLIFY 1\nlayout(location=1)out vec4 gVelocity;varying vec2 vUv;uniform sampler2D inputBuffer;void main(){gl_FragColor=texture2D(inputBuffer,vUv);gVelocity=vec4(0.0);}"})}set inputBuffer(e){this.uniforms.inputBuffer.value=e}},lR=class extends iO{constructor(){super("TAAResolvePass"),this.MRTCompatible=!0,this.needsSwap=!1,this.passThroughMaterial=new oR,this.resolutionVector=new wi,this.resolveMaterial=new Yn({name:"TAAResolveMaterial",uniforms:{inputBuffer:new bc(null),historyBuffer:new bc(null),velocityBuffer:new bc(null),depthBuffer:new bc(null),resolution:new bc(new wi)},blending:G,depthWrite:!1,depthTest:!1,vertexShader:"#define GLSLIFY 1\nvarying vec2 vUv;varying vec2 vTexCoords[9];uniform vec2 resolution;void main(){vUv=position.xy*0.5+0.5;vec2 texelSize=vec2(1.0)/resolution;vTexCoords[0]=vUv+vec2(-texelSize.x,-texelSize.y);vTexCoords[1]=vUv+vec2(0.0,-texelSize.y);vTexCoords[2]=vUv+vec2(texelSize.x,-texelSize.y);vTexCoords[3]=vUv+vec2(-texelSize.x,0.0);vTexCoords[4]=vUv+vec2(0.0,0.0);vTexCoords[5]=vUv+vec2(texelSize.x,0.0);vTexCoords[6]=vUv+vec2(-texelSize.x,texelSize.y);vTexCoords[7]=vUv+vec2(0.0,texelSize.y);vTexCoords[8]=vUv+vec2(texelSize.x,texelSize.y);gl_Position=vec4(position.xy,1.0,1.0);}",fragmentShader:"#define GLSLIFY 1\n#include \nvarying vec2 vUv;varying vec2 vTexCoords[9];uniform sampler2D inputBuffer;uniform sampler2D historyBuffer;uniform sampler2D velocityBuffer;uniform sampler2D depthBuffer;uniform vec2 resolution;\n#define USE_YCOCG\n#define USE_CATMULL_ROM\nconst float feedback_min=0.5;const float feedback_max=0.95;vec3 RGB_YCoCg(vec3 c){return vec3(c.x/4.0+c.y/2.0+c.z/4.0,c.x/2.0-c.z/2.0,-c.x/4.0+c.y/2.0-c.z/4.0);}vec3 YCoCg_RGB(vec3 c){return clamp(vec3(c.x+c.y-c.z,c.x+c.z,c.x-c.y-c.z),vec3(0.0),vec3(1.0));}vec4 sample_color(sampler2D tex,vec2 uv){\n#ifdef USE_YCOCG\nvec4 c=texture(tex,uv);return vec4(RGB_YCoCg(c.rgb),c.a);\n#else\nreturn texture(tex,uv);\n#endif\n}vec4 sample_catmull_rom(sampler2D tex,vec2 uv,vec2 texSize){vec2 samplePos=uv*texSize;vec2 texPos1=floor(samplePos-0.5)+0.5;vec2 f=samplePos-texPos1;vec2 w0=f*(-0.5+f*(1.0-0.5*f));vec2 w1=1.0+f*f*(-2.5+1.5*f);vec2 w2=f*(0.5+f*(2.0-1.5*f));vec2 w3=f*f*(-0.5+0.5*f);vec2 w12=w1+w2;vec2 offset12=w2/(w1+w2);vec2 texPos0=texPos1-1.0;vec2 texPos3=texPos1+2.0;vec2 texPos12=texPos1+offset12;texPos0/=texSize;texPos3/=texSize;texPos12/=texSize;vec4 result=vec4(0.0);result+=texture2D(tex,vec2(texPos12.x,texPos0.y))*w12.x*w0.y;result+=texture2D(tex,vec2(texPos0.x,texPos12.y))*w0.x*w12.y;result+=texture2D(tex,vec2(texPos12.x,texPos12.y))*w12.x*w12.y;result+=texture2D(tex,vec2(texPos3.x,texPos12.y))*w3.x*w12.y;result+=texture2D(tex,vec2(texPos12.x,texPos3.y))*w12.x*w3.y;return result;}vec3 choose_motion_vector(){\n#ifdef CHOOSE_LONGEST_MOTION_VECTOR\nfloat longest=-1.0;vec3 v_choose=vec3(-1.0);for(int i=0;i<9;i++){vec3 v=texture2D(velocityBuffer,vTexCoords[i]).rgb;float l=length(v.xy);if(l>longest){longest=l;v_choose=v;}}return v_choose;\n#else\nfloat closest_depth=1000.0;vec2 closest_uv_offset=vec2(0.0);for(int i=0;i<9;i++){float neighbor_depth=texture2D(depthBuffer,vTexCoords[i]).r;if(neighbor_depth1.0){return vec4(p_clip,avg.w)+v_clip/ma_unit;}else{return input_texel;}}vec3 clip_aabb_variance(in vec3 cOld,in vec3 cNew,in vec3 centre,in vec3 halfSize){if(all(lessThanEqual(abs(cOld-centre),halfSize))){return cOld;}vec3 dir=(cNew-cOld);vec3 near=centre-sign(dir)*halfSize;vec3 tAll=(near-cOld)/dir;float t=0.0001;for(int i=0;i<3;i++){if(tAll[i]>=0.0&&tAll[i]=0.0001){return cOld;}return cOld+dir*t;}void main(){vec3 v=choose_motion_vector();vec2 velocity=v.rg;vec2 previousPixelPos=vUv-velocity;vec4 currentColor=sample_color(inputBuffer,vUv);\n#ifdef USE_CATMULL_ROM\nvec4 previousColor=sample_catmull_rom(historyBuffer,previousPixelPos,resolution);\n#else\nvec4 previousColor=sample_color(historyBuffer,previousPixelPos);\n#endif\n#ifdef USE_YCOCG\npreviousColor=vec4(RGB_YCoCg(previousColor.rgb),previousColor.a);\n#endif\nvec4 ctl=sample_color(inputBuffer,vTexCoords[0]);vec4 ctc=sample_color(inputBuffer,vTexCoords[1]);vec4 ctr=sample_color(inputBuffer,vTexCoords[2]);vec4 cml=sample_color(inputBuffer,vTexCoords[3]);vec4 cmc=sample_color(inputBuffer,vTexCoords[4]);vec4 cmr=sample_color(inputBuffer,vTexCoords[5]);vec4 cbl=sample_color(inputBuffer,vTexCoords[6]);vec4 cbc=sample_color(inputBuffer,vTexCoords[7]);vec4 cbr=sample_color(inputBuffer,vTexCoords[8]);vec4 cmin=min(ctl,min(ctc,min(ctr,min(cml,min(cmc,min(cmr,min(cbl,min(cbc,cbr))))))));vec4 cmax=max(ctl,max(ctc,max(ctr,max(cml,max(cmc,max(cmr,max(cbl,max(cbc,cbr))))))));vec4 cavg=(ctl+ctc+ctr+cml+cmc+cmr+cbl+cbc+cbr)/9.0;vec4 cmin5=min(ctc,min(cml,min(cmc,min(cmr,cbc))));vec4 cmax5=max(ctc,max(cml,max(cmc,max(cmr,cbc))));vec4 cavg5=(ctc+cml+cmc+cmr+cbc)/5.0;cmin=0.5*(cmin+cmin5);cmax=0.5*(cmax+cmax5);cavg=0.5*(cavg+cavg5);\n#ifdef USE_YCOCG\nvec2 chroma_extent=vec2(0.25*0.5*(cmax.r-cmin.r));vec2 chroma_center=currentColor.gb;cmin.yz=chroma_center-chroma_extent;cmax.yz=chroma_center+chroma_extent;cavg.yz=chroma_center;\n#endif\nvec4 previousColorClipped=clamp(previousColor,cmin,cmax);\n#ifdef LUMINANCE_DIFFERENCES\n#ifdef USE_YCOCG\nfloat lum0=currentColor.r;float lum1=previousColorClipped.r;\n#else\nfloat lum0=luminance(currentColor.rgb);float lum1=luminance(previousColorClipped.rgb);\n#endif\nfloat unbiased_diff=abs(lum0-lum1)/max(lum0,max(lum1,0.2));float unbiased_weight=1.0-unbiased_diff;float unbiased_weight_sqr=unbiased_weight*unbiased_weight;float k_feedback=mix(feedback_min,feedback_max,unbiased_weight_sqr);vec4 result=mix(currentColor,previousColorClipped,vec4(k_feedback));\n#else\nconst float alpha=0.1;vec4 result=mix(currentColor,previousColorClipped,1.0-alpha);\n#endif\n#ifdef USE_YCOCG\ngl_FragColor=vec4(YCoCg_RGB(result.rgb).rgb,result.a);\n#else\ngl_FragColor=result;\n#endif\n}"}),this.historyRenderTarget=new qi(1024,1024,{minFilter:Fe,stencilBuffer:!1,depthBuffer:!1}),this.historyRenderTarget.texture.name="TAA.History",this.resultRenderTarget=new qi(1024,1024,{minFilter:Fe,stencilBuffer:!1,depthBuffer:!1}),this.resultRenderTarget.texture.name="TAA.Output"}setSize(e,t){this.historyRenderTarget.setSize(e,t),this.resultRenderTarget.setSize(e,t)}render(e,t){this.fullscreenMaterial=this.resolveMaterial,this.resolveMaterial.uniforms.inputBuffer.value=t.texture[0],this.resolveMaterial.uniforms.velocityBuffer.value=t.texture[1],this.resolveMaterial.uniforms.depthBuffer.value=t.depthTexture,this.resolveMaterial.uniforms.historyBuffer.value=this.historyRenderTarget.texture,this.resolveMaterial.uniforms.resolution.value.set(t.width,t.height),e.setRenderTarget(this.resultRenderTarget),e.render(this.scene,this.camera),this.fullscreenMaterial=this.passThroughMaterial,this.passThroughMaterial.inputBuffer=this.resultRenderTarget.texture,e.setRenderTarget(this.historyRenderTarget),e.render(this.scene,this.camera);let i=this.renderToScreen?null:t;this.fullscreenMaterial=this.passThroughMaterial,this.passThroughMaterial.inputBuffer=this.resultRenderTarget.texture,e.setRenderTarget(i),e.render(this.scene,this.camera)}dispose(){this.resultRenderTarget.dispose(),this.historyRenderTarget.dispose(),this.resolveMaterial.dispose(),this.passThroughMaterial.dispose()}},hR=class extends iO{constructor(e,t,i){super("TransmissionPass",void 0,t),this.MRTCompatible=!0,this.depthPass=new uO(e,t,{renderTarget:i.transmissionDepthTarget}),this.passThroughMaterial=new oR,this.splineScene=e,this.needsSwap=!1}updatePasses(e){this.passThroughMaterial=new oR,this.depthPass=new uO(this.splineScene,this.camera,{renderTarget:e.transmissionDepthTarget})}setCamera(e){this.camera=e}setScene(e){this.splineScene=e}render(e,t,i){let r=this.camera.layers.mask,n=e;n.setRenderTarget(n.transmissionRenderTarget),this.fullscreenMaterial=this.passThroughMaterial,this.passThroughMaterial.inputBuffer=t.texture[0],n.clear(),n.render(this.scene,this.camera),this.camera.layers.disable(3),this.depthPass.render(e,t,i),n.shadowMap.needsUpdate=!1,n.shadowMap.autoUpdate=!1;let s=this.renderToScreen?null:t;this.camera.layers.set(3),e.setRenderTarget(s),e.render(this.splineScene,this.camera),this.camera.layers.mask=r}},cR=new Ho,dR=new Yn({transparent:!0,vertexShader:"\n void main() {\n gl_Position = vec4(0.0);\n }\n ",fragmentShader:"\n layout(location = 1) out vec4 gVelocity;\n\n void main() {\n gl_FragColor = vec4(0.0);\n\t\t\tgVelocity = vec4(0.0);\n }\n "}),uR=class extends iO{constructor(e,t,i){super("OpaquePass",t??cR,i),this.MRTCompatible=!0,this.hasTransmissionPass=!1,this.clear=!0,this.clearColorOnly=!1,this.clearDepth=!1,this.needsSwap=!1,this.originalMaterials=new Map,this.MRTCompatible=e}set splatViewer(e){this._splatViewer=e}get splatViewer(){return this._splatViewer}setCamera(e){this.camera=e}setScene(e){this.scene=e??cR}getScene(){return this.scene}render(e,t){this.camera.layers.enable(3),this.hasTransmissionPass&&(this.originalMaterials.clear(),this.scene.traverse((e=>{e.layers.isEnabled(3)&&e instanceof $E&&(this.originalMaterials.set(e.id,e.material),e.material=dR)})),e.shadowMap.needsUpdate=!0,e.shadowMap.autoUpdate=!0),this.camera.layers.enable(8);let i=this.renderToScreen?null:t;if(e.setRenderTarget(i),this.clearColorOnly&&e.clear(!0,!1,!0),this.clear&&e.clear(),!0===this._splatViewer?.splatRenderingInitialized){let t=e.autoClear;e.autoClear=!1,e.render(this.scene,this.camera),this._splatViewer.update(),e.render(this._splatViewer.splatMesh,this.camera),e.autoClear=t}else e.render(this.scene,this.camera);this.clearDepth&&e.clear(!1,!0,!1),this.hasTransmissionPass&&this.originalMaterials.forEach(((e,t)=>{let i=this.scene.getObjectById(t);i&&(i.material=e)}))}},pR=class{constructor(e,{depthBuffer:t=!0,stencilBuffer:i=!1,multisampling:r=0,frameBufferType:n=0}={}){this.renderer=e,this.helperStartIndex=0,this.copyPass=new rO,this.depthTexture=null,this.timer=new DO,this._width=1,this._height=1,this.passes=[],this.helperPasses=[],this.autoRenderToScreen=!0,this.inputBuffer=this.createBuffer(t,i,n,r,!0,"input buffer mrt"),this.inputBufferSingle=this.createBuffer(t,i,n,r,!1," input buffer single"),this.inputBufferSingle.texture.dispose(),this.inputBufferSingle.depthTexture.dispose(),this.inputBufferSingle.texture=this.inputBuffer.texture[0],this.inputBufferSingle.depthTexture=this.inputBuffer.depthTexture,this.outputBuffer=this.inputBuffer.clone(),this.outputBuffer.name="output buffer mrt",this.outputBufferSingle=this.createBuffer(t,i,n,r,!1,"output buffer single"),this.outputBufferSingle.texture.dispose(),this.outputBufferSingle.depthTexture.dispose(),this.outputBufferSingle.texture=this.outputBuffer.texture[0],this.outputBufferSingle.depthTexture=this.outputBuffer.depthTexture,this.setRenderer(e)}get multisampling(){return this.inputBuffer.samples||0}set multisampling(e){let t=this.inputBuffer,i=this.multisampling;i>0&&e>0?(this.inputBuffer.samples=e,this.outputBuffer.samples=e,this.inputBuffer.dispose(),this.outputBuffer.dispose()):i!==e&&(this.inputBuffer.dispose(),this.outputBuffer.dispose(),console.log("creating new input buffer"),this.inputBuffer=this.createBuffer(t.depthBuffer,t.stencilBuffer,t.texture.type,e,!0,"new input buffer"),this.inputBuffer.depthTexture=this.depthTexture,this.outputBuffer=this.inputBuffer.clone())}getTimer(){return this.timer}getRenderer(){return this.renderer}setRenderer(e){if(this.renderer=e,null!==e){let t=e.getSize(new wi),i=e.getContext().getContextAttributes()?.alpha??!1,r=this.inputBuffer.texture[0].type;r===je&&e.outputEncoding===Qt&&(this.inputBuffer.texture[0].encoding=Qt,this.outputBuffer.texture[0].encoding=Qt,this.inputBuffer.dispose(),this.outputBuffer.dispose(),console.log("doing some kinda dispose??")),e.autoClear=!1,this.setSize(t.width,t.height,!1);for(let n of this.passes)n.initialize(e,i,r)}}replaceRenderer(e,t=!0){let i=this.renderer,r=i.domElement.parentNode;return this.setRenderer(e),t&&null!==r&&(r.removeChild(i.domElement),r.appendChild(e.domElement)),i}createDepthTexture(){let e=this.depthTexture=new No(this._width,this._height);return this.inputBuffer.depthTexture=e,this.inputBuffer.dispose(),this.inputBuffer.stencilBuffer?(e.format=nt,e.type=Je):e.type=Ye,e}deleteDepthTexture(){if(null!==this.depthTexture){this.depthTexture.dispose(),this.depthTexture=null,this.inputBuffer.depthTexture=null,this.inputBuffer.dispose();for(let e of this.passes)e.setDepthTexture(null)}}createBuffer(e,t,i,r,n,s){let a,o=this.renderer,l=null===o?new wi:o.getDrawingBufferSize(new wi),h={minFilter:Fe,magFilter:Fe,wrapS:Le,wrapT:Le,stencilBuffer:t,depthBuffer:e};return r>0?(a=new qi(l.width,l.height,h),a.samples=r):(n?(a=new Xi(l.width,l.height,2,h),a.texture[1].type=Qe):a=new qi(l.width,l.height,h),a.depthTexture=new No(2048,2048),a.depthTexture.type=Xe),i===je&&null!==o&&o.outputEncoding===Qt&&(Array.isArray(a.texture)?a.texture.forEach((e=>e.encoding=Qt)):a.texture.encoding=Qt),Array.isArray(a.texture)?a.texture.forEach(((e,t)=>{e.name=`EffectComposer.Buffer ${n} ${t}`,e.generateMipmaps=!1})):(a.texture.name=`EffectComposer.Buffer ${n}`,a.texture.generateMipmaps=!1),a.name=s,a}addPass(e,t){let i,r=this.passes,n=this.renderer,s=n.getDrawingBufferSize(new wi),a=n.getContext().getContextAttributes()?.alpha??!1;if(e.MRTCompatible&&(i=this.inputBuffer.texture[0].type),e.MRTCompatible||(i=this.inputBuffer.texture.type),e.setRenderer(n),e.setSize(s.width,s.height),e.initialize(n,a,i),this.autoRenderToScreen&&(r.length>0&&(r[r.length-1].renderToScreen=!1),e.renderToScreen&&(this.autoRenderToScreen=!1)),void 0!==t?r.splice(t,0,e):r.push(e),this.autoRenderToScreen&&(r[r.length-1].renderToScreen=!0),e.needsDepthTexture||null!==this.depthTexture)if(null===this.depthTexture){let t=this.createDepthTexture();for(e of r)e.setDepthTexture(t)}else e.setDepthTexture(this.depthTexture)}setHelperStartIndex(e){this.helperStartIndex=e}removePass(e){let t=this.passes,i=t.indexOf(e);if(-1!==i&&t.splice(i,1).length>0){if(null!==this.depthTexture){let i=(e,t)=>e||t.needsDepthTexture;t.reduce(i,!1)||(e.getDepthTexture()===this.depthTexture&&e.setDepthTexture(null),this.deleteDepthTexture())}this.autoRenderToScreen&&i===t.length&&(e.renderToScreen=!1,t.length>0&&(t[t.length-1].renderToScreen=!0))}}removeAllPasses(){let e=this.passes;this.deleteDepthTexture(),e.length>0&&(this.autoRenderToScreen&&(e[e.length-1].renderToScreen=!1),this.passes=[])}render(e){let t,i,r,n,s=this.renderer,a=this.copyPass,o=this.inputBuffer,l=this.outputBuffer,h=this.inputBufferSingle,c=this.outputBufferSingle,d=!1;void 0===e&&(e=this.timer.update().getDelta());for(let u of this.passes)u.enabled&&(u.MRTCompatible?u.render(s,o,l,e,d):u.render(s,h,c,e,d),u.needsSwap&&(d&&(a.renderToScreen=u.renderToScreen,t=s.getContext(),i=s.state.buffers.stencil,i.setFunc(t.NOTEQUAL,1,4294967295),a.render(s,o,l,e,d),i.setFunc(t.EQUAL,1,4294967295)),r=o,n=h,o=l,h=c,l=r,c=n),u instanceof EO?d=!0:u instanceof nO&&(d=!1))}setSize(e,t,i){let r=this.renderer;if(this._width=e,this._height=t,void 0===e||void 0===t){let i=r.getSize(new wi);e=i.width,t=i.height}r.setSize(e,t,i);let n=r.getDrawingBufferSize(new wi);this.inputBuffer.setSize(n.width,n.height),this.outputBuffer.setSize(n.width,n.height),this.inputBufferSingle.setSize(n.width,n.height),this.outputBufferSingle.setSize(n.width,n.height);for(let s of this.passes)s.setSize(n.width,n.height)}reset(){let e=this.timer.isAutoResetEnabled();this.dispose(),this.autoRenderToScreen=!0,this.timer.setAutoResetEnabled(e)}dispose(){for(let e of this.passes)e.dispose();this.passes=[],null!==this.inputBuffer&&this.inputBuffer.dispose(),null!==this.outputBuffer&&this.outputBuffer.dispose(),null!==this.inputBufferSingle&&this.inputBufferSingle.dispose(),null!==this.outputBufferSingle&&this.outputBufferSingle.dispose(),this.deleteDepthTexture(),this.copyPass.dispose(),this.timer.dispose()}},fR=new Yn({name:"CombineMaterial",uniforms:{inputBufferA:new bc(null),inputBufferB:new bc(null)},blending:G,depthWrite:!1,depthTest:!1,vertexShader:"\nvarying vec2 vUv;\nvoid main() {\n gl_Position = vec4(position.xy, 1.0, 1.0);\n vUv = position.xy * 0.5 + 0.5;\n}\n",fragmentShader:"\n varying vec2 vUv;\n uniform sampler2D inputBufferA;\n uniform sampler2D inputBufferB;\n\n // TODO: Why do we need these when postpro of framemode is enabled???\n layout(location = 1) out vec4 gVelocity;\n\n void main() {\n\tvec4 resA = texture2D(inputBufferA, vUv);\n\tvec4 resB = texture2D(inputBufferB, vUv);\n float a = resA.a + resB.a * ( 1.0 - resA.a );\n\n\tvec4 res;\n\tres.rgb = resA.rgb + (resB.rgb * (1.0 - resA.a));\n\tres.a = resA.a + resB.a * (1.0 - resA.a);\n\tgl_FragColor = res;\n gVelocity = vec4(0.0);\n }\n"}),mR=class extends iO{constructor(e){super("HelperPass",void 0,e),this.MRTCompatible=!1,this.fullscreenMaterial=fR,this.helperPass=new uR(!1,void 0,this.camera),this.helperPass.hasTransmissionPass=!1,this.helperPass.clear=!1,this.helperPass.renderToScreen=!1,this.helperPassOnTop=new uR(!1,void 0,this.camera),this.helperPassOnTop.hasTransmissionPass=!1,this.helperPassOnTop.clear=!1,this.helperPassOnTop.renderToScreen=!1;let t=new WO({preset:VO,edgeDetectionMode:GI});this.effectPass=new _O(this.camera,t),this.rt=new qi(10,10,{minFilter:Fe,magFilter:Fe,wrapS:Le,wrapT:Le,depthBuffer:!0})}setSize(e,t){this.rt.setSize(e,t),this.effectPass.setSize(e,t)}set sceneHelpers(e){this.helperPass.setScene(e)}get sceneHelpers(){return this.helperPass.getScene()}set sceneHelpersOnTop(e){this.helperPassOnTop.setScene(e)}get sceneHelpersOnTop(){return this.helperPassOnTop.getScene()}setCamera(e){this.helperPass.setCamera(e),this.helperPassOnTop.setCamera(e)}initialize(e,t,i){super.initialize(e,t,i),this.effectPass.initialize(e,t,i)}dispose(){super.dispose(),this.rt.dispose(),this.effectPass.dispose()}render(e,t,i){this.rt.depthTexture=t.depthTexture;let r=e.getClearAlpha();e.setClearAlpha(0),this.helperPass.clearDepth=!0,this.helperPass.clearColorOnly=!0,this.helperPass.render(e,this.rt),this.helperPassOnTop.render(e,this.rt),this.effectPass.renderToScreen=!1,this.effectPass.render(e,this.rt,i),this.fullscreenMaterial.uniforms.inputBufferA.value=i.texture,this.fullscreenMaterial.uniforms.inputBufferB.value=t.texture,e.setClearAlpha(r),e.setRenderTarget(null),e.clear(),e.render(this.scene,this.camera)}},gR=[[.478712,.875764],[-.337956,-.793959],[-.955259,-.028164],[.864527,.325689],[.209342,-.395657],[-.106779,.672585],[.156213,.235113],[-.413644,-.082856],[-.415667,.323909],[.141896,-.93998],[.954932,-.182516],[-.766184,.410799],[-.434912,-.458845],[.415242,-.078724],[.728335,-.491777],[-.058086,-.066401],[.20299,.686837],[-.808362,-.556402],[.507386,-.640839],[-.723494,-.22924],[.48974,.317826],[-.622663,.765301],[-.01064,.929347],[.663146,.647618],[-.096674,-.413835],[.525945,-.321063],[-.122533,.366019],[.195235,-.687983],[-.563203,.098748],[.418563,.561335],[-.378595,.800367],[.826922,.001024],[-.085372,-.766651],[-.92192,.183673],[-.590008,-.721799],[.167751,-.164393],[.032961,-.56253],[.6329,-.107059],[-.46408,.569669],[-.173676,-.958758],[-.242648,-.234303],[-.275362,.157163],[.382295,-.795131],[.562955,.115562],[.190586,.470121],[.770764,-.297576],[.237281,.93105],[-.666642,-.455871],[-.905649,-.298379],[.33952,.157829],[.701438,-.7041],[-.062758,.160346],[-.220674,.957141],[.642692,.432706],[-.77339,-.015272],[-.671467,.24688],[.158051,.062859],[.806009,.527232],[-.05762,-.247071],[.333436,-.51671],[-.550658,-.315773],[-.652078,.589846],[.008818,.530556],[-.210004,.519896]],vR=new Yn({vertexShader:"#define GLSLIFY 1\n#include \nout vec3 n;void main(){\n#include \n#include \n#include \n#include \n#include \n#include \nvec4 view_space=viewMatrix*modelMatrix*vec4(transformed,1.0);gl_Position=projectionMatrix*view_space;n=normalize(transformedNormal);}",fragmentShader:"#define GLSLIFY 1\nin vec3 n;void main(){gl_FragColor=vec4(n,1.0);}"}),yR=new Yn({vertexShader:"#define GLSLIFY 1\nout vec2 v_uv;void main(){gl_Position=vec4(position.xy,1.0,1.0);v_uv=uv;}",fragmentShader:"#define GLSLIFY 1\nin vec2 v_uv;uniform sampler2D texture_ao_lrez;uniform sampler2D texture_depth_lrez;uniform sampler2D texture_depth_hrez;uniform float near;uniform float far;float linearize_depth(float depth_sampled){float z=depth_sampled*2.0-1.0;return(2.0*near*far)/(far+near-z*(far-near));}vec2 nearest_depth_filter(in vec2 uv){vec2 resolution=vec2(textureSize(texture_depth_lrez,0));vec2 texel_size=1.0/resolution;vec2 offset=uv-0.5*texel_size;float d_hrez=texture(texture_depth_hrez,uv).r;float a=abs(d_hrez-texture(texture_depth_lrez,offset).r);float b=abs(d_hrez-texture(texture_depth_lrez,offset+vec2(texel_size.x,0.0)).r);float c=abs(d_hrez-texture(texture_depth_lrez,offset+vec2(0.0,texel_size.y)).r);float d=abs(d_hrez-texture(texture_depth_lrez,offset+vec2(texel_size.x,texel_size.y)).r);float min_diff=min(a,min(b,min(c,d)));if(min_diff==a)return offset;if(min_diff==b)return offset+vec2(texel_size.x,0.0);if(min_diff==c)return offset+vec2(0.0,texel_size.y);if(min_diff==d)return offset+vec2(texel_size.x,texel_size.y);}void main(){\n#ifdef DEBUG\nfloat d_lrez=texture(texture_depth_lrez,v_uv).r;float d_hrez=texture(texture_depth_hrez,v_uv).r;float output_d=mix(linearize_depth(d_lrez)/far,linearize_depth(d_hrez)/far,step(0.5,v_uv.x));gl_FragColor=vec4(vec3(output_d),1.0);\n#else\nvec2 filtered_uv=nearest_depth_filter(v_uv);vec4 ao=texture(texture_ao_lrez,filtered_uv);gl_FragColor=vec4(ao.rgb,1.0);gl_FragColor=ao;\n#endif\n}",uniforms:{texture_ao_lrez:new bc(null),texture_depth_lrez:new bc(null),texture_depth_hrez:new bc(null),near:new bc(null),far:new bc(null)}}),xR=class extends iO{constructor(e,t){super("AmbientOcclusionPass",void 0,t),this.fogEnabled=!1,this.fogNear=1,this.fogFar=1e3,this.frameIndex=0,this._runHalfRes=!0,this._width=1,this._height=1;let i=1024,r=1024;this.gBuffer=new qi(i,r,{type:Xe,depthTexture:new No(i,r),minFilter:Fe,magFilter:Fe}),this.depthBufferHighRes=new qi(i,r,{depthTexture:new No(i,r)}),this.aoBuffer=new qi(i,r,{minFilter:Fe,magFilter:Fe}),this.splineScene=e,this.splineCamera=t;let n=new Float32Array(2*gR.length);for(let a=0;a=far){final=1.0;}vec3 color=mix(ao_color,vec3(1.0),final);if(fog_enabled){float fog_factor=smoothstep(fog_near,fog_far,view_space_p.z);color=mix(color,vec3(1.0),fog_factor);}gl_FragColor=vec4(color,1.0);}",uniforms:{near:new bc(null),far:new bc(null),fov:new bc(null),proj_info:new bc(new Wi),is_ortho:new bc(!1),resolution:new bc(new wi),radius_of_influence:new bc(8),radius_in_screen_space:new bc(1),exponent:new bc(1),ao_color:new bc(new Zi),bias:new bc(.5),texture_depth:new bc(null),texture_normals:new bc(null),texture_blue_noise:new bc(null),texture_blue_noise_in_disk:new bc(this.blueNoiseInDiskTexture),frame_index:new bc(0),fog_enabled:new bc(!1),fog_near:new bc(1),fog_far:new bc(1e3)}}),this.radius=128,this.aoColor={r:0,g:0,b:0},this.bias=.5,this.hbaoMaterial.uniforms.texture_depth.value=this.gBuffer.depthTexture,this.hbaoMaterial.uniforms.texture_normals.value=this.gBuffer.texture,this.needsSwap=!0,this.aaBuffer=new qi(i,r,{minFilter:Fe,magFilter:Fe,wrapS:Le,wrapT:Le,depthBuffer:!1,type:Xe});let s=new WO({preset:HO,edgeDetectionMode:GI});this.effectPass=new _O(this.camera,s)}initialize(e,t,i){super.initialize(e,t,i),this.effectPass.initialize(e,t,i)}setBlueNoiseTexture(e){this.hbaoMaterial.uniforms.texture_blue_noise.value=e}setSize(e,t){this._width=e,this._height=t,this.depthBufferHighRes.setSize(e,t);let i=this._runHalfRes?.5:1,r=e*i,n=t*i;this.gBuffer.setSize(r,n),this.aoBuffer.setSize(r,n),this.hbaoMaterial.uniforms.resolution.value.set(r,n),this.aaBuffer.setSize(r,n),this.effectPass.setSize(r,n)}get runHalfRes(){return this._runHalfRes}set runHalfRes(e){this._runHalfRes=e,this.setSize(this._width,this._height)}setCamera(e){this.splineCamera=e}setScene(e){this.splineScene=e}render(e,t,i){this.splineScene.overrideMaterial=vR;let r=this.splineCamera.layers.mask;if(this.splineCamera.layers.set(5),e.setRenderTarget(this.gBuffer),e.clear(),e.render(this.splineScene,this.splineCamera),e.setRenderTarget(this.depthBufferHighRes),e.clear(),e.render(this.splineScene,this.splineCamera),this.splineScene.overrideMaterial=null,this.splineCamera.layers.mask=r,this.hbaoMaterial.uniforms.radius_of_influence.value=this.radius,this.hbaoMaterial.uniforms.ao_color.value.set(this.aoColor.r,this.aoColor.g,this.aoColor.b),this.hbaoMaterial.uniforms.bias.value=this.bias,this.hbaoMaterial.uniforms.fog_enabled.value=this.fogEnabled,this.hbaoMaterial.uniforms.fog_near.value=this.fogNear,this.hbaoMaterial.uniforms.fog_far.value=this.fogFar,this.hbaoMaterial.uniforms.frame_index.value=this.frameIndex,this.frameIndex++,this.splineCamera.isPerspectiveCamera){this.hbaoMaterial.uniforms.near.value=this.splineCamera.perspCamera.near,this.hbaoMaterial.uniforms.far.value=this.splineCamera.perspCamera.far;let e=this.splineCamera.perspCamera.projectionMatrix.elements,t=2/e[0],i=2/e[5],r=-(1-e[8])/e[0],n=-(1+e[9])/e[5];this.hbaoMaterial.uniforms.proj_info.value.set(t,i,r,n);let s=this.splineCamera.perspCamera.fov*(Math.PI/180),a=this.hbaoMaterial.uniforms.resolution.value.y/(2*Math.tan(.5*s)),o=.5*this.hbaoMaterial.uniforms.radius_of_influence.value*a;this.hbaoMaterial.uniforms.radius_in_screen_space.value=o,this.hbaoMaterial.uniforms.is_ortho.value=!1}else{this.hbaoMaterial.uniforms.near.value=this.splineCamera.orthoCamera.near,this.hbaoMaterial.uniforms.far.value=this.splineCamera.orthoCamera.far;let e=this.splineCamera.orthoCamera.projectionMatrix.elements,t=2/e[0],i=2/e[5],r=-(1+e[12])/e[0],n=-(1-e[13])/e[5];this.hbaoMaterial.uniforms.proj_info.value.set(t,i,r,n);let s=this.hbaoMaterial.uniforms.resolution.value.y/i*.5,a=this.hbaoMaterial.uniforms.radius_of_influence.value*s;this.hbaoMaterial.uniforms.radius_in_screen_space.value=a,this.hbaoMaterial.uniforms.is_ortho.value=!0}this.runHalfRes?(this.fullscreenMaterial=this.hbaoMaterial,e.setRenderTarget(this.aoBuffer),e.clear(),e.render(this.scene,this.camera),this.fullscreenMaterial=yR,yR.uniforms.texture_ao_lrez.value=this.aoBuffer.texture,yR.uniforms.texture_depth_lrez.value=this.gBuffer.depthTexture,yR.uniforms.texture_depth_hrez.value=this.depthBufferHighRes.depthTexture,e.setRenderTarget(e.aoRenderTarget),e.clear(),e.render(this.scene,this.camera)):(this.fullscreenMaterial=this.hbaoMaterial,e.setRenderTarget(this.aaBuffer),e.clear(),e.render(this.scene,this.camera),this.effectPass.renderToScreen=!1,this.effectPass.render(e,this.aaBuffer,e.aoRenderTarget))}dispose(){this.gBuffer.dispose(),this.depthBufferHighRes.dispose(),this.aoBuffer.dispose()}},bR=class extends CO{constructor(){super(new Yn({vertexShader:"\nvarying vec2 vUv;\nvoid main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"\nuniform sampler2D tInput;\nuniform sampler2D tMap;\nuniform vec2 resolution;\nvarying vec2 vUv;\n\nuniform vec2 uResolution;\nuniform vec2 uCoords;\n\n// Draws a rectangle at center with size \nfloat rectangle(vec2 st, vec2 size) {\n size = vec2(0.5) - size * 0.5;\n vec2 uv = vec2(step(size.x, st.x), step(size.y, st.y));\n uv *= vec2(step(size.x, 1.0 - st.x), step(size.y, 1.0 - st.y));\n\n return uv.x * uv.y;\n}\n\nuniform vec2 uSize;\nuniform float uScale;\nuniform float uDPR;\nuniform float uCurrent;\nuniform vec3 uSceneColor;\n\nvoid main() {\n vec2 screenUv = gl_FragCoord.xy / uResolution.xy;\n screenUv *= 1.0 / uDPR;\n\n vec2 center = vec2(0.5, -0.5);\n vec2 outsideUv = screenUv;\n outsideUv += center;\n outsideUv -= uCoords.xy / uResolution.xy;\n outsideUv = (outsideUv - 0.5) + 0.5;\n outsideUv -= center;\n vec2 s = (uSize / uResolution) * uScale;\n float isOutside = 1.0 - rectangle(outsideUv, s);\n \n vec2 mid = vec2(0.5);\n vec2 insideUv = (screenUv - mid + s * mid) / s;\n vec4 background = texture2D(tInput, screenUv);\n vec4 image = texture2D(tMap, insideUv);\n gl_FragColor = mix(image, background, isOutside);\n}\n",uniforms:{tInput:new bc(null),tMap:new bc(null),uResolution:new bc(new wi),uSize:new bc(new wi),uCoords:new bc(new wi),uScale:new bc(1),uSceneColor:new bc(new Ni(16711680)),uDPR:new bc(1),uCurrent:new bc(0)}}),"tInput"),this.needsSwap=!0}get uniforms(){return this.fullscreenMaterial.uniforms}get texture(){return this.uniforms.tMap.value}set texture(e){this.uniforms.tMap.value=e}},wR=[],_R=class extends CO{constructor(){super(new Yn({vertexShader:"\nvoid main() {\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"\nuniform sampler2D toScene;\nuniform sampler2D fromScene;\nuniform vec2 resolution;\n\nuniform vec2 uResolution;\nuniform float uDPR;\n\nuniform float mixRatio;\nuniform sampler2D tMixTexture;\nuniform int useTexture;\nuniform float threshold;\n\nvoid main() {\n\tvec2 screenUv = gl_FragCoord.xy / uResolution.xy;\n\tscreenUv *= 1.0 / uDPR;\n\n\tvec4 texel1 = texture2D( fromScene, screenUv );\n\tvec4 texel2 = texture2D( toScene, screenUv );\n\n\tif (useTexture==1) {\n\t\t\n\t\tvec4 transitionTexel = texture2D( tMixTexture, screenUv );\n\t\tfloat r = mixRatio * (1.0 + threshold * 2.0) - threshold;\n\t\tfloat mixf=clamp((transitionTexel.r - r)*(1.0/threshold), 0.0, 1.0);\n\t\t\n\t\tgl_FragColor = mix( texel1, texel2, mixf );\n\t} else {\n\t\t\n\t\tgl_FragColor = mix( texel1, texel2, mixRatio );\n\t\t\n\t}\n}\n",uniforms:{toScene:new bc(null),fromScene:new bc(null),uResolution:new bc(new wi),uDPR:new bc(1),mixRatio:new bc(0),threshold:new bc(.1),useTexture:new bc(0),tMixTexture:{value:wR[0]}}}),"toScene"),this.needsSwap=!0}get uniforms(){return this.fullscreenMaterial.uniforms}get texture(){return this.uniforms.fromScene.value}set texture(e){this.uniforms.fromScene.value=e}};function SR(e,t){return t&&t.enabled&&e.push(t.effect),e}var AR=e=>Object.values(pO).includes(e)?e:pO.NORMAL,MR=class extends ai{constructor(e){super(),this.postprocessingState=Ib.defaultData,this._scene=new Ho,this._camera=new xI,this.effects=new Map,this.blueNoiseTexture=new Qo,this._renderToScreen=!0,this.clock=new rc,this.renderer=e,this.debug=!1,this.effects.set("bloom",new JO),this.effects.set("chromaticAberration",new eR),this.effects.set("vignette",new nR),this.effects.set("noise",new rR),this.effects.set("colorAverage",new tR),this.effects.set("hueSaturation",new iR),this.effects.set("brightnessContrast",new $O),this.effects.set("depthOfField",new sR),this.effects.set("pixelation",new aR),this.effectComposer=new pR(this.renderer),this.effectComposer.autoRenderToScreen=!1,this.opaquePass=new uR(!0,this.scene,this.camera),this.opaquePass.clear=!0,this.transmissionPass=new hR(this.scene,this.camera,this.renderer),this.aoPass=new xR(this.scene,this.camera),this.taaPass=new lR,this.taaPass.renderToScreen=!1,this.helperPass=new mR(this.camera),this.helperPass.renderToScreen=!1,this.overlayPass=new bR,this.overlayPass.enabled=!1,this.sceneTransitionPass=new _R,this.sceneTransitionPass.enabled=!1,this._initCopyPass(),this._initPasses()}set overlayTexture(e){void 0!==e?(this.overlayPass.texture=e,this.overlayPass.enabled=!0):this.overlayPass.enabled=!1}get overlayTexture(){return this.overlayPass.texture}set sceneHelpers(e){this.helperPass.sceneHelpers=e}get sceneHelpers(){return this.helperPass.sceneHelpers}set sceneHelpersOnTop(e){this.helperPass.sceneHelpersOnTop=e}get sceneHelpersOnTop(){return this.helperPass.sceneHelpersOnTop}get scene(){return this._scene}set scene(e){this._scene=e,this.opaquePass.setScene(e),this.transmissionPass.setScene(e),this.aoPass.setScene(e)}get camera(){return this._camera}set camera(e){this._camera=e,this.opaquePass.setCamera(e),this.transmissionPass.setCamera(e),this.aoPass.setCamera(e),this.helperPass.setCamera(e)}updateRenderToScreen(){let e=!1;for(let t=this.effectComposer.passes.length-1;t>=0;t--){let i=this.effectComposer.passes[t];!0!==i.enabled||e||!this._renderToScreen?i.renderToScreen=!1:(i.renderToScreen=!0,e=!0)}}disableHelpers(){this.helperPass.enabled=!1,this.updateRenderToScreen()}enableHelpers(){this.helperPass.enabled=!0,this.updateRenderToScreen()}updateBlueNoiseTexture(e){this.blueNoiseTexture=new Qo(e,128,128),this.blueNoiseTexture.wrapS=Re,this.blueNoiseTexture.wrapT=Re,this.blueNoiseTexture.minFilter=ze,this.blueNoiseTexture.magFilter=ze,this.blueNoiseTexture.needsUpdate=!0}setAmbientOcclusionParams(e,t,i,r,n,s,a,o){this.aoPass.enabled=e,this.aoPass.radius=t,this.aoPass.bias=i,this.aoPass.aoColor=r,this.aoPass.fogEnabled=n,this.aoPass.fogNear=s,this.aoPass.fogFar=a,this.aoPass.runHalfRes!==!o&&(this.aoPass.runHalfRes=!o)}setTransmissionPassEnabled(e){this.transmissionPass.enabled=e,this.opaquePass.hasTransmissionPass=e}_initPasses(){if(this.uvEffectPass?.dispose(),this.effectPass?.dispose(),this.effectComposer.removeAllPasses(),this.transmissionPass.updatePasses(this.renderer),this.effectComposer.addPass(this.aoPass),this.effectComposer.addPass(this.opaquePass),this.effectComposer.addPass(this.transmissionPass),this.effectComposer.addPass(this.taaPass),this.postprocessingState.enabled){let e=[this.effects.get("pixelation")].reduce(SR,[]);e.length>0&&(this.uvEffectPass=new _O(this.camera,...e),this.uvEffectPass.renderToScreen=!1,this.effectComposer.addPass(this.uvEffectPass));let t=[this.effects.get("chromaticAberration"),this.effects.get("bloom"),this.effects.get("colorAverage"),this.effects.get("hueSaturation"),this.effects.get("brightnessContrast"),this.effects.get("vignette"),this.effects.get("noise")].reduce(SR,[]);t.length>0&&(this.effectPass=new _O(this.camera,...t),this.effectPass.renderToScreen=!1,this.effectComposer.addPass(this.effectPass))}this.effectComposer.addPass(this.overlayPass),this.effectComposer.addPass(this.sceneTransitionPass),this.effectComposer.addPass(this.helperPass)}_initCopyPass(){if(this._savePass)return;let e=new wi;this.renderer.getDrawingBufferSize(e),this._rt=new qi(e.x,e.y,{depthBuffer:!1,stencilBuffer:!1,wrapS:Re,wrapT:Re}),this._rt.samples=0,this._savePass=new rO(this._rt,!1),this._savePass.renderToScreen=!1}setCopyPass(e){this._rt=e,this._savePass=new rO(this._rt,!1),this.renderToScreen=!1}get renderToScreen(){return this._renderToScreen}set renderToScreen(e){if(this._renderToScreen===e)return;let t=this.effectComposer;!t||(!0===e?t.removePass(this._savePass):t.addPass(this._savePass),this._renderToScreen=e,this.updateRenderToScreen())}set sceneTransitionFromTexture(e){e!==this.sceneTransitionPass.texture&&(null!==e?this.sceneTransitionPass.enabled=!0:(this.sceneTransitionPass.enabled=!1,this.updateRenderToScreen()),this.sceneTransitionPass.texture=e)}get texture(){return this._rt&&this._rt.texture}get renderTarget(){return this._rt}updatePostprocessing(e){let{enabled:t,...i}=e,r=!1;t!==this.postprocessingState.enabled&&(r=!0);for(let n of Object.entries(i)){let e=n[1],t=this.effects.get(n[0]);if(t){t.enabled!==e.enabled&&(r=!0),t.enabled=e.enabled;for(let[i,r]of Object.entries(e))"blendFunction"===i?t.blendFunction=AR(r):t[i]=r}}this.postprocessingState=e,r&&this._initPasses()}render(){this.effectComposer.render(this.clock.getDelta())}setScissor(e,t,i,r){e instanceof Wi?(this.effectComposer.inputBuffer.scissor.set(e.x,e.y,e.z,e.w),this.effectComposer.outputBuffer.scissor.set(e.x,e.y,e.z,e.w)):(this.effectComposer.inputBuffer.scissor.set(e,t,i,r),this.effectComposer.outputBuffer.scissor.set(e,t,i,r));let n=this.renderer.getPixelRatio();this.effectComposer.inputBuffer.scissor.multiplyScalar(n),this.effectComposer.outputBuffer.scissor.multiplyScalar(n),this.renderer.setScissor(e,t,i,r)}setScissorTest(e){this.effectComposer.inputBuffer.scissorTest=e,this.effectComposer.outputBuffer.scissorTest=e,this.renderer.setScissorTest(e)}setViewport(e,t,i,r){e instanceof Wi?(this.effectComposer.inputBuffer.viewport.copy(e),this.effectComposer.outputBuffer.viewport.copy(e)):(this.effectComposer.inputBuffer.viewport.set(e,t,i,r),this.effectComposer.outputBuffer.viewport.set(e,t,i,r))}resize(e,t,i){if(this.effectComposer.setSize(e,t,i),this._rt){let i=this.renderer.getPixelRatio();this._rt.setSize(e*i,t*i)}}dispose(){this.uvEffectPass?.dispose(),this.effectPass?.dispose(),this.effectComposer.dispose()}},ER=cs.lights_fragment_begin,CR=cs.shadowmask_pars_fragment,TR=null,DR=new Yn({vertexShader:"\nattribute vec3 randomColor;\nvarying vec3 vNormal;\nflat out vec3 vColor;\n\nvoid main()\n{\nvNormal = normal;\nvColor = randomColor;\ngl_Position = projectionMatrix * (modelViewMatrix * vec4(position, 1.0));\n}\n",fragmentShader:"\nuniform float depthContrast;\nvarying vec3 vNormal;\nflat in vec3 vColor;\nvoid main()\n{\nvec3 normal = (normalize(vNormal)).rgb;\n\nfloat contrastDepth = (gl_FragCoord.z - 0.5) * depthContrast + 0.5;\n\nvec3 resultColor = mix(mix(vColor, normal, 0.2), vec3(contrastDepth), 0.4);\ngl_FragColor = vec4(resultColor, vColor.r);\n}\n",uniforms:{depthContrast:{value:1}}}),PR=new Hi,IR=class extends jo{constructor(e){super(e),this._pixelRatio=this.getPixelRatio(),this.viewportWidth=1,this.viewportHeight=1,this.resolution=new wi,this.pipeline=new MR(this),this.dummyCamera=new xI,this.sceneTransitionDuration=0,this.sceneTransitionTimeRemaining=-1,this.isXRCopyPassSet=!1,this.clear=(e=!0,t=!0,i=!0)=>{let r=this.getContext(),n=0;e&&(n|=r.COLOR_BUFFER_BIT),t&&(n|=r.DEPTH_BUFFER_BIT),i&&(n|=r.STENCIL_BUFFER_BIT),r.clear(n),r.clearBufferfv(r.COLOR,1,[0,0,0,1])},this.autoClear=!1;let t=this.setPixelRatio.bind(this),i=this.setSize.bind(this);this.shadowMap.enabled=!0,this.shadowMap.type=k,this.dummyCamera.matrixAutoUpdate=!1;let r=this.getContext();if(r&&"drawingBufferColorSpace"in r)try{r.drawingBufferColorSpace="display-p3"}catch(Ox){console.warn(Ox)}this.setPixelRatio=e=>{this._pixelRatio!==e&&(this._pixelRatio=e,t(e))},this.setSize=(e,t,r=!0)=>{(this.viewportWidth!==e||this.viewportHeight!==t)&&(this.viewportWidth=e,this.viewportHeight=t,i(e,t,r),this.normalRenderTarget?.setSize(e*this._pixelRatio,t*this._pixelRatio),this._resizeTransmission(e,t),this.transmissionDepthTarget?.setSize(e*this._pixelRatio/2,t*this._pixelRatio/2),this.pipeline.resize(e,t,r))},this._superDispose=this.dispose,this.dispose=this._currentDispose}createAORenderTarget(){void 0===this.aoRenderTarget&&(this.aoRenderTarget=new qi(this.viewportWidth*this._pixelRatio,this.viewportHeight*this._pixelRatio,{generateMipmaps:!1,minFilter:Fe,magFilter:Fe,wrapS:Le,wrapT:Le,depthBuffer:!1}))}_resizeTransmission(e,t){this.transmissionRenderTarget?.setSize(e*this._pixelRatio/(this.hdTransmission?1:2),t*this._pixelRatio/(this.hdTransmission?1:2)),this.aoRenderTarget?.setSize(e*this._pixelRatio/1,t*this._pixelRatio/1)}get hdTransmission(){return 1===RT.transmissionLod.value}set hdTransmission(e){RT.transmissionLod.value=!0===e?1:2,this._resizeTransmission(this.viewportWidth,this.viewportHeight)}createTransmissionRenderTarget(){void 0===this.transmissionRenderTarget&&(this.transmissionRenderTarget=new qi(this.viewportWidth*this._pixelRatio/(this.hdTransmission?1:2),this.viewportHeight*this._pixelRatio/(this.hdTransmission?1:2),{generateMipmaps:!0,minFilter:Ve,magFilter:Fe,wrapS:Le,wrapT:Le,depthBuffer:!1}),this.transmissionDepthTarget=new qi(this.viewportWidth*this._pixelRatio/2,this.viewportHeight*this._pixelRatio/2,{minFilter:ze,magFilter:ze,depthBuffer:!1}))}createNormalRenderTarget(){void 0===this.normalRenderTarget&&(this.normalRenderTarget=new qi(this.viewportWidth*this._pixelRatio,this.viewportHeight*this._pixelRatio,{generateMipmaps:!1,minFilter:ze,magFilter:ze,type:Xe,depthTexture:new No(this.viewportWidth*this._pixelRatio,this.viewportHeight*this._pixelRatio)}))}renderNormal(e,t,i){this.normalRenderTarget&&(this.setClearColor(0),i.layers.enable(8),i.layers.disable(0),i.layers.disable(3),t.traverseEntity((e=>{e.layers.isEnabled(8)&&(e.copyPreviousMatrix=!1)})),this.setRenderTarget(this.normalRenderTarget),this.clear(),DR.uniforms.depthContrast.value=i instanceof xI?(i.far-i.near)/1e4:1,t.overrideMaterial=DR,this.render(t,i),this.setClearColor(t.bgColor,t.bgColor.a),this.setRenderTarget(null),t.overrideMaterial=e.wireframeState?FL:null,i.layers.enable(0),i.layers.enable(3),t.traverseEntity((e=>{e.layers.isEnabled(8)&&(e.copyPreviousMatrix=!0)})))}renderSplineSceneWithDummyCamera(e,t,i=1){this.dummyCamera.updateCameraState(t.dataPatched),this.dummyCamera.matrix.copy(t.matrixWorld);let r=t.height,n=t.width,s=this.viewportWidth/this.viewportHeight;n{RT.penumbraSize.value[t]=e})),RT.pixelRatioNode.value=this.getPixelRatio(),0!==this.resolution.x&&0!==this.resolution.y?RT.resolution.value.set(this.resolution.x,this.resolution.y):RT.resolution.value.set(this.viewportWidth*this._pixelRatio,this.viewportHeight*this._pixelRatio),void 0!==s?(RT.normalRenderTarget.value=s,RT.normalRenderTargetDepth.value=PR):l.needsNormal()&&(this.createNormalRenderTarget(),RT.normalRenderTarget.value=this.normalRenderTarget.texture,RT.normalRenderTargetDepth.value=this.normalRenderTarget.depthTexture,this.renderNormal(l,a,t));let h=a.data.ao,c=h.occlusion;c&&(this.createAORenderTarget(),RT.aoRenderTarget.value=this.aoRenderTarget.texture),RT.aoEnabled.value=c,this.pipeline.setAmbientOcclusionParams(h.occlusion,h.radius,h.bias,a.aoColor,null!==a.fog,a.backupFog.near,a.backupFog.far,h.aoFullRes),this.pipeline.aoPass.setBlueNoiseTexture(this.pipeline.blueNoiseTexture);let d=!1;if(void 0!==n)RT.transmissionRenderTarget.value=n,RT.transmissionRenderTargetDepth.value=PR,this.pipeline.setTransmissionPassEnabled(!1);else{let e=l.needsTransmission();e&&(void 0===this.transmissionRenderTarget&&(d=!0),this.createTransmissionRenderTarget(),RT.transmissionRenderTarget.value=this.transmissionRenderTarget.texture,RT.aspectRatio.value=function(e,t){return e>=t?new wi(t/e,1):new wi(1,e/t)}(this.viewportWidth,this.viewportHeight),RT.transmissionRenderTargetDepth.value=this.transmissionDepthTarget.texture),this.pipeline.setTransmissionPassEnabled(e)}t.layers.enable(3),t.layers.enable(8),this.pipeline.sceneHelpers=i,this.pipeline.sceneHelpersOnTop=r,this.pipeline.scene=a,this.pipeline.camera=t,d&&this.pipeline.transmissionPass.updatePasses(this),this.pipeline.postprocessingState!==a.postprocessing&&(this.pipeline.updatePostprocessing(a.postprocessing),!i&&!r&&this.pipeline.disableHelpers()),void 0!==this.clearAlphaOverride&&this.setClearAlpha(this.clearAlphaOverride),a.overrideMaterial=l.wireframeState?FL:null,this.pipeline.render(),RT.frameIndex.value=(RT.frameIndex.value+1)%16,t instanceof xI&&t.copyHistory(),a.visible=o}renderFromSceneForSceneTransitionPass(e,t,i){this.pipeline.renderToScreen=!1,this.pipeline.renderTarget,this.renderSplineScene(e,t),this.pipeline.sceneTransitionFromTexture=this.pipeline.renderTarget.texture,this.sceneTransitionDuration=i,this.sceneTransitionTimeRemaining=i,this.pipeline.renderToScreen=!0;let r=this.pipeline.sceneTransitionPass.uniforms;r.uDPR.value=window.devicePixelRatio,r.uResolution.value.set(this.domElement.width,this.domElement.height).divideScalar(window.devicePixelRatio)}_currentDispose(){this._superDispose(),this.pipeline.dispose(),this.aoRenderTarget?.dispose(),this.transmissionRenderTarget?.dispose(),this.transmissionDepthTarget?.dispose(),this.normalRenderTarget?.dispose(),this.normalRenderTarget?.depthTexture?.dispose()}},OR=class extends(tI(zc)){constructor(e,t=15,i=10066329){super(e,t,i),this.object=e,this.added=!1,this.name=`DirectionalLightHelper: ${e.uuid}`}raycast(e,t){sI(this.object,OR.geometryHelper,e,t)}},RR=class extends(tI(Oc)){constructor(e,t=15,i=6710886){super(e,t,i),this.object=e,this.name=`PointLightHelper: ${e.uuid}`}raycast(e,t){sI(this.object,RR.geometryHelper,e,t)}},LR=class extends(tI(Ic)){constructor(e,t=6710886){super(e,t),this.object=e,this.name=`SpotLightHelper: ${e.uuid}`}raycast(e,t){sI(this.object,LR.geometryHelper,e,t)}update(){if(void 0!==this.object){let e=LR._vector,t=this.object.distance?this.object.distance:1e3,i=t*Math.tan(this.object.angle);this.cone.scale.set(i,i,t),e.setFromMatrixPosition(this.object.target.matrixWorld),this.cone.lookAt(e);let r=void 0!==this.color?this.color:this.light.color;if(this.cone.material instanceof Array)for(let n=0,s=this.cone.material.length;n{if(e instanceof sP)if(Array.isArray(e.material))for(let t of e.material)t.needsUpdate=!0;else e.material.needsUpdate=!0,e.material.dispose()}))}updateShadow(e){void 0!==e.softShadowQuality&&this.isActive&&((e="medium")=>{if(TR===e)return!1;TR=e;let t=(e=>{switch(e){case"low":return 8;case"medium":default:return 16;case"high":return 32}})(e);cs.shadowmap_pars_fragment=(e=>`\n\n// PCSS implementation based on:\n// https://www.gamedev.net/articles/programming/graphics/contact-hardening-soft-shadows-made-fast-r4906/\n// NOTE: This number affects how big the shadow blur can\n// possibly get. Bigger number == bigger blur, but less precise results\n\nconst float gPenumbraFilterSize = 80.0;\nconst int gPenumbraSamples = ${e};\nconst int gShadowSamples = ${e};\nconst float gShadowSamplesRpc = 1.0f / float(gShadowSamples);\n\n#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n\n uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\n struct DirectionalLightShadow {\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n\n uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\n #endif\n\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n\n uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\n struct SpotLightShadow {\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n\n uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\n #endif\n\n #if NUM_POINT_LIGHT_SHADOWS > 0\n\n uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\n struct PointLightShadow {\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n float shadowCameraNear;\n float shadowCameraFar;\n };\n\n uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\n #endif\n\n /*\n #if NUM_RECT_AREA_LIGHTS > 0\n\n // TODO (abelnation): create uniforms for area light shadows\n\n #endif\n */\n\nfloat computePenumbra(int index, sampler2D shadowMap, float temporalAngle, float texelSize, vec2 uv, float compare, float texelScalar, float shadowRadius)\n{\n float penumbra = 1.0;\n float blockerDepthAvg = 0.0;\n float blockerCount = 0.0;\n\n #pragma unroll_loop_start\n for(int i = 0; i < gPenumbraSamples; i ++)\n {\n vec2 offset = (vogelDiskSample(i, gShadowSamples, temporalAngle) * texelSize) * texelScalar;\n float depth = unpackRGBAToDepth( texture2D( shadowMap, uv + offset ) );\n\n if(depth < compare + 0.0001)\n {\n blockerDepthAvg += depth;\n blockerCount++;\n }\n }\n #pragma unroll_loop_end\n\n if (blockerCount > 0.0)\n {\n blockerDepthAvg /= blockerCount;\n\n // Compute penumbra\n penumbra = (compare - blockerDepthAvg) / (blockerDepthAvg);\n penumbra *= penumbra;\n penumbra *= 200.0 * penumbraSize[min(index, 5 - 1)]; // Magic number that affects how quickly the penumbra grows\n\n return clamp(penumbra, 0.00, 1.0);\n }\n return 0.0;\n}\n\nfloat vogelShadow(int index, sampler2D shadowMap, vec2 uv, float texelSize, float compare, float shadowRadius)\n{\n float shadow = 0.0f;\n\n // NOTE: When using TAA, we should use screen space interleaved gradient noise\n vec2 halton = haltonSequence[frameIndex];\n float temporalOffset = getNoiseInterleavedGradient(gl_FragCoord.xy + halton);\n float temporalAngle = temporalOffset * PI2;\n\n float texelScalar = (gPenumbraFilterSize) / (texelSize * 1024.);\n float penumbra = computePenumbra(index, shadowMap, temporalAngle, texelSize, uv, compare, texelScalar, shadowRadius);\n if (penumbra == -1.0) {\n return 1.0;\n }\n\n #pragma unroll_loop_start\n for (int i = 0; i < gShadowSamples; i++)\n {\n vec2 vogelSample = vogelDiskSample(i, gShadowSamples, temporalAngle) * texelSize;\n // Overall blurring offset\n vec2 offset = vogelSample * (shadowRadius * 2.);\n\n // Penumbra offset\n offset += vogelSample * (penumbra * texelScalar);\n\n shadow += step( compare, unpackRGBAToDepth( texture2D( shadowMap, uv + offset ) ) );\n }\n #pragma unroll_loop_end\n\n return shadow * gShadowSamplesRpc;\n}\n\n\n float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\n return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\n }\n\n vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\n return unpackRGBATo2Half( texture2D( shadow, uv ) );\n\n }\n\n float VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\n float occlusion = 1.0;\n\n vec2 distribution = texture2DDistribution( shadow, uv );\n\n float hard_shadow = step( compare , distribution.x ); // Hard Shadow\n\n if (hard_shadow != 1.0 ) {\n\n float distance = compare - distribution.x ;\n float variance = max( 0.00000, distribution.y * distribution.y );\n float softness_probability = variance / (variance + distance * distance ); // Chebeyshevs inequality\n softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); // 0.3 reduces light bleed\n occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\n }\n return occlusion;\n\n }\n\n float getShadow( int i, sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\n float shadow = 1.0;\n\n shadowCoord.xyz /= shadowCoord.w;\n shadowCoord.z += shadowBias;\n\n // if ( something && something ) breaks ATI OpenGL shader compiler\n // if ( all( something, something ) ) using this instead\n\n bvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n bool inFrustum = all( inFrustumVec );\n\n bvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\n bool frustumTest = all( frustumTestVec );\n\n if ( frustumTest ) {\n\n #if defined( SHADOWMAP_TYPE_PCF )\n\n vec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n return vogelShadow(i, shadowMap, shadowCoord.xy, texelSize.x, shadowCoord.z, shadowRadius );\n\n #elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\n vec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n float dx = texelSize.x;\n float dy = texelSize.y;\n\n vec2 uv = shadowCoord.xy;\n vec2 f = fract( uv * shadowMapSize + 0.5 );\n uv -= f * texelSize;\n\n shadow = (\n texture2DCompare( shadowMap, uv, shadowCoord.z ) +\n texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n f.x ) +\n mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n f.x ) +\n mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n f.y ) +\n mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n f.y ) +\n mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n f.x ),\n mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n f.x ),\n f.y )\n ) * ( 1.0 / 9.0 );\n\n #elif defined( SHADOWMAP_TYPE_VSM )\n\n shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\n #else // no percentage-closer filtering:\n\n shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\n #endif\n\n }\n\n return shadow;\n\n }\n\n // cubeToUV() maps a 3D direction vector suitable for cube texture mapping to a 2D\n // vector suitable for 2D texture mapping. This code uses the following layout for the\n // 2D texture:\n //\n // xzXZ\n // y Y\n //\n // Y - Positive y direction\n // y - Negative y direction\n // X - Positive x direction\n // x - Negative x direction\n // Z - Positive z direction\n // z - Negative z direction\n //\n // Source and test bed:\n // https://gist.github.com/tschw/da10c43c467ce8afd0c4\n\n vec2 cubeToUV( vec3 v, float texelSizeY ) {\n\n // Number of texels to avoid at the edge of each square\n\n vec3 absV = abs( v );\n\n // Intersect unit cube\n\n float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n absV *= scaleToCube;\n\n // Apply scale to avoid seams\n\n // two texels less per square (one texel will do for NEAREST)\n v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\n // Unwrap\n\n // space: -1 ... 1 range for each square\n //\n // #X## dim := ( 4 , 2 )\n // # # center := ( 1 , 1 )\n\n vec2 planar = v.xy;\n\n float almostATexel = 1.5 * texelSizeY;\n float almostOne = 1.0 - almostATexel;\n\n if ( absV.z >= almostOne ) {\n\n if ( v.z > 0.0 )\n planar.x = 4.0 - v.x;\n\n } else if ( absV.x >= almostOne ) {\n\n float signX = sign( v.x );\n planar.x = v.z * signX + 2.0 * signX;\n\n } else if ( absV.y >= almostOne ) {\n\n float signY = sign( v.y );\n planar.x = v.x + 2.0 * signY + 2.0;\n planar.y = v.z * signY - 2.0;\n\n }\n\n // Transform to UV space\n\n // scale := 0.5 / dim\n // translate := ( center + 0.5 ) / dim\n return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\n }\n\n float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\n float shadow = 1.0;\n vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\n // for point lights, the uniform @vShadowCoord is re-purposed to hold\n // the vector from the light to the world-space position of the fragment.\n vec3 lightToPosition = shadowCoord.xyz;\n\n // dp = normalized distance from light to fragment position\n float compare = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); // need to clamp?\n compare += shadowBias;\n\n // bd3D = base direction 3D\n vec3 bd3D = normalize( lightToPosition );\n\n vec2 halton = haltonSequence[frameIndex];\n float temporalOffset = getNoiseInterleavedGradient(gl_FragCoord.xy + halton);\n float temporalAngle = temporalOffset * PI2;\n\n #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_VSM )\n for (int i = 0; i < gShadowSamples; i++) {\n vec2 vogelSample = vogelDiskSample(i, gShadowSamples, temporalAngle) * texelSize;\n\n // Overall blurring offset\n vec3 offset = vec3(vogelSample.x, vogelSample.y, -vogelSample.x) * (shadowRadius + 5.);\n\n // NOTE: Removed for now\n // Penumbra offset\n //offset += vec3(vogelSample.x, vogelSample.y, vogelSample.y) * (penumbra * gPenumbraFilterSize);\n\n shadow += texture2DCompare( shadowMap, cubeToUV( bd3D + offset, texelSize.y ), compare );\n\n }\n return shadow * gShadowSamplesRpc;\n\n #elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n for (int i = 0; i < 16; i++) {\n vec2 vogelSample = vogelDiskSample(i, gShadowSamples, temporalAngle) * texelSize;\n\n // Overall blurring offset\n vec3 offset = vec3(vogelSample.x, vogelSample.y, -vogelSample.x) * (shadowRadius + 5.);\n\n shadow += texture2DCompare( shadowMap, cubeToUV( bd3D + offset, texelSize.y ), compare );\n\n }\n return shadow * (1.0 / 16.0);\n #else // no percentage-closer filtering\n\n return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), compare );\n\n #endif\n\n }\n\n#endif\n`)(t);let i=ER.slice();i=i.replace("getShadow( spotShadowMap[ i ]","getShadow( UNROLLED_LOOP_INDEX + 3, spotShadowMap[ i ]"),i=i.replace("getShadow( directionalShadowMap[ i ]","getShadow( UNROLLED_LOOP_INDEX, directionalShadowMap[ i ]"),cs.lights_fragment_begin=i;let r=CR.slice();return r=r.replaceAll("getShadow(","getShadow( UNROLLED_LOOP_INDEX, "),cs.shadowmask_pars_fragment=r,!0})(e.softShadowQuality)&&this.forceMaterialsUpdate()}updateFog(e,t){if(e.enabled?this.fog=this.backupFog:this.fog=null,this.isActive){this.scene.fog=this.fog}this.fogUseBGColor=e.useBackgroundColor,e.useBackgroundColor?this.backupFog.color.set(this.bgColor):this.backupFog.color=yD(e.color,t),this.backupFog.near=e.near,this.backupFog.far=e.far}updateAo(e,t){void 0!==e.aoColor&&(this.aoColor=yD(e.aoColor,t))}updateByOp(e,t,i,r){super.updateByOp(e,t,i,r);let n=t;jv(e.path,["fog"])?this.updateFog(n.fog,i.shared):jv(e.path,["ao"])?this.updateAo(n.ao,i.shared):jv(e.path,["ambient"])?this.updateAmbientLight(n.ambient,i.shared):jv(e.path,["shadow"])&&this.updateShadow(n.shadow)}updateState(e,t){this.updateState_Entity(e,t),void 0!==e.backgroundColor&&this.setBackgroundColor(yD(e.backgroundColor,t.shared)),void 0!==e.fog&&this.updateFog(e.fog,t.shared),void 0!==e.ambient&&this.updateAmbientLight(e.ambient,t.shared),void 0!==e.ao&&this.updateAo(e.ao,t.shared),void 0!==e.shadow&&this.updateShadow(e.shadow)}raycast(e,t){super.raycast(e,t)}switchActiveCamera(e){e&&e.isDescendantOf(this)&&(this.activeCamera!==this.personalCamera&&(this.activeCamera.objectHelper.visible=!0),this.activeCamera=e,e.objectHelper.visible=!1)}get playCamera(){return this.scene?.find(this.data.publish.playCamera)??this.personalCamera}switchToPlayCamera(){this.switchActiveCamera(this.playCamera)}get penumbraSizeArray(){return null===this.penumbraSizeArrayCache&&this.updatePenumbraSizeArray(),this.penumbraSizeArrayCache}updatePenumbraSizeArray(){this.penumbraSizeArrayCache=new Array(5).fill(.5);let e=0,t=0;this.traverseEntity((i=>{if(!i.visible)return!0;i instanceof zR&&i.visible&&e<3&&(this.penumbraSizeArrayCache[e]=i.data.penumbraSize,e+=1),i instanceof UR&&i.visible&&e<2&&(this.penumbraSizeArrayCache[3+t]=i.data.penumbraSize,t+=1)}))}raycastWithClones(e){let t=[],i=r=>{for(let n of r.children){let r=n.cloner;vS.is(n)&&(n.visible||r?.object.data.visible)&&((DI(n)||II(n)&&this.scene.enableHelpers&&n.objectHelper.visible)&&(e.intersectObject(n,!1,t),iL(n,e,t,!0)),i(n))}};return i(this),t}},jR=class extends(TI(Jh,RR)){constructor(e,t,i){super(),this.super_Entity(e,t),this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024,this.shadow.normalBias=1,this.layers.enable(3);let r=this.shadow.camera;r.fov=90,r.aspect=1,r.near=100,r.far=2500;let n=new Zi(-r.far+this.position.x,-r.far+this.position.y,-r.far+this.position.z),s=new Zi(r.far+this.position.x,r.far+this.position.y,r.far+this.position.z),a=new $i(n,s),o=new Vc(a,new Ni(16755200));o.visible=!1,this.gizmos.shadowmap=o,this.update()}update(){if(this.shadow&&(this.shadow.camera.updateProjectionMatrix(),this.gizmos))for(let e in this.gizmos){let t=this.gizmos[e];if(t instanceof Vc){let e=this.shadow.camera,i=new Zi(-e.far+this.position.x,-e.far+this.position.y,-e.far+this.position.z),r=new Zi(e.far+this.position.x,e.far+this.position.y,e.far+this.position.z);t.box.set(i,r),t.updateMatrixWorld(!0)}}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.objectHelper&&this.objectHelper.update()}updateState(e,t){this.updateState_Light(e,t),void 0!==e.distance&&(this.distance=e.distance),void 0!==e.decay&&(this.decay=e.decay),void 0!==e.shadowRadius&&(this.shadow.radius=e.shadowRadius),void 0!==e.shadowResolution&&(this.shadow.mapSize.set(e.shadowResolution,e.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null))}},GR=class extends dP{get forceComputeSize(){return!0}get shape(){return this.geometry.userData.shape}updateEntityBoxSize(e,t){let i=this.geometry.getAttribute("position");void 0!==i?ZE(i,this.geometry.drawRange.start,this.geometry.drawRange.count<1/0?this.geometry.drawRange.count:i.count,e,t):super.updateEntityBoxSize(e,t)}},HR=class extends dP{constructor(e,t,i){super(e,t,i),this._shapeId=null,this._context=i}updateState(e,t){super.updateState(e,t),this.updateShape()}updateShape(){let e,t={...this.data.geometry.extrusion.shape};for(let r in t)"string"==typeof t[r]&&(t[r]=this._context.shared.getVariable(t[r],[this.uuid,"geometry","extrusion","shape",r]));if("Custom"===t.type){let i=t.shapeId;if(i!==this._shapeId&&this.detachShape(),i){this._shapeId=i;let t=this._context.scene.find(i);t?.data&&(t.attachedPaths.add(this),e=t.geometry.userData?.shape),e||this._context.scene.addPendingCommand((()=>this.updateShape()))}}else{let i;switch(t.type){case"Rectangle":i=HM;break;case"Ellipse":i=hM;break;case"Polygon":i=FM;break;case"Star":i=qM;break;default:throw new Error(`Unknown shape type: ${t.type}`)}e=i.create({parameters:t}).userData.shape}let i=this.geometry;e&&i.inputs&&(i.inputs.shapeData=e,i.build(),this.attachedSurfaceCloners.forEach((e=>e.update())))}detachShape(){null!==this._shapeId&&this._context.scene.find(this._shapeId)?.attachedPaths.delete(this)}createGeometryDelayed(e){this.geometryCreateDeleyed=e.shared,this.updateShape(),this.refreshAttachedPaths(e)}updateTransformState(e,t){return super.updateTransformState(e,t)}updateGeometryInteractions(e,t){super.updateGeometryInteractions(e,t),this.updateShape()}updateEntityBoxSize(e,t){let i=this.geometry.getAttribute("position");void 0!==i?ZE(i,this.geometry.drawRange.start,this.geometry.drawRange.count<1/0?this.geometry.drawRange.count:i.count,e,t):super.updateEntityBoxSize(e,t)}},WR=class extends(uI(Bo,OI)){constructor(e,t,i){super(),"Instance"===t.type&&"string"==typeof e&&(t=this.transformAssignData(t,i)),this.super_Entity(e,t),this.objectHelper.update()}get isComponentRoot(){return"Component"===this.data.type&&"string"==typeof this.identity}get isInstanceRoot(){return"Instance"===this.data.type&&"string"==typeof this.identity}transformAssignData(e,t){let i=Ow.getComponentData({scene:t.scene.data,shared:t.shared.data},e.component);if(i){let t,r;for(let n of Yb.rootOverrideProps)void 0===e[n]?(void 0===t&&(t={...e}),t[n]=i.data[n]):(void 0===r&&(r={}),r[n]=e[n],void 0===t&&(t={...e}),t[n]=dv.apply(i.data[n],e[n]));return this.overrideData=r,t}return{...Ub.defaultData,...e,...Ag(Ub.defaultData,Yb.rootOverrideProps)}}updateByOp(e,t,i,r){let n;if(this.isInstanceRoot&&!r)if(t=this.transformAssignData(t,i),0===e.type&&0===e.path.length&&this.component)for(let s of Yb.rootOverrideProps)s in e.props&&void 0===e.props[s]&&(void 0===n&&(n={...e,props:{...e.props}}),n.props[s]=this.component.data[s]);else if(0===e.type&&e.path.length>0&&Yb.rootOverrideProps.includes(e.path[0])){let i=e.path[0];void 0===n&&(n={...e,path:[],props:{[i]:t[i]}})}super.updateByOp(n??e,t,i,r)}updateState(e,t){this.updateState_Entity(e,t)}expandInstanceChildren(e){let t=this.data;if(void 0===this.component){let i=e.scene.find(t.component)??null,r=!1;if(i!==this.oldComponent){if(this.oldComponent){let t=0;for(let i of this.children){if(!vS.is(i))break;e.scene.disposeAndUnregisterEntityRecursivelyIfNotReregistered(i),qR(i),t+=1}this.children.splice(0,t)}r=!0}if(i){let n={};XR(e,[this.uuid],t.overrides,this,i,i,0,r,n);for(let t of this.children)if(vS.is(t)){let i=t.data;"Empty"===i.type&&i.animations&&t.traverseEntity((t=>{if(t instanceof dP&&t.isSkinnedMesh){let i=t.dataPatched;if(i.bones&&i.boneInverses){let r=i.bones.map((t=>e.scene.find(n[t]))),s=i.boneInverses.map((e=>(new Er).fromArray(e))),a=new Jo(r,s);t.bind(a,t.bindMatrix)}}else t.matrixAutoUpdate=!0}))}}this.oldComponent=this.component}}};function qR(e){if(e.component){let t=e.component.instances.indexOf(e);t>=0&&e.component.instances.splice(t,1);for(let i of e.children)vS.is(i)&&qR(i)}}function YR(e,t,i,r){return e.component===t&&mg(e.identity,r)?e.overrideData===i?2:1:0}function XR(e,t,i,r,n,s,a,o,l){if(a>50)return!1;if(r.component!==n){if(r.component){let e=r.component.instances.indexOf(r);e>=0&&r.component.instances.splice(e,1)}n.instances.push(r),r.component=n}n instanceof WR&&n.isInstanceRoot&&n.expandInstanceChildren(e);let h=0;for(let c of n.children)if(vS.is(c)){let n=[...t,..."string"==typeof c.identity?[c.identity]:c.identity],d=qb.resolve(i,n,1);null==d||d instanceof mv||(Object.setPrototypeOf(d,mv.prototype),console.error("wrong prototype"));let u,p=null;if(!o){let t=r.children[h];if(p=vS.is(t)?t:null,null!==p){let e=YR(p,c,d,n);u=e>=1?p.stateSelection:void 0,2!==e&&(p=null)}if(null===p&&(p=e.scene.findInstance(n)??null,null!==p)){let t=YR(p,c,d,n);if(u=t>=1?p.stateSelection:void 0,2!==t)p=null;else{let t=p.parent.children.indexOf(p);p.parent.children.splice(t,1),r.children.splice(h,0,p),p.parent===r?t<=h&&console.error("not possible"):(p.parent=r,p.matrixWorldNeedsUpdate=!0,p.resetBBoxNeedsUpdate(),p.updateVisible(),e.pendingDeletes.delete(p))}}}if(null===p){let t=d?dv.apply(c.data,d):c.data;Yx.is(t.type)&&(t={...t,type:"Empty"}),p=DS.createEntity(n,t,e),p.overrideData=d,r.add(p),r.children.splice(r.children.length-1,1),r.children.splice(h,0,p),p.updateState(p.data,e),u&&p.changeSelectedState(u,e),e.scene.registerInstanceAndSetUuid(p)}if(p.isBone){l[p.identity[p.identity.length-1]]=p.uuid}h+=1,XR(e,t,i,p,c,s,a+1,o,l)}if(!o){let t=h;for(;;){let t=r.children[h];if(!vS.is(t))break;e.pendingDeletes.add(t),h+=1}r.children.splice(t,h-t)}return!0}var QR=class extends(uI(Xo,OI)){constructor(e,t){super(),this.super_Entity(e,t),this.objectHelper.update(),this.matrixAutoUpdate=!0}updateState(e,t){this.updateState_Entity(e,t)}};function ZR(e,t,i){return"Mesh"===t.type?function(e,t,i){let r;return"TextGeometry"===t.geometry.type?new VP(e,t,i):(r="SubdivGeometry"===t.geometry.type?new vP(e,t,i):"PathGeometry"===t.geometry.type?new HR(e,t,i):"VectorGeometry"===t.geometry.type?new GR(e,t,i):"BooleanGeometry"===t.geometry.type?new CI(e,t,i):new dP(e,t,i),r)}(e,t,i):"Empty"===t.type||"Splat"===t.type?new RI(e,t):"Bone"===t.type?new QR(e,t):"Page"===t.type?new VR(e,t):"PointLight"===t.type?new jR(e,t,i):"SpotLight"===t.type?new UR(e,t,i):"DirectionalLight"===t.type?new zR(e,t,i):"Component"===t.type||"Instance"===t.type?new WR(e,t,i):Yx.is(t.type)?new xI(e,t):(console.error(t),new RI(e,t))}function KR(e,t){let i=!1,r=t.getLayersOfType("transmission"),n=t.getLayersOfType("outline");return n.length>0&&(e.layers.set(8),r.length>0&&e.layers.enable(3),i=!0,pP(e),uP(e)),0===r.length&&0===n.length&&e.layers.set(0),e instanceof sP&&e.needsAO&&e.layers.enable(5),i}function JR(e,t){if(!t.layers)return!1;let i=!1,r=t.getLayersOfType("transmission").filter((e=>e.data.visible)),n=t.getLayersOfType("outline").filter((e=>e.data.visible));return r.length>0&&(e.layers.set(3),n.length>0&&e.layers.enable(8),i=!0),0===r.length&&0===n.length&&e.layers.set(0),e.needsAO&&e.layers.enable(5),i}DS.createEntity=ZR,DS.changeEntityProptotype=function(e,t,i){let r=ZR(e.identity,t,i),n=e.children,s=e.attachedPaths,a=e.parent,o=e.component,l=e.instances,h=e.overrideData,c=e.uuid,d=e.stateSelection;e.dispose();for(let u of Object.keys(e))delete e[u];Object.setPrototypeOf(e,Object.getPrototypeOf(r));for(let u of Object.keys(r))e[u]=r[u];e.children=[...e.children,...n],e.attachedPaths=s,e.parent=a,e.component=o,e.instances=l,e.uuid=c,e.overrideData=h,e.updateState(e.data,i),d&&e.changeSelectedState(d,i),e.resetBBoxNeedsUpdate()},DS.Cloner=eI;var $R=new wc,eL=new Er,tL=new Mr;function iL(e,t,i,r=!1){let n=e.cloner;if(n)for(let s of n.children){let n=eL.copy(s.matrixWorld).invert(),a=tL.copy(t.ray).applyMatrix4(n),o=e.matrixWorld;a.applyMatrix4(o);let l=$R;l.set(a.origin,a.direction),l.near=t.near,l.far=t.far;let h=l.intersectObject(e,!1);h.length>0&&i.push({...h[0],object:r?s:e})}}var rL=class{constructor(){this._constraints=new Map}setConstraint(e,t){null===t?this._constraints.delete(e):this._constraints.set(e,t)}removeDependencies(e){this._constraints.delete(e)}applyConstraints(e){let t=new Set;this._constraints.forEach(((i,r)=>{let n=[r,i],s=i;for(;this._constraints.has(s);)s=this._constraints.get(s),t.has(s)||n.push(s);for(let a=n.length-2;a>=0;a--)if(!t.has(n[a])){let i=e.find(n[a]);i?i.applyPathSnapping(e):console.warn(`missing entity ${n[a]}`),t.add(n[a])}}))}findDependency(e,t){let i=e;for(;this._constraints.has(i);)if(i=this._constraints.get(i),i===t)return!0;return!1}},nL=d(_()),sL=d(C()),aL=d(_()),oL=d(C()),lL=class{constructor(e,t,i){this._dataNormalized=e,this._minD=t,this._maxD=i}static createFromUnnormalized(e){let t=oL.sup(e),i=oL.inf(e),r=(0,aL.default)(new Float32Array(e.size),e.shape),n=t-i;return n<1e-4?oL.assigns(r,0):(oL.subs(r,e,i),oL.divs(r,r,n)),new lL(r,i,t)}get data(){return this._dataNormalized}get minD(){return this._minD}get maxD(){return this._maxD}denormalize(){let e=(0,aL.default)(new Float32Array(this._dataNormalized.size),this._dataNormalized.shape);return oL.muls(e,this._dataNormalized,this._maxD-this._minD),oL.adds(e,e,this._minD),e}},hL=class{constructor(e,t){this._quantized=e,this._method=t}get quantized(){return this._quantized}static maxIntBits(e){return 2**e-1}static fromNormalized(e,t){let i,r=e.data;if("norm8x"===t){let e=hL.maxIntBits(8),t=(0,aL.default)(new Float32Array(r.size),r.shape);oL.muls(t,r,e),oL.roundeq(t),i=(0,aL.default)(new Uint8Array(t.data),r.shape)}else if("norm565"===t){let e=(0,aL.default)(new Float32Array(r.size),r.shape);oL.assign(e,r),oL.mulseq(e.pick(null,0),hL.maxIntBits(5)),oL.mulseq(e.pick(null,1),hL.maxIntBits(6)),oL.mulseq(e.pick(null,2),hL.maxIntBits(5)),oL.roundeq(e);let t=(0,aL.default)(new Uint16Array(e.data),r.shape),n=(0,aL.default)(new Uint16Array(r.shape[0]),[r.shape[0]]),s=(0,aL.default)(new Uint16Array(r.shape[0]),[r.shape[0]]);oL.lshifts(n,t.pick(null,0),11),oL.lshifts(s,t.pick(null,1),5),oL.boreq(n,s),oL.boreq(n,t.pick(null,2)),i=n}else{let e=(0,aL.default)(new Float32Array(r.size),r.shape);oL.assign(e,r),oL.mulseq(e.pick(null,0),hL.maxIntBits(11)),oL.mulseq(e.pick(null,1),hL.maxIntBits(10)),oL.mulseq(e.pick(null,2),hL.maxIntBits(11)),oL.roundeq(e);let t=(0,aL.default)(new Uint32Array(e.data),r.shape),n=(0,aL.default)(new Uint32Array(r.shape[0]),[r.shape[0]]),s=(0,aL.default)(new Uint32Array(r.shape[0]),[r.shape[0]]);oL.lshifts(n,t.pick(null,0),21),oL.lshifts(s,t.pick(null,1),11),oL.boreq(n,s),oL.boreq(n,t.pick(null,2)),i=n}return new hL(i,t)}dequantize(e,t){let i,r=this._method,n=this._quantized;if("norm8x"===r){let e=hL.maxIntBits(8);i=(0,aL.default)(new Float32Array(n.size),n.shape),oL.muls(i,n,1/e)}else if("norm565"===r){let e=(0,aL.default)(new Uint8Array(n.shape[0]),[n.shape[0]]),t=(0,aL.default)(new Uint8Array(n.shape[0]),[n.shape[0]]),r=(0,aL.default)(new Uint8Array(n.shape[0]),[n.shape[0]]);oL.rrshifts(e,n,11),oL.rrshifts(t,n,5),oL.bandseq(t,hL.maxIntBits(6)),oL.bands(r,n,hL.maxIntBits(5)),i=(0,aL.default)(new Float32Array(3*n.shape[0]),[n.shape[0],3]),oL.muls(i.pick(null,0),e,1/hL.maxIntBits(5)),oL.muls(i.pick(null,1),t,1/hL.maxIntBits(6)),oL.muls(i.pick(null,2),r,1/hL.maxIntBits(5))}else{let e=(0,aL.default)(new Uint16Array(n.shape[0]),[n.shape[0]]),t=(0,aL.default)(new Uint16Array(n.shape[0]),[n.shape[0]]),r=(0,aL.default)(new Uint16Array(n.shape[0]),[n.shape[0]]);oL.rrshifts(e,n,21),oL.rrshifts(t,n,11),oL.bandseq(t,hL.maxIntBits(10)),oL.bands(r,n,hL.maxIntBits(11)),i=(0,aL.default)(new Float32Array(3*n.shape[0]),[n.shape[0],3]),oL.muls(i.pick(null,0),e,1/hL.maxIntBits(11)),oL.muls(i.pick(null,1),t,1/hL.maxIntBits(10)),oL.muls(i.pick(null,2),r,1/hL.maxIntBits(11))}return new lL(i,e,t)}},cL=class{constructor(e,t,i,r,n,s=!1){this._quantized=e,this._minMaxMatrix=t,this._chunkSize=i,this._quantizationMethod=r,this._variableChunkSize=n,this._isDynamicChunks=s}get length(){return this._quantized.shape[0]}get nchunks(){return this._minMaxMatrix.shape[0]}get quantized(){return this._quantized}get method(){return this._quantizationMethod}get minmaxMatrix(){return this._minMaxMatrix}_createPrunedMinMax(e){let t=e.length,i=this.minmaxMatrix.shape[0]-t,r=(0,nL.default)(new Float32Array(2*i),[i,2]),n=0,s=i,a=0,o=this.minmaxMatrix.shape[0];for(let l=0;ln&&sL.assign(r.hi(s,2).lo(n,0),this.minmaxMatrix.hi(o,2).lo(a,0)),n=s,a=o+1;return na&&(i?sL.assign(t.hi(o,i).lo(a,0),this._quantized.hi(h,i).lo(l,0)):sL.assign(t.hi(o).lo(a),this._quantized.hi(h).lo(l))),a=o,l=h+1;return a1?lL.createFromUnnormalized(e.hi(c,e.shape[1]).lo(h,0)):lL.createFromUnnormalized(e.hi(c).lo(h)),a.set(o,0,l.minD),a.set(o,1,l.maxD),r.shape.length>1?sL.assign(r.hi(c,r.shape[1]).lo(h,0),hL.fromNormalized(l,t).quantized):sL.assign(r.hi(c).lo(h),hL.fromNormalized(l,t).quantized)}return new cL(r,a,i,t)}denormDequant(){let e,t,i=this._minMaxMatrix.shape[0],r=this._quantized,n=r.shape[0],s=this._quantizationMethod,a=this._chunkSize;if(this._isDynamicChunks){if(!this._variableChunkSize)throw new Error("variable chunk must exists if chunkSize isDynamic");e=this._variableChunkSize}t="norm8x"===s?(0,nL.default)(new Float32Array(r.size),r.shape):(0,nL.default)(new Float32Array(3*n),[n,3]);let o=0,l=a;for(let h=0;h1?new hL(r.hi(u,r.shape[1]).lo(o,0),s):new hL(r.hi(u).lo(o),s),sL.assign(t.hi(u,t.shape[1]).lo(o,0),d.dequantize(a,c).denormalize()),o=u}return t}static async fetchArrayBuffer(e){return await(await fetch(e,{mode:"cors"})).arrayBuffer()}},dL=d(_()),uL=d(C()),pL=d(_()),fL=d(C()),mL=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9];function gL(e){return e<1e5?e<100?e<10?0:1:e<1e4?e<1e3?2:3:4:e<1e7?e<1e6?5:6:e<1e9?e<1e8?7:8:9}function vL(e,t){if(e===t)return 0;if(~~e===e&&~~t===t){if(0===e||0===t)return e=0)return-1;if(e>=0)return 1;e=-e,t=-t}let i=gL(e),r=gL(t),n=0;return ir&&(t*=mL[i-r-1],e/=10,n=1),e===t?n:e=0;)n++;return n-t}function xL(e,t,i,r,n){for(r===t&&r++;r>>1;n(i,e[t])<0?a=t:s=t+1}let o=r-s;switch(o){case 3:e[s+3]=e[s+2];case 2:e[s+2]=e[s+1];case 1:e[s+1]=e[s];break;default:for(;o>0;)e[s+o]=e[s+o-1],o--}e[s]=i}}function bL(e,t,i,r,n,s){let a=0,o=0,l=1;if(s(e,t[i+n])>0){for(o=r-n;l0;)a=l,l=1+(l<<1),l<=0&&(l=o);l>o&&(l=o),a+=n,l+=n}else{for(o=n+1;lo&&(l=o);let r=a;a=n-l,l=n-r}for(a++;a>>1);s(e,t[i+r])>0?a=r+1:l=r}return l}function wL(e,t,i,r,n,s){let a=0,o=0,l=1;if(s(e,t[i+n])<0){for(o=n+1;lo&&(l=o);let r=a;a=n-l,l=n-r}else{for(o=r-n;l=0;)a=l,l=1+(l<<1),l<=0&&(l=o);l>o&&(l=o),a+=n,l+=n}for(a++;a>>1);s(e,t[i+r])<0?l=r:a=r+1}return l}var _L=class{constructor(e,t){u(this,"array",null),u(this,"compare",null),u(this,"minGallop",7),u(this,"length",0),u(this,"tmpStorageLength",256),u(this,"stackLength",0),u(this,"runStart",null),u(this,"runLength",null),u(this,"stackSize",0),this.array=e,this.compare=t,this.length=e.length,this.length<512&&(this.tmpStorageLength=this.length>>>1),this.tmp=new Array(this.tmpStorageLength),this.stackLength=this.length<120?5:this.length<1542?10:this.length<119151?19:40,this.runStart=new Array(this.stackLength),this.runLength=new Array(this.stackLength)}pushRun(e,t){this.runStart[this.stackSize]=e,this.runLength[this.stackSize]=t,this.stackSize+=1}mergeRuns(){for(;this.stackSize>1;){let e=this.stackSize-2;if(e>=1&&this.runLength[e-1]<=this.runLength[e]+this.runLength[e+1]||e>=2&&this.runLength[e-2]<=this.runLength[e]+this.runLength[e-1])this.runLength[e-1]this.runLength[e+1])break;this.mergeAt(e)}}forceMergeRuns(){for(;this.stackSize>1;){let e=this.stackSize-2;e>0&&this.runLength[e-1]=7||i>=7);if(u)break;d<0&&(d=0),d+=2}if(this.minGallop=d,d<1&&(this.minGallop=1),1===t){for(o=0;o=0;o--)s[u+o]=s[d+o];return void(s[c]=a[h])}let p=this.minGallop;for(;;){let i=0,f=0,m=!1;do{if(n(a[h],s[l])<0){if(s[c--]=s[l--],i++,f=0,0==--t){m=!0;break}}else if(s[c--]=a[h--],f++,i=0,1==--r){m=!0;break}}while((i|f)=0;o--)s[u+o]=s[d+o];if(0===t){m=!0;break}}if(s[c--]=a[h--],1==--r){m=!0;break}if(f=r-bL(s[l],a,0,r,r-1,n),0!==f){for(c-=f,h-=f,r-=f,u=c+1,d=h+1,o=0;o=7||f>=7);if(m)break;p<0&&(p=0),p+=2}if(this.minGallop=p,p<1&&(this.minGallop=1),1===r){for(c-=t,l-=t,u=c+1,d=l+1,o=t-1;o>=0;o--)s[u+o]=s[d+o];s[c]=a[h]}else{if(0===r)throw new Error("mergeHigh preconditions were not respected");for(d=c-(r-1),o=0;o1)for(let t=0;t[e,t]));!function(e,t,i,r){if(!Array.isArray(e))throw new TypeError("Can only sort arrays");t?"function"!=typeof t&&(r=i,i=t,t=vL):t=vL,i||(i=0),r||(r=e.length);let n=r-i;if(n<2)return;let s=0;if(n<32)return s=yL(e,i,r,t),void xL(e,i,r,i+s,t);let a=new _L(e,t),o=function(e){let t=0;for(;e>=32;)t|=1&e,e>>=1;return e+t}(n);do{if(s=yL(e,i,r,t),so&&(r=o),xL(e,i,i+r,i+s,t),s=r}a.pushRun(i,s),a.mergeRuns(),n-=s,i+=s}while(0!==n);a.forceMergeRuns()}(a,((e,t)=>e[0]-t[0]));let o=a.map((([e,t])=>t));return(0,pL.default)(Uint32Array.from(o))}var EL=class{constructor(e,t,i,r,n,s,a,o,l,h){this.propertyDescs=e,this.format=t,this.nsplats=i,this.xyz=r,this.colors=n,this.harmonics=s,this.opacity=a,this.scaling=o,this.rotation=l,this.maxSHDegree=h}getPlyBinary(){let e=EL._generateHeaderString(this.propertyDescs,this.format,this.nsplats),t=(new TextEncoder).encode(e),i=Object.keys(this.propertyDescs).length,r=(0,dL.default)(new Float32Array(this.nsplats*i),[this.nsplats,i]);if(uL.assign(r.pick(null,this.propertyDescs.x.index),this.xyz.pick(null,0)),uL.assign(r.pick(null,this.propertyDescs.y.index),this.xyz.pick(null,1)),uL.assign(r.pick(null,this.propertyDescs.z.index),this.xyz.pick(null,2)),uL.assign(r.pick(null,this.propertyDescs.f_dc_0.index),this.colors.pick(null,0)),uL.assign(r.pick(null,this.propertyDescs.f_dc_1.index),this.colors.pick(null,1)),uL.assign(r.pick(null,this.propertyDescs.f_dc_2.index),this.colors.pick(null,2)),uL.assign(r.pick(null,this.propertyDescs.opacity.index),this.opacity.pick(null,0)),uL.assign(r.pick(null,this.propertyDescs.scale_0.index),this.scaling.pick(null,0)),uL.assign(r.pick(null,this.propertyDescs.scale_1.index),this.scaling.pick(null,1)),uL.assign(r.pick(null,this.propertyDescs.scale_2.index),this.scaling.pick(null,2)),uL.assign(r.pick(null,this.propertyDescs.rot_0.index),this.rotation.pick(null,0)),uL.assign(r.pick(null,this.propertyDescs.rot_1.index),this.rotation.pick(null,1)),uL.assign(r.pick(null,this.propertyDescs.rot_2.index),this.rotation.pick(null,2)),uL.assign(r.pick(null,this.propertyDescs.rot_3.index),this.rotation.pick(null,3)),this.harmonics&&this.harmonics.length>0)for(let a=0;a=e.byteLength)throw new Error("End of file reached while searching for end of header");let s=new Uint8Array(e,i,n);r+=t.decode(s),i+=n;let a=i-200,o=new Uint8Array(e,Math.max(0,a),a>0?200:n);if(t.decode(o).includes("end_header"))break}let s,a=r.split("\n"),o=0,l={},h={},c=0;for(let u=0;u0}get nchunks(){return this.xyz.nchunks}get nsplats(){return this.xyz.length}get chunkSize(){return this.config.chunkSize}static compressFromGaussianData(e,t){let i=cL.fromArray(e.xyz,t.xyz,t.chunkSize),r=cL.fromArray(e.scaling,t.scaling,t.chunkSize),n=cL.fromArray(e.colors,t.color,t.chunkSize),s=cL.fromArray(e.opacity,t.opacity,t.chunkSize),a=cL.fromArray(e.rotation,t.quaternion,t.chunkSize),o=e.harmonics,l=[];if(t.harmonics)for(let h=0;h=s[l]+n[l];)l++;l in t?t[l].push(a):t[l]=[a]}}return t}pruneSplats(e){let t,i=this._countIndexesInChunks(e),r=[];return i.length>0&&(t=this.variableChunkSize?[...this.variableChunkSize]:Array(this.nchunks).fill(this.chunkSize),i.forEach(((e,i)=>{t[i]-=e.length,t[i]<=0&&r.push(i)})),t=t.filter((e=>e>0))),new CL(this.config,this.xyz.pruneFeature(e,r,t),this.scaling.pruneFeature(e,r,t),this.color.pruneFeature(e,r,t),this.opacity.pruneFeature(e,r,t),this.quaternion.pruneFeature(e,r,t),this.harmonics?this.harmonics.map((t=>t.pruneFeature(e,r,this.variableChunkSize))):void 0,t)}static async loadConfig(e){return await(await fetch(e,{method:"GET",mode:"cors",headers:{Accept:"application/json"}})).json()}toGaussians(){let e={},t=0;if(e.x={dtype:"float",index:t},t++,e.y={dtype:"float",index:t},t++,e.z={dtype:"float",index:t},t++,e.f_dc_0={dtype:"float",index:t},t++,e.f_dc_1={dtype:"float",index:t},t++,e.f_dc_2={dtype:"float",index:t},t++,this.harmonics&&this.harmonics.length>0)for(let r=0;re.denormDequant()));return new EL(e,{format:"binary_little_endian",version:"1.0"},this.xyz.length,this.xyz.denormDequant(),this.color.denormDequant(),i||[],this.opacity.denormDequant(),this.scaling.denormDequant(),this.quaternion.denormDequant(),3)}},TL=d(_()),DL=d(C()),PL={xyz:3,color:3,opacity:1,scaling:3,quaternion:4,harmonics:3},IL=class{constructor(e){this._buffer=e}get buffer(){return this._buffer}get decoded(){return this._decoded||(this._decoded=this.decodeBuffer()),this._decoded}get colorsA(){let e=this.decoded.color.denormDequant(),t=this.decoded.opacity.denormDequant(),i=(0,TL.default)(new Float32Array(4*e.shape[0]),[e.shape[0],4]);return DL.mulseq(e,.28209479177387814),DL.addseq(e,.5),DL.mulseq(e,255),DL.maxseq(e,0),DL.minseq(e,255),DL.negeq(t),DL.expeq(t),DL.addseq(t,1),DL.recipeq(t),DL.mulseq(t,255),DL.assign(i.hi(e.shape[0],3).lo(0,0),e),DL.assign(i.hi(e.shape[0],4).lo(0,3),t),(0,TL.default)(new Uint8Array(i.data),[e.shape[0],4]).data}get nsplats(){return this.decoded.nsplats}getSplatCount(){return this.decoded.nsplats}get precomputedCovarianceBufferData(){return this._precomputedCovarianceBufferData}decodeBuffer(){let{splatCount:e,chunkCount:t,chunkSize:i,typeChunks:r,vertexData:n,propertiesDesc:s}=this.decodeHeader(),a={xyz:s.xyz.compressionMethod,color:s.color.compressionMethod,opacity:s.opacity.compressionMethod,scaling:s.scaling.compressionMethod,quaternion:s.quaternion.compressionMethod,chunkSize:i};s.harmonics_0&&(a.harmonics=s.harmonics_0.compressionMethod);let o=n.byteOffset,l=Array(Object.keys(s).length);for(let g in s)l[s[g].index]={name:g,method:s[g].compressionMethod};let h,c=2*t*4,d=o,u="dynamic"===r?2*t:0,p=!1;if(u>0){let e=new Uint16Array(n.buffer.slice(d,d+u));d+=u,h=Array.from(e),p=!0}let f={};for(let g of l){let r,s=0,a=!0;if("norm8x"===g.method)s=1*e*PL[g.name];else if("norm11"===g.method)s=4*e;else{if("norm565"!==g.method)throw a=!1,new Error(`Not Implemented format: ${g.method}`);s=2*e}if(!a)throw new Error("loading chunk byt hasnot minmax!");{let e=n.buffer.slice(d,d+c);r=(0,TL.default)(new Float32Array(e),[t,2]),d+=c}let o,l=n.buffer.slice(d,d+s);if(d+=s,"norm8x"===g.method)o=(0,TL.default)(new Uint8Array(l),[e,PL[g.name]]);else if("norm11"===g.method)o=(0,TL.default)(new Uint32Array(l));else{if("norm565"!==g.method)throw new Error(`Not Implemented format: ${g.method}`);o=(0,TL.default)(new Uint16Array(l))}f[g.name]=new cL(o,r,i,g.method,h,p)}let m=[];for(let g=0;g<15;g++){let e=f[`harmonics_${g}`];e&&(m.push(e),delete f[`harmonics_${g}`])}return m.length>0&&(f.harmonics=m),new CL(a,f.xyz,f.scaling,f.color,f.opacity,f.quaternion,f.harmonics,h)}buildPreComputedBuffers(){let e=this.decoded,t=e.nsplats,i=new ArrayBuffer(24*t),r=new Float32Array(i),n=e.scaling.denormDequant(),s=e.quaternion.denormDequant(),a=new Qi,o=new _i,l=new _i,h=new _i,c=new Er;for(let d=0;d=e.byteLength)throw new Error("End of file reached while searching for end of header");let s=new Uint8Array(e,i,n);r+=t.decode(s),i+=n;let a=i-200,o=new Uint8Array(e,Math.max(0,a),a>=0?200:n);if(t.decode(o).includes("end_header"))break}let s=r.split("\n"),a=0,o=0,l=0,h=0,c="",d={};for(let p=0;p0)for(let S=0;S0)for(let S=0;S0&&(w.set(new Uint8Array(g.buffer),_),_+=v),e.xyz instanceof cL&&(w.set(new Uint8Array(e.xyz.minmaxMatrix.data.buffer),_),_+=s),w.set(new Uint8Array(e.xyz.quantized.data.buffer),_),_+=a,e.color instanceof cL&&(w.set(new Uint8Array(e.color.minmaxMatrix.data.buffer),_),_+=s),w.set(new Uint8Array(e.color.quantized.data.buffer),_),_+=l,e.opacity instanceof cL&&(w.set(new Uint8Array(e.opacity.minmaxMatrix.data.buffer),_),_+=s),w.set(new Uint8Array(e.opacity.quantized.data.buffer),_),_+=c,e.scaling instanceof cL&&(w.set(new Uint8Array(e.scaling.minmaxMatrix.data.buffer),_),_+=s),w.set(new Uint8Array(e.scaling.quantized.data.buffer),_),_+=u,e.quaternion instanceof cL&&(w.set(new Uint8Array(e.quaternion.minmaxMatrix.data.buffer),_),_+=s),w.set(new Uint8Array(e.quaternion.quantized.data.buffer),_),_+=f,x>0&&e.harmonics&&e.harmonics.length>0)for(let S=0;Se.enabled&&"Include"===e.mode)).map((e=>"Box"===e.type?x(e):w(e))),c=n.filter((e=>e.enabled&&"Exclude"===e.mode)).map((e=>"Box"===e.type?x(e):w(e)));for(let e=a[i];e{let n=function(e,t,i,r,n){let s=e-n[0],a=t-n[1],o=i-n[2],l=1/(r[3]*s+r[7]*a+r[11]*o+r[15]);return{x:(r[0]*s+r[4]*a+r[8]*o+r[12])*l+n[0],y:(r[1]*s+r[5]*a+r[9]*o+r[13])*l+n[1],z:(r[2]*s+r[6]*a+r[10]*o+r[14])*l+n[2]}}(e,t,i,r.invRotationMatrix,r.cropCenter);return Array.isArray(r)?function(e,t,i,r){return e>=r[0]&&e<=r[3]&&t>=r[1]&&t<=r[4]&&i>=r[2]&&i<=r[5]}(n.x,n.y,n.z,r):function(e,t,i,r){let n=(e-r.cropCenter[0])*r.invRadiusX,s=(t-r.cropCenter[1])*r.invRadiusY,a=(i-r.cropCenter[2])*r.invRadiusZ;return n*n+s*s+a*a<=1}(n.x,n.y,n.z,r)}))}function x(e){let t=e.cropSize[0]/2,i=e.cropSize[1]/2,r=e.cropSize[2]/2,n=[e.cropCenter[0]-t,e.cropCenter[1]-i,e.cropCenter[2]-r,e.cropCenter[0]+t,e.cropCenter[1]+i,e.cropCenter[2]+r],s=b(e.cropRotation);return Object.assign(n,{invRotationMatrix:s,cropCenter:e.cropCenter})}function b(e){let t=[],i=e[0]*Math.PI/180,r=e[1]*Math.PI/180,n=e[2]*Math.PI/180,s=Math.cos(i),a=Math.sin(i),o=Math.cos(r),l=Math.sin(r),h=Math.cos(n),c=Math.sin(n),d=s*h,u=s*c,p=a*h,f=a*c;return t[0]=o*h,t[1]=-o*c,t[2]=l,t[4]=u+p*l,t[5]=d-f*l,t[6]=-a*o,t[8]=f-d*l,t[9]=p+u*l,t[10]=s*o,t[12]=0,t[13]=0,t[14]=0,t[3]=0,t[7]=0,t[11]=0,t[15]=1,t}function w(e){let t=2/e.cropSize[0],i=2/e.cropSize[1],r=2/e.cropSize[2],n=b(e.cropRotation);return{invRadiusX:t,invRadiusY:i,invRadiusZ:r,cropCenter:e.cropCenter,invRotationMatrix:n}}e.onmessage=b=>{if(b.data.getCroppedIndexes){let t=new Uint32Array(function(e,t){let i=[],r=t.filter((e=>e.enabled&&"Include"===e.mode)).map((e=>"Box"===e.type?x(e):w(e))),n=t.filter((e=>e.enabled&&"Exclude"===e.mode)).map((e=>"Box"===e.type?x(e):w(e))),s=e.length;for(let a=0;a1){t.exports.sortIndexes(n,s,h,a,o,l,u.DepthMapRange,r);let e=new Uint32Array(r);p=e.buffer,e.set(new Uint32Array(c,l,r))}else if(1===r){let e=new Uint32Array(r);e[0]=new Uint32Array(c,n,i)[0],p=e.buffer}else p=new ArrayBuffer(0);e.postMessage({sortDone:!0,indexesBuffer:p},[p])}(b.data.sort.view,b.data.sort.cameraPosition);else if(b.data.init){u=b.data.init.Constants,i=b.data.init.splatCount;let r=u.BytesPerInt,d=3*u.BytesPerFloat,p=new Uint8Array(b.data.init.sorterWasmBytes),f=i*(r+d)+(i*u.BytesPerInt*2+u.DepthMapRange*u.BytesPerInt*2)+32*u.MemoryPageSize,m=Math.floor(f/u.MemoryPageSize)+1,g={module:{},env:{memory:new WebAssembly.Memory({initial:2*m,maximum:3*m,shared:!0})}};WebAssembly.compile(p).then((e=>WebAssembly.instantiate(e,g))).then((p=>{t=p,n=0,s=i*r,a=s+i*d,h=a+16*u.BytesPerFloat*2,o=h+i*u.BytesPerInt,l=o+u.DepthMapRange*u.BytesPerInt,c=g.env.memory.buffer,e.postMessage({sortSetupPhase1Complete:!0})}))}}}u(OL,"DepthMapRange",65536),u(OL,"MemoryPageSize",65536),u(OL,"BytesPerFloat",4),u(OL,"BytesPerInt",4);var LL=function(){let e=new Float32Array(1),t=new Int32Array(e.buffer);return function(i){return e[0]=i,t[0]}}(),BL=function(e,t,i,r){return e+(t<<8)+(i<<16)+(r<<24)},zL=new wi,kL=class extends Un{constructor(e,t,i,r,n=!1,s=1,a,o){super(i,r),this.splatCount=t,this.meshIndexIntervals=a,this.meshMatrixWorlds=o,this.splatBuffers=e,this.geometry=i,this.material=r,this.splatDataTextures=null,this.halfPrecisionCovariancesOnGPU=n,this.devicePixelRatio=s,this.resetLocalSplatDataAndTexturesFromSplatBuffer()}static buildMesh(e,t,i=!1,r=1,n,s){let a=kL.buildGeomtery(t),o=kL.buildMaterial(n);return new kL(e,t,a,o,i,r,n,s)}static buildMaterial(e){let t={covariancesTexture:{type:"t",value:null},centersColorsTexture:{type:"t",value:null},meshIndexIntervals:{value:e},meshMatrixWorldsTexture:{type:"t",value:null},focal:{type:"v2",value:new wi},viewport:{type:"v2",value:new wi},basisViewport:{type:"v2",value:new wi},debugColor:{type:"v3",value:new Ni},covariancesTextureSize:{type:"v2",value:new wi(1024,1024)},centersColorsTextureSize:{type:"v2",value:new wi(1024,1024)},orthoZoom:{type:"f",value:-1}};return new Yn({uniforms:t,vertexShader:"\n precision highp float;\n #include \n\n attribute uint splatIndex;\n\n uniform highp sampler2D covariancesTexture;\n uniform highp usampler2D centersColorsTexture;\n uniform vec2 focal;\n uniform vec2 viewport;\n uniform vec2 basisViewport;\n uniform vec2 covariancesTextureSize;\n uniform vec2 centersColorsTextureSize;\n\t\t\t\t\t\tuniform highp sampler2D meshMatrixWorldsTexture;\n\t\t\t\t\t\tuniform uint meshIndexIntervals[257];\n\t\t\t\t\t\tuniform float orthoZoom;\n\n varying vec4 vColor;\n varying vec2 vUv;\n\n varying vec2 vPosition;\n\n const vec4 encodeNorm4 = vec4(1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0);\n const uvec4 mask4 = uvec4(uint(0x000000FF), uint(0x0000FF00), uint(0x00FF0000), uint(0xFF000000));\n const uvec4 shift4 = uvec4(0, 8, 16, 24);\n vec4 uintToRGBAVec (uint u) {\n uvec4 urgba = mask4 & u;\n urgba = urgba >> shift4;\n vec4 rgba = vec4(urgba) * encodeNorm4;\n return rgba;\n }\n\n vec2 getDataUV(in int stride, in int offset, in vec2 dimensions) {\n vec2 samplerUV = vec2(0.0, 0.0);\n float d = float(splatIndex * uint(stride) + uint(offset)) / dimensions.x;\n samplerUV.y = float(floor(d)) / dimensions.y;\n samplerUV.x = fract(d);\n return samplerUV;\n }\n\n void main () {\n uvec4 sampledCenterColor = texture(centersColorsTexture, getDataUV(1, 0, centersColorsTextureSize));\n vec3 splatCenter = uintBitsToFloat(uvec3(sampledCenterColor.gba));\n vColor = uintToRGBAVec(sampledCenterColor.r);\n\n vPosition = position.xy * 2.0;\n\n\t\t\t\t\t\t\t\tuint meshIndex;\n\t\t\t\t\t\t\t\tfor (int i = 1; i < 257; i++) {\n\t\t\t\t\t\t\t\t\tif (splatIndex < meshIndexIntervals[i]) {\n\t\t\t\t\t\t\t\t\t\tmeshIndex = uint(i - 1);\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tfloat strideMulmeshIndex = float(4u*meshIndex);\n\t\t\t\t\t\t\t\tfloat meshMatrixWorldsTextureLength = float(256*4);\n\n\t\t\t\t\t\t\t\tmat4 modelMat = mat4(\n\t\t\t\t\t\t\t\t\ttexture(meshMatrixWorldsTexture, vec2((strideMulmeshIndex+0.0)/meshMatrixWorldsTextureLength, 0)),\n\t\t\t\t\t\t\t\t\ttexture(meshMatrixWorldsTexture, vec2((strideMulmeshIndex+1.0)/meshMatrixWorldsTextureLength, 0)),\n\t\t\t\t\t\t\t\t\ttexture(meshMatrixWorldsTexture, vec2((strideMulmeshIndex+2.0)/meshMatrixWorldsTextureLength, 0)),\n\t\t\t\t\t\t\t\t\ttexture(meshMatrixWorldsTexture, vec2((strideMulmeshIndex+3.0)/meshMatrixWorldsTextureLength, 0))\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tmat4 modelViewMat = viewMatrix * modelMat;\n\t\t\t\t\t\t\t\tvec4 viewCenter = modelViewMat * vec4(splatCenter, 1.0); \n vec4 clipCenter = projectionMatrix * viewCenter;\n\n vec2 sampledCovarianceA = texture(covariancesTexture, getDataUV(3, 0, covariancesTextureSize)).rg;\n vec2 sampledCovarianceB = texture(covariancesTexture, getDataUV(3, 1, covariancesTextureSize)).rg;\n vec2 sampledCovarianceC = texture(covariancesTexture, getDataUV(3, 2, covariancesTextureSize)).rg;\n\n vec3 cov3D_M11_M12_M13 = vec3(sampledCovarianceA.rg, sampledCovarianceB.r);\n vec3 cov3D_M22_M23_M33 = vec3(sampledCovarianceB.g, sampledCovarianceC.rg);\n\n // Compute the 2D covariance matrix from the upper-right portion of the 3D covariance matrix\n mat3 Vrk = mat3(\n cov3D_M11_M12_M13.x, cov3D_M11_M12_M13.y, cov3D_M11_M12_M13.z,\n cov3D_M11_M12_M13.y, cov3D_M22_M23_M33.x, cov3D_M22_M23_M33.y,\n cov3D_M11_M12_M13.z, cov3D_M22_M23_M33.y, cov3D_M22_M23_M33.z\n );\n float s = 1.0 / (viewCenter.z * viewCenter.z);\n\n mat3 W = transpose(mat3(modelViewMat));\n mat3 T = orthoZoom > 0.0 ? W : W * mat3(\n\t\t\t\t\t\t\t\t\tfocal.x / viewCenter.z, 0., -(focal.x * viewCenter.x) * s,\n\t\t\t\t\t\t\t\t\t0., focal.y / viewCenter.z, -(focal.y * viewCenter.y) * s,\n\t\t\t\t\t\t\t\t\t0., 0., 0.\n\t\t\t\t\t\t\t\t);\n mat3 cov2Dm = transpose(T) * Vrk * T;\n cov2Dm[0][0] += 0.3;\n cov2Dm[1][1] += 0.3;\n\n // We are interested in the upper-left 2x2 portion of the projected 3D covariance matrix because\n // we only care about the X and Y values. We want the X-diagonal, cov2Dm[0][0],\n // the Y-diagonal, cov2Dm[1][1], and the correlation between the two cov2Dm[0][1]. We don't\n // need cov2Dm[1][0] because it is a symetric matrix.\n vec3 cov2Dv = vec3(cov2Dm[0][0], cov2Dm[0][1], cov2Dm[1][1]);\n\n vec3 ndcCenter = clipCenter.xyz / clipCenter.w;\n\n // We now need to solve for the eigen-values and eigen vectors of the 2D covariance matrix\n // so that we can determine the 2D basis for the splat. This is done using the method described\n // here: https://people.math.harvard.edu/~knill/teaching/math21b2004/exhibits/2dmatrices/index.html\n //\n // This is a different approach than in the original work at INRIA. In that work they compute the\n // max extents of the 2D covariance matrix in screen space to form an axis aligned bounding rectangle\n // which forms the geometry that is actually rasterized. They then use the inverse 2D covariance\n // matrix (called 'conic') to determine fragment opacity.\n float a = cov2Dv.x;\n float d = cov2Dv.z;\n float b = cov2Dv.y;\n float D = a * d - b * b;\n float trace = a + d;\n float traceOver2 = 0.5 * trace;\n float term2 = sqrt(trace * trace / 4.0 - D);\n float eigenValue1 = traceOver2 + term2;\n\t\t\t\t\t\t\t\tfloat eigenValue2 = max(traceOver2 - term2, 0.00); // prevent negative eigen value\n\n const float maxSplatSize = 1024.0;\n vec2 eigenVector1 = normalize(vec2(b, eigenValue1 - a));\n // since the eigen vectors are orthogonal, we derive the second one from the first\n vec2 eigenVector2 = vec2(eigenVector1.y, -eigenVector1.x);\n vec2 basisVector1 = eigenVector1 * min(sqrt(2.0 * eigenValue1), maxSplatSize);\n vec2 basisVector2 = eigenVector2 * min(sqrt(2.0 * eigenValue2), maxSplatSize);\n\n vec2 ndcOffset = vec2(vPosition.x * basisVector1 + vPosition.y * basisVector2) * basisViewport;\n\n\t\t\t\t\t\t\t\tif (orthoZoom > 0.0) {\n\t\t\t\t\t\t\t\t\tndcOffset *= orthoZoom;\n\t\t\t\t\t\t\t\t}\n\n gl_Position = vec4(ndcCenter.xy + ndcOffset, ndcCenter.z, 1.0);\n }",fragmentShader:"\n precision highp float;\n #include \n\n uniform vec3 debugColor;\n\n varying vec4 vColor;\n varying vec2 vUv;\n\n varying vec2 vPosition;\n\t\t\t\t\t\tlayout(location = 1) out vec4 gVelocity; \n\n void main () {\n // compute the negative squared distance from the center of the splat to the\n // current fragment in the splat's local space.\n float A = -dot(vPosition, vPosition);\n if (A < -4.0) discard;\n vec3 color = vColor.rgb;\n A = exp(A) * vColor.a;\n gl_FragColor = vec4(color.rgb, A);\n\t\t\t\t\t\t\t\tgVelocity = vec4(0.0); // so it is ignored by TAA\n }",transparent:!0,alphaTest:1,blending:H,depthTest:!0,depthWrite:!1,side:j})}static buildGeomtery(e){let t=new En;t.setIndex([0,1,2,0,2,3]);let i=new Float32Array(12),r=new mn(i,3);t.setAttribute("position",r),r.setXYZ(0,-1,-1,0),r.setXYZ(1,-1,1,0),r.setXYZ(2,1,1,0),r.setXYZ(3,1,-1,0),r.needsUpdate=!0;let n=(new tc).copy(t),s=new Uint32Array(e),a=new $o(s,1,!1);return a.setUsage(35048),n.setAttribute("splatIndex",a),n.instanceCount=e,n}resetLocalSplatDataAndTexturesFromSplatBuffer(){this.updateLocalSplatDataFromSplatBuffer(),this.allocateAndStoreLocalSplatDataInTextures()}updateLocalSplatDataFromSplatBuffer(){this.splatBuffers.forEach((e=>e.buildPreComputedBuffers())),this.covariances=new Float32Array(6*this.splatCount),this.colors=new Uint8Array(4*this.splatCount),this.centers=new Float32Array(3*this.splatCount);let e=0,t=0,i=0;for(let r of this.splatBuffers){let n=r.nsplats;this.colors.subarray(e,e+4*n).set(r.colorsA),e+=4*n,this.centers.subarray(t,t+3*n).set(r.decoded.xyz.denormDequant().data),t+=3*n,this.covariances.subarray(i,i+6*n).set(new Float32Array(r.precomputedCovarianceBufferData)),i+=6*n}}allocateAndStoreLocalSplatDataInTextures(){let e=this.splatCount,t=new wi(4096,1024);for(;t.x*t.y*2<6*e;)t.y*=2;let i,r,n=new wi(4096,1024);for(;n.x*n.y*4<4*e;)n.y*=2;if(this.halfPrecisionCovariancesOnGPU){r=new Uint16Array(t.x*t.y*2);for(let e=0;e0&&(zL.set(e.x*this.devicePixelRatio,e.y*this.devicePixelRatio),this.material.uniforms.viewport.value.copy(zL),this.material.uniforms.basisViewport.value.set(2/zL.x,2/zL.y),this.material.uniforms.focal.value.set(t,i),this.material.uniforms.orthoZoom.value=r,this.material.uniformsNeedUpdate=!0)}getSplatDataTextures(){return this.splatDataTextures}getSplatCount(){return this.splatCount}getCenters(){return this.centers}getColors(){return this.colors}getCovariances(){return this.covariances}dispose(){this.geometry.dispose(),this.material.dispose(),this.splatDataTextures&&(this.splatDataTextures.covariances.texture.dispose(),this.splatDataTextures.centerColors.texture.dispose(),this.splatDataTextures.meshMatrixWorlds.texture.dispose())}},NL=class{constructor(e={}){u(this,"updateSplatMeshUniforms",function(){let e=new wi;return function(){null!==this.splatMesh&&this.splatMesh.getSplatCount()>0&&(this.renderer.getSize(e),this.cameraFocalLengthX=this.camera.projectionMatrix.elements[0]*this.devicePixelRatio*e.x*.45,this.cameraFocalLengthY=this.camera.projectionMatrix.elements[5]*this.devicePixelRatio*e.y*.45,this.splatMesh.updateUniforms(e,this.cameraFocalLengthX,this.cameraFocalLengthY,this.camera.isPerspectiveCamera?-1:this.camera.zoom*this.devicePixelRatio))}}()),u(this,"updateView",function(){let e=new Er,t=[],i=new Zi(0,0,-1),r=new Zi(0,0,-1),n=new Zi,s=new Zi;return function(a=!1){let o=this.updateMatrixWorldsInWorkerIfNeeded(),l=this.cropsChanged();if(!a){r.set(0,0,-1).applyQuaternion(this.camera.quaternion);let e=!1,t=!1;if(r.dot(i)<=.95&&(e=!0),s.copy(this.camera.position).sub(n).length()>=1&&(t=!0),!(e||t||o||l))return}n.copy(this.camera.position),i.copy(r),e.copy(this.camera.matrixWorld).invert(),e.premultiply(this.camera.perspCamera.projectionMatrix),t[0]=this.camera.position.x,t[1]=this.camera.position.y,t[2]=this.camera.position.z;let h={sort:{view:e.elements,cameraPosition:t,splatRenderCount:this.splatRenderCount,splatSortCount:this.splatRenderCount},...o?{newMatrixWorlds:this.meshMatrixWorlds}:{},...l?{newCropsArray:this.cropsArray}:{}};this.sortRunning?this.queuedMessage=h:(this.queuedMessage=null,this.sortRunning=!0,this.sortWorker.postMessage(h))}}()),this.scene=e.scene,this.currentPage=null,this.renderer=e.renderer,this.devicePixelRatio=window.devicePixelRatio,this.sortWorker=null,this.splatRenderCount=0,this.splatSortCount=0,this.splatMesh=null,this.sortRunning=!1,this.splatRenderingInitialized=!1,this.meshMatrixWorlds=null,this.meshMatrixWorldsOld=null,this.cropsArray=null,this.splatEntries=null,this.queuedMessage=null}get camera(){return this.scene.activeCamera}reloadSplats(){this.splatRenderingInitialized=!1;let e=this.loadSplat();this.renderer.pipeline.opaquePass.splatViewer=e?this:null}loadSplat(e={}){this.activePage=this.scene.activePage,e.position&&(e.position=(new Zi).fromArray(e.position)),e.orientation&&(e.orientation=(new Qi).fromArray(e.orientation)),e.halfPrecisionCovariances=!!e.halfPrecisionCovariances;let t=[];if(this.splatEntries=t,this.activePage.traverseEntity((e=>{if("Splat"===e.data.type){let i=e.visible;e.traverseAncestors((e=>{i&&(i=e.visible)})),i&&t.push(e)}})),this.splatMesh&&this.splatMesh.dispose(),0===t.length)return this.splatMesh=null,!1;this.meshMatrixWorlds=t.map((e=>e.matrixWorld)),this.meshMatrixWorldsOld=t.map((e=>e.matrixWorld.clone())),this.cropsArray=t.map((e=>e.data.crops.map((e=>e.data))));let i=t.map((e=>new IL(new Uint8Array(e.data.buffer).buffer))),r=0,n=[0];for(let s of i)r+=s.getSplatCount(),n.push(r);return this.setupSplatMesh(i,r,e.position,e.orientation,e.halfPrecisionCovariances,this.devicePixelRatio,n,this.meshMatrixWorlds),this.setupSortWorker(r),!0}updateMatrixWorldsInWorkerIfNeeded(){let e=this.splatDataTextures.meshMatrixWorlds.data;for(let t=0;te.equals(this.meshMatrixWorldsOld[t])))&&(this.meshMatrixWorldsOld=this.meshMatrixWorlds.map((e=>e.clone())),!0)}cropsChanged(){let e=!1;return this.splatEntries.forEach(((t,i)=>{t.data.crops.forEach(((t,r)=>{void 0===this.cropsArray[i][r]?(e=!0,this.cropsArray[i][r]=t.data):Object.entries(t.data).forEach((([t,n])=>{(Array.isArray(n)&&n.some(((e,n)=>e!==this.cropsArray[i][r][t][n]))||n!==this.cropsArray[i][r]?.[t])&&(e=!0,this.cropsArray[i][r][t]=n)}))})),t.data.crops.length!==this.cropsArray[i]?.length&&(this.cropsArray[i].length=t.data.crops.length,e=!0)})),e}setupSplatMesh(e,t,i=new Zi,r=new Qi,n=!1,s=1,a,o){this.splatMesh=kL.buildMesh(e,t,n,s,a,o),this.splatMesh.position.copy(i),this.splatMesh.quaternion.copy(r),this.splatMesh.frustumCulled=!1,this.splatMesh.renderOrder=10,this.updateSplatMeshUniforms(),this.splatRenderCount=t}setupSortWorker(e){this.sortWorker=function(e){let t=new Worker(URL.createObjectURL(new Blob(["(",RL.toString(),")(self)"],{type:"application/javascript"}))),i=atob("AGFzbQEAAAAADwhkeWxpbmsuMAEEAAAAAAETA2AAAGAIf39/f39/f38AYAABfwISAQNlbnYGbWVtb3J5AgMAgIAEAwQDAAECBzkDEV9fd2FzbV9jYWxsX2N0b3JzAAALc29ydEluZGV4ZXMAARNlbXNjcmlwdGVuX3Rsc19pbml0AAIK3gMDAwABC9IDAwF/BnwBfgJAIAdFDQAgAysDUCEMIAMrAzAhDSADKwMQIQ5BACEDRP///////+9/IQtEAAAAAAAAEAAhCgNAIAIgA0ECdGoCfyAOIAEgA0EMbGoiCCoCALuiIA0gCCoCBLuioCAMIAgqAgi7oqBEAAAAAAAAsECiIgmZRAAAAAAAAOBBYwRAIAmqDAELQYCAgIB4CzYCACAJIAsgCSALYxshCyAJIAogCSAKZBshCiADQQFqIgMgB0cNAAsgB0UNACAGuCAKIAuhoyEJQQAhAwNAAn8gCSACIANBAnRqIgEoAgC3IAuhoiIKmUQAAAAAAADgQWMEQCAKqgwBC0GAgICAeAshCCABIAg2AgAgBCAIQQJ0aiIBIAEoAgBBAWo2AgAgA0EBaiIDIAdHDQALCyAGQQJPBEAgBCgCACEIQQEhAwNAIAQgA0ECdGoiASABKAIAIAhqIgg2AgAgA0EBaiIDIAZHDQALCyAHQQFrIgGtIQ8DQCAEIAIgD6dBAnQiA2ooAgBBAnRqIgcgBygCAEEBayIHNgIAIAUgASAHa0ECdGogACADaigCADYCACAPUCEDIA9CAX0hDyADRQ0ACyAGBEAgBEEAIAZBAnT8CwALCwQAQQAL"),r=new Uint8Array(i.length);for(let n=0;n{e.data.sortDone?(this.sortRunning=!1,this.splatMesh?.updateIndexes(new Uint32Array(e.data.indexesBuffer)),this.lastSortTime=e.data.sortTime,this.queuedMessage&&(this.sortWorker.postMessage(this.queuedMessage),this.queuedMessage=null)):e.data.sortCanceled?this.sortRunning=!1:e.data.sortSetupPhase1Complete?this.sortWorker.postMessage({positions:this.splatMesh.getCenters().buffer,meshMatrixWorlds:this.splatMesh.meshMatrixWorlds,meshIndexIntervals:this.splatMesh.meshIndexIntervals,cropsArray:this.cropsArray}):e.data.sortSetupComplete&&(this.splatDataTextures=this.splatMesh.getSplatDataTextures(),this.updateView(!0,!0),this.splatRenderingInitialized=!0)}}update(){!1!==this.splatRenderingInitialized&&(this.updateSplatMeshUniforms(),this.updateView())}getSplatMesh(){return this.splatMesh}},FL=new un;FL.wireframe=!0;var UL=new Zi,VL=class extends Ho{constructor(e,t){super(),this.data=e,this.enableHelpers=!1,this.wireframeState=!1,this.needsTransmissionDirty=!0,this.needsNormalDirty=!0,this._needsTransmission=!1,this._needsNormal=!1,this.geometryCacheChanged=!1,this.splatViewer=null,this.entityByUuid={},this.entityIdentityToEntity={},this.toExpandCloner=new Set,this.toUpdateCloner=new Set,this.pendingCommands=[],this.pathConstraints=new rL,this.errorPage=new VR("fdasfa",{...Xb.defaultData,name:""}),this.invisibleObjects=new RI("jflkdsafjasdifjaslk",{...Vb.defaultData,visible:!1,name:"buildin invisible"}),this.needsRecomputeInstances=!1,this.init(e,t),this.matrixAutoUpdate=!1}markGeometryCacheDirty(){this.geometryCacheChanged=!0}markNeedsUpdateRendererDirty(){this.needsTransmissionDirty=!0,this.needsNormalDirty=!0}needsTransmission(){return this.needsTransmissionDirty&&(this._needsTransmission=function(e){let t=!1;return e.traverseEntity((e=>{if(e instanceof sP)if(Array.isArray(e.material))for(let i=0;i{if(e instanceof sP)if(Array.isArray(e.material))for(let i=0;ifunction(e,t){let i=0;for(;it[i])return 1;i+=1}return i!==t.length?-1:i!==e.length?1:0}(e.sortKey,t.sortKey))),t.map((e=>e.entity))}nonExistOrDescendantOf(e,t){let i=this.find(e);if(void 0===i)return!0;for(;i;){if(i.uuid===t)return!0;i=i.parent}return!1}find(e){if(this.activePage&&this.activePage.personalCamera.parent){if("f23858d0-4a3b-4bd8-8173-66ed0af7f6fb-personalCamera"===e)return this.activePage.personalCamera;if(e===Kx)return this.activePage.personalCamera}if(""===e||void 0===e)return;let t=this.entityByUuid[e];return void 0===t?this.getObjectByProperty("uuid",e):t}debugEnsureEntity(e){let t=this.find(e);t?Array.isArray(t.identity)&&void 0===this.findInstance(t.identity)&&console.error("not found instance"):console.error("not found")}addPendingExpandCloner(e){this.toExpandCloner.add(e)}addPendingUpdateCloner(e){this.toUpdateCloner.add(e)}markToExpandCloner(e){this.toExpandCloner.add(e),e.traverseEntityAncestors((e=>{this.toExpandCloner.add(e)}))}doPendingExpandCloner(){this.toExpandCloner.forEach((e=>{e.expandCloner(this)})),this.toExpandCloner.clear()}doPendingUpdateCloner(){this.toUpdateCloner.forEach((e=>{e.cloner?.update()})),this.toUpdateCloner.clear()}doPendingUpdates(){this.doPendingExpandCloner(),this.doPendingUpdateCloner(),this.applyPendingCommands()}addPendingCommand(e){this.pendingCommands.push(e)}applyPendingCommands(){this.pendingCommands.forEach((e=>e())),this.pendingCommands.length=0}updateByLibOp(e,t){1===e.path.length&&"components"===e.path[0]&&1===e.type&&this.createChildrenObjects([{...e.data.asset,id:e.id}],this.invisibleObjects,t)}updateTreeByOp(e,t){if(0===e.path.length&&7===e.type){let i=null===e.parent?this:this.find(e.parent);if(void 0===i)throw new Error("unexpected");let r=this.createObject(e.id,e.data,e.children,i,e.localIndex,t);r.updateVisible(),r.resetBBoxNeedsUpdate(),DI(r)&&PI(r.parent)&&(r.invalidateUpstreamBooleanData(),r.parent.invalidateDownstreamBooleanData().recomputeBoolean()),this.markNeedsRecomputeInstancesForAncessors(i),this.markNeedsRecomputeInstancesForChildren(r),this.markToExpandCloner(r),this.markPenumbraSizeDirty(),r.updatePathSnapping()}else if(0===e.path.length&&8===e.type){let t=this.find(e.id);if(void 0===t)throw new Error("unexpected");this.markToExpandCloner(t),t.resetBBoxNeedsUpdate(),this.unregisterObject(t);let i=t.parent;this.markNeedsRecomputeInstancesForAncessors(i),this.markNeedsRecomputeInstancesForChildren(t),this.markPenumbraSizeDirty(),t.parent.remove(t),PI(t.parent)&&(t.parent.invalidateUpstreamBooleanData(),t.parent.invalidateDownstreamBooleanData().recomputeBoolean()),DI(t)&&(t.freeBooleanPointer(),i instanceof CI&&i.invalidateDownstreamBooleanData().recomputeBoolean()),t instanceof HR&&t.detachShape(),this.disposeAndUnregisterEntityRecursivelyIfNotReregistered(t),this.pathConstraints.removeDependencies(t.uuid),t.updatePathSnapping()}else if(0===e.path.length&&9===e.type){let t=this.find(e.id);if(void 0===t)throw new Error("unexpected");this.markNeedsRecomputeInstancesForChildren(t);let i=t.parent;this.markNeedsRecomputeInstancesForAncessors(i),t.cloner?.resetOnMove(),this.markToExpandCloner(t);let r=null===e.parent?this:this.find(e.parent);if(void 0===r)throw new Error("unexpected");r.add(t),this.markNeedsRecomputeInstancesForAncessors(r),this.markToExpandCloner(t),t.invalidateClonerTransform(t),t.updateVisible(),t.resetBBoxNeedsUpdate(),this.markPenumbraSizeDirty();let n=e.localIndex;r.children.splice(n,0,r.children.pop()),DI(t)&&(t.invalidateUpstreamBooleanData(),PI(t.parent)?t.parent.invalidateDownstreamBooleanData().recomputeBoolean():i instanceof CI&&i.invalidateDownstreamBooleanData().recomputeBoolean()),t.updatePathSnapping()}this.markNeedsUpdateRendererDirty(),this.markGeometryCacheDirty()}get playPage(){return this.find(this.data.publish.playPage)??this.errorPage}updatePage(e){this.activePage&&this.activePage.onDeactive(),this.activePage=this.errorPage;for(let t of this.children)t instanceof VR&&(t.visible=t.uuid===e,t.visible&&(this.activePage=t,this.activePage.onActive(this)));this.activePage!==this.splatViewer?.activePage&&this.reloadSplats()}updateEntityByOp(e,t,i,r){if(0===t.type){if(("overrides"in t.props||"component"in t.props)&&this.markNeedsRecomputeInstances(),"visible"in t.props&&this.markPenumbraSizeDirty(),t.path.includes("overrides")&&"states"in t.props){let{rest:e}=t.props;t={...t,props:e},this.markNeedsRecomputeInstances()}"pathSnapping"===t.path[0]&&void 0!==t.props.pathId&&this.pathConstraints.setConstraint(e,t.props.pathId)}let n=this.find(e);if(n)try{(function(e,t,i,r){e.updateByOp(t,i,r,!1)})(n,t,i,{scene:this,shared:r}),n instanceof dP&&n.updateGeometryGroupsIfNeeded()}catch(kx){console.error(kx)}}get activeCamera(){return this.activePage.activeCamera}switchActiveCamera(e){this.activePage.switchActiveCamera(e)}isInvisibleObjects(e){return e===this.invisibleObjects||e.hasAnccestor(this.invisibleObjects)}init(e,t){let i=Object.entries(t.data.lib.components).map(((e,t)=>({data:e[1].asset.data,children:e[1].asset.children,id:e[0],fi:t})));this.invisibleObjects.updateState(this.invisibleObjects.data,{scene:this,shared:t}),this.add(this.invisibleObjects),this.createChildrenObjects(i,this.invisibleObjects,t),this.createChildrenObjects(e.objects,this,t),this.updatePage(e.publish.playPage),this.activePage.switchToPlayCamera(),this.expandInstances(t,!0),this.traverseEntity((e=>{PI(e)&&e.recomputeBoolean(),e instanceof xI&&e.updateUp()})),this.doPendingExpandCloner(),this.applyPendingCommands()}markNeedsRecomputeInstances(){this.needsRecomputeInstances=!0}markNeedsRecomputeInstancesForChildren(e){e.traverseEntity((e=>{("Component"===e.data.type||"Instance"===e.data.type)&&this.markNeedsRecomputeInstances()}))}markNeedsRecomputeInstancesForAncessors(e){vS.is(e)&&("Component"===e.data.type&&this.markNeedsRecomputeInstances(),e.traverseAncestors((e=>{vS.is(e)&&"Component"===e.data.type&&this.markNeedsRecomputeInstances()})))}relativeizeInner(e,t,i,r,n,s,a){if(e){let o=r.find(e);o&&o!==r&&n.forInstancesRec((r=>{r.data=Uv(r.data,(n=>{let o=n.events.data(a.id),l=r.goUp(s);if(l){let r=[...Rg(l.identity),e].join("-"),n=this.entityIdentityToEntity[r];if(n){let e=n.uuid;zv.zoom(o,t)[i]=e}else console.warn("cannot find instance")}})).data}))}}rewriteActions(e,t,i,r,n,s){e.forEach((e=>{("Transition"===e.data.type||"Animation"===e.data.type)&&this.relativeizeInner(e.data.object,[...t,e.id],"object",i,r,n,s)}))}rewriteEventsBeforeGoToPlayMode(){this.traverseEntity((e=>{if(e instanceof WR&&"string"==typeof e.identity&&"Component"===e.data.type)return e.traverseEntity(((t,i)=>{t.data.events.forEach((r=>{if("GameControl"===r.data.type){let n=!1;if(t.forInstancesRec((e=>{e.data=Uv(e.data,(t=>{e.isInstanceRoot||(t.events.delete(r.id),n=!0)})).data})),!1===n)for(let s of uw.list)this.rewriteActions(r.data.gameActions[s],["gameActions",s],e,t,i,r)}else"Conditional"===r.data.type?("Distance"===r.data.condition.type?(this.relativeizeInner(r.data.condition.fromObject,["condition"],"fromObject",e,t,i,r),this.relativeizeInner(r.data.condition.toObject,["condition"],"toObject",e,t,i,r)):"State"===r.data.condition.type?this.relativeizeInner(r.data.condition.object,["condition"],"object",e,t,i,r):"Comparison"===r.data.condition.type&&("Property"===r.data.condition.lOperand.type&&this.relativeizeInner(r.data.condition.lOperand.value[0],["condition","lOperand","value"],0,e,t,i,r),"Property"===r.data.condition.rOperand.type&&this.relativeizeInner(r.data.condition.rOperand.value[0],["condition","rOperand","value"],0,e,t,i,r)),this.rewriteActions(r.data.inActions,["inActions"],e,t,i,r),this.rewriteActions(r.data.outActions,["outActions"],e,t,i,r)):"actions"in r.data&&this.rewriteActions(r.data.actions,["actions"],e,t,i,r)}))})),!0}))}expandInstances(e,t,i){let r=new Set;this.traverseEntity((n=>{if(n instanceof WR&&n.isInstanceRoot)return n.expandInstanceChildren({scene:this,shared:e,pendingDeletes:r}),t||n.resetBBoxNeedsUpdate(),i&&n.traverseEntity((e=>{i.addClip(e)})),!0}));for(let n of r)this.disposeAndUnregisterEntityRecursivelyIfNotReregistered(n),qR(n)}recomputeInstances(e,t){this.needsRecomputeInstances&&(this.needsRecomputeInstances=!1,this.traverseEntity((e=>{e instanceof WR&&e.isInstanceRoot&&(e.component=void 0)})),this.expandInstances(e,!1,t))}disposeAndUnregisterEntityRecursivelyIfNotReregistered(e){e.traverseEntity((e=>{let t="string"==typeof e.identity?e.identity:e.identity.join("-");this.entityIdentityToEntity[t]===e&&(delete this.entityByUuid[e.uuid],delete this.entityIdentityToEntity[t]),e.dispose()}))}clearScene(){for(let e of this.children)vS.is(e)&&e.disposeRecursively();this.children.length=0}resetAfterClear(e,t){this.init(e,t)}raycast(e){return this.raycast1(e,!1)}raycast1(e,t){let i=[],r=n=>{for(let s of n.children){let n=s.cloner;if(vS.is(s)&&!s.raycastLock&&(s.visible||n?.object.data.visible))if(!0===t&&s.isInstanceRoot){let t=[];if(e.intersectObject(s,!0,t),t.length){let e=t[0];e.object=s,e.point.applyMatrix4(e.object.matrixWorld);let r=s.matrixWorld.clone().invert();e.point.applyMatrix4(r),i.push(e)}}else(DI(s)||II(s)&&this.enableHelpers&&s.objectHelper.visible)&&(e.intersectObject(s,!1,i),iL(s,e,i)),r(s)}};return r(this),i}raycastWithClones(e){let t=[],i=r=>{for(let n of r.children){let r=n.cloner;vS.is(n)&&(n.visible||r?.object.data.visible)&&((DI(n)||II(n)&&this.enableHelpers&&n.objectHelper.visible)&&(e.intersectObject(n,!1,t),iL(n,e,t,!0)),i(n))}};return i(this),t}forEachEntity(e){for(let t of this.children)vS.is(t)&&e(t)}traverseConcreteEntity(e){for(let t of this.children)vS.is(t)&&t.isConcreteEntity&&t.traverseEntity(e)}traverseEntity(e){for(let t of this.children)vS.is(t)&&t.traverseEntity(e)}updateFont(e,t){this.traverseEntity((i=>{if(i instanceof dP&&"Mesh"===i.data.type&&"TextGeometry"===i.data.geometry.type&&i.data.geometry.font===e){let r=i.geometry,n=i.data.geometry;r.updateFont(e,t).then((()=>{r.update(n);let e=i.invalidateDownstreamBooleanData();PI(e)&&e.recomputeBoolean()}))}}))}traverseObject(e){for(let t of this.children)cS.is(t)&&t.traverseObject(e)}traverseVisibleEntity(e){for(let t of this.children)vS.is(t)&&t.visible&&t.traverseVisibleEntity(e)}dispose(){this.clearScene()}createChildrenObjects(e,t,i){let r=0;for(let n of e)this.createObject(n.id,n.data,n.children,t,r,i),r+=1}registerObjectCreatedInLegacy(e){this.entityByUuid[e.uuid]=e}unregisterObject(e){delete this.entityByUuid[e.uuid];for(let t of e.children)this.unregisterObject(t)}createObject(e,t,i,r,n,s){let a={scene:this,shared:s},o=ZR(e,t,a);return o&&(this.entityByUuid[e]=o,r.add(o),r.children.splice(n,0,r.children.pop()),i.length>0&&(o.isInstanceRoot?console.error("instance should not have children!"):this.createChildrenObjects(i,o,s)),o.updateState(t,a),o instanceof dP&&o.updateGeometryGroupsIfNeeded(),o.updateVisible(),o.cloner&&this.toExpandCloner.add(o),t.pathSnapping?.pathId&&this.pathConstraints.setConstraint(e,t.pathSnapping.pathId)),"Empty"===t.type&&t.animations&&o.traverseEntity((e=>{if(e instanceof dP&&e.isSkinnedMesh){let t=e.dataPatched;if(t.bones&&t.boneInverses){let i=t.bones.map((e=>this.find(e))),r=t.boneInverses.map((e=>(new Er).fromArray(e))),n=new Jo(i,r);e.bind(n,e.bindMatrix)}}else e.matrixAutoUpdate=!0})),o}getCenter(e){let t=[];for(let r=0,n=e.length;r{if(t instanceof $E)if(Array.isArray(t.material))for(let i=0;i{r instanceof xI&&r.setViewplaneSize(e,t,i)}))}initializeSplatViewer(e){this.splatViewer=new NL({scene:this,renderer:e}),this.reloadSplats()}reloadSplats(){this.splatViewer?.reloadSplats()}},jL=(e,t)=>{let i=t.x-e.x,r=t.y-e.y;return Math.sqrt(i*i+r*r)},GL=e=>e*(Math.PI/180),HL=e=>e*(180/Math.PI),WL=new Map,qL=e=>{WL.has(e)&&clearTimeout(WL.get(e)),WL.set(e,setTimeout(e,100))},YL=(e,t,i)=>{let r,n=t.split(/[ ,]+/g);for(let s=0;s{let r,n=t.split(/[ ,]+/g);for(let s=0;s(e.preventDefault(),e.type.match(/^touch/)?e.changedTouches:e),ZL=()=>{if(typeof window>"u")return;return{x:void 0!==window.pageXOffset?window.pageXOffset:(document.documentElement||document.body.parentNode||document.body).scrollLeft,y:void 0!==window.pageYOffset?window.pageYOffset:(document.documentElement||document.body.parentNode||document.body).scrollTop}},KL=(e,t)=>{t.top||t.right||t.bottom||t.left?(e.style.top=t.top,e.style.right=t.right,e.style.bottom=t.bottom,e.style.left=t.left):(e.style.left=t.x+"px",e.style.top=t.y+"px")},JL=(e,t,i)=>{let r=$L(e);for(let n in r)if(r.hasOwnProperty(n))if("string"==typeof t)r[n]=t+" "+i;else{let e="";for(let r=0,n=t.length;r{let t={};return t[e]="",["webkit","Moz","o"].forEach((function(i){t[i+e.charAt(0).toUpperCase()+e.slice(1)]=""})),t},eB=(e,t)=>{for(let i in t)t.hasOwnProperty(i)&&(e[i]=t[i]);return e},tB=(e,t)=>{if(e.length)for(let i=0,r=e.length;i=0&&i._handlers_[e].splice(i._handlers_[e].indexOf(t),1),i},lB.prototype.trigger=function(e,t){var i,r=this,n=e.split(/[ ,]+/g);r._handlers_=r._handlers_||{};for(var s=0;s{let i={};for(let r in e)e.hasOwnProperty(r)&&t.hasOwnProperty(r)?i[r]=t[r]:e.hasOwnProperty(r)&&(i[r]=e[r]);return i})(t.options,e))},lB.prototype.bindEvt=function(e,t){var i=this;return i._domHandlers_=i._domHandlers_||{},i._domHandlers_[t]=function(){"function"==typeof i["on"+t]?i["on"+t].apply(i,arguments):console.warn('[WARNING] : Missing "on'+t+'" handler.')},YL(e,sB[t],i._domHandlers_[t]),oB[t]&&YL(e,oB[t],i._domHandlers_[t]),i},lB.prototype.unbindEvt=function(e,t){var i=this;return i._domHandlers_=i._domHandlers_||{},XL(e,sB[t],i._domHandlers_[t]),oB[t]&&XL(e,oB[t],i._domHandlers_[t]),delete i._domHandlers_[t],this};var hB=lB;function cB(e,t){return this.identifier=t.identifier,this.position=t.position,this.frontPosition=t.frontPosition,this.collection=e,this.defaults={size:100,threshold:.1,color:"white",fadeTime:250,dataOnly:!1,restJoystick:!0,restOpacity:1,mode:"dynamic",zone:document.body,lockX:!1,lockY:!1,shape:"circle"},this.config(t),"dynamic"===this.options.mode&&(this.options.restOpacity=0),this.id=cB.id,cB.id+=1,this.buildEl().stylize(),this.instance={el:this.ui.el,on:this.on.bind(this),off:this.off.bind(this),show:this.show.bind(this),hide:this.hide.bind(this),add:this.addToDom.bind(this),remove:this.removeFromDom.bind(this),destroy:this.destroy.bind(this),setPosition:this.setPosition.bind(this),resetDirection:this.resetDirection.bind(this),computeDirection:this.computeDirection.bind(this),trigger:this.trigger.bind(this),position:this.position,frontPosition:this.frontPosition,ui:this.ui,identifier:this.identifier,id:this.id,options:this.options},this.instance}cB.prototype=new hB,cB.constructor=cB,cB.id=0,cB.prototype.buildEl=function(e){return this.ui={},this.options.dataOnly||(this.ui.el=document.createElement("div"),this.ui.back=document.createElement("div"),this.ui.front=document.createElement("div"),this.ui.el.className="nipple collection_"+this.collection.id,this.ui.back.className="back",this.ui.front.className="front",this.ui.el.setAttribute("id","nipple_"+this.collection.id+"_"+this.id),this.ui.el.appendChild(this.ui.back),this.ui.el.appendChild(this.ui.front)),this},cB.prototype.stylize=function(){if(this.options.dataOnly)return this;var e=this.options.fadeTime+"ms",t=((e,t)=>{let i=$L(e);for(let r in i)i.hasOwnProperty(r)&&(i[r]=t);return i})("borderRadius","50%"),i=JL("transition","opacity",e),r={};return r.el={position:"absolute",opacity:this.options.restOpacity,display:"block",zIndex:999},r.back={position:"absolute",display:"block",width:this.options.size+"px",height:this.options.size+"px",marginLeft:-this.options.size/2+"px",marginTop:-this.options.size/2+"px",background:"rgba(255, 255, 255, .4)",border:"solid 2px rgba(0, 0, 0, .1)"},r.front={width:this.options.size/2+"px",height:this.options.size/2+"px",position:"absolute",display:"block",marginLeft:-this.options.size/4+"px",marginTop:-this.options.size/4+"px",background:"rgba(255, 255, 255, .8)",border:"solid 2px rgba(0, 0, 0, .1)"},eB(r.el,i),"circle"===this.options.shape&&eB(r.back,t),eB(r.front,t),this.applyStyles(r),this},cB.prototype.applyStyles=function(e){for(var t in this.ui)if(this.ui.hasOwnProperty(t))for(var i in e[t])this.ui[t].style[i]=e[t][i];return this},cB.prototype.addToDom=function(){return this.options.dataOnly||document.body.contains(this.ui.el)||this.options.zone.appendChild(this.ui.el),this},cB.prototype.removeFromDom=function(){return this.options.dataOnly||!document.body.contains(this.ui.el)||this.options.zone.removeChild(this.ui.el),this},cB.prototype.destroy=function(){clearTimeout(this.removeTimeout),clearTimeout(this.showTimeout),clearTimeout(this.restTimeout),this.trigger("destroyed",this.instance),this.removeFromDom(),this.off()},cB.prototype.show=function(e){var t=this;return t.options.dataOnly||(clearTimeout(t.removeTimeout),clearTimeout(t.showTimeout),clearTimeout(t.restTimeout),t.addToDom(),t.restCallback(),setTimeout((function(){t.ui.el.style.opacity=1}),0),t.showTimeout=setTimeout((function(){t.trigger("shown",t.instance),"function"==typeof e&&e.call(this)}),t.options.fadeTime)),t},cB.prototype.hide=function(e){var t=this;if(t.options.dataOnly)return t;if(t.ui.el.style.opacity=t.options.restOpacity,clearTimeout(t.removeTimeout),clearTimeout(t.showTimeout),clearTimeout(t.restTimeout),t.removeTimeout=setTimeout((function(){var i="dynamic"===t.options.mode?"none":"block";t.ui.el.style.display=i,"function"==typeof e&&e.call(t),t.trigger("hidden",t.instance)}),t.options.fadeTime),t.options.restJoystick){let i=t.options.restJoystick,r={};r.x=!0===i||!1!==i.x?0:t.instance.frontPosition.x,r.y=!0===i||!1!==i.y?0:t.instance.frontPosition.y,t.setPosition(e,r)}return t},cB.prototype.setPosition=function(e,t){var i=this;i.frontPosition={x:t.x,y:t.y};var r=i.options.fadeTime+"ms",n={};n.front=JL("transition",["top","left"],r);var s={front:{}};s.front={left:i.frontPosition.x+"px",top:i.frontPosition.y+"px"},i.applyStyles(n),i.applyStyles(s),i.restTimeout=setTimeout((function(){"function"==typeof e&&e.call(i),i.restCallback()}),i.options.fadeTime)},cB.prototype.restCallback=function(){var e=this,t={};t.front=JL("transition","none",""),e.applyStyles(t),e.trigger("rested",e.instance)},cB.prototype.resetDirection=function(){this.direction={x:!1,y:!1,angle:!1}},cB.prototype.computeDirection=function(e){var t,i,r,n=e.angle.radian,s=Math.PI/4,a=Math.PI/2;if(n>s&&n<3*s&&!e.lockX?t="up":n>-s&&n<=s&&!e.lockY?t="left":n>3*-s&&n<=-s&&!e.lockX?t="down":e.lockY||(t="right"),e.lockY||(i=n>-a&&n0?"up":"down"),e.force>this.options.threshold){var o,l={};for(o in this.direction)this.direction.hasOwnProperty(o)&&(l[o]=this.direction[o]);var h={};for(o in this.direction={x:i,y:r,angle:t},e.direction=this.direction,l)l[o]===this.direction[o]&&(h[o]=!0);if(h.x&&h.y&&h.angle)return e;(!h.x||!h.y)&&this.trigger("plain",e),h.x||this.trigger("plain:"+i,e),h.y||this.trigger("plain:"+r,e),h.angle||this.trigger("dir dir:"+t,e)}else this.resetDirection();return e};var dB=cB;function uB(e,t){var i=this;i.nipples=[],i.idles=[],i.actives=[],i.ids=[],i.pressureIntervals={},i.manager=e,i.id=uB.id,uB.id+=1,i.defaults={zone:document.body,multitouch:!1,maxNumberOfNipples:10,mode:"dynamic",position:{top:0,left:0},catchDistance:200,size:100,threshold:.1,color:"white",fadeTime:250,dataOnly:!1,restJoystick:!0,restOpacity:1,lockX:!1,lockY:!1,shape:"circle",dynamicPage:!1,follow:!1},i.config(t),("static"===i.options.mode||"semi"===i.options.mode)&&(i.options.multitouch=!1),i.options.multitouch||(i.options.maxNumberOfNipples=1);let r=getComputedStyle(i.options.zone.parentElement);return r&&"flex"===r.display&&(i.parentIsFlex=!0),i.updateBox(),i.prepareNipples(),i.bindings(),i.begin(),i.nipples}uB.prototype=new hB,uB.constructor=uB,uB.id=0,uB.prototype.prepareNipples=function(){var e=this,t=e.nipples;t.on=e.on.bind(e),t.off=e.off.bind(e),t.options=e.options,t.destroy=e.destroy.bind(e),t.ids=e.ids,t.id=e.id,t.processOnMove=e.processOnMove.bind(e),t.processOnEnd=e.processOnEnd.bind(e),t.get=function(e){if(void 0===e)return t[0];for(var i=0,r=t.length;i
\ No newline at end of file diff --git a/blog/august-monthly-recap/index.html b/blog/august-monthly-recap/index.html index 36a5852085e..32774ba8012 100644 --- a/blog/august-monthly-recap/index.html +++ b/blog/august-monthly-recap/index.html @@ -14,8 +14,8 @@ - - + +
Push Protocol
· 22 min read

Our 2021 Year in Review 🎉🎉🎉

Cover Image of Our 2021 Year in Review 🎉🎉🎉

+

2021 was an epic year for EPNS. And not just us, for the entire crypto space. It was the year when the world finally opened up to crypto, blockchain, DeFi, and all their use cases. Along with the fundamental changes also arrived the age of L2 scaling and NFTs, pushing blockchain and crypto further into the mainstream.

+

Alongside all the massive developments that the crypto space accomplished altogether, EPNS too has been growing at a rapid pace. From our Token Generation Event giving birth to our native token $PUSH to hitting important milestones, to say 2021 was a thrilling year would be a massive understatement. Some major milestones we reached include protocol audit, Community Incentives Programs, the EPNS Governance launch, community growth with EPNS Rockstars, mobile app launch, SDKs, the EPNS browser extension release, and project collaborations with some of the most renowned protocols in the space!

+

That being said, it wouldn’t have been possible without our super supportive community that kept pushing us for the best in us. We are humbled by the love and support that we have received from the EPNS and wider Ethereum community. We love you all. A HUGE Kudos to the EPNS team as well for working tirelessly day in and day out to make EPNS the truly robust, reliant, and decentralized communication protocol for Web3.

+

Welcome to the EPNS 2021 Rewind, where we summarize our journey and highlights in the past year, reminiscing how much we’ve grown as a project.

+

🌟 And then it Began — The $PUSH Token Genesis 🌟

+
    +
  • Token Generation Event
  • +
  • Liquidity mining
  • +
  • Airdrop to our early adopters and community members
  • +
+

As the year kicked off, EPNS took huge steps. It all started with a genesis — the Token Generation Event of $PUSH. It was no mean feat! It was the culmination of months of hard work combined with thorough discussions and feedback from members of the community, advisors and investors regarding the overall tokenomics of $PUSH. The token generation was followed by the initiation of the Liquidity Rewards Program. The Rewards program launched with two pools: The PUSH Staking Pool and the Uniswap LP Pool, allowing users to participate in yield farming and liquidity mining opportunities with $PUSH.

+

Over the months that followed the TGE, $PUSH got listed on highly popular crypto exchanges like Huobi, KuCoin, Uniswap, ParaSwap, WazirX, MEXC, ZebPay, Gate.io, Bitbns.

+

This truly was an exciting time for the team, and so was it for the community as it marked the beginning of EPNS’s push (pun totally intended) to become the world’s first decentralized notifications & Web3 communication protocol.

+

🌟 Frens Coming Together 🌟

+

As we built the world’s first decentralized web3 notifications and communications protocol, we realized that it was time to put EPNS to heavy testing and start onboarding more participants to the protocol! So, we partnered with numerous decentralized protocols to start working with them as part of our pilot program and implementing channels for their various use cases. The pilot program gradually grew into something we did not imagine. By the end of 2021, we were working with a number of household DeFi and Web3 projects joining the list. We are super excited to be able to integrate EPNS with our fellow partners and thrilled to be working with some of the best minds in the industry and bringing push notifications for their users.

+ +

Below are all the protocols and projects we are working with for our pilot program — Uniswap | Alpha Homora | Polygon (previously MATIC) | Gitcoin | AAVE | ENS | Unstoppable Domains | Biconomy | Superfluid | Oasis.app | PoolTogether | Yam Finance | Mask.io | Ceramic | Frontier | bZx | CLR.fund | UniLend Finance | Charged Particle | GnosisDAO’s SafeSnap | PlotX | Boardroom| B.Protocol | Symphony Finance

+

🌟 Following the Roadmap: Building the Tech! 🌟

+

As the EPNS community grew and flourished over the year, so did our tech! Building a community is one thing, building the tech to deliver our promise for a decentralized web3 notifications protocol is another. In the past months, we’ve followed our Roadmap carefully and executed sequentially to eventually lead up to our soon-to-come Mainnet launch!

+

First Image of Our 2021 Year in Review 🎉🎉🎉

+

In Q1, while our main focus was to get prepared and successfully complete our Smart Contracts Audit and everything surrounding the Token Generation Event, we also made great improvements in our frontends and worked on providing tooling for developers to start experimenting with the protocol. By the end of Q1, we ended up by successfully launching our token together with our incentives website and our ROCKSTARS of EPNS NFTs initiative for the community to participate.

+

During Q2, a lot of our efforts were towards establishing collaborations with some of the most important protocols in the space. We started working on our strategic pilot partnerships and collabs with some of the major Defi protocols and communities in the ecosystem, these include Uniswap, AAVE, Alpha Homora, TrueFi, Gitcoin, Polygon, Superfluid, Biconomy, and much much more!

+

Q2 also saw the release of the EPNS browser extension (allowing you to receive notifications on your browser as well), SDK Beta v1.0 releases for the Showrunners SDK & Backend SDKs with example dApps for you developers to test us out!

+

Q3 saw MAJOR leaps and changes in how EPNS is designed and progressed as a protocol. It was time that EPNS looked to be future-proof and ready for a multi-chain world. The EPNS Protocol was now divided into EPNS Core Protocol and EPNS Communicator Protocol. The Core protocol is deployed only on Ethereum while the Communicator Protocol would be deployed on multiple chains, allowing for multi-chain functionality. Going multi-chain also meant that we needed to change how user incentives were designed, the details of which you can read here.

+ +

Q3 also included the official launch of EPNS Governance, marking the first step to progressively decentralizing the EPNS Protocol among $PUSH holders.

+

Further, the Protocol contracts were also audited by Chainsafe during this Q3!

+

We were also able to achieve the launch of the alpha of PUSH Nodes which would enable communication across Ethereum, L2s, and even other EVM and non-EVM L1s!

+

It was in the same quarter that we also started working on EPIPs (Ethereum Push Improvement Proposals) as a means to allow users to propose changes to and vote on proposals related to EPNS.

+

As the year started coming to a close in Q4, our complete focus shifted on preparing EPNS for its upcoming Mainnet launch in early January 2022.

+

This quarter saw us adding some much needed protocol feature updates such as a spam box for indirect subscriptions, delegation of channel controls, and verification badges on frontend. Along with this came our successful implementation of meta transactions for “subscribe/unsubscribe” actions, as well as for sending notifications themselves! This represents a huge step forward in terms of user experience as users wanting to opt-in to receive notifications will now just need to sign an off-chain transaction.

+

The staging environment, PUSH Mobile App and PUSH Nodes were migrated to Kovan Testnet, allowing us to ensure that our migration scripts are rock solid, and assuring us that we were taking all the necessary precautions in our preparation for the big day!

+

2021 was a busy year, and we’re proud to have achieved the vast majority of our product and community milestones. To always remain transparent, it’s important to note that the third party mobile SDK, P2P Push Nodes incentives, and Ceramic DID integration milestones were postponed so we could prioritize making EPNS multi-chain compatible ahead of mainnet launch. In our upcoming 2022 Roadmap, we are brainstorming the best implementation cycle for these features.

+

🌟 Rocking the world with EPNS Rockstars 🌟

+
    +
  • NFTs and Rockstars
  • +
  • Community contributions: from beautiful artwork, development guides, articles and more! +At EPNS, we realized that we are nothing without the backing of our wonderful community. In order to show our gratitude to our most passionate and vibrant supporters, we launched the EPNS ROCKSTARS NFT Collection. Every week, a member from the community is chosen (currently via Governance) to be awarded that week’s ROCKSTAR NFT and by extension be crowned as that week’s EPNS Rockstar! And that’s not all, every ROCKSTAR receives a bag of 2400 $PUSH along with their prestigious NFT!
  • +
+

Over the course of this year we have chosen 35 EPNS Rockstars, and we are at a loss for words for the sheer dedication, love, and support this community has shown us while participating in this program!

+

Second Image of Our 2021 Year in Review 🎉🎉🎉

+

From community education through articles, development guides, and simple explainers, to EPNS-themed artworks, memes, and videos; this community showed us that they really are our Rockstars!

+

🌟 Power to the People — Governance Launch 🌟

+ +

In September, we launched EPNS Governance, as a push for progressive decentralization of the EPNS protocol among the community. It was time for the $PUSH community to take charge by delegating their votes! The Governance framework launched with three ways for the community to vote and be involved: 1) Weekly Rockstar NFT, 2) Grants Program and 3) Metagovernance.

+

The Governance framework laid out the rules, processes, and roles of governance by the community during Phase 0 of the progressive decentralization plan for EPNS. This ensured that there was a clear groundwork for the community to coordinate to make better decisions. In the first iteration of the governance mechanism we use Snapshot, a multi-chain gasless client for decentralized voting. Due to its Snapshot-based implementation, the voting mechanism shall be weighted based on the number of $PUSH tokens delegated to the voting address. Hereafter, any potential modifications to the protocol must pass through a proposal and voting process.

+

Over the past few months, we saw a steady increase in the number of participants and delegates in governance. The governance forum has been gaining traction to propose and discuss proposals. The increasing involvement of community members within the forum’s General Discussion, and also during the Snapshot voting of the weekly EPNS Rockstar has helped us slowly achieve the progressive decentralization we aimed for when we launched the EPNS Governance.

+

Learn more about how EPNS Governance works here.

+

🌟 Giving Back through Retroactive Public Goods Funding 🌟

+

What started as a small but ambitious project in Gitcoin Grants Round 7 ended up as a top 5 project in the round with 210 contributors, and has grown today to be a sponsor for the past two Grants Rounds this year!

+

So, now, with all the love and support we’ve been receiving from you amazing folks in our community. it was time for us to give back to the Web3 community by sponsoring Gitcoin Grants Rounds 11, & 12!

+ +

🌟 Conferences, Talks, AMAs…Events Galore!!! 🌟

2021 had no shortage of events within the crypto and web3 community. As the world slowly started opening up in the latter half of the year, so did the emergence of in-person events and talks. We were glad to be a part of some of the most prestigious summits and conferences this year. Hold on, this one’s going to a long list.

AMAs

  • Satoshi Club AMA
  • Polkastarter
  • WazirX
  • EPNS Community AMA
  • TheLAO Community AMA
  • Coin Crunch India AMA and more!

Conferences, Summits, and Talks

Podcasts

EPNS Featured

EPNS Blog Posts

Our Community, our heartbeat

We would have never been anything without the awesome Web3 and PUSH community backing us. The love you shower us with keeps us up and running! At the end of the day, what we are building is an infrastructure for you the community to find value in, and simplify your web3 experience. Thank you for all the love you’ve shown us this past year! You are the real heartbeat of EPNS. our Rockstars!

Rockstars of Ethereum

We had an awesome time with some really amazing people who have rocked our community. We shared the space with

Coming 🔜 Season -2

Our Community meanwhile saw some amazing growth as well

  • Twitter Reached 100K + followers
  • Telegram Reached 50K + members
+

🌟 Wrapping it up for 2021 & Looking forward to 2022 🌟

+
    +
  • What are the plans?
  • +
  • Starting the year with our Mainnet Launch on 11th January 2022
  • +
+

Bidding adieu to 2021, we now have a new year to look forward to. The past year was an inspiring one with EPNS accomplishing and expanding beyond imagination. We worked hard to ensure EPNS is cross-chain ready! And we even had the opportunity to put a POC ready during the Solana Breakpoint event! We expanded our team and integrated with multiple major protocols and projects within the ecosystem, and continue to have the backing of the most amazing community we’ve seen!

+

2022 marks a new beginning, it’s now time for EPNS to go big. We have big plans for the upcoming year — Mainnet launch, grants program and more!

+

The EPNS mainnet launches on January 11, 2022. With it, applications across Web3 will begin exploring what it means to communicate with each other and with their users in a decentralized, permissionless, and incentivized way.

+

With the launch of our mainnet, businesses, service providers, and dApps in Web3 will officially be able to create channels to communicate with their own communities. The utilities are nearly limitless. DeFi applications can set up notifications that are triggered with on-chain information like loan liquidations and governance proposals. Good samaritans can set up channels to notify their subscribers about airdrops, or when suspicious activity could portent security issues. Centralized exchanges can notify people when new tokens are launched. All of this happens with just a click of a button, putting so much more power into the hands of the everyday Web3 user.

+

It’s an ambitious year to look forward. But as all good things, we move…forward.

+

Let’s #PUSH for Web3 Notifs, and Have a rocking 2022 💖💖💖

Be a part of the conversation by sharing this article

About Push Protocol
Push is the communication protocol of web3. Push protocol enables cross-chain notifications and messaging for dapps, wallets, and services tied to wallet addresses in an open, gasless, and platform-agnostic fashion. The open communication layer allows any crypto wallet / frontend to tap into the network and get the communication across.
Twitter
Discord
YouTube
Linkedin
+ + \ No newline at end of file diff --git a/blog/page/10/index.html b/blog/page/10/index.html index 4dc4899823f..3fe9c8f459f 100644 --- a/blog/page/10/index.html +++ b/blog/page/10/index.html @@ -14,8 +14,8 @@ - - + +
Page 10

Cover image of November Monthly Recap

· 3 min read

What a month for the Push project and community! From making many new frens to launching our very own Improvement Proposals, much has happened and we cannot wait to share everything with you. 🤩

Cover image of Introducing Push Improvement Proposal (PIP)

· 4 min read

Push (previously known as EPNS) has grown to become the leading communication layer for all Web3 actors including protocols, dapps, smart contracts, wallets, backend, and users. But, to service such a large ecosystem, there needs to be a streamlined process for improving and developing the ecosystem to meet every actor’s needs. Introducing — Push Improvement Proposals (PIP).
+
Skip to main content
Page 10

Cover image of November Monthly Recap

· 3 min read

What a month for the Push project and community! From making many new frens to launching our very own Improvement Proposals, much has happened and we cannot wait to share everything with you. 🤩

Cover image of Introducing Push Improvement Proposal (PIP)

· 4 min read

Push (previously known as EPNS) has grown to become the leading communication layer for all Web3 actors including protocols, dapps, smart contracts, wallets, backend, and users. But, to service such a large ecosystem, there needs to be a streamlined process for improving and developing the ecosystem to meet every actor’s needs. Introducing — Push Improvement Proposals (PIP).
\ No newline at end of file diff --git a/blog/page/11/index.html b/blog/page/11/index.html index 1c2fb14cc42..7c91d7694d4 100644 --- a/blog/page/11/index.html +++ b/blog/page/11/index.html @@ -14,8 +14,8 @@ - - + +
Page 12

Cover image of EPNS Rebrands into Push Protocol, the Communication Protocol for Web3

· 3 min read

Ethereum Push Notification Service (EPNS) is rebranding into Push Protocol. The rebrand signifies the network’s move beyond Ethereum to other blockchains and beyond push notifications to all forms of communication. The existing channels, notifications, $PUSH token, and app all remain unchanged. Learn more at push.org

Cover image of EPNS Allies With Commonwealth to Bring Governance Notifications to Users

· 2 min read

Commonwealth, the all-in-one platform that lets projects simplify their community management and governance, joins forces with EPNS to enable direct communication with platform users. As such, users of Commonwealth are poised to receive decentralized push notifications pertaining to the governance process. These notifications increase user participation and keep users updated about every step in the governance lifecycle.

Cover image of Reef Chain Integrates EPNS to Enable Seamless Communication With Users

· 2 min read

Reef Chain is a fast, scalable, efficient, and affordable Layer-1 network that aims to integrate all the best aspects of popular blockchains into one platform to offer a world-class experience to users and developers. It is designed to power the next generation of DeFi, NFT, GameFi, and metaverse projects.

Cover image of ‘My Dapp’ Would Like to Send You Push Notifications

· 3 min read

In Part 1.1, we introduced modern push technology, which consists of these primary components: an app publisher who publishes information by notifications, a client who is the receiver of notifications based on a subscription, and the push notification provider who acts as middleware between these two actors.

Cover image of EPNS Monthly Blocks

· 3 min read

This August was definitely a wild ride and we couldn’t have had more fun.🎢 Let’s take a look at all the happenings this month!

Cover image of ‘My App’ Would Like to Send You Push Notifications

· 4 min read

It is hard to imagine modern mobile devices without push notifications. The first push service was launched by Apple in June 2009, the Apple Push Notification Service (APNs). After that, Google followed with a service of their own, Google Cloud to Device Messaging (C2DM). Both companies have led efforts to enhance the push notification technology to where it is today.

Cover image of Fast-tracking Proposals, Approved!

· 2 min read

We are excited to announce that governance proposal PIP-08 — Fast-tracking of PIPs that get Immediate traction into Snapshot — was approved via governance voting by a vast majority of 1.2M PUSH in favor.
+
Skip to main content
Page 12

Cover image of EPNS Rebrands into Push Protocol, the Communication Protocol for Web3

· 3 min read

Ethereum Push Notification Service (EPNS) is rebranding into Push Protocol. The rebrand signifies the network’s move beyond Ethereum to other blockchains and beyond push notifications to all forms of communication. The existing channels, notifications, $PUSH token, and app all remain unchanged. Learn more at push.org
Read More

Cover image of EPNS Allies With Commonwealth to Bring Governance Notifications to Users

· 2 min read

Commonwealth, the all-in-one platform that lets projects simplify their community management and governance, joins forces with EPNS to enable direct communication with platform users. As such, users of Commonwealth are poised to receive decentralized push notifications pertaining to the governance process. These notifications increase user participation and keep users updated about every step in the governance lifecycle.
Read More

Cover image of Reef Chain Integrates EPNS to Enable Seamless Communication With Users

· 2 min read

Reef Chain is a fast, scalable, efficient, and affordable Layer-1 network that aims to integrate all the best aspects of popular blockchains into one platform to offer a world-class experience to users and developers. It is designed to power the next generation of DeFi, NFT, GameFi, and metaverse projects.
Read More

Cover image of ‘My Dapp’ Would Like to Send You Push Notifications

· 3 min read

In Part 1.1, we introduced modern push technology, which consists of these primary components: an app publisher who publishes information by notifications, a client who is the receiver of notifications based on a subscription, and the push notification provider who acts as middleware between these two actors.
Read More

Cover image of EPNS Monthly Blocks

· 3 min read

This August was definitely a wild ride and we couldn’t have had more fun.🎢 Let’s take a look at all the happenings this month!
Read More

Cover image of ‘My App’ Would Like to Send You Push Notifications

· 4 min read

It is hard to imagine modern mobile devices without push notifications. The first push service was launched by Apple in June 2009, the Apple Push Notification Service (APNs). After that, Google followed with a service of their own, Google Cloud to Device Messaging (C2DM). Both companies have led efforts to enhance the push notification technology to where it is today.
Read More

Cover image of Fast-tracking Proposals, Approved!

· 2 min read

We are excited to announce that governance proposal PIP-08 — Fast-tracking of PIPs that get Immediate traction into Snapshot — was approved via governance voting by a vast majority of 1.2M PUSH in favor.
Read More
\ No newline at end of file diff --git a/blog/page/13/index.html b/blog/page/13/index.html index a4f05a6a0b3..6cb1ed8d1a0 100644 --- a/blog/page/13/index.html +++ b/blog/page/13/index.html @@ -14,8 +14,8 @@ - - + +
Page 14

Cover image of EPNS and Quest3 Unite in Pilot Collaboration to Bring Notifications for Users

· 2 min read

EPNS and Quest3, the quest and event platform for web3, join forces in a pilot collaboration to enable direct communication between users and the platform. As a result, users of the platform are poised to receive push notifications about various happenings. These notifications will allow users to grab opportunities on the platform and encourage participation.

Cover Image of EPNS and Sturdy Form An Alliance to Enable Direct Communication for Users

· 2 min read

Sturdy, the DeFi lending platform for interest free loan and high yield lending, and EPNS team up in a pilot collaboration to bring push notifications to users. As such, Sturdy will now be able to seamlessly interact with its users and keep them updated about the status of their loans and high-yielding opportunities on the platform.

Cover image of EPNS Monthly Blocks

· 3 min read

We made it to a wonderful end of Q2! Lots of foundational work have happened throughout this first half of the year in preparation for all the great things coming for EPNS in the remaining part of 2022. Let’s go briefly over the happenings of this month.

Cover Image of EPNS at NFT NYC 2022: All set for the NFTVerse

· 4 min read

We’re all set and headed to the biggest NFT Party in the world! Touted as the Superbowl of the NFTs and the new CES for NFTs by our frens at Coinbase and Ledger respectively, hsow can we miss this event!

Cover Image of EPNS x Stox: Enabling Communication for the Global Portfolio Tracker

· 2 min read

EPNS and Stox, the portfolio tracker platform for DeFi, team up in a pilot collaboration to bring push notifications to users. As such, Stox will now be able to seamlessly interact with its users and keep them updated about the status of their portfolio, mainly when their NFTs are sold.
+
Skip to main content
Page 14

Cover image of EPNS and Quest3 Unite in Pilot Collaboration to Bring Notifications for Users

· 2 min read

EPNS and Quest3, the quest and event platform for web3, join forces in a pilot collaboration to enable direct communication between users and the platform. As a result, users of the platform are poised to receive push notifications about various happenings. These notifications will allow users to grab opportunities on the platform and encourage participation.
Read More

Cover Image of EPNS and Sturdy Form An Alliance to Enable Direct Communication for Users

· 2 min read

Sturdy, the DeFi lending platform for interest free loan and high yield lending, and EPNS team up in a pilot collaboration to bring push notifications to users. As such, Sturdy will now be able to seamlessly interact with its users and keep them updated about the status of their loans and high-yielding opportunities on the platform.
Read More

Cover image of EPNS Monthly Blocks

· 3 min read

We made it to a wonderful end of Q2! Lots of foundational work have happened throughout this first half of the year in preparation for all the great things coming for EPNS in the remaining part of 2022. Let’s go briefly over the happenings of this month.
Read More

Cover Image of EPNS at NFT NYC 2022: All set for the NFTVerse

· 4 min read

We’re all set and headed to the biggest NFT Party in the world! Touted as the Superbowl of the NFTs and the new CES for NFTs by our frens at Coinbase and Ledger respectively, hsow can we miss this event!
Read More

Cover Image of EPNS x Stox: Enabling Communication for the Global Portfolio Tracker

· 2 min read

EPNS and Stox, the portfolio tracker platform for DeFi, team up in a pilot collaboration to bring push notifications to users. As such, Stox will now be able to seamlessly interact with its users and keep them updated about the status of their portfolio, mainly when their NFTs are sold.
Read More
\ No newline at end of file diff --git a/blog/page/15/index.html b/blog/page/15/index.html index 7226afa7ee5..522235c08c1 100644 --- a/blog/page/15/index.html +++ b/blog/page/15/index.html @@ -14,8 +14,8 @@ - - + +
Page 15

Cover Image of Why Engaging with Users Within the NFTVerse Matters

· 5 min read

With the recent launches of Coinbase NFT, a peer-to-peer NFT marketplace with a personalised social feed feature; and Lens Protocol 🌿 a social graph to build decentralized social media platforms NFTs and the dawn of decentralized censorship-free social media is eventually bound to happen soon.

Cover Image of EPNS x The Graph: Enabling a better way to access blockchain data 🧑‍🚀 🔔

· 4 min read

As the blockchain ecosystem has grown, so too has the challenge of accessing on-chain data across multiple blockchain networks. The Graph is an indexing protocol that indexes, organises and makes data accessible from networks like Ethereum and IPFS It is often referred to as “Google” for the blockchains. As more and more data finds its way on-chain, users and developers need to access organised data efficiently.

Cover Image of Huobi ❤️ Supports Indian Artists!

· One min read

Continuing the celebration of $PUSH listing on Huobi Global this weeks $ROCKSTAR #NFT is sponsored by awesome peeps at Huobi Global to celebrate Indian art 🇮🇳. The winner gets the $ROCKSTAR NFT + 2400 $PUSH (~$12,000)+ Sweet surprise from Huobi 🎁

Cover Image of EPNS push notifications are never boring

· 4 min read

We are back, sharing our ETHGlobal Hack Money hackathon story. Can’t believe it’s already week -3!! It’s been an amazing learning experience so far. A big shout out to the ETHGlobal Team for always being there to help and organizing the best AMAs and office hours sessions. Getting feedback and ideas from the devs at Aavesome Compound, etc has made this learning process about DeFi landscape and tech amazingly fun.

Cover Image of Hello World: BUIDLing a working EPNS Mobile app

· 3 min read

It’s another day at EthGlobal HackMoney hackathon and we are back with more detail and further progress. While most of the dev project cycles start at smart contract and end at dApp, we have taken a different approach and instead are focusing on getting the EPNS mobile app and push notification server built out first.

Cover Image Building Ethereum Push Notification Service protocol

· One min read

We are excited to announce that Ethereum Push Notification Service(EPNS) protocol has officially kicked off, yay !! EPNS protocol is a way to send notifications out to users of different dApps (or potentially all users of Ethereum itself) via Web, Mobile (push notifications) or Web3 Providers. EPNS App Owners called Channels Owners can send mass unencrypted notifications (all users in their specific app group), or encrypted targetted messages to specific users in their App Group called Channels.
+
Skip to main content
Page 15

Cover Image of Why Engaging with Users Within the NFTVerse Matters

· 5 min read

With the recent launches of Coinbase NFT, a peer-to-peer NFT marketplace with a personalised social feed feature; and Lens Protocol 🌿 a social graph to build decentralized social media platforms NFTs and the dawn of decentralized censorship-free social media is eventually bound to happen soon.
Read More

Cover Image of EPNS x The Graph: Enabling a better way to access blockchain data 🧑‍🚀 🔔

· 4 min read

As the blockchain ecosystem has grown, so too has the challenge of accessing on-chain data across multiple blockchain networks. The Graph is an indexing protocol that indexes, organises and makes data accessible from networks like Ethereum and IPFS It is often referred to as “Google” for the blockchains. As more and more data finds its way on-chain, users and developers need to access organised data efficiently.
Read More

Cover Image of Our 2021 Year in Review 🎉🎉🎉

· 22 min read

2021 was an epic year for EPNS. And not just us, for the entire crypto space. It was the year when the world finally opened up to crypto, blockchain, DeFi, and all their use cases. Along with the fundamental changes also arrived the age of L2 scaling and NFTs, pushing blockchain and crypto further into the mainstream.
Read More

Cover Image of Huobi ❤️ Supports Indian Artists!

· One min read

Continuing the celebration of $PUSH listing on Huobi Global this weeks $ROCKSTAR #NFT is sponsored by awesome peeps at Huobi Global to celebrate Indian art 🇮🇳. The winner gets the $ROCKSTAR NFT + 2400 $PUSH (~$12,000)+ Sweet surprise from Huobi 🎁
Read More

Cover Image of EPNS push notifications are never boring

· 4 min read

We are back, sharing our ETHGlobal Hack Money hackathon story. Can’t believe it’s already week -3!! It’s been an amazing learning experience so far. A big shout out to the ETHGlobal Team for always being there to help and organizing the best AMAs and office hours sessions. Getting feedback and ideas from the devs at Aavesome Compound, etc has made this learning process about DeFi landscape and tech amazingly fun.
Read More

Cover Image of Hello World: BUIDLing a working EPNS Mobile app

· 3 min read

It’s another day at EthGlobal HackMoney hackathon and we are back with more detail and further progress. While most of the dev project cycles start at smart contract and end at dApp, we have taken a different approach and instead are focusing on getting the EPNS mobile app and push notification server built out first.
Read More

Cover Image Building Ethereum Push Notification Service protocol

· One min read

We are excited to announce that Ethereum Push Notification Service(EPNS) protocol has officially kicked off, yay !! EPNS protocol is a way to send notifications out to users of different dApps (or potentially all users of Ethereum itself) via Web, Mobile (push notifications) or Web3 Providers. EPNS App Owners called Channels Owners can send mass unencrypted notifications (all users in their specific app group), or encrypted targetted messages to specific users in their App Group called Channels.
Read More
\ No newline at end of file diff --git a/blog/page/2/index.html b/blog/page/2/index.html index 022912a9d20..e5e66a84397 100644 --- a/blog/page/2/index.html +++ b/blog/page/2/index.html @@ -14,8 +14,8 @@ - - + +
Page 3

Cover image of $PUSH is Live on Polygon &amp; Quickswap!💜

· 2 min read

Today we are excited to announce the launch of the $PUSH token on Polygon! Following the successful launch of Push Protocol onto Polygon mainnet last year, we are now carrying over that multi-chain functionality and composability to our $PUSH token.

Cover image of Exploring the Role of ZK Knowledge in Decentralized Communication🌐

· 4 min read

The world of decentralized systems is undergoing a significant evolution, triggered by the imperative quest for privacy and scalability solutions. The technology under our microscope today is zero-knowledge technology, the inherent strengths of which, developers are tirelessly examining for possible integration into Push Protocol.

Cover image of A Technical Deep Dive + 5 Simple Steps to Get Started With Push NFT Chat

· 7 min read

Push NFT Chat is a seamless and secure communication platform that enables NFTs to chat directly with one another. Unlike traditional chat systems tied to wallet addresses, Push NFT Chat allows chats to be specifically associated with individual NFTs owned by users. This is a game changer for chat integrations.

Cover image of June Monthly Recap 🌅

· 3 min read

What a month it’s been at Push! From groundbreaking features to new partnerships, we’ve been on an exciting journey this June making major strides towards our mission of decentralizing communication in web3. We couldn’t be more thrilled to share the highlights with you.

Cover image of How Push Protocol Can Revolutionize Data-Driven Decision Making📊

· 4 min read

In today’s fast-paced business environment, accessing and analyzing data in real-time is critical to making informed decisions. Push Protocol is a powerful tool that can help organizations achieve this goal by providing a way to receive real-time data updates as soon as they become available.
+
Skip to main content
Page 3

Cover image of $PUSH is Live on Polygon &amp; Quickswap!💜

· 2 min read

Today we are excited to announce the launch of the $PUSH token on Polygon! Following the successful launch of Push Protocol onto Polygon mainnet last year, we are now carrying over that multi-chain functionality and composability to our $PUSH token.
Read More

Cover image of Exploring the Role of ZK Knowledge in Decentralized Communication🌐

· 4 min read

The world of decentralized systems is undergoing a significant evolution, triggered by the imperative quest for privacy and scalability solutions. The technology under our microscope today is zero-knowledge technology, the inherent strengths of which, developers are tirelessly examining for possible integration into Push Protocol.
Read More

Cover image of A Technical Deep Dive + 5 Simple Steps to Get Started With Push NFT Chat

· 7 min read

Push NFT Chat is a seamless and secure communication platform that enables NFTs to chat directly with one another. Unlike traditional chat systems tied to wallet addresses, Push NFT Chat allows chats to be specifically associated with individual NFTs owned by users. This is a game changer for chat integrations.
Read More

Cover image of June Monthly Recap 🌅

· 3 min read

What a month it’s been at Push! From groundbreaking features to new partnerships, we’ve been on an exciting journey this June making major strides towards our mission of decentralizing communication in web3. We couldn’t be more thrilled to share the highlights with you.
Read More

Cover image of How Push Protocol Can Revolutionize Data-Driven Decision Making📊

· 4 min read

In today’s fast-paced business environment, accessing and analyzing data in real-time is critical to making informed decisions. Push Protocol is a powerful tool that can help organizations achieve this goal by providing a way to receive real-time data updates as soon as they become available.
Read More
\ No newline at end of file diff --git a/blog/page/4/index.html b/blog/page/4/index.html index aea4fb4b570..c89d398bb96 100644 --- a/blog/page/4/index.html +++ b/blog/page/4/index.html @@ -14,8 +14,8 @@ - - + +
Page 5

Cover image of Enhancing Web3 Livestreaming | Push x Graviton🧲

· 3 min read

Graviton provides pathways and tools for creators to grow without limitations imposed by centralized platforms. With a commitment to empowering artists and creators, Graviton provides web3 tools and infrastructure for creators to leverage to better reach their audience, promote their work, and monetize their creative projects.

Cover image of How to Build a Game Collectibles dApp with Push and Alchemy🎮

· 6 min read

This blog post delves into the world of blockchain-based gaming collectibles and how using Alchemy and Push Protocol can revolutionize the development process. Alchemy provides a powerful infrastructure of nodes and enhanced APIs for managing blockchain interactions, while Push Protocol enables real-time communication within the gaming ecosystem.

Cover image of Unlocking the Full Potential of Push: A Look at $PUSH Token Utility🪙

· 6 min read

Token economics (or tokenomics) are a critical component of any blockchain or cryptocurrency project. It dictates how incentives are created, distributed, and managed within the network. Push Protocol is a decentralized communication layer for Web3 that uses a native token, $PUSH, to incentivize its network participants.

Cover image of Demystifying PGP Encryption in Push🛡️

· 4 min read

PGP Encryption, or Pretty Good Privacy as its also known, is a critical element of what makes Push messages so secure. It’s a security program that enables users to communicate securely by decrypting and encrypting messages — but how does it work?

Cover image of April Monthly Recap✨

· 4 min read

Welcome to another exciting month at Push Protocol! While there’s a lot to get through, there is one announcement that stands out and we think is worthwhile giving extra attention.
+
Skip to main content
Page 5

Cover image of Enhancing Web3 Livestreaming | Push x Graviton🧲

· 3 min read

Graviton provides pathways and tools for creators to grow without limitations imposed by centralized platforms. With a commitment to empowering artists and creators, Graviton provides web3 tools and infrastructure for creators to leverage to better reach their audience, promote their work, and monetize their creative projects.
Read More

Cover image of How to Build a Game Collectibles dApp with Push and Alchemy🎮

· 6 min read

This blog post delves into the world of blockchain-based gaming collectibles and how using Alchemy and Push Protocol can revolutionize the development process. Alchemy provides a powerful infrastructure of nodes and enhanced APIs for managing blockchain interactions, while Push Protocol enables real-time communication within the gaming ecosystem.
Read More

Cover image of Unlocking the Full Potential of Push: A Look at $PUSH Token Utility🪙

· 6 min read

Token economics (or tokenomics) are a critical component of any blockchain or cryptocurrency project. It dictates how incentives are created, distributed, and managed within the network. Push Protocol is a decentralized communication layer for Web3 that uses a native token, $PUSH, to incentivize its network participants.
Read More

Cover image of Demystifying PGP Encryption in Push🛡️

· 4 min read

PGP Encryption, or Pretty Good Privacy as its also known, is a critical element of what makes Push messages so secure. It’s a security program that enables users to communicate securely by decrypting and encrypting messages — but how does it work?
Read More

Cover image of April Monthly Recap✨

· 4 min read

Welcome to another exciting month at Push Protocol! While there’s a lot to get through, there is one announcement that stands out and we think is worthwhile giving extra attention.
Read More
\ No newline at end of file diff --git a/blog/page/6/index.html b/blog/page/6/index.html index 10892e3cfd8..aff5b26a532 100644 --- a/blog/page/6/index.html +++ b/blog/page/6/index.html @@ -14,8 +14,8 @@ - - + +
Page 6

Cover image of Understanding Delivery Nodes🚂

· 5 min read

To fully grasp the concept of push notifications and messages, it is essential to first understand the role of delivery nodes in a communication protocol. Delivery nodes are endpoints where messages are sent and received. They can be physical devices, applications, or servers and are tasked with relaying messages from one point to another.

Cover image of Push Launches Wallet-to-Wallet Video Chat📹

· 2 min read

Today, Push Protocol is excited to announce the launch of Push Video! Push Video is the first wallet-to-wallet video chat that allows web3 users to video chat with each other live. Get started at app.push.org

Cover image of Push Protocolについて知っておくべきこと🔔

· 7 min read

Push Protocol(前身はEPNS)は、Web3通信プロトコルであり、任意のdAppsやスマートコントラクト、バックエンド、またはプロトコルが、ユーザーウォレットアドレスを介してオンチェーンとオフチェーンの両方において、オープンで、Gasless、マルチチェーン、及びプラットフォームに依存しない方法で通信できるようにします。

Cover image of March Monthly Recap🌄

· 4 min read

Welcome to another exciting month at Push! As we reflect on the past few weeks, we are thrilled to share some of the major milestones we’ve achieved in the world of decentralized communication. From the introduction of exciting new Push Chat and Notification features to the highly anticipated launch of Push Chat Mobile, we’ve been working hard to enhance the Push Protocol.
+
Skip to main content
Page 6

Cover image of Understanding Delivery Nodes🚂

· 5 min read

To fully grasp the concept of push notifications and messages, it is essential to first understand the role of delivery nodes in a communication protocol. Delivery nodes are endpoints where messages are sent and received. They can be physical devices, applications, or servers and are tasked with relaying messages from one point to another.
Read More

Cover image of Push Protocolにつ��いて知っておくべきこと🔔

· 7 min read

Push Protocol(前身はEPNS)は、Web3通信プロトコルであり、任意のdAppsやスマートコントラクト、バックエンド、またはプロトコルが、ユーザーウォレットアドレスを介してオンチェーンとオフチェーンの両方において、オープンで、Gasless、マルチチェーン、及びプラットフォームに依存しない方法で通信できるようにします。
Read More

Cover image of Push Launches Wallet-to-Wallet Video Chat📹

· 2 min read

Today, Push Protocol is excited to announce the launch of Push Video! Push Video is the first wallet-to-wallet video chat that allows web3 users to video chat with each other live. Get started at app.push.org
Read More

Cover image of March Monthly Recap🌄

· 4 min read

Welcome to another exciting month at Push! As we reflect on the past few weeks, we are thrilled to share some of the major milestones we’ve achieved in the world of decentralized communication. From the introduction of exciting new Push Chat and Notification features to the highly anticipated launch of Push Chat Mobile, we’ve been working hard to enhance the Push Protocol.
Read More
\ No newline at end of file diff --git a/blog/page/7/index.html b/blog/page/7/index.html index 8c122d0fa84..4d923dd06c2 100644 --- a/blog/page/7/index.html +++ b/blog/page/7/index.html @@ -14,8 +14,8 @@ - - + +
Page 7

Cover image of Launch of The Push Ambassadors Program 💜 (English + Español)

· 3 min read

After a wonderful 2022 during which the Push team had the opportunity to participate in so many events and got to know hackers and frens from all around the world, we’d like to share some exciting news in our process to grow the Push DAO and work closer with the community.

Cover image of Recreating Web2 Communication Channels in Web3 Using Push👥

· 4 min read

The ability to communicate effectively with users is a crucial aspect of any decentralized application or service. This is where communication channels come in. Serving as a bridge between dapps and users, enabling notifications, chat messages and other forms of communication across various blockchain networks.

Cover image of Bankless Nation and Push Partner to Enable News Notifications 🔔

· 2 min read

Bankless, the world’s most popular crypto email and global community, is partnering with Push to update its users with the latest crypto developments and analysis. Through this collaboration, Bankless users will be able to receive important notifications and alerts directly on their devices, ensuring they never miss an opportunity to take advantage of the latest DeFi trends.
+
Skip to main content
Page 7

Cover image of Launch of The Push Ambassadors Program 💜 (English + Español)

· 3 min read

After a wonderful 2022 during which the Push team had the opportunity to participate in so many events and got to know hackers and frens from all around the world, we’d like to share some exciting news in our process to grow the Push DAO and work closer with the community.
Read More

Cover image of Recreating Web2 Communication Channels in Web3 Using Push👥

· 4 min read

The ability to communicate effectively with users is a crucial aspect of any decentralized application or service. This is where communication channels come in. Serving as a bridge between dapps and users, enabling notifications, chat messages and other forms of communication across various blockchain networks.
Read More

Cover image of Bankless Nation and Push Partner to Enable News Notifications 🔔

· 2 min read

Bankless, the world’s most popular crypto email and global community, is partnering with Push to update its users with the latest crypto developments and analysis. Through this collaboration, Bankless users will be able to receive important notifications and alerts directly on their devices, ensuring they never miss an opportunity to take advantage of the latest DeFi trends.
Read More
\ No newline at end of file diff --git a/blog/page/8/index.html b/blog/page/8/index.html index 44c10782535..7b995c7fd6b 100644 --- a/blog/page/8/index.html +++ b/blog/page/8/index.html @@ -14,8 +14,8 @@ - - + +
Page 8

Cover image of Push Chat: The Solution To Centralized Messaging ✅

· 4 min read

Developers and researchers in computer networks are constantly seeking ways to improve messaging systems’ security, reliability, and scalability. Why? Because traditional centralized messaging systems have their drawbacks, including vulnerabilities to hacks, censorship and the risk of downtime.

Cover image of February Monthly Recap 🚀

· 3 min read

Welcome to our monthly update for February! What a month this was for Push. From our massive launch on BNBChain to releasing Push Delivery Nodes, Push Chat, and Push Group Chat. Needless to say, we’ve been busy.

Cover image of Getting Started with Push SDK: Socket API🔔

· 4 min read

The Socket API is a package that helps you connect to the Push backend using WebSockets, built on top of Socket.IO With this API, you can easily subscribe to real-time notifications and updates from the Push network.

Cover image of Push @ETHDenver Full Itinerary 🌄

· 2 min read

ETHDenver is just around the corner and the Push team is going to be there! We’re extremely excited to be joining the largest Ethereum-based conference of the year and can’t wait to meet all of you, our amazing community members in person.

Cover image of Getting Started With Push SDK: uiweb API🛠️

· 5 min read

The @pushprotocol/uiweb package is a collection of React components for building dApps that interact with the Push Protocol. It includes components for rendering notifications, spam notifications, and forms for subscribing and unsubscribing to spam notification channels.

Cover image of Empower Your Wallet, App, or Platform with Push Delivery Nodes⚡

· 3 min read

Push Delivery Nodes serve as a decentralized solution for connecting web3 and web2. They allow any centralized or decentralized platform to receive communications from Push Storage Nodes, which validate and index all communications and link them to a user’s wallet address and multi-chain identit

Cover image of Push Protocol Launches on BNB Chain!💛

· 2 min read

Today, we’re excited to announce that Push Protocol is launching on the BNB Chain mainnets! This means the largest web3 communication platform is now available to BNB’s ecosystem of thousands of dapps and hundreds of thousands of daily users.
+
Skip to main content
Page 8

Cover image of Push Chat: The Solution To Centralized Messaging ✅

· 4 min read

Developers and researchers in computer networks are constantly seeking ways to improve messaging systems’ security, reliability, and scalability. Why? Because traditional centralized messaging systems have their drawbacks, including vulnerabilities to hacks, censorship and the risk of downtime.
Read More

Cover image of February Monthly Recap 🚀

· 3 min read

Welcome to our monthly update for February! What a month this was for Push. From our massive launch on BNBChain to releasing Push Delivery Nodes, Push Chat, and Push Group Chat. Needless to say, we’ve been busy.
Read More

Cover image of Getting Started with Push SDK: Socket API🔔

· 4 min read

The Socket API is a package that helps you connect to the Push backend using WebSockets, built on top of Socket.IO With this API, you can easily subscribe to real-time notifications and updates from the Push network.
Read More

Cover image of Push @ETHDenver Full Itinerary 🌄

· 2 min read

ETHDenver is just around the corner and the Push team is going to be there! We’re extremely excited to be joining the largest Ethereum-based conference of the year and can’t wait to meet all of you, our amazing community members in person.
Read More

Cover image of Getting Started With Push SDK: uiweb API🛠️

· 5 min read

The @pushprotocol/uiweb package is a collection of React components for building dApps that interact with the Push Protocol. It includes components for rendering notifications, spam notifications, and forms for subscribing and unsubscribing to spam notification channels.
Read More

Cover image of Empower Your Wallet, App, or Platform with Push Delivery Nodes⚡

· 3 min read

Push Delivery Nodes serve as a decentralized solution for connecting web3 and web2. They allow any centralized or decentralized platform to receive communications from Push Storage Nodes, which validate and index all communications and link them to a user’s wallet address and multi-chain identit
Read More

Cover image of Push Protocol Launches on BNB Chain!💛

· 2 min read

Today, we’re excited to announce that Push Protocol is launching on the BNB Chain mainnets! This means the largest web3 communication platform is now available to BNB’s ecosystem of thousands of dapps and hundreds of thousands of daily users.
Read More
\ No newline at end of file diff --git a/blog/page/9/index.html b/blog/page/9/index.html index cd579ab90c5..d35be72c7d8 100644 --- a/blog/page/9/index.html +++ b/blog/page/9/index.html @@ -14,8 +14,8 @@ - - + +
Skip to main content

44 posts tagged with "Blockchain Technology"

View All Tags

Cover image of Enhancing Blockchain Based Games UX Through In-Game Chat + Notifications🎮

· 4 min read

Blockchain gaming has emerged as a rapidly growing niche within the gaming industry, driven by the unique benefits it offers players, including true ownership of in-game assets, interoperability between games, and provable scarcity of digital items. Despite these advantages, the sector faces challenges in scalability and user interaction. Push Protocol, a real-time communication solution with low latency and scalability, offers a promising solution to these issues.

Cover image of May Monthly Recap ☀️

· 3 min read

Welcome to another exciting month at Push! May flew by in the blink of an eye, and we have a whirlwind of exciting updates and achievements to share with you. From groundbreaking developments to valuable partnerships and community activities, the past month has been nothing short of extraordinary.

Cover image of Enhancing Web3 Livestreaming | Push x Graviton🧲

· 3 min read

Graviton provides pathways and tools for creators to grow without limitations imposed by centralized platforms. With a commitment to empowering artists and creators, Graviton provides web3 tools and infrastructure for creators to leverage to better reach their audience, promote their work, and monetize their creative projects.

Cover image of How to Build a Game Collectibles dApp with Push and Alchemy🎮

· 6 min read

This blog post delves into the world of blockchain-based gaming collectibles and how using Alchemy and Push Protocol can revolutionize the development process. Alchemy provides a powerful infrastructure of nodes and enhanced APIs for managing blockchain interactions, while Push Protocol enables real-time communication within the gaming ecosystem.

Cover image of Unlocking the Full Potential of Push: A Look at $PUSH Token Utility🪙

· 6 min read

Token economics (or tokenomics) are a critical component of any blockchain or cryptocurrency project. It dictates how incentives are created, distributed, and managed within the network. Push Protocol is a decentralized communication layer for Web3 that uses a native token, $PUSH, to incentivize its network participants.

Cover image of Demystifying PGP Encryption in Push🛡️

· 4 min read

PGP Encryption, or Pretty Good Privacy as its also known, is a critical element of what makes Push messages so secure. It’s a security program that enables users to communicate securely by decrypting and encrypting messages — but how does it work?

Cover image of April Monthly Recap✨

· 4 min read

Welcome to another exciting month at Push Protocol! While there’s a lot to get through, there is one announcement that stands out and we think is worthwhile giving extra attention.
+
Skip to main content

44 posts tagged with "Blockchain Technology"

View All Tags

Cover image of Enhancing Blockchain Based Games UX Through In-Game Chat + Notifications🎮

· 4 min read

Blockchain gaming has emerged as a rapidly growing niche within the gaming industry, driven by the unique benefits it offers players, including true ownership of in-game assets, interoperability between games, and provable scarcity of digital items. Despite these advantages, the sector faces challenges in scalability and user interaction. Push Protocol, a real-time communication solution with low latency and scalability, offers a promising solution to these issues.

Cover image of May Monthly Recap ☀️

· 3 min read

Welcome to another exciting month at Push! May flew by in the blink of an eye, and we have a whirlwind of exciting updates and achievements to share with you. From groundbreaking developments to valuable partnerships and community activities, the past month has been nothing short of extraordinary.

Cover image of Enhancing Web3 Livestreaming | Push x Graviton🧲

· 3 min read

Graviton provides pathways and tools for creators to grow without limitations imposed by centralized platforms. With a commitment to empowering artists and creators, Graviton provides web3 tools and infrastructure for creators to leverage to better reach their audience, promote their work, and monetize their creative projects.

Cover image of How to Build a Game Collectibles dApp with Push and Alchemy🎮

· 6 min read

This blog post delves into the world of blockchain-based gaming collectibles and how using Alchemy and Push Protocol can revolutionize the development process. Alchemy provides a powerful infrastructure of nodes and enhanced APIs for managing blockchain interactions, while Push Protocol enables real-time communication within the gaming ecosystem.

Cover image of Unlocking the Full Potential of Push: A Look at $PUSH Token Utility🪙

· 6 min read

Token economics (or tokenomics) are a critical component of any blockchain or cryptocurrency project. It dictates how incentives are created, distributed, and managed within the network. Push Protocol is a decentralized communication layer for Web3 that uses a native token, $PUSH, to incentivize its network participants.

Cover image of Demystifying PGP Encryption in Push🛡️

· 4 min read

PGP Encryption, or Pretty Good Privacy as its also known, is a critical element of what makes Push messages so secure. It’s a security program that enables users to communicate securely by decrypting and encrypting messages — but how does it work?

Cover image of April Monthly Recap✨

· 4 min read

Welcome to another exciting month at Push Protocol! While there’s a lot to get through, there is one announcement that stands out and we think is worthwhile giving extra attention.
\ No newline at end of file diff --git a/blog/tags/blockchain-technology/page/3/index.html b/blog/tags/blockchain-technology/page/3/index.html index 37875cf5bda..ca0c09edf5e 100644 --- a/blog/tags/blockchain-technology/page/3/index.html +++ b/blog/tags/blockchain-technology/page/3/index.html @@ -14,8 +14,8 @@ - - + +
Skip to main content

49 posts tagged with "Blockchain"

View All Tags

Cover image of Bringing Push to MetaMask Snaps

· 3 min read

Today we are excited to announce the launch of our brand new Push Snap — enabling Push Notification enhancements for MetaMask! To create new and enhanced web3 user experiences, MetaMask and Consensys have worked to introduce new integration possibilities for MetMask wallet holders via MetaMask Snaps — new features and functionality created by third-party developers that MetaMask users worldwide can install directly into their wallet.

Cover image of June Monthly Recap 🌅

· 3 min read

What a month it’s been at Push! From groundbreaking features to new partnerships, we’ve been on an exciting journey this June making major strides towards our mission of decentralizing communication in web3. We couldn’t be more thrilled to share the highlights with you.

Cover image of Recreating Web2 Communication Channels in Web3 Using Push👥

· 4 min read

The ability to communicate effectively with users is a crucial aspect of any decentralized application or service. This is where communication channels come in. Serving as a bridge between dapps and users, enabling notifications, chat messages and other forms of communication across various blockchain networks.

Cover image of Getting Started with Push SDK: Socket API🔔

· 4 min read

The Socket API is a package that helps you connect to the Push backend using WebSockets, built on top of Socket.IO With this API, you can easily subscribe to real-time notifications and updates from the Push network.

Cover image of Push Protocol Launches on BNB Chain!💛

· 2 min read

Today, we’re excited to announce that Push Protocol is launching on the BNB Chain mainnets! This means the largest web3 communication platform is now available to BNB’s ecosystem of thousands of dapps and hundreds of thousands of daily users.
+
Skip to main content

50 posts tagged with "Blockchain"

View All Tags

Cover image of Bringing Push to MetaMask Snaps

· 3 min read

Today we are excited to announce the launch of our brand new Push Snap — enabling Push Notification enhancements for MetaMask! To create new and enhanced web3 user experiences, MetaMask and Consensys have worked to introduce new integration possibilities for MetMask wallet holders via MetaMask Snaps — new features and functionality created by third-party developers that MetaMask users worldwide can install directly into their wallet.

Cover image of June Monthly Recap 🌅

· 3 min read

What a month it’s been at Push! From groundbreaking features to new partnerships, we’ve been on an exciting journey this June making major strides towards our mission of decentralizing communication in web3. We couldn’t be more thrilled to share the highlights with you.

Cover image of Recreating Web2 Communication Channels in Web3 Using Push👥

· 4 min read

The ability to communicate effectively with users is a crucial aspect of any decentralized application or service. This is where communication channels come in. Serving as a bridge between dapps and users, enabling notifications, chat messages and other forms of communication across various blockchain networks.

Cover image of Getting Started with Push SDK: Socket API🔔

· 4 min read

The Socket API is a package that helps you connect to the Push backend using WebSockets, built on top of Socket.IO With this API, you can easily subscribe to real-time notifications and updates from the Push network.

Cover image of Push Protocol Launches on BNB Chain!💛

· 2 min read

Today, we’re excited to announce that Push Protocol is launching on the BNB Chain mainnets! This means the largest web3 communication platform is now available to BNB’s ecosystem of thousands of dapps and hundreds of thousands of daily users.
\ No newline at end of file diff --git a/blog/tags/blockchain/page/2/index.html b/blog/tags/blockchain/page/2/index.html index 8cbd595e47c..25e363af239 100644 --- a/blog/tags/blockchain/page/2/index.html +++ b/blog/tags/blockchain/page/2/index.html @@ -3,7 +3,7 @@ -49 posts tagged with "Blockchain" | Push | The Communication Protocol of Web3 +50 posts tagged with "Blockchain" | Push | The Communication Protocol of Web3 @@ -14,8 +14,8 @@ - - + +
Skip to main content

49 posts tagged with "Blockchain"

View All Tags

Cover image of Push and Phuture Finance Team Up to Enhance User Engagement🐋

· 3 min read

This week, we are glad to feature our fren and the leading crypto index platform — Phuture Finance. Phuture Finance is an investment platform that combines passive exposure to crypto assets with transparency and lasting value. As such, the index platform is working towards making DeFi more accessible by bringing yield-generating index funds to risk-averse crypto investors.

Cover image of January Monthly Recap❄️

· 3 min read

Welcome to our monthly update! We are thrilled to share with you the numerous achievements and milestones we accomplished in the month of January — spoiler, it's a lot.

Cover image of Push and Wherever Team Up to Bring Web3 Communication Tools to Dapps🛠️

· 4 min read

This week, our featured fren is a wallet-first customer communication platform, Wherever 😊 Imagine wallet-to-wallet communication on dapps that protects users’ data and privacy, all the while ensuring they get the best possible experience. That’s Wherever for you. The platform enables web3 dapps to communicate with wallets directly, no matter where they are. Communication wherever, literally!

Cover image of Introducing Push Improvement Proposal (PIP)

· 4 min read

Push (previously known as EPNS) has grown to become the leading communication layer for all Web3 actors including protocols, dapps, smart contracts, wallets, backend, and users. But, to service such a large ecosystem, there needs to be a streamlined process for improving and developing the ecosystem to meet every actor’s needs. Introducing — Push Improvement Proposals (PIP).

Cover image of Push Monthly Blocks

· 3 min read

Hello Push fam 🎎. Get comfortable and relax. We have so much to talk about this month! After our rebrand to Push Protocol many things followed up and it’s time we go over them.

Cover image of Push Monthly Blocks

· 2 min read

Hi Push frens!✨ This one is a very special Monthly Blocks edition as it is the first Push Protocol edition. Let’s take time to recap briefly all the happenings this month!
+
Skip to main content

50 posts tagged with "Blockchain"

View All Tags

Cover image of Push and Phuture Finance Team Up to Enhance User Engagement🐋

· 3 min read

This week, we are glad to feature our fren and the leading crypto index platform — Phuture Finance. Phuture Finance is an investment platform that combines passive exposure to crypto assets with transparency and lasting value. As such, the index platform is working towards making DeFi more accessible by bringing yield-generating index funds to risk-averse crypto investors.

Cover image of January Monthly Recap❄️

· 3 min read

Welcome to our monthly update! We are thrilled to share with you the numerous achievements and milestones we accomplished in the month of January — spoiler, it's a lot.

Cover image of Push and Wherever Team Up to Bring Web3 Communication Tools to Dapps🛠️

· 4 min read

This week, our featured fren is a wallet-first customer communication platform, Wherever 😊 Imagine wallet-to-wallet communication on dapps that protects users’ data and privacy, all the while ensuring they get the best possible experience. That’s Wherever for you. The platform enables web3 dapps to communicate with wallets directly, no matter where they are. Communication wherever, literally!

Cover image of Introducing Push Improvement Proposal (PIP)

· 4 min read

Push (previously known as EPNS) has grown to become the leading communication layer for all Web3 actors including protocols, dapps, smart contracts, wallets, backend, and users. But, to service such a large ecosystem, there needs to be a streamlined process for improving and developing the ecosystem to meet every actor’s needs. Introducing — Push Improvement Proposals (PIP).

Cover image of Push Monthly Blocks

· 3 min read

Hello Push fam 🎎. Get comfortable and relax. We have so much to talk about this month! After our rebrand to Push Protocol many things followed up and it’s time we go over them.

Cover image of Push Monthly Blocks

· 2 min read

Hi Push frens!✨ This one is a very special Monthly Blocks edition as it is the first Push Protocol edition. Let’s take time to recap briefly all the happenings this month!
\ No newline at end of file diff --git a/blog/tags/blockchain/page/3/index.html b/blog/tags/blockchain/page/3/index.html index dc69d444c39..fd7810300bd 100644 --- a/blog/tags/blockchain/page/3/index.html +++ b/blog/tags/blockchain/page/3/index.html @@ -3,7 +3,7 @@ -49 posts tagged with "Blockchain" | Push | The Communication Protocol of Web3 +50 posts tagged with "Blockchain" | Push | The Communication Protocol of Web3 @@ -14,8 +14,8 @@ - - + +
Skip to main content

49 posts tagged with "Blockchain"

View All Tags

Cover image of Reef Chain Integrates EPNS to Enable Seamless Communication With Users

· 2 min read

Reef Chain is a fast, scalable, efficient, and affordable Layer-1 network that aims to integrate all the best aspects of popular blockchains into one platform to offer a world-class experience to users and developers. It is designed to power the next generation of DeFi, NFT, GameFi, and metaverse projects.

Cover image of ‘My Dapp’ Would Like to Send You Push Notifications

· 3 min read

In Part 1.1, we introduced modern push technology, which consists of these primary components: an app publisher who publishes information by notifications, a client who is the receiver of notifications based on a subscription, and the push notification provider who acts as middleware between these two actors.

Cover image of EPNS Monthly Blocks

· 3 min read

This August was definitely a wild ride and we couldn’t have had more fun.🎢 Let’s take a look at all the happenings this month!

Cover image of ‘My App’ Would Like to Send You Push Notifications

· 4 min read

It is hard to imagine modern mobile devices without push notifications. The first push service was launched by Apple in June 2009, the Apple Push Notification Service (APNs). After that, Google followed with a service of their own, Google Cloud to Device Messaging (C2DM). Both companies have led efforts to enhance the push notification technology to where it is today.

Cover Image of Vamos Latam Fam 🧉

· 3 min read

We had a blast with our invitees during Friday PUSH #21 in preparation for ETH Latam 🇦🇷 💃. Mariano, Juan David, and CryptoChica joined us to discuss about everything ETH Latam, and the challenges and opportunities for the Latam region.

Cover image of Monthly Blocks

· 4 min read

July flew by in the blink of an eye, and as we go deeper into Q3 more things are coming together nicely. This second half of the year is looking to be loaded with many new features and so many great news.

Cover Image of ICYMI — EPNS at EthCC 2022 Paris 🇫🇷

· 3 min read

While the sweltering heat was the talk of the town, we donned our cool collective hats and focused on being part of one of the largest Ethereum events focused on tech and community, with three intense days of conferences, networking and learning.
+
Skip to main content

50 posts tagged with "Blockchain"

View All Tags

Cover image of Reef Chain Integrates EPNS to Enable Seamless Communication With Users

· 2 min read

Reef Chain is a fast, scalable, efficient, and affordable Layer-1 network that aims to integrate all the best aspects of popular blockchains into one platform to offer a world-class experience to users and developers. It is designed to power the next generation of DeFi, NFT, GameFi, and metaverse projects.

Cover image of ‘My Dapp’ Would Like to Send You Push Notifications

· 3 min read

In Part 1.1, we introduced modern push technology, which consists of these primary components: an app publisher who publishes information by notifications, a client who is the receiver of notifications based on a subscription, and the push notification provider who acts as middleware between these two actors.

Cover image of EPNS Monthly Blocks

· 3 min read

This August was definitely a wild ride and we couldn’t have had more fun.🎢 Let’s take a look at all the happenings this month!

Cover image of ‘My App’ Would Like to Send You Push Notifications

· 4 min read

It is hard to imagine modern mobile devices without push notifications. The first push service was launched by Apple in June 2009, the Apple Push Notification Service (APNs). After that, Google followed with a service of their own, Google Cloud to Device Messaging (C2DM). Both companies have led efforts to enhance the push notification technology to where it is today.

Cover Image of Vamos Latam Fam 🧉

· 3 min read

We had a blast with our invitees during Friday PUSH #21 in preparation for ETH Latam 🇦🇷 💃. Mariano, Juan David, and CryptoChica joined us to discuss about everything ETH Latam, and the challenges and opportunities for the Latam region.

Cover image of Monthly Blocks

· 4 min read

July flew by in the blink of an eye, and as we go deeper into Q3 more things are coming together nicely. This second half of the year is looking to be loaded with many new features and so many great news.

Cover Image of ICYMI — EPNS at EthCC 2022 Paris 🇫🇷

· 3 min read

While the sweltering heat was the talk of the town, we donned our cool collective hats and focused on being part of one of the largest Ethereum events focused on tech and community, with three intense days of conferences, networking and learning.
\ No newline at end of file diff --git a/blog/tags/blockchain/page/4/index.html b/blog/tags/blockchain/page/4/index.html index 21cd6c4d016..955c8d1b294 100644 --- a/blog/tags/blockchain/page/4/index.html +++ b/blog/tags/blockchain/page/4/index.html @@ -3,7 +3,7 @@ -49 posts tagged with "Blockchain" | Push | The Communication Protocol of Web3 +50 posts tagged with "Blockchain" | Push | The Communication Protocol of Web3 @@ -14,8 +14,8 @@ - - + +
Skip to main content

49 posts tagged with "Blockchain"

View All Tags

Cover Image of Roadmap 2022 — Q2 Wrap Up

· 6 min read

Wow! Half of 2022 is done! Can’t believe it’s been more than six months since our Mainnet launch! And not to mention that we’ve got some of the best collaborations in the Web3 space packed with some amazing feature upgrades to help build a truly decentralized communication layer across Web3!

Cover image of Friday PUSH #19

· 3 min read

Last Friday we had a very special Friday PUSH with very special guests. We were accompanied by Jacob from ETH Global, and some of the teams that decided to implement EPNS during the ETHNewYork hackathon last month.

Cover image of EPNS and Quest3 Unite in Pilot Collaboration to Bring Notifications for Users

· 2 min read

EPNS and Quest3, the quest and event platform for web3, join forces in a pilot collaboration to enable direct communication between users and the platform. As a result, users of the platform are poised to receive push notifications about various happenings. These notifications will allow users to grab opportunities on the platform and encourage participation.

Cover image of EPNS Monthly Blocks

· 3 min read

We made it to a wonderful end of Q2! Lots of foundational work have happened throughout this first half of the year in preparation for all the great things coming for EPNS in the remaining part of 2022. Let’s go briefly over the happenings of this month.
+
Skip to main content

50 posts tagged with "Blockchain"

View All Tags

Cover Image of Roadmap 2022 — Q2 Wrap Up

· 6 min read

Wow! Half of 2022 is done! Can’t believe it’s been more than six months since our Mainnet launch! And not to mention that we’ve got some of the best collaborations in the Web3 space packed with some amazing feature upgrades to help build a truly decentralized communication layer across Web3!

Cover image of Friday PUSH #19

· 3 min read

Last Friday we had a very special Friday PUSH with very special guests. We were accompanied by Jacob from ETH Global, and some of the teams that decided to implement EPNS during the ETHNewYork hackathon last month.

Cover image of EPNS and Quest3 Unite in Pilot Collaboration to Bring Notifications for Users

· 2 min read

EPNS and Quest3, the quest and event platform for web3, join forces in a pilot collaboration to enable direct communication between users and the platform. As a result, users of the platform are poised to receive push notifications about various happenings. These notifications will allow users to grab opportunities on the platform and encourage participation.

Cover image of EPNS Monthly Blocks

· 3 min read

We made it to a wonderful end of Q2! Lots of foundational work have happened throughout this first half of the year in preparation for all the great things coming for EPNS in the remaining part of 2022. Let’s go briefly over the happenings of this month.
\ No newline at end of file diff --git a/blog/tags/blockchain/page/5/index.html b/blog/tags/blockchain/page/5/index.html index d416575d64e..01568e9f250 100644 --- a/blog/tags/blockchain/page/5/index.html +++ b/blog/tags/blockchain/page/5/index.html @@ -3,7 +3,7 @@ -49 posts tagged with "Blockchain" | Push | The Communication Protocol of Web3 +50 posts tagged with "Blockchain" | Push | The Communication Protocol of Web3 @@ -14,8 +14,8 @@ - - + +
Skip to main content

49 posts tagged with "Blockchain"

View All Tags

Cover Image of EPNS at NFT NYC 2022: All set for the NFTVerse

· 4 min read

We’re all set and headed to the biggest NFT Party in the world! Touted as the Superbowl of the NFTs and the new CES for NFTs by our frens at Coinbase and Ledger respectively, hsow can we miss this event!

Cover Image of EPNS x Stox: Enabling Communication for the Global Portfolio Tracker

· 2 min read

EPNS and Stox, the portfolio tracker platform for DeFi, team up in a pilot collaboration to bring push notifications to users. As such, Stox will now be able to seamlessly interact with its users and keep them updated about the status of their portfolio, mainly when their NFTs are sold.

Cover Image of Why Engaging with Users Within the NFTVerse Matters

· 5 min read

With the recent launches of Coinbase NFT, a peer-to-peer NFT marketplace with a personalised social feed feature; and Lens Protocol 🌿 a social graph to build decentralized social media platforms NFTs and the dawn of decentralized censorship-free social media is eventually bound to happen soon.

Cover Image of EPNS x The Graph: Enabling a better way to access blockchain data 🧑‍🚀 🔔

· 4 min read

As the blockchain ecosystem has grown, so too has the challenge of accessing on-chain data across multiple blockchain networks. The Graph is an indexing protocol that indexes, organises and makes data accessible from networks like Ethereum and IPFS It is often referred to as “Google” for the blockchains. As more and more data finds its way on-chain, users and developers need to access organised data efficiently.

Cover Image of EPNS push notifications are never boring

· 4 min read

We are back, sharing our ETHGlobal Hack Money hackathon story. Can’t believe it’s already week -3!! It’s been an amazing learning experience so far. A big shout out to the ETHGlobal Team for always being there to help and organizing the best AMAs and office hours sessions. Getting feedback and ideas from the devs at Aavesome Compound, etc has made this learning process about DeFi landscape and tech amazingly fun.

Cover Image Building Ethereum Push Notification Service protocol

· One min read

We are excited to announce that Ethereum Push Notification Service(EPNS) protocol has officially kicked off, yay !! EPNS protocol is a way to send notifications out to users of different dApps (or potentially all users of Ethereum itself) via Web, Mobile (push notifications) or Web3 Providers. EPNS App Owners called Channels Owners can send mass unencrypted notifications (all users in their specific app group), or encrypted targetted messages to specific users in their App Group called Channels.
+
Skip to main content

50 posts tagged with "Blockchain"

View All Tags

Cover Image of EPNS at NFT NYC 2022: All set for the NFTVerse

· 4 min read

We’re all set and headed to the biggest NFT Party in the world! Touted as the Superbowl of the NFTs and the new CES for NFTs by our frens at Coinbase and Ledger respectively, hsow can we miss this event!

Cover Image of EPNS x Stox: Enabling Communication for the Global Portfolio Tracker

· 2 min read

EPNS and Stox, the portfolio tracker platform for DeFi, team up in a pilot collaboration to bring push notifications to users. As such, Stox will now be able to seamlessly interact with its users and keep them updated about the status of their portfolio, mainly when their NFTs are sold.

Cover Image of Why Engaging with Users Within the NFTVerse Matters

· 5 min read

With the recent launches of Coinbase NFT, a peer-to-peer NFT marketplace with a personalised social feed feature; and Lens Protocol 🌿 a social graph to build decentralized social media platforms NFTs and the dawn of decentralized censorship-free social media is eventually bound to happen soon.

Cover Image of EPNS x The Graph: Enabling a better way to access blockchain data 🧑‍🚀 🔔

· 4 min read

As the blockchain ecosystem has grown, so too has the challenge of accessing on-chain data across multiple blockchain networks. The Graph is an indexing protocol that indexes, organises and makes data accessible from networks like Ethereum and IPFS It is often referred to as “Google” for the blockchains. As more and more data finds its way on-chain, users and developers need to access organised data efficiently.

Cover Image of Our 2021 Year in Review 🎉🎉🎉

· 22 min read

2021 was an epic year for EPNS. And not just us, for the entire crypto space. It was the year when the world finally opened up to crypto, blockchain, DeFi, and all their use cases. Along with the fundamental changes also arrived the age of L2 scaling and NFTs, pushing blockchain and crypto further into the mainstream.

Cover Image of EPNS push notifications are never boring

· 4 min read

We are back, sharing our ETHGlobal Hack Money hackathon story. Can’t believe it’s already week -3!! It’s been an amazing learning experience so far. A big shout out to the ETHGlobal Team for always being there to help and organizing the best AMAs and office hours sessions. Getting feedback and ideas from the devs at Aavesome Compound, etc has made this learning process about DeFi landscape and tech amazingly fun.

Cover Image Building Ethereum Push Notification Service protocol

· One min read

We are excited to announce that Ethereum Push Notification Service(EPNS) protocol has officially kicked off, yay !! EPNS protocol is a way to send notifications out to users of different dApps (or potentially all users of Ethereum itself) via Web, Mobile (push notifications) or Web3 Providers. EPNS App Owners called Channels Owners can send mass unencrypted notifications (all users in their specific app group), or encrypted targetted messages to specific users in their App Group called Channels.
\ No newline at end of file diff --git a/blog/tags/blockhain-development/index.html b/blog/tags/blockhain-development/index.html index bb34c17ef9b..79853eb4fda 100644 --- a/blog/tags/blockhain-development/index.html +++ b/blog/tags/blockhain-development/index.html @@ -14,8 +14,8 @@ - - + +
Skip to main content

2 posts tagged with "BNBChain"

View All Tags

Cover image of Push Protocol Launches on BNB Chain!💛

· 2 min read

Today, we’re excited to announce that Push Protocol is launching on the BNB Chain mainnets! This means the largest web3 communication platform is now available to BNB’s ecosystem of thousands of dapps and hundreds of thousands of daily users.
+
Skip to main content

2 posts tagged with "BNBChain"

View All Tags

Cover image of Push Protocol Launches on BNB Chain!💛

· 2 min read

Today, we’re excited to announce that Push Protocol is launching on the BNB Chain mainnets! This means the largest web3 communication platform is now available to BNB’s ecosystem of thousands of dapps and hundreds of thousands of daily users.
\ No newline at end of file diff --git a/blog/tags/bnb/index.html b/blog/tags/bnb/index.html index 4544634263f..8d72282fcd2 100644 --- a/blog/tags/bnb/index.html +++ b/blog/tags/bnb/index.html @@ -14,8 +14,8 @@ - - + +
Skip to main content

3 posts tagged with "BNB"

View All Tags

Cover image of Push Protocol Launches on BNB Chain!💛

· 2 min read

Today, we’re excited to announce that Push Protocol is launching on the BNB Chain mainnets! This means the largest web3 communication platform is now available to BNB’s ecosystem of thousands of dapps and hundreds of thousands of daily users.
+
Skip to main content

3 posts tagged with "BNB"

View All Tags

Cover image of Push Protocol Launches on BNB Chain!💛

· 2 min read

Today, we’re excited to announce that Push Protocol is launching on the BNB Chain mainnets! This means the largest web3 communication platform is now available to BNB’s ecosystem of thousands of dapps and hundreds of thousands of daily users.
\ No newline at end of file diff --git a/blog/tags/boba-network/index.html b/blog/tags/boba-network/index.html index a1ec24d630b..88b7f57a508 100644 --- a/blog/tags/boba-network/index.html +++ b/blog/tags/boba-network/index.html @@ -14,8 +14,8 @@ - - + +
Skip to main content

37 posts tagged with "Ethereum"

View All Tags

Cover image of What is ERC-6551 and How’s It Better than ERC-721?

· 3 min read

In 2017, the ERC-721 standard revolutionized the tokenization of digital assets, defining the basic set of rules and functions for creating non-fungible tokens (NFTs). Since then, NFTs have gained significant popularity, transforming how we perceive and interact with digital art, collectibles, virtual real estate, and more.

Cover image of Push Monthly Blocks

· 3 min read

Hello Push fam 🎎. Get comfortable and relax. We have so much to talk about this month! After our rebrand to Push Protocol many things followed up and it’s time we go over them.

Cover image of Push Monthly Blocks

· 2 min read

Hi Push frens!✨ This one is a very special Monthly Blocks edition as it is the first Push Protocol edition. Let’s take time to recap briefly all the happenings this month!

Cover image of Push Going Big on Polygon with Frens

· 3 min read

Push Protocol has recently launched on Polygon with Lens being the official launch partner. Today, we are excited to announce, some old, and some new friends are combining forces with Push to grow and strengthen their presence in the Polygon ecosystem.

Cover image of Push and Lens: Powering UX with Notifications and Aave’s Lens

· 3 min read

We’re excited to announce the first protocol to use Push on the Polygon mainnet: Lens Protocol! Since its launch in January 2022, Push has powered over 17 million decentralized notifications to over 60,000 subscribers, becoming the de facto communication layer for web3.

Cover image of EPNS Rebrands into Push Protocol, the Communication Protocol for Web3

· 3 min read

Ethereum Push Notification Service (EPNS) is rebranding into Push Protocol. The rebrand signifies the network’s move beyond Ethereum to other blockchains and beyond push notifications to all forms of communication. The existing channels, notifications, $PUSH token, and app all remain unchanged. Learn more at push.org

Cover image of EPNS Allies With Commonwealth to Bring Governance Notifications to Users

· 2 min read

Commonwealth, the all-in-one platform that lets projects simplify their community management and governance, joins forces with EPNS to enable direct communication with platform users. As such, users of Commonwealth are poised to receive decentralized push notifications pertaining to the governance process. These notifications increase user participation and keep users updated about every step in the governance lifecycle.
+
Skip to main content

38 posts tagged with "Ethereum"

View All Tags

Cover image of What is ERC-6551 and How’s It Better than ERC-721?

· 3 min read

In 2017, the ERC-721 standard revolutionized the tokenization of digital assets, defining the basic set of rules and functions for creating non-fungible tokens (NFTs). Since then, NFTs have gained significant popularity, transforming how we perceive and interact with digital art, collectibles, virtual real estate, and more.

Cover image of Push Monthly Blocks

· 3 min read

Hello Push fam 🎎. Get comfortable and relax. We have so much to talk about this month! After our rebrand to Push Protocol many things followed up and it’s time we go over them.

Cover image of Push Monthly Blocks

· 2 min read

Hi Push frens!✨ This one is a very special Monthly Blocks edition as it is the first Push Protocol edition. Let’s take time to recap briefly all the happenings this month!

Cover image of Push Going Big on Polygon with Frens

· 3 min read

Push Protocol has recently launched on Polygon with Lens being the official launch partner. Today, we are excited to announce, some old, and some new friends are combining forces with Push to grow and strengthen their presence in the Polygon ecosystem.

Cover image of Push and Lens: Powering UX with Notifications and Aave’s Lens

· 3 min read

We’re excited to announce the first protocol to use Push on the Polygon mainnet: Lens Protocol! Since its launch in January 2022, Push has powered over 17 million decentralized notifications to over 60,000 subscribers, becoming the de facto communication layer for web3.

Cover image of EPNS Rebrands into Push Protocol, the Communication Protocol for Web3

· 3 min read

Ethereum Push Notification Service (EPNS) is rebranding into Push Protocol. The rebrand signifies the network’s move beyond Ethereum to other blockchains and beyond push notifications to all forms of communication. The existing channels, notifications, $PUSH token, and app all remain unchanged. Learn more at push.org

Cover image of EPNS Allies With Commonwealth to Bring Governance Notifications to Users

· 2 min read

Commonwealth, the all-in-one platform that lets projects simplify their community management and governance, joins forces with EPNS to enable direct communication with platform users. As such, users of Commonwealth are poised to receive decentralized push notifications pertaining to the governance process. These notifications increase user participation and keep users updated about every step in the governance lifecycle.
\ No newline at end of file diff --git a/blog/tags/ethereum/page/2/index.html b/blog/tags/ethereum/page/2/index.html index d445df523b0..12a17aec47f 100644 --- a/blog/tags/ethereum/page/2/index.html +++ b/blog/tags/ethereum/page/2/index.html @@ -3,7 +3,7 @@ -37 posts tagged with "Ethereum" | Push | The Communication Protocol of Web3 +38 posts tagged with "Ethereum" | Push | The Communication Protocol of Web3 @@ -14,8 +14,8 @@ - - + +
Skip to main content

37 posts tagged with "Ethereum"

View All Tags

Cover image of Reef Chain Integrates EPNS to Enable Seamless Communication With Users

· 2 min read

Reef Chain is a fast, scalable, efficient, and affordable Layer-1 network that aims to integrate all the best aspects of popular blockchains into one platform to offer a world-class experience to users and developers. It is designed to power the next generation of DeFi, NFT, GameFi, and metaverse projects.

Cover image of EPNS Monthly Blocks

· 3 min read

This August was definitely a wild ride and we couldn’t have had more fun.🎢 Let’s take a look at all the happenings this month!

Cover image of Fast-tracking Proposals, Approved!

· 2 min read

We are excited to announce that governance proposal PIP-08 — Fast-tracking of PIPs that get Immediate traction into Snapshot — was approved via governance voting by a vast majority of 1.2M PUSH in favor.

Cover Image of Vamos Latam Fam 🧉

· 3 min read

We had a blast with our invitees during Friday PUSH #21 in preparation for ETH Latam 🇦🇷 💃. Mariano, Juan David, and CryptoChica joined us to discuss about everything ETH Latam, and the challenges and opportunities for the Latam region.

Cover image of Monthly Blocks

· 4 min read

July flew by in the blink of an eye, and as we go deeper into Q3 more things are coming together nicely. This second half of the year is looking to be loaded with many new features and so many great news.

Cover Image of ICYMI — EPNS at EthCC 2022 Paris 🇫🇷

· 3 min read

While the sweltering heat was the talk of the town, we donned our cool collective hats and focused on being part of one of the largest Ethereum events focused on tech and community, with three intense days of conferences, networking and learning.

Cover Image of Roadmap 2022 — Q2 Wrap Up

· 6 min read

Wow! Half of 2022 is done! Can’t believe it’s been more than six months since our Mainnet launch! And not to mention that we’ve got some of the best collaborations in the Web3 space packed with some amazing feature upgrades to help build a truly decentralized communication layer across Web3!
+
Skip to main content

38 posts tagged with "Ethereum"

View All Tags

Cover image of Reef Chain Integrates EPNS to Enable Seamless Communication With Users

· 2 min read

Reef Chain is a fast, scalable, efficient, and affordable Layer-1 network that aims to integrate all the best aspects of popular blockchains into one platform to offer a world-class experience to users and developers. It is designed to power the next generation of DeFi, NFT, GameFi, and metaverse projects.

Cover image of EPNS Monthly Blocks

· 3 min read

This August was definitely a wild ride and we couldn’t have had more fun.🎢 Let’s take a look at all the happenings this month!

Cover image of Fast-tracking Proposals, Approved!

· 2 min read

We are excited to announce that governance proposal PIP-08 — Fast-tracking of PIPs that get Immediate traction into Snapshot — was approved via governance voting by a vast majority of 1.2M PUSH in favor.

Cover Image of Vamos Latam Fam 🧉

· 3 min read

We had a blast with our invitees during Friday PUSH #21 in preparation for ETH Latam 🇦🇷 💃. Mariano, Juan David, and CryptoChica joined us to discuss about everything ETH Latam, and the challenges and opportunities for the Latam region.

Cover image of Monthly Blocks

· 4 min read

July flew by in the blink of an eye, and as we go deeper into Q3 more things are coming together nicely. This second half of the year is looking to be loaded with many new features and so many great news.

Cover Image of ICYMI — EPNS at EthCC 2022 Paris 🇫🇷

· 3 min read

While the sweltering heat was the talk of the town, we donned our cool collective hats and focused on being part of one of the largest Ethereum events focused on tech and community, with three intense days of conferences, networking and learning.

Cover Image of Roadmap 2022 — Q2 Wrap Up

· 6 min read

Wow! Half of 2022 is done! Can’t believe it’s been more than six months since our Mainnet launch! And not to mention that we’ve got some of the best collaborations in the Web3 space packed with some amazing feature upgrades to help build a truly decentralized communication layer across Web3!
\ No newline at end of file diff --git a/blog/tags/ethereum/page/3/index.html b/blog/tags/ethereum/page/3/index.html index 984ccbb7940..bb98d31ff20 100644 --- a/blog/tags/ethereum/page/3/index.html +++ b/blog/tags/ethereum/page/3/index.html @@ -3,7 +3,7 @@ -37 posts tagged with "Ethereum" | Push | The Communication Protocol of Web3 +38 posts tagged with "Ethereum" | Push | The Communication Protocol of Web3 @@ -14,8 +14,8 @@ - - + +
Skip to main content

37 posts tagged with "Ethereum"

View All Tags

Cover image of Friday PUSH #19

· 3 min read

Last Friday we had a very special Friday PUSH with very special guests. We were accompanied by Jacob from ETH Global, and some of the teams that decided to implement EPNS during the ETHNewYork hackathon last month.

Cover image of EPNS and Quest3 Unite in Pilot Collaboration to Bring Notifications for Users

· 2 min read

EPNS and Quest3, the quest and event platform for web3, join forces in a pilot collaboration to enable direct communication between users and the platform. As a result, users of the platform are poised to receive push notifications about various happenings. These notifications will allow users to grab opportunities on the platform and encourage participation.

Cover image of EPNS Monthly Blocks

· 3 min read

We made it to a wonderful end of Q2! Lots of foundational work have happened throughout this first half of the year in preparation for all the great things coming for EPNS in the remaining part of 2022. Let’s go briefly over the happenings of this month.

Cover Image of EPNS at NFT NYC 2022: All set for the NFTVerse

· 4 min read

We’re all set and headed to the biggest NFT Party in the world! Touted as the Superbowl of the NFTs and the new CES for NFTs by our frens at Coinbase and Ledger respectively, hsow can we miss this event!

Cover Image of EPNS x Stox: Enabling Communication for the Global Portfolio Tracker

· 2 min read

EPNS and Stox, the portfolio tracker platform for DeFi, team up in a pilot collaboration to bring push notifications to users. As such, Stox will now be able to seamlessly interact with its users and keep them updated about the status of their portfolio, mainly when their NFTs are sold.
+
Skip to main content

38 posts tagged with "Ethereum"

View All Tags

Cover image of Friday PUSH #19

· 3 min read

Last Friday we had a very special Friday PUSH with very special guests. We were accompanied by Jacob from ETH Global, and some of the teams that decided to implement EPNS during the ETHNewYork hackathon last month.

Cover image of EPNS and Quest3 Unite in Pilot Collaboration to Bring Notifications for Users

· 2 min read

EPNS and Quest3, the quest and event platform for web3, join forces in a pilot collaboration to enable direct communication between users and the platform. As a result, users of the platform are poised to receive push notifications about various happenings. These notifications will allow users to grab opportunities on the platform and encourage participation.

Cover image of EPNS Monthly Blocks

· 3 min read

We made it to a wonderful end of Q2! Lots of foundational work have happened throughout this first half of the year in preparation for all the great things coming for EPNS in the remaining part of 2022. Let’s go briefly over the happenings of this month.

Cover Image of EPNS at NFT NYC 2022: All set for the NFTVerse

· 4 min read

We’re all set and headed to the biggest NFT Party in the world! Touted as the Superbowl of the NFTs and the new CES for NFTs by our frens at Coinbase and Ledger respectively, hsow can we miss this event!

Cover Image of EPNS x Stox: Enabling Communication for the Global Portfolio Tracker

· 2 min read

EPNS and Stox, the portfolio tracker platform for DeFi, team up in a pilot collaboration to bring push notifications to users. As such, Stox will now be able to seamlessly interact with its users and keep them updated about the status of their portfolio, mainly when their NFTs are sold.
\ No newline at end of file diff --git a/blog/tags/ethereum/page/4/index.html b/blog/tags/ethereum/page/4/index.html index 48983ff5ce7..3fa0410d891 100644 --- a/blog/tags/ethereum/page/4/index.html +++ b/blog/tags/ethereum/page/4/index.html @@ -3,7 +3,7 @@ -37 posts tagged with "Ethereum" | Push | The Communication Protocol of Web3 +38 posts tagged with "Ethereum" | Push | The Communication Protocol of Web3 @@ -14,8 +14,8 @@ - - + +
Skip to main content

37 posts tagged with "Ethereum"

View All Tags

Cover Image of Why Engaging with Users Within the NFTVerse Matters

· 5 min read

With the recent launches of Coinbase NFT, a peer-to-peer NFT marketplace with a personalised social feed feature; and Lens Protocol 🌿 a social graph to build decentralized social media platforms NFTs and the dawn of decentralized censorship-free social media is eventually bound to happen soon.

Cover Image of EPNS x The Graph: Enabling a better way to access blockchain data 🧑‍🚀 🔔

· 4 min read

As the blockchain ecosystem has grown, so too has the challenge of accessing on-chain data across multiple blockchain networks. The Graph is an indexing protocol that indexes, organises and makes data accessible from networks like Ethereum and IPFS It is often referred to as “Google” for the blockchains. As more and more data finds its way on-chain, users and developers need to access organised data efficiently.

Cover Image of Huobi ❤️ Supports Indian Artists!

· One min read

Continuing the celebration of $PUSH listing on Huobi Global this weeks $ROCKSTAR #NFT is sponsored by awesome peeps at Huobi Global to celebrate Indian art 🇮🇳. The winner gets the $ROCKSTAR NFT + 2400 $PUSH (~$12,000)+ Sweet surprise from Huobi 🎁

Cover Image of EPNS push notifications are never boring

· 4 min read

We are back, sharing our ETHGlobal Hack Money hackathon story. Can’t believe it’s already week -3!! It’s been an amazing learning experience so far. A big shout out to the ETHGlobal Team for always being there to help and organizing the best AMAs and office hours sessions. Getting feedback and ideas from the devs at Aavesome Compound, etc has made this learning process about DeFi landscape and tech amazingly fun.

Cover Image of Hello World: BUIDLing a working EPNS Mobile app

· 3 min read

It’s another day at EthGlobal HackMoney hackathon and we are back with more detail and further progress. While most of the dev project cycles start at smart contract and end at dApp, we have taken a different approach and instead are focusing on getting the EPNS mobile app and push notification server built out first.

Cover Image Building Ethereum Push Notification Service protocol

· One min read

We are excited to announce that Ethereum Push Notification Service(EPNS) protocol has officially kicked off, yay !! EPNS protocol is a way to send notifications out to users of different dApps (or potentially all users of Ethereum itself) via Web, Mobile (push notifications) or Web3 Providers. EPNS App Owners called Channels Owners can send mass unencrypted notifications (all users in their specific app group), or encrypted targetted messages to specific users in their App Group called Channels.
+
Skip to main content

38 posts tagged with "Ethereum"

View All Tags

Cover Image of Why Engaging with Users Within the NFTVerse Matters

· 5 min read

With the recent launches of Coinbase NFT, a peer-to-peer NFT marketplace with a personalised social feed feature; and Lens Protocol 🌿 a social graph to build decentralized social media platforms NFTs and the dawn of decentralized censorship-free social media is eventually bound to happen soon.

Cover Image of EPNS x The Graph: Enabling a better way to access blockchain data 🧑‍🚀 🔔

· 4 min read

As the blockchain ecosystem has grown, so too has the challenge of accessing on-chain data across multiple blockchain networks. The Graph is an indexing protocol that indexes, organises and makes data accessible from networks like Ethereum and IPFS It is often referred to as “Google” for the blockchains. As more and more data finds its way on-chain, users and developers need to access organised data efficiently.

Cover Image of Our 2021 Year in Review 🎉🎉🎉

· 22 min read

2021 was an epic year for EPNS. And not just us, for the entire crypto space. It was the year when the world finally opened up to crypto, blockchain, DeFi, and all their use cases. Along with the fundamental changes also arrived the age of L2 scaling and NFTs, pushing blockchain and crypto further into the mainstream.

Cover Image of Huobi ❤️ Supports Indian Artists!

· One min read

Continuing the celebration of $PUSH listing on Huobi Global this weeks $ROCKSTAR #NFT is sponsored by awesome peeps at Huobi Global to celebrate Indian art 🇮🇳. The winner gets the $ROCKSTAR NFT + 2400 $PUSH (~$12,000)+ Sweet surprise from Huobi 🎁

Cover Image of EPNS push notifications are never boring

· 4 min read

We are back, sharing our ETHGlobal Hack Money hackathon story. Can’t believe it’s already week -3!! It’s been an amazing learning experience so far. A big shout out to the ETHGlobal Team for always being there to help and organizing the best AMAs and office hours sessions. Getting feedback and ideas from the devs at Aavesome Compound, etc has made this learning process about DeFi landscape and tech amazingly fun.

Cover Image of Hello World: BUIDLing a working EPNS Mobile app

· 3 min read

It’s another day at EthGlobal HackMoney hackathon and we are back with more detail and further progress. While most of the dev project cycles start at smart contract and end at dApp, we have taken a different approach and instead are focusing on getting the EPNS mobile app and push notification server built out first.

Cover Image Building Ethereum Push Notification Service protocol

· One min read

We are excited to announce that Ethereum Push Notification Service(EPNS) protocol has officially kicked off, yay !! EPNS protocol is a way to send notifications out to users of different dApps (or potentially all users of Ethereum itself) via Web, Mobile (push notifications) or Web3 Providers. EPNS App Owners called Channels Owners can send mass unencrypted notifications (all users in their specific app group), or encrypted targetted messages to specific users in their App Group called Channels.
\ No newline at end of file diff --git a/blog/tags/ethglobal/index.html b/blog/tags/ethglobal/index.html index 3ba6c6739c3..a5c43cebf88 100644 --- a/blog/tags/ethglobal/index.html +++ b/blog/tags/ethglobal/index.html @@ -14,8 +14,8 @@ - - + +
Skip to main content

4 posts tagged with "Governance"

View All Tags

Cover image of Fast-tracking Proposals, Approved!

· 2 min read

We are excited to announce that governance proposal PIP-08 — Fast-tracking of PIPs that get Immediate traction into Snapshot — was approved via governance voting by a vast majority of 1.2M PUSH in favor.
+
Skip to main content

5 posts tagged with "Governance"

View All Tags

Cover image of Fast-tracking Proposals, Approved!

· 2 min read

We are excited to announce that governance proposal PIP-08 — Fast-tracking of PIPs that get Immediate traction into Snapshot — was approved via governance voting by a vast majority of 1.2M PUSH in favor.

Cover Image of Our 2021 Year in Review 🎉🎉🎉

· 22 min read

2021 was an epic year for EPNS. And not just us, for the entire crypto space. It was the year when the world finally opened up to crypto, blockchain, DeFi, and all their use cases. Along with the fundamental changes also arrived the age of L2 scaling and NFTs, pushing blockchain and crypto further into the mainstream.
\ No newline at end of file diff --git a/blog/tags/grant-writing/index.html b/blog/tags/grant-writing/index.html index 33da72ec2d4..22898d1e8c3 100644 --- a/blog/tags/grant-writing/index.html +++ b/blog/tags/grant-writing/index.html @@ -14,8 +14,8 @@ - - + +
Skip to main content
+
Skip to main content
\ No newline at end of file diff --git a/blog/tags/infrastructure/index.html b/blog/tags/infrastructure/index.html index 345ec671e0e..61e8845b3ec 100644 --- a/blog/tags/infrastructure/index.html +++ b/blog/tags/infrastructure/index.html @@ -14,8 +14,8 @@ - - + +
Skip to main content

34 posts tagged with "Push Notification"

View All Tags

Cover image of Push Launches Wallet-to-Wallet Video Chat📹

· 2 min read

Today, Push Protocol is excited to announce the launch of Push Video! Push Video is the first wallet-to-wallet video chat that allows web3 users to video chat with each other live. Get started at app.push.org

Cover image of Push Protocolについて知っておくべきこと🔔

· 7 min read

Push Protocol(前身はEPNS)は、Web3通信プロトコルであり、任意のdAppsやスマートコントラクト、バックエンド、またはプロトコルが、ユーザーウォレットアドレスを介してオンチェーンとオフチェーンの両方において、オープンで、Gasless、マルチチェーン、及びプラットフォームに依存しない方法で通信できるようにします。

Cover image of January Monthly Recap❄️

· 3 min read

Welcome to our monthly update! We are thrilled to share with you the numerous achievements and milestones we accomplished in the month of January — spoiler, it's a lot.

Cover image of Push and Wherever Team Up to Bring Web3 Communication Tools to Dapps🛠️

· 4 min read

This week, our featured fren is a wallet-first customer communication platform, Wherever 😊 Imagine wallet-to-wallet communication on dapps that protects users’ data and privacy, all the while ensuring they get the best possible experience. That’s Wherever for you. The platform enables web3 dapps to communicate with wallets directly, no matter where they are. Communication wherever, literally!

Cover image of Push 2022 Year in Review🎉

· 4 min read

2022 was a marvelous year for Push thanks to our fantastic team and growing community of talented developers. To everyone who has helped support the Push project — devs, community members, partners, co-sponsors, we thank you!
+
Skip to main content

34 posts tagged with "Push Notification"

View All Tags

Cover image of Push Protocolについて知っておくべきこと🔔

· 7 min read

Push Protocol(前身はEPNS)は、Web3通信プロトコルであり、任意のdAppsやスマートコントラクト、バックエンド、またはプロトコルが、ユーザーウォレットアドレスを介してオンチェーンとオフチェーンの両方において、オープンで、Gasless、マルチチェーン、及びプラットフォームに依存しない方法で通信できるようにします。

Cover image of Push Launches Wallet-to-Wallet Video Chat📹

· 2 min read

Today, Push Protocol is excited to announce the launch of Push Video! Push Video is the first wallet-to-wallet video chat that allows web3 users to video chat with each other live. Get started at app.push.org

Cover image of January Monthly Recap❄️

· 3 min read

Welcome to our monthly update! We are thrilled to share with you the numerous achievements and milestones we accomplished in the month of January — spoiler, it's a lot.

Cover image of Push and Wherever Team Up to Bring Web3 Communication Tools to Dapps🛠️

· 4 min read

This week, our featured fren is a wallet-first customer communication platform, Wherever 😊 Imagine wallet-to-wallet communication on dapps that protects users’ data and privacy, all the while ensuring they get the best possible experience. That’s Wherever for you. The platform enables web3 dapps to communicate with wallets directly, no matter where they are. Communication wherever, literally!

Cover image of Push 2022 Year in Review🎉

· 4 min read

2022 was a marvelous year for Push thanks to our fantastic team and growing community of talented developers. To everyone who has helped support the Push project — devs, community members, partners, co-sponsors, we thank you!
\ No newline at end of file diff --git a/blog/tags/push-notification/page/2/index.html b/blog/tags/push-notification/page/2/index.html index 521077e7391..49f00b0da21 100644 --- a/blog/tags/push-notification/page/2/index.html +++ b/blog/tags/push-notification/page/2/index.html @@ -14,8 +14,8 @@ - - + +
Skip to main content

34 posts tagged with "Push Notification"

View All Tags

Cover image of November Monthly Recap

· 3 min read

What a month for the Push project and community! From making many new frens to launching our very own Improvement Proposals, much has happened and we cannot wait to share everything with you. 🤩

Cover image of Introducing Push Improvement Proposal (PIP)

· 4 min read

Push (previously known as EPNS) has grown to become the leading communication layer for all Web3 actors including protocols, dapps, smart contracts, wallets, backend, and users. But, to service such a large ecosystem, there needs to be a streamlined process for improving and developing the ecosystem to meet every actor’s needs. Introducing — Push Improvement Proposals (PIP).
+
Skip to main content

34 posts tagged with "Push Notification"

View All Tags

Cover image of November Monthly Recap

· 3 min read

What a month for the Push project and community! From making many new frens to launching our very own Improvement Proposals, much has happened and we cannot wait to share everything with you. 🤩

Cover image of Introducing Push Improvement Proposal (PIP)

· 4 min read

Push (previously known as EPNS) has grown to become the leading communication layer for all Web3 actors including protocols, dapps, smart contracts, wallets, backend, and users. But, to service such a large ecosystem, there needs to be a streamlined process for improving and developing the ecosystem to meet every actor’s needs. Introducing — Push Improvement Proposals (PIP).
\ No newline at end of file diff --git a/blog/tags/push-notification/page/3/index.html b/blog/tags/push-notification/page/3/index.html index ed8778c9aab..85ec404a8a8 100644 --- a/blog/tags/push-notification/page/3/index.html +++ b/blog/tags/push-notification/page/3/index.html @@ -14,8 +14,8 @@ - - + +
Skip to main content

34 posts tagged with "Push Notification"

View All Tags

Cover image of Enjoy Your NFT, Stay Tuned for Next Steps!

· 3 min read

The metaverse without communication is counter-intuitive. Users are disconnected when connecting to digital assets and worlds; Push Protocol aims to change that. With the current web3 experience, it is not practical to expect meaningful and valuable interactions without a robust communication method.

Cover image of Announcing the Push Chat Alpha Launch

· 4 min read

Today, we’re excited to announce the next evolution in Push Protocol: Push Chat! Push Chat is a wallet-to-wallet communication protocol that will accelerate the growth and value of web3 applications and communities alike. We are launching the Push Chat alpha and opening up access to select users across the Push community. To learn how to get access to the alpha, see “Push Chat Alpha Access” below.

Cover image of Join Us for the ETHBogotá 2022 Hackathon

· 3 min read

A few weeks ago, we teamed up with our frens at ETHGlobal for a month-long ETHOnline hackathon with thousands of builders hacking from across the world. As expected, all the hackers delivered impressive work.

Cover image of Push Going Big on Polygon with Frens

· 3 min read

Push Protocol has recently launched on Polygon with Lens being the official launch partner. Today, we are excited to announce, some old, and some new friends are combining forces with Push to grow and strengthen their presence in the Polygon ecosystem.

Cover image of EPNS Allies With Commonwealth to Bring Governance Notifications to Users

· 2 min read

Commonwealth, the all-in-one platform that lets projects simplify their community management and governance, joins forces with EPNS to enable direct communication with platform users. As such, users of Commonwealth are poised to receive decentralized push notifications pertaining to the governance process. These notifications increase user participation and keep users updated about every step in the governance lifecycle.

Cover image of Reef Chain Integrates EPNS to Enable Seamless Communication With Users

· 2 min read

Reef Chain is a fast, scalable, efficient, and affordable Layer-1 network that aims to integrate all the best aspects of popular blockchains into one platform to offer a world-class experience to users and developers. It is designed to power the next generation of DeFi, NFT, GameFi, and metaverse projects.
+
Skip to main content

34 posts tagged with "Push Notification"

View All Tags

Cover image of Enjoy Your NFT, Stay Tuned for Next Steps!

· 3 min read

The metaverse without communication is counter-intuitive. Users are disconnected when connecting to digital assets and worlds; Push Protocol aims to change that. With the current web3 experience, it is not practical to expect meaningful and valuable interactions without a robust communication method.

Cover image of Announcing the Push Chat Alpha Launch

· 4 min read

Today, we’re excited to announce the next evolution in Push Protocol: Push Chat! Push Chat is a wallet-to-wallet communication protocol that will accelerate the growth and value of web3 applications and communities alike. We are launching the Push Chat alpha and opening up access to select users across the Push community. To learn how to get access to the alpha, see “Push Chat Alpha Access” below.

Cover image of Join Us for the ETHBogotá 2022 Hackathon

· 3 min read

A few weeks ago, we teamed up with our frens at ETHGlobal for a month-long ETHOnline hackathon with thousands of builders hacking from across the world. As expected, all the hackers delivered impressive work.

Cover image of Push Going Big on Polygon with Frens

· 3 min read

Push Protocol has recently launched on Polygon with Lens being the official launch partner. Today, we are excited to announce, some old, and some new friends are combining forces with Push to grow and strengthen their presence in the Polygon ecosystem.

Cover image of EPNS Allies With Commonwealth to Bring Governance Notifications to Users

· 2 min read

Commonwealth, the all-in-one platform that lets projects simplify their community management and governance, joins forces with EPNS to enable direct communication with platform users. As such, users of Commonwealth are poised to receive decentralized push notifications pertaining to the governance process. These notifications increase user participation and keep users updated about every step in the governance lifecycle.

Cover image of Reef Chain Integrates EPNS to Enable Seamless Communication With Users

· 2 min read

Reef Chain is a fast, scalable, efficient, and affordable Layer-1 network that aims to integrate all the best aspects of popular blockchains into one platform to offer a world-class experience to users and developers. It is designed to power the next generation of DeFi, NFT, GameFi, and metaverse projects.
\ No newline at end of file diff --git a/blog/tags/push-notification/page/4/index.html b/blog/tags/push-notification/page/4/index.html index 12ed5482860..b22d675216d 100644 --- a/blog/tags/push-notification/page/4/index.html +++ b/blog/tags/push-notification/page/4/index.html @@ -14,8 +14,8 @@ - - + +
Skip to main content

45 posts tagged with "Pushprotocol"

View All Tags

Cover image of $PUSH is Live on Polygon &amp; Quickswap!💜

· 2 min read

Today we are excited to announce the launch of the $PUSH token on Polygon! Following the successful launch of Push Protocol onto Polygon mainnet last year, we are now carrying over that multi-chain functionality and composability to our $PUSH token.

Cover image of Exploring the Role of ZK Knowledge in Decentralized Communication🌐

· 4 min read

The world of decentralized systems is undergoing a significant evolution, triggered by the imperative quest for privacy and scalability solutions. The technology under our microscope today is zero-knowledge technology, the inherent strengths of which, developers are tirelessly examining for possible integration into Push Protocol.

Cover image of A Technical Deep Dive + 5 Simple Steps to Get Started With Push NFT Chat

· 7 min read

Push NFT Chat is a seamless and secure communication platform that enables NFTs to chat directly with one another. Unlike traditional chat systems tied to wallet addresses, Push NFT Chat allows chats to be specifically associated with individual NFTs owned by users. This is a game changer for chat integrations.

Cover image of June Monthly Recap 🌅

· 3 min read

What a month it’s been at Push! From groundbreaking features to new partnerships, we’ve been on an exciting journey this June making major strides towards our mission of decentralizing communication in web3. We couldn’t be more thrilled to share the highlights with you.

Cover image of How Push Protocol Can Revolutionize Data-Driven Decision Making📊

· 4 min read

In today’s fast-paced business environment, accessing and analyzing data in real-time is critical to making informed decisions. Push Protocol is a powerful tool that can help organizations achieve this goal by providing a way to receive real-time data updates as soon as they become available.

Cover image of Transforming Decentralized Communication With Push &amp; AI🤖

· 6 min read

As the world of web3 continues to evolve, Push Protocol is playing a critical role in revolutionizing decentralized communication. Our web3-native chat and video chat capabilities, agnostic to any platform, have opened the door to seamless communication in the decentralized world. But what happens when we combine the power of Push Protocol with Artificial Intelligence (AI)?
+
Skip to main content

45 posts tagged with "Pushprotocol"

View All Tags

Cover image of $PUSH is Live on Polygon &amp; Quickswap!💜

· 2 min read

Today we are excited to announce the launch of the $PUSH token on Polygon! Following the successful launch of Push Protocol onto Polygon mainnet last year, we are now carrying over that multi-chain functionality and composability to our $PUSH token.

Cover image of Exploring the Role of ZK Knowledge in Decentralized Communication🌐

· 4 min read

The world of decentralized systems is undergoing a significant evolution, triggered by the imperative quest for privacy and scalability solutions. The technology under our microscope today is zero-knowledge technology, the inherent strengths of which, developers are tirelessly examining for possible integration into Push Protocol.

Cover image of A Technical Deep Dive + 5 Simple Steps to Get Started With Push NFT Chat

· 7 min read

Push NFT Chat is a seamless and secure communication platform that enables NFTs to chat directly with one another. Unlike traditional chat systems tied to wallet addresses, Push NFT Chat allows chats to be specifically associated with individual NFTs owned by users. This is a game changer for chat integrations.

Cover image of June Monthly Recap 🌅

· 3 min read

What a month it’s been at Push! From groundbreaking features to new partnerships, we’ve been on an exciting journey this June making major strides towards our mission of decentralizing communication in web3. We couldn’t be more thrilled to share the highlights with you.

Cover image of How Push Protocol Can Revolutionize Data-Driven Decision Making📊

· 4 min read

In today’s fast-paced business environment, accessing and analyzing data in real-time is critical to making informed decisions. Push Protocol is a powerful tool that can help organizations achieve this goal by providing a way to receive real-time data updates as soon as they become available.

Cover image of Transforming Decentralized Communication With Push &amp; AI🤖

· 6 min read

As the world of web3 continues to evolve, Push Protocol is playing a critical role in revolutionizing decentralized communication. Our web3-native chat and video chat capabilities, agnostic to any platform, have opened the door to seamless communication in the decentralized world. But what happens when we combine the power of Push Protocol with Artificial Intelligence (AI)?
\ No newline at end of file diff --git a/blog/tags/pushprotocol/page/4/index.html b/blog/tags/pushprotocol/page/4/index.html index b17719f7b07..a3f890cb7c7 100644 --- a/blog/tags/pushprotocol/page/4/index.html +++ b/blog/tags/pushprotocol/page/4/index.html @@ -14,8 +14,8 @@ - - + +
Skip to main content

45 posts tagged with "Pushprotocol"

View All Tags

Cover image of Introducing Push Improvement Proposal (PIP)

· 4 min read

Push (previously known as EPNS) has grown to become the leading communication layer for all Web3 actors including protocols, dapps, smart contracts, wallets, backend, and users. But, to service such a large ecosystem, there needs to be a streamlined process for improving and developing the ecosystem to meet every actor’s needs. Introducing — Push Improvement Proposals (PIP).

Cover image of Push Monthly Blocks

· 3 min read

Hello Push fam 🎎. Get comfortable and relax. We have so much to talk about this month! After our rebrand to Push Protocol many things followed up and it’s time we go over them.

Cover image of Push Monthly Blocks

· 2 min read

Hi Push frens!✨ This one is a very special Monthly Blocks edition as it is the first Push Protocol edition. Let’s take time to recap briefly all the happenings this month!
+
Skip to main content

45 posts tagged with "Pushprotocol"

View All Tags

Cover image of Introducing Push Improvement Proposal (PIP)

· 4 min read

Push (previously known as EPNS) has grown to become the leading communication layer for all Web3 actors including protocols, dapps, smart contracts, wallets, backend, and users. But, to service such a large ecosystem, there needs to be a streamlined process for improving and developing the ecosystem to meet every actor’s needs. Introducing — Push Improvement Proposals (PIP).

Cover image of Push Monthly Blocks

· 3 min read

Hello Push fam 🎎. Get comfortable and relax. We have so much to talk about this month! After our rebrand to Push Protocol many things followed up and it’s time we go over them.

Cover image of Push Monthly Blocks

· 2 min read

Hi Push frens!✨ This one is a very special Monthly Blocks edition as it is the first Push Protocol edition. Let’s take time to recap briefly all the happenings this month!
\ No newline at end of file diff --git a/blog/tags/reputation-system/index.html b/blog/tags/reputation-system/index.html index c0cebd52fde..2486ea8ddce 100644 --- a/blog/tags/reputation-system/index.html +++ b/blog/tags/reputation-system/index.html @@ -14,8 +14,8 @@ - - + +
Skip to main content

3 posts tagged with "Web3 Tools"

View All Tags

Cover image of June Monthly Recap 🌅

· 3 min read

What a month it’s been at Push! From groundbreaking features to new partnerships, we’ve been on an exciting journey this June making major strides towards our mission of decentralizing communication in web3. We couldn’t be more thrilled to share the highlights with you.

Cover image of How Push Protocol Can Revolutionize Data-Driven Decision Making📊

· 4 min read

In today’s fast-paced business environment, accessing and analyzing data in real-time is critical to making informed decisions. Push Protocol is a powerful tool that can help organizations achieve this goal by providing a way to receive real-time data updates as soon as they become available.
+
Skip to main content

3 posts tagged with "Web3 Tools"

View All Tags

Cover image of June Monthly Recap 🌅

· 3 min read

What a month it’s been at Push! From groundbreaking features to new partnerships, we’ve been on an exciting journey this June making major strides towards our mission of decentralizing communication in web3. We couldn’t be more thrilled to share the highlights with you.

Cover image of How Push Protocol Can Revolutionize Data-Driven Decision Making📊

· 4 min read

In today’s fast-paced business environment, accessing and analyzing data in real-time is critical to making informed decisions. Push Protocol is a powerful tool that can help organizations achieve this goal by providing a way to receive real-time data updates as soon as they become available.
\ No newline at end of file diff --git a/blog/tags/web-3/index.html b/blog/tags/web-3/index.html index dac53790678..cebda2ac49c 100644 --- a/blog/tags/web-3/index.html +++ b/blog/tags/web-3/index.html @@ -14,8 +14,8 @@ - - + +
Skip to main content

115 posts tagged with "Web3"

View All Tags

Cover image of EPNS Allies With Commonwealth to Bring Governance Notifications to Users

· 2 min read

Commonwealth, the all-in-one platform that lets projects simplify their community management and governance, joins forces with EPNS to enable direct communication with platform users. As such, users of Commonwealth are poised to receive decentralized push notifications pertaining to the governance process. These notifications increase user participation and keep users updated about every step in the governance lifecycle.

Cover image of Reef Chain Integrates EPNS to Enable Seamless Communication With Users

· 2 min read

Reef Chain is a fast, scalable, efficient, and affordable Layer-1 network that aims to integrate all the best aspects of popular blockchains into one platform to offer a world-class experience to users and developers. It is designed to power the next generation of DeFi, NFT, GameFi, and metaverse projects.

Cover image of ‘My Dapp’ Would Like to Send You Push Notifications

· 3 min read

In Part 1.1, we introduced modern push technology, which consists of these primary components: an app publisher who publishes information by notifications, a client who is the receiver of notifications based on a subscription, and the push notification provider who acts as middleware between these two actors.

Cover image of ‘My App’ Would Like to Send You Push Notifications

· 4 min read

It is hard to imagine modern mobile devices without push notifications. The first push service was launched by Apple in June 2009, the Apple Push Notification Service (APNs). After that, Google followed with a service of their own, Google Cloud to Device Messaging (C2DM). Both companies have led efforts to enhance the push notification technology to where it is today.

Cover image of Fast-tracking Proposals, Approved!

· 2 min read

We are excited to announce that governance proposal PIP-08 — Fast-tracking of PIPs that get Immediate traction into Snapshot — was approved via governance voting by a vast majority of 1.2M PUSH in favor.

Cover Image of Vamos Latam Fam 🧉

· 3 min read

We had a blast with our invitees during Friday PUSH #21 in preparation for ETH Latam 🇦🇷 💃. Mariano, Juan David, and CryptoChica joined us to discuss about everything ETH Latam, and the challenges and opportunities for the Latam region.
+
Skip to main content

115 posts tagged with "Web3"

View All Tags

Cover image of EPNS Allies With Commonwealth to Bring Governance Notifications to Users

· 2 min read

Commonwealth, the all-in-one platform that lets projects simplify their community management and governance, joins forces with EPNS to enable direct communication with platform users. As such, users of Commonwealth are poised to receive decentralized push notifications pertaining to the governance process. These notifications increase user participation and keep users updated about every step in the governance lifecycle.

Cover image of Reef Chain Integrates EPNS to Enable Seamless Communication With Users

· 2 min read

Reef Chain is a fast, scalable, efficient, and affordable Layer-1 network that aims to integrate all the best aspects of popular blockchains into one platform to offer a world-class experience to users and developers. It is designed to power the next generation of DeFi, NFT, GameFi, and metaverse projects.

Cover image of ‘My Dapp’ Would Like to Send You Push Notifications

· 3 min read

In Part 1.1, we introduced modern push technology, which consists of these primary components: an app publisher who publishes information by notifications, a client who is the receiver of notifications based on a subscription, and the push notification provider who acts as middleware between these two actors.

Cover image of ‘My App’ Would Like to Send You Push Notifications

· 4 min read

It is hard to imagine modern mobile devices without push notifications. The first push service was launched by Apple in June 2009, the Apple Push Notification Service (APNs). After that, Google followed with a service of their own, Google Cloud to Device Messaging (C2DM). Both companies have led efforts to enhance the push notification technology to where it is today.

Cover image of Fast-tracking Proposals, Approved!

· 2 min read

We are excited to announce that governance proposal PIP-08 — Fast-tracking of PIPs that get Immediate traction into Snapshot — was approved via governance voting by a vast majority of 1.2M PUSH in favor.

Cover Image of Vamos Latam Fam 🧉

· 3 min read

We had a blast with our invitees during Friday PUSH #21 in preparation for ETH Latam 🇦🇷 💃. Mariano, Juan David, and CryptoChica joined us to discuss about everything ETH Latam, and the challenges and opportunities for the Latam region.
\ No newline at end of file diff --git a/blog/tags/web-3/page/12/index.html b/blog/tags/web-3/page/12/index.html index 3d62192cf64..25391e1b387 100644 --- a/blog/tags/web-3/page/12/index.html +++ b/blog/tags/web-3/page/12/index.html @@ -14,8 +14,8 @@ - - + +
Skip to main content

115 posts tagged with "Web3"

View All Tags

Cover image of Exploring the Role of ZK Knowledge in Decentralized Communication🌐

· 4 min read

The world of decentralized systems is undergoing a significant evolution, triggered by the imperative quest for privacy and scalability solutions. The technology under our microscope today is zero-knowledge technology, the inherent strengths of which, developers are tirelessly examining for possible integration into Push Protocol.

Cover image of June Monthly Recap 🌅

· 3 min read

What a month it’s been at Push! From groundbreaking features to new partnerships, we’ve been on an exciting journey this June making major strides towards our mission of decentralizing communication in web3. We couldn’t be more thrilled to share the highlights with you.

Cover image of How Push Protocol Can Revolutionize Data-Driven Decision Making📊

· 4 min read

In today’s fast-paced business environment, accessing and analyzing data in real-time is critical to making informed decisions. Push Protocol is a powerful tool that can help organizations achieve this goal by providing a way to receive real-time data updates as soon as they become available.

Cover image of Transforming Decentralized Communication With Push &amp; AI🤖

· 6 min read

As the world of web3 continues to evolve, Push Protocol is playing a critical role in revolutionizing decentralized communication. Our web3-native chat and video chat capabilities, agnostic to any platform, have opened the door to seamless communication in the decentralized world. But what happens when we combine the power of Push Protocol with Artificial Intelligence (AI)?

Cover image of $100,000 of Push x ImmuneFi Bug Bounty Program goes Live 🪲

· 2 min read

Are you a skilled security researchers looking for an exciting challenge and the opportunity to earn big? Look no further! We are thrilled to announce the launch of the Push’s collaborative Bug Bounty Program with Immunefi and calling all hackers to participate!
+
Skip to main content

115 posts tagged with "Web3"

View All Tags

Cover image of Exploring the Role of ZK Knowledge in Decentralized Communication🌐

· 4 min read

The world of decentralized systems is undergoing a significant evolution, triggered by the imperative quest for privacy and scalability solutions. The technology under our microscope today is zero-knowledge technology, the inherent strengths of which, developers are tirelessly examining for possible integration into Push Protocol.

Cover image of June Monthly Recap 🌅

· 3 min read

What a month it’s been at Push! From groundbreaking features to new partnerships, we’ve been on an exciting journey this June making major strides towards our mission of decentralizing communication in web3. We couldn’t be more thrilled to share the highlights with you.

Cover image of How Push Protocol Can Revolutionize Data-Driven Decision Making📊

· 4 min read

In today’s fast-paced business environment, accessing and analyzing data in real-time is critical to making informed decisions. Push Protocol is a powerful tool that can help organizations achieve this goal by providing a way to receive real-time data updates as soon as they become available.

Cover image of Transforming Decentralized Communication With Push &amp; AI🤖

· 6 min read

As the world of web3 continues to evolve, Push Protocol is playing a critical role in revolutionizing decentralized communication. Our web3-native chat and video chat capabilities, agnostic to any platform, have opened the door to seamless communication in the decentralized world. But what happens when we combine the power of Push Protocol with Artificial Intelligence (AI)?

Cover image of $100,000 of Push x ImmuneFi Bug Bounty Program goes Live 🪲

· 2 min read

Are you a skilled security researchers looking for an exciting challenge and the opportunity to earn big? Look no further! We are thrilled to announce the launch of the Push’s collaborative Bug Bounty Program with Immunefi and calling all hackers to participate!
\ No newline at end of file diff --git a/blog/tags/web-3/page/4/index.html b/blog/tags/web-3/page/4/index.html index f8d0871de9a..98fb7e5a455 100644 --- a/blog/tags/web-3/page/4/index.html +++ b/blog/tags/web-3/page/4/index.html @@ -14,8 +14,8 @@ - - + +
Skip to main content

115 posts tagged with "Web3"

View All Tags

Cover image of Enhancing Blockchain Based Games UX Through In-Game Chat + Notifications🎮

· 4 min read

Blockchain gaming has emerged as a rapidly growing niche within the gaming industry, driven by the unique benefits it offers players, including true ownership of in-game assets, interoperability between games, and provable scarcity of digital items. Despite these advantages, the sector faces challenges in scalability and user interaction. Push Protocol, a real-time communication solution with low latency and scalability, offers a promising solution to these issues.

Cover image of May Monthly Recap ☀️

· 3 min read

Welcome to another exciting month at Push! May flew by in the blink of an eye, and we have a whirlwind of exciting updates and achievements to share with you. From groundbreaking developments to valuable partnerships and community activities, the past month has been nothing short of extraordinary.

Cover image of Push DAO Progressive Decentralization — The Next Phase of Push Governance🌐

· 4 min read

Over the past year, our team has worked hard to create a strong foundation to build & scale the Push DAO. Today, we are launching the next phase of Push governance via the Push Progressive Decentralization Roadmap, opening opportunities for our community to get more involved with Push Protocol in our journey to become a community-owned project.

Cover image of Enhancing Web3 Livestreaming | Push x Graviton🧲

· 3 min read

Graviton provides pathways and tools for creators to grow without limitations imposed by centralized platforms. With a commitment to empowering artists and creators, Graviton provides web3 tools and infrastructure for creators to leverage to better reach their audience, promote their work, and monetize their creative projects.

Cover image of How to Build a Game Collectibles dApp with Push and Alchemy🎮

· 6 min read

This blog post delves into the world of blockchain-based gaming collectibles and how using Alchemy and Push Protocol can revolutionize the development process. Alchemy provides a powerful infrastructure of nodes and enhanced APIs for managing blockchain interactions, while Push Protocol enables real-time communication within the gaming ecosystem.
+
Skip to main content

115 posts tagged with "Web3"

View All Tags

Cover image of Enhancing Blockchain Based Games UX Through In-Game Chat + Notifications🎮

· 4 min read

Blockchain gaming has emerged as a rapidly growing niche within the gaming industry, driven by the unique benefits it offers players, including true ownership of in-game assets, interoperability between games, and provable scarcity of digital items. Despite these advantages, the sector faces challenges in scalability and user interaction. Push Protocol, a real-time communication solution with low latency and scalability, offers a promising solution to these issues.

Cover image of May Monthly Recap ☀️

· 3 min read

Welcome to another exciting month at Push! May flew by in the blink of an eye, and we have a whirlwind of exciting updates and achievements to share with you. From groundbreaking developments to valuable partnerships and community activities, the past month has been nothing short of extraordinary.

Cover image of Push DAO Progressive Decentralization — The Next Phase of Push Governance🌐

· 4 min read

Over the past year, our team has worked hard to create a strong foundation to build & scale the Push DAO. Today, we are launching the next phase of Push governance via the Push Progressive Decentralization Roadmap, opening opportunities for our community to get more involved with Push Protocol in our journey to become a community-owned project.

Cover image of Enhancing Web3 Livestreaming | Push x Graviton🧲

· 3 min read

Graviton provides pathways and tools for creators to grow without limitations imposed by centralized platforms. With a commitment to empowering artists and creators, Graviton provides web3 tools and infrastructure for creators to leverage to better reach their audience, promote their work, and monetize their creative projects.

Cover image of How to Build a Game Collectibles dApp with Push and Alchemy🎮

· 6 min read

This blog post delves into the world of blockchain-based gaming collectibles and how using Alchemy and Push Protocol can revolutionize the development process. Alchemy provides a powerful infrastructure of nodes and enhanced APIs for managing blockchain interactions, while Push Protocol enables real-time communication within the gaming ecosystem.
\ No newline at end of file diff --git a/blog/tags/web-3/page/5/index.html b/blog/tags/web-3/page/5/index.html index 9aabd46ad09..b56ab34ed83 100644 --- a/blog/tags/web-3/page/5/index.html +++ b/blog/tags/web-3/page/5/index.html @@ -14,8 +14,8 @@ - - + +
Skip to main content

115 posts tagged with "Web3"

View All Tags

Cover image of Unlocking the Full Potential of Push: A Look at $PUSH Token Utility🪙

· 6 min read

Token economics (or tokenomics) are a critical component of any blockchain or cryptocurrency project. It dictates how incentives are created, distributed, and managed within the network. Push Protocol is a decentralized communication layer for Web3 that uses a native token, $PUSH, to incentivize its network participants.

Cover image of Demystifying PGP Encryption in Push🛡️

· 4 min read

PGP Encryption, or Pretty Good Privacy as its also known, is a critical element of what makes Push messages so secure. It’s a security program that enables users to communicate securely by decrypting and encrypting messages — but how does it work?

Cover image of April Monthly Recap✨

· 4 min read

Welcome to another exciting month at Push Protocol! While there’s a lot to get through, there is one announcement that stands out and we think is worthwhile giving extra attention.

Cover image of Understanding Delivery Nodes🚂

· 5 min read

To fully grasp the concept of push notifications and messages, it is essential to first understand the role of delivery nodes in a communication protocol. Delivery nodes are endpoints where messages are sent and received. They can be physical devices, applications, or servers and are tasked with relaying messages from one point to another.

Cover image of Push Launches Wallet-to-Wallet Video Chat📹

· 2 min read

Today, Push Protocol is excited to announce the launch of Push Video! Push Video is the first wallet-to-wallet video chat that allows web3 users to video chat with each other live. Get started at app.push.org

Cover image of Push Protocolについて知っておくべきこと🔔

· 7 min read

Push Protocol(前身はEPNS)は、Web3通信プロトコルであり、任意のdAppsやスマートコントラクト、バックエンド、またはプロトコルが、ユーザーウォレットアドレスを介してオンチェーンとオフチェーンの両方において、オープンで、Gasless、マルチチェーン、及びプラットフォームに依存しない方法で通信できるようにします。
+
Skip to main content

115 posts tagged with "Web3"

View All Tags

Cover image of Unlocking the Full Potential of Push: A Look at $PUSH Token Utility🪙

· 6 min read

Token economics (or tokenomics) are a critical component of any blockchain or cryptocurrency project. It dictates how incentives are created, distributed, and managed within the network. Push Protocol is a decentralized communication layer for Web3 that uses a native token, $PUSH, to incentivize its network participants.

Cover image of Demystifying PGP Encryption in Push🛡️

· 4 min read

PGP Encryption, or Pretty Good Privacy as its also known, is a critical element of what makes Push messages so secure. It’s a security program that enables users to communicate securely by decrypting and encrypting messages — but how does it work?

Cover image of April Monthly Recap✨

· 4 min read

Welcome to another exciting month at Push Protocol! While there’s a lot to get through, there is one announcement that stands out and we think is worthwhile giving extra attention.

Cover image of Understanding Delivery Nodes🚂

· 5 min read

To fully grasp the concept of push notifications and messages, it is essential to first understand the role of delivery nodes in a communication protocol. Delivery nodes are endpoints where messages are sent and received. They can be physical devices, applications, or servers and are tasked with relaying messages from one point to another.

Cover image of Push Protocolについて知っておくべきこと🔔

· 7 min read

Push Protocol(前身はEPNS)は、Web3通信プロトコルであり、任意のdAppsやスマートコントラクト、バックエンド、またはプロトコルが、ユーザーウォレットアドレスを介してオンチェーンとオフチェーンの両方において、オープンで、Gasless、マルチチェーン、及びプラットフォームに依存しない方法で通信できるようにします。

Cover image of Push Launches Wallet-to-Wallet Video Chat📹

· 2 min read

Today, Push Protocol is excited to announce the launch of Push Video! Push Video is the first wallet-to-wallet video chat that allows web3 users to video chat with each other live. Get started at app.push.org
\ No newline at end of file diff --git a/blog/tags/web-3/page/6/index.html b/blog/tags/web-3/page/6/index.html index 5dab0544d74..c16a51fff02 100644 --- a/blog/tags/web-3/page/6/index.html +++ b/blog/tags/web-3/page/6/index.html @@ -14,8 +14,8 @@ - - + +
Skip to main content

115 posts tagged with "Web3"

View All Tags

Cover image of March Monthly Recap🌄

· 4 min read

Welcome to another exciting month at Push! As we reflect on the past few weeks, we are thrilled to share some of the major milestones we’ve achieved in the world of decentralized communication. From the introduction of exciting new Push Chat and Notification features to the highly anticipated launch of Push Chat Mobile, we’ve been working hard to enhance the Push Protocol.

Cover image of Launch of The Push Ambassadors Program 💜 (English + Español)

· 3 min read

After a wonderful 2022 during which the Push team had the opportunity to participate in so many events and got to know hackers and frens from all around the world, we’d like to share some exciting news in our process to grow the Push DAO and work closer with the community.

Cover image of Recreating Web2 Communication Channels in Web3 Using Push👥

· 4 min read

The ability to communicate effectively with users is a crucial aspect of any decentralized application or service. This is where communication channels come in. Serving as a bridge between dapps and users, enabling notifications, chat messages and other forms of communication across various blockchain networks.
+
Skip to main content

115 posts tagged with "Web3"

View All Tags

Cover image of March Monthly Recap🌄

· 4 min read

Welcome to another exciting month at Push! As we reflect on the past few weeks, we are thrilled to share some of the major milestones we’ve achieved in the world of decentralized communication. From the introduction of exciting new Push Chat and Notification features to the highly anticipated launch of Push Chat Mobile, we’ve been working hard to enhance the Push Protocol.

Cover image of Launch of The Push Ambassadors Program 💜 (English + Español)

· 3 min read

After a wonderful 2022 during which the Push team had the opportunity to participate in so many events and got to know hackers and frens from all around the world, we’d like to share some exciting news in our process to grow the Push DAO and work closer with the community.

Cover image of Recreating Web2 Communication Channels in Web3 Using Push👥

· 4 min read

The ability to communicate effectively with users is a crucial aspect of any decentralized application or service. This is where communication channels come in. Serving as a bridge between dapps and users, enabling notifications, chat messages and other forms of communication across various blockchain networks.
\ No newline at end of file diff --git a/blog/tags/web-3/page/7/index.html b/blog/tags/web-3/page/7/index.html index 30f76c6da0d..96237bbdf99 100644 --- a/blog/tags/web-3/page/7/index.html +++ b/blog/tags/web-3/page/7/index.html @@ -14,8 +14,8 @@ - - + +
Skip to main content

115 posts tagged with "Web3"

View All Tags

Cover image of Push 2022 Year in Review🎉

· 4 min read

2022 was a marvelous year for Push thanks to our fantastic team and growing community of talented developers. To everyone who has helped support the Push project — devs, community members, partners, co-sponsors, we thank you!

Cover image of November Monthly Recap

· 3 min read

What a month for the Push project and community! From making many new frens to launching our very own Improvement Proposals, much has happened and we cannot wait to share everything with you. 🤩

Cover image of Introducing Push Improvement Proposal (PIP)

· 4 min read

Push (previously known as EPNS) has grown to become the leading communication layer for all Web3 actors including protocols, dapps, smart contracts, wallets, backend, and users. But, to service such a large ecosystem, there needs to be a streamlined process for improving and developing the ecosystem to meet every actor’s needs. Introducing — Push Improvement Proposals (PIP).
+
Skip to main content

115 posts tagged with "Web3"

View All Tags

Cover image of Push 2022 Year in Review🎉

· 4 min read

2022 was a marvelous year for Push thanks to our fantastic team and growing community of talented developers. To everyone who has helped support the Push project — devs, community members, partners, co-sponsors, we thank you!

Cover image of November Monthly Recap

· 3 min read

What a month for the Push project and community! From making many new frens to launching our very own Improvement Proposals, much has happened and we cannot wait to share everything with you. 🤩

Cover image of Introducing Push Improvement Proposal (PIP)

· 4 min read

Push (previously known as EPNS) has grown to become the leading communication layer for all Web3 actors including protocols, dapps, smart contracts, wallets, backend, and users. But, to service such a large ecosystem, there needs to be a streamlined process for improving and developing the ecosystem to meet every actor’s needs. Introducing — Push Improvement Proposals (PIP).
\ No newline at end of file diff --git a/blog/tags/web-chat/index.html b/blog/tags/web-chat/index.html index d12c8279e9b..1f8e5eddc76 100644 --- a/blog/tags/web-chat/index.html +++ b/blog/tags/web-chat/index.html @@ -14,8 +14,8 @@ - - + +
Skip to main content

One post tagged with "Year in Review"

View All Tags

Cover Image of Our 2021 Year in Review 🎉🎉🎉

· 22 min read

2021 was an epic year for EPNS. And not just us, for the entire crypto space. It was the year when the world finally opened up to crypto, blockchain, DeFi, and all their use cases. Along with the fundamental changes also arrived the age of L2 scaling and NFTs, pushing blockchain and crypto further into the mainstream.
+ + \ No newline at end of file diff --git a/blog/tags/yield-farming/index.html b/blog/tags/yield-farming/index.html index ee67e0305e3..e0bbb3e94d5 100644 --- a/blog/tags/yield-farming/index.html +++ b/blog/tags/yield-farming/index.html @@ -14,8 +14,8 @@ - - + +
Skip to main content
Watch Workshops, Build and Win $50k. Join BRB Online
Get ready for an epic tech showdown across 18 cities in India, where amazing minds come together to solve one big problem, with a chance to win over $50,000 USD in prizes!
#BRBIndia
18CITIES
1BIG PROBLEM
$50k+AVAILABLE IN PRIZES

Partners

Community Partners
Schedule
Join Virtually, Build and Win $50k+

BRB Online

Filecoin, Partner of Push, #BRBIndia, pan-India dev tourLearn how to develop DataDAOs to Incentivize data contributions and storage
Fri, Nov 3, 20237:30PM @ Push Protocol YouTube
Chain safe, Partner of Push, #BRBIndia, pan-India dev tourDevelop plugins for web3.js 4.x, enhancing Ethereum sectors like NFTs, DeFi, Gaming, etc
Sat, Nov 4, 20237:30PM @ Push Protocol YouTube
The Graph, Partner of Push, #BRBIndia, pan-India dev tourLearn to organize and serve blockchain data for your application using subgraphs
Thu, Nov 9, 20237:30PM @ Push Protocol YouTube
Shardeum, Partner of Push, #BRBIndia, pan-India dev tourLearn to build an Automated Market Maker (AMM) optimized for parallel processing
Thu, Nov 16, 20237:30PM @ Push Protocol YouTube
Biconomy, Partner of Push, #BRBIndia, pan-India dev tourLearn to build a new validation module to use with the Biconomy smart accounts
Fri, Nov 17, 20237:30PM @ Push Protocol YouTube
Aragon, Partner of Push, #BRBIndia, pan-India dev tourLearn to build DAO solutions
Fri, Nov 24, 20237:30PM @ Push Protocol YouTube
Polygon, Partner of Push, #BRBIndia, pan-India dev tourLearn to Implement OpenZeppelin to vote on zkEVM from Ethereum or Polygon PoS
Sat, Nov 25, 20237:30PM @ Push Protocol YouTube

Partners Bounties

Ethereum Foundation, Partner of Push, #BRBIndia, pan-India dev tourUse Account Abstraction to make Ethereum quantum proof
$5,000
View Bounty
Polygon, Partner of Push, #BRBIndia, pan-India dev tourImplement OpenZeppelin Governor to vote on zkEVM from Ethereum or Polygon PoS
$5,000
View Bounty
The Graph, Partner of Push, #BRBIndia, pan-India dev tourBuild the most creative subgraphs or utilize existing subgraphs for your application
$5,000
View Bounty
Shardeum, Partner of Push, #BRBIndia, pan-India dev tourBuild an Automated Market Maker (AMM) optimized for parallel processing
$5,000
View Bounty
Aragon, Partner of Push, #BRBIndia, pan-India dev tourBuild on Aragon OSx: Address community issues via on-chain governance by creating plugins or dApps
$5,000
View Bounty
Biconomy, Partner of Push, #BRBIndia, pan-India dev tourBuild a new validation module to use with the Biconomy smart accounts
$5,000
View Bounty
Filecoin, Partner of Push, #BRBIndia, pan-India dev tourDevelop DataDAOs on Filecoin: Incentivize data contributions and storage
$5,000
View Bounty
Timeswap, Partner of Push, #BRBIndia, pan-India dev tourDesign and implement Account Abstraction (AA) features for Timeswap Protocol
$5,000
View Bounty
Chain safe, Partner of Push, #BRBIndia, pan-India dev tourDevelop plugins for web3.js 4.x, enhancing Ethereum sectors like NFTs, DeFi, Gaming, etc
$5,000
View Bounty
Alchemy, Partner of Push, #BRBIndia, pan-India dev tourImplement creative user experience flows facilitated by Alchemy’s Account Abstraction SDK
$5,000
View Bounty
Push ProtocolBuild Push V3 by enhancing the fees pool logic of V2 to accept any tokens
$7,500
View Bounty

Join the conversationImage showing BRB Chat is powered by Push Chat

This is a token gated group. You can join but will need 1 $PUSH in your wallet to be able to send messages.
Drop us a GM!
24x7 Support on DiscordImage showing BRB Chat is powered by Push Chat
Updates & AnnouncementsImage showing BRB Chat is powered by Push Chat
© 2023 Push. All rights reserved.
\ No newline at end of file diff --git a/cheatsheet/index.html b/cheatsheet/index.html index cc67e321b1e..71942f0d6eb 100644 --- a/cheatsheet/index.html +++ b/cheatsheet/index.html @@ -14,8 +14,8 @@ - - + +
Skip to main content

Get started

Push Chat enables web3 native messaging between wallets, groups, NFTs or even conditional (gated) groups. To do so, you will be using Push SDK API that will abstract away the complexity of authentication, encryption, signing, sending and receiving of messages.

diff --git a/docs/chat/build/group-permissions/index.html b/docs/chat/build/group-permissions/index.html index 63db2e59f2d..a2c950cb2cb 100644 --- a/docs/chat/build/group-permissions/index.html +++ b/docs/chat/build/group-permissions/index.html @@ -14,8 +14,8 @@ - - + +

ChatProfile

Empower User Interaction: Showcase Wallet Addresses, Group Names, and Member Management with ChatProfile in Your Dapp.

The ChatProfile feature empowers you to autonomously construct the header of a chat view component with minimal effort, requiring just the inclusion of a chatId. It extends beyond the fundamental profile view, offering additional capabilities such as a group management modal, enhancing your chat experience.

diff --git a/docs/chat/ui-components/Advanced/chatuiprovider/index.html b/docs/chat/ui-components/Advanced/chatuiprovider/index.html index 127acd1061f..6066b849c47 100644 --- a/docs/chat/ui-components/Advanced/chatuiprovider/index.html +++ b/docs/chat/ui-components/Advanced/chatuiprovider/index.html @@ -15,8 +15,8 @@ - - + +

ChatView

Effortless Messaging Integration: Add a Complete Chat Interface to Your Dapp with ChatView Component.

If you want to easily add a chat feature to your application without dealing with complex API calls, this is the solution for you. With the Chat View component, you get everything you need for a chat interface, including the chat profile, input box, and message list, all in one simple package. Say goodbye to the hassle of integrating individual components or making API calls. Just input your chat ID and customize it as needed – it's that easy!

diff --git a/docs/chat/ui-components/Advanced/chatviewbubble-component/index.html b/docs/chat/ui-components/Advanced/chatviewbubble-component/index.html index dd45d2b7396..d4af8ac33fa 100644 --- a/docs/chat/ui-components/Advanced/chatviewbubble-component/index.html +++ b/docs/chat/ui-components/Advanced/chatviewbubble-component/index.html @@ -15,8 +15,8 @@ - - + +

ChatViewBubble

Simplify Development: Instantly Integrate Pre-built Chat Bubble UI for Your Dapp

ChatViewBubble serves as the fundamental building block for a chat view, allowing users to showcase individual chat messages while formatting them based on the provided payload. This essential component facilitates the presentation and customization of single chat messages with ease.

diff --git a/docs/chat/ui-components/Advanced/chatviewlist-component/index.html b/docs/chat/ui-components/Advanced/chatviewlist-component/index.html index ce4935971b5..c6661cc3e3b 100644 --- a/docs/chat/ui-components/Advanced/chatviewlist-component/index.html +++ b/docs/chat/ui-components/Advanced/chatviewlist-component/index.html @@ -15,8 +15,8 @@ - - + +

ChatViewList

Streamlined Chat List Integration: Easily Add a Message List to Your Dapp with Built-in Pagination

This component streamlines the process of displaying a paginated list of messages within your user interface. All you need to do is provide a chat ID, and the component handles the rest, presenting you with a comprehensive view of all messages. Additionally, it conveniently includes chat meta information at the top of the component for a complete chat experience.

diff --git a/docs/chat/ui-components/Advanced/creategroupmodal-component/index.html b/docs/chat/ui-components/Advanced/creategroupmodal-component/index.html index 46574f4ed29..40ec3f7e03f 100644 --- a/docs/chat/ui-components/Advanced/creategroupmodal-component/index.html +++ b/docs/chat/ui-components/Advanced/creategroupmodal-component/index.html @@ -15,8 +15,8 @@ - - + +

CreateGroupModal

Effortless Modal Integration: Add a modal to create group effortlessly with CreateGroupModal.

Creating groups becomes a straightforward task with this modal component, completely eliminating the need to concern yourself with its functionality. By simply passing an onClose method for the modal, you can effortlessly integrate it into your application. This versatility allows you to create both gated and non-gated groups without any hassle.

diff --git a/docs/chat/ui-components/Advanced/messageinput-component/index.html b/docs/chat/ui-components/Advanced/messageinput-component/index.html index 178c88c53df..f0d387fd9f3 100644 --- a/docs/chat/ui-components/Advanced/messageinput-component/index.html +++ b/docs/chat/ui-components/Advanced/messageinput-component/index.html @@ -15,8 +15,8 @@ - - + +

MessageInput

Versatile Message Input Integration: Enable Text, Image, File, and Gif Sharing in Your Dapp with MessageInput.

Leveraging this component grants you access to a comprehensive input field equipped with all the necessary features for sending messages. It offers a wide range of customization options, including the inclusion of emojis, GIFs, and file-sharing capabilities. Furthermore, it provides users with the flexibility to set a connection button if the ChatUIProvider lacks wallet connection details. Additionally, the component seamlessly manages the verification failure process for gated groups, allowing for effortless customization of its parameters to suit your specific needs.

diff --git a/docs/chat/ui-components/Advanced/themization/index.html b/docs/chat/ui-components/Advanced/themization/index.html index 2d149197466..bd6e728c914 100644 --- a/docs/chat/ui-components/Advanced/themization/index.html +++ b/docs/chat/ui-components/Advanced/themization/index.html @@ -15,8 +15,8 @@ - - + +

Integrate Push Chat

Streamline Chat Integration for Developers: Say goodbye to the hassles of UI design and API calls. With our web components available in the @pushprotocol/uiweb package, you can effortlessly integrate push chat functionality into your dapp using just a few lines of code.

As an example, take a look at how we seamlessly integrated the Push Chat View component into the push.org/brb website in the image below.

diff --git a/docs/chat/ui-components/integrate-support-bot/index.html b/docs/chat/ui-components/integrate-support-bot/index.html index 73bcb3ec5ce..8c7d0855156 100644 --- a/docs/chat/ui-components/integrate-support-bot/index.html +++ b/docs/chat/ui-components/integrate-support-bot/index.html @@ -14,8 +14,8 @@ - - + +

Integrate Support Bot

Wallets are your protocol's users as they interact with your protocol. Support bot component enables any wallet to start chatting with you about any issues they are facing with your protocol without the hassle of providing extra information or doxxing their identities.

With our support chat component available in @pushprotocol/uiweb package, wallet address are first-class citizens and your protocol user only needs to connect their wallet to start solving their queries.

diff --git a/docs/dao/contribute-to-push-dao/contribute-contribute-further/index.html b/docs/dao/contribute-to-push-dao/contribute-contribute-further/index.html index 0b6895828e7..d4532de49d1 100644 --- a/docs/dao/contribute-to-push-dao/contribute-contribute-further/index.html +++ b/docs/dao/contribute-to-push-dao/contribute-contribute-further/index.html @@ -14,8 +14,8 @@ - - + +

Integrating notifications overview

This section explores how to integrate notifications on your dApp, mobile app, crypto wallet or on any other frontend.

Push is an interoperable network which already have live integrations from Push Metamask snap, Unstoppable web / mobile app, Push dapp / mobile app / extension among other dapps, extensions and mobile apps. This means notifs are already received by wallets that are on those platforms as they have integrated Push protocol.

diff --git a/docs/notifications/build/manage-channel/index.html b/docs/notifications/build/manage-channel/index.html index f7460e1be66..96ed1aac2ea 100644 --- a/docs/notifications/build/manage-channel/index.html +++ b/docs/notifications/build/manage-channel/index.html @@ -14,8 +14,8 @@ - - + +

Styling notification content overview

Designing rich notification for Push closely follows the markdown standards. Below is a live example of what is possible with push notifications currently via Push Protocol.

diff --git a/docs/notifications/build/testing-notifications/index.html b/docs/notifications/build/testing-notifications/index.html index cc8ee1335a1..9e48db69de1 100644 --- a/docs/notifications/build/testing-notifications/index.html +++ b/docs/notifications/build/testing-notifications/index.html @@ -14,8 +14,8 @@ - - + +

Testing notifications overview

This section explores various ways by which you can test your notifications.

Push is an interoperable network which already have live integrations from Push Metamask snap, Unstoppable web / mobile app, Push dapp / mobile app / extension among other dapps, extensions and mobile apps. This means notifs are already received by wallets that are on those platforms as they have integrated Push protocol.

diff --git a/docs/notifications/build/types-of-notification/index.html b/docs/notifications/build/types-of-notification/index.html index ba30d74bf2b..638f7270634 100644 --- a/docs/notifications/build/types-of-notification/index.html +++ b/docs/notifications/build/types-of-notification/index.html @@ -14,8 +14,8 @@ - - + +

What is a Notification in Push protocol?

Notifications follow composable blocks that helps achieve modular structure and helps in building on top of them. Any developer can utilize the notification protocol to send out notifications (on-chain or off-chain) to their users from a variety of platforms including web3 protocols, smart contracts, dapps, backend, etc.

These notifications are tied to wallet address of the user and are indexed by push nodes allowing any crypto frontend such as wallet, dapp or mobile app to query and display these notifications for the wallet users along with sending them out as push notifications.

diff --git a/docs/notifications/notification-standards/notification-standards-basic/index.html b/docs/notifications/notification-standards/notification-standards-basic/index.html index b23fa9d7eab..03c5e3f76af 100644 --- a/docs/notifications/notification-standards/notification-standards-basic/index.html +++ b/docs/notifications/notification-standards/notification-standards-basic/index.html @@ -14,8 +14,8 @@ - - + +
Push Metamask Snap is now live,Get started!
Frens of Push Protocol - Aave ProtocolFrens of Push Protocol - Lens ProtocolFrens of Push Protocol - SafeFrens of Push Protocol - Unstoppable DomainsFrens of Push Protocol - SnapshotFrens of Push Protocol - QiDAOFrens of Push Protocol - Bancor ProtocolFrens of Push Protocol - CoindeskFrens of Push Protocol - LiFi ProtocolFrens of Push Protocol - AragonFrens of Push Protocol - Mean FinanceFrens of Push Protocol - Uniswap

Frens of Push

Explore hundreds of applications building with Push
worldwide across DeFi, NFTs, Gaming, Dev tools, and more.

Powered by Push

All692
DeFi
DAO
NFT
Metaverse
Tooling
Infrastructure
Social
Service
Gaming
Media
Hackathons

Never Miss an Update

Sign up and stay up to date with ecosystem announcements, giveaways and more.
+data-styled.g286[id="sc-keyframes-eoUyJr"]{content:"eoUyJr,"}/*!sc*/ +
Push Metamask Snap is now live,Get started!
Frens of Push Protocol - Aave ProtocolFrens of Push Protocol - Lens ProtocolFrens of Push Protocol - SafeFrens of Push Protocol - Unstoppable DomainsFrens of Push Protocol - SnapshotFrens of Push Protocol - QiDAOFrens of Push Protocol - Bancor ProtocolFrens of Push Protocol - CoindeskFrens of Push Protocol - LiFi ProtocolFrens of Push Protocol - AragonFrens of Push Protocol - Mean FinanceFrens of Push Protocol - Uniswap

Frens of Push

Explore hundreds of applications building with Push
worldwide across DeFi, NFTs, Gaming, Dev tools, and more.

Powered by Push

All693
DeFi
DAO
NFT
Metaverse
Tooling
Infrastructure
Social
Service
Gaming
Media
Wallet
Hackathons

Never Miss an Update

Sign up and stay up to date with ecosystem announcements, giveaways and more.
\ No newline at end of file diff --git a/home/index.html b/home/index.html index a1cf826e3c4..4304f1f9691 100644 --- a/home/index.html +++ b/home/index.html @@ -14,8 +14,8 @@ - - + +
Push Metamask Snap is now live,Get started!

The Communication Protocol of Web3

Push Protocol is a web3 communication network, enabling cross-chain notifications and messaging for dapps, wallets, and services.
...Notifications
Sent
...Total
Subscribers
450+Total Push
Integrations
>$1MIn Grants
Given
Powered by Push Protocol - Bankless LogoPowered by Push Protocol - Decentraland Logo
Powered by Push Protocol - Shapeshift LogoPowered by Push Protocol - Uniswap LogoPowered by Push Protocol - Oasis Logo
Powered by Push Protocol - Snapshot LogoPowered by Push Protocol - ENS Logo
Powered by Push Protocol - Bancor LogoPowered by Push Protocol - Aragon Logo
Powered by Push Protocol - MakerDAO LogoPowered by Push Protocol - EarniFi Logo
Powered by Push Protocol - Cryptocurrency Jobs LogoPowered by Push Protocol - AAVE LogoPowered by Push Protocol - Rekt Logo
Powered by Push Protocol - Bankless LogoPowered by Push Protocol - Decentraland LogoPowered by Push Protocol - Uniswap LogoPowered by Push Protocol - AAVE LogoPowered by Push Protocol - Rekt LogoPowered by Push Protocol - Sushiswap LogoPowered by Push Protocol - Unstoppable Domains LogoPowered by Push Protocol - Proof of Humanity Logo
Powered by Push Protocol - Unstoppable Domains Logo
Powered by Push Protocol - MahaDAO Logo
Powered by Push Protocol - Proof of Humanity Logo
Powered by Push Protocol - Sushiswap Logo

Powered by Push

Discover an amazing community of developers integrating Push to build a powerful communication stack.Explore Integrations
Powered by Push Protocol - Polychain Monsters Logo
Powered by Push Protocol - Pool Together Logo
Powered by Push Protocol - ETHSign Logo
Powered by Push Protocol - Lens Protocol Logo
Powered by Push Protocol - Lens Protocol LogoPowered by Push Protocol - 1Inch LogoPowered by Push Protocol - Coindesk LogoPowered by Push Protocol - ENS LogoPowered by Push Protocol - Bancor LogoPowered by Push Protocol - Aragon LogoPowered by Push Protocol - QiDAO LogoPowered by Push Protocol - DyDx Logo
Powered by Push Protocol - Meta Stable LogoPowered by Push Protocol - 1Inch LogoPowered by Push Protocol - Second Live Logo
Powered by Push Protocol - Atlendis LogoPowered by Push Protocol - Apeswap Logo
Powered by Push Protocol - QiDAO LogoPowered by Push Protocol - DyDx Logo
Powered by Push Protocol - Lepasa Metaverse LogoPowered by Push Protocol - Orion Protocol Logo
Powered by Push Protocol - Symphony Finance Labs LogoPowered by Push Protocol - Coindesk LogoPowered by Push Protocol - Kyber Network Logo
Powered by Push Protocol - LiFi Protocol LogoPowered by Push Protocol - Developer DAO Logo
Push powers communication for over 100 of the world’s leading dapps and service providers across DeFi, NFTs, gaming, dev tools, and more. Push is currently live on Ethereum, Polygon and BNB Chain.
Ethereum Logo
Polygon Logo
BNB Chain Logo
Illustration showing Push as the missing piece of web3

Push is the missing piece of Web3

Until Push, no solution existed to enable native communication between wallets in response to on- and off-chain data. The result was a fractured dapp ecosystem, held together by antiquated and centralized communication platforms.Push is building the communication network for Web3, addressing a gap in critical infrastructure and improving the everyday experience for blockchain users.How Push works
Push Notifications directly connect applications to individual users, enabling secure and personalized communication in response to customized on- and off-chain activity.Build Push Notifications
Illustration showing Push Notifications
Push Chat is the leading decentralized, web3 native chat application with user friendly features like 1-1, group chat, videos/images, and (soon) streaming.Build with Push Chat
Illustration showing Push Chat
Push DAO is the home of community ownership of the Push Protocol. Push token holders can view, propose, and vote on critical developments to the protocol.Explore Push DAO
Illustration showing Push DAO

Why do you need Push?

Chain Agnostic
Chain Agnostic
Immediate Communication
Immediate Communication
Decentralized Stack
Decentralized Stack
Improved UX
Improved UX
Security Alerts
Security Alerts
Censorship Resistant
Censorship Resistant
Before Push, blockchain applications, service providers, and wallets had no way to natively communicate with each other. Most communication in today’s ecosystem relies on traditional web2 solutions, resulting in a broken ecosystem and problems in daily use.

Push Insights & Updates

Backed by successful entrepreneurs and venture capital funds.

Featured in

\ No newline at end of file diff --git a/index.html b/index.html index 50667b0a63e..8c4cc85bc88 100644 --- a/index.html +++ b/index.html @@ -14,8 +14,8 @@ - - + +
Push Metamask Snap is now live,Get started!

The Communication Protocol of Web3

Push Protocol is a web3 communication network, enabling cross-chain notifications and messaging for dapps, wallets, and services.
...Notifications
Sent
...Total
Subscribers
450+Total Push
Integrations
>$1MIn Grants
Given
Powered by Push Protocol - Bankless LogoPowered by Push Protocol - Decentraland Logo
Powered by Push Protocol - Shapeshift LogoPowered by Push Protocol - Uniswap LogoPowered by Push Protocol - Oasis Logo
Powered by Push Protocol - Snapshot LogoPowered by Push Protocol - ENS Logo
Powered by Push Protocol - Bancor LogoPowered by Push Protocol - Aragon Logo
Powered by Push Protocol - MakerDAO LogoPowered by Push Protocol - EarniFi Logo
Powered by Push Protocol - Cryptocurrency Jobs LogoPowered by Push Protocol - AAVE LogoPowered by Push Protocol - Rekt Logo
Powered by Push Protocol - Bankless LogoPowered by Push Protocol - Decentraland LogoPowered by Push Protocol - Uniswap LogoPowered by Push Protocol - AAVE LogoPowered by Push Protocol - Rekt LogoPowered by Push Protocol - Sushiswap LogoPowered by Push Protocol - Unstoppable Domains LogoPowered by Push Protocol - Proof of Humanity Logo
Powered by Push Protocol - Unstoppable Domains Logo
Powered by Push Protocol - MahaDAO Logo
Powered by Push Protocol - Proof of Humanity Logo
Powered by Push Protocol - Sushiswap Logo

Powered by Push

Discover an amazing community of developers integrating Push to build a powerful communication stack.Explore Integrations
Powered by Push Protocol - Polychain Monsters Logo
Powered by Push Protocol - Pool Together Logo
Powered by Push Protocol - ETHSign Logo
Powered by Push Protocol - Lens Protocol Logo
Powered by Push Protocol - Lens Protocol LogoPowered by Push Protocol - 1Inch LogoPowered by Push Protocol - Coindesk LogoPowered by Push Protocol - ENS LogoPowered by Push Protocol - Bancor LogoPowered by Push Protocol - Aragon LogoPowered by Push Protocol - QiDAO LogoPowered by Push Protocol - DyDx Logo
Powered by Push Protocol - Meta Stable LogoPowered by Push Protocol - 1Inch LogoPowered by Push Protocol - Second Live Logo
Powered by Push Protocol - Atlendis LogoPowered by Push Protocol - Apeswap Logo
Powered by Push Protocol - QiDAO LogoPowered by Push Protocol - DyDx Logo
Powered by Push Protocol - Lepasa Metaverse LogoPowered by Push Protocol - Orion Protocol Logo
Powered by Push Protocol - Symphony Finance Labs LogoPowered by Push Protocol - Coindesk LogoPowered by Push Protocol - Kyber Network Logo
Powered by Push Protocol - LiFi Protocol LogoPowered by Push Protocol - Developer DAO Logo
Push powers communication for over 100 of the world’s leading dapps and service providers across DeFi, NFTs, gaming, dev tools, and more. Push is currently live on Ethereum, Polygon and BNB Chain.
Ethereum Logo
Polygon Logo
BNB Chain Logo
Illustration showing Push as the missing piece of web3

Push is the missing piece of Web3

Until Push, no solution existed to enable native communication between wallets in response to on- and off-chain data. The result was a fractured dapp ecosystem, held together by antiquated and centralized communication platforms.Push is building the communication network for Web3, addressing a gap in critical infrastructure and improving the everyday experience for blockchain users.How Push works
Push Notifications directly connect applications to individual users, enabling secure and personalized communication in response to customized on- and off-chain activity.Build Push Notifications
Illustration showing Push Notifications
Push Chat is the leading decentralized, web3 native chat application with user friendly features like 1-1, group chat, videos/images, and (soon) streaming.Build with Push Chat
Illustration showing Push Chat
Push DAO is the home of community ownership of the Push Protocol. Push token holders can view, propose, and vote on critical developments to the protocol.Explore Push DAO
Illustration showing Push DAO

Why do you need Push?

Chain Agnostic
Chain Agnostic
Immediate Communication
Immediate Communication
Decentralized Stack
Decentralized Stack
Improved UX
Improved UX
Security Alerts
Security Alerts
Censorship Resistant
Censorship Resistant
Before Push, blockchain applications, service providers, and wallets had no way to natively communicate with each other. Most communication in today’s ecosystem relies on traditional web2 solutions, resulting in a broken ecosystem and problems in daily use.

Push Insights & Updates

Backed by successful entrepreneurs and venture capital funds.

Featured in

\ No newline at end of file diff --git a/privacy/index.html b/privacy/index.html index 92cd8f146cb..2e5610c3db1 100644 --- a/privacy/index.html +++ b/privacy/index.html @@ -14,8 +14,8 @@ - - + +
Push Metamask Snap is now live,Get started!

PRIVACY POLICY

Defines how Push collects, handles and processes data.

Last Updated: 2nd November 2020

SUMMARY

We recognise our responsibilities in relation to the collection, holding, processing, use and/or transfer of personal data. Your privacy is of utmost importance to us.

This policy (the Policy) outlines how we collect, use, store and disclose your personal data. Please take a moment to read about how we collect, use and/or disclose your personal data so that you know and understand the purposes for which we may collect, use and/or disclose your personal data. By accessing the website at push.org, app.push.org or staging.push.org or any other subdomains of push.org (the Website(s)), you agree and consent to Ethereum Push Notification Service Foundation (the Company), its related corporations, business units and affiliates, as well as their respective representatives and/or agents (collectively referred to herein as “Push”, “us”, “we” or “our”), collecting, using, disclosing and sharing amongst themselves the personal data, and to disclosing such personal data to relevant third party providers. This Policy supplements but does not supersede nor replace any other consent which you may have previously provided to us nor does it affect any rights that we may have at law in connection with the collection, use and/or disclosure of your personal data. We may from time to time update this Policy to ensure that this Policy is consistent with our future developments, industry trends and/or any changes in legal or regulatory requirements. Subject to your rights at law, the prevailing terms of this Policy shall apply. For the avoidance of doubt, this Policy forms part of the Terms of Service governing your relationship with us and should be read in conjunction with such Terms of Service. All capitalised terms used but not defined herein shall have the meaning ascribed to them in the Terms of Service.

The security of your personal data is important to us. At each stage of data collection, use and disclosure, Push has in place physical, electronic, administrative and procedural safeguards to protect the personal data stored with us. However, do note that no transmission of personal data over the internet can be guaranteed to be 100% secure – accordingly and despite our efforts, Push cannot guarantee or warrant the security of any information you transmit to us, or to or from our online services. Push shall not have any responsibility or liability for the security of information transmitted via the internet.

This Policy describes how Push may collect, use, disclose, process and manage your personal data, and applies to any individual’s personal data which is in our possession or under our control.

1.1 What personal data is collected by Push

"Personal data” means data, whether true or not, about an individual who can be identified (i) from that data, or (ii) from that data and other information to which the organisation has or is likely to have access. Some examples of personal data that Push may collect are:

(a) personal particulars (e.g. name, contact details, residential address, date of birth, identity card/passport details, social media handles and other social media profile information, and/or education details);

(b) financial details (e.g. income, expenses, credit history and/or credit card and bank information);

(c) images and voice recordings of our conversations with you, whether from our events or office surveillances or otherwise;

(d) work experience and employment details (e.g. occupation, directorships and other positions held, employment history, salary, and/or benefits);

(e) tax and insurance information;

(f) information about your risk profile, investments, investment objectives, knowledge and experience and/or business interests and assets;

(g) information about your use of our services and Website;

(h) usernames and password, third party account credentials (such as your Facebook login credentials, Google login credentials) and IP address;

(i) banking information (e.g. account numbers and banking transactions);

(j) private or public cryptographic key relating to addresses on distributed ledger networks and/or similar information; and/or

(k) personal opinions made known to us (e.g. feedback or responses to surveys).

Personal data may be collected when you interact with our services or use the Website, or may be received by Push from third-party databases or service providers that provide business information.

1.2 Purposes for collection, use and disclosure of your personal data

Push may collect, use and/or disclose your personal data for its business purposes, including operations for these purposes. These may include, without limitation, the following:

(a) developing and providing facilities, products or services (whether made available by us or through us), including but not limited to:

(i) sale of digital tokens or virtual currencies;

(ii) acting as intermediaries through any blockchain, network or platform developed or managed by us;

(iii) recording and/or encryption on any blockchain, network or platform developed or managed by us;

(iv) promoting advertisements or marketing material, whether from us or third parties;

(v) various products and/or services (whether digital or not, and whether provided through an external service provider or otherwise), including without limitation the Services as set out in the Terms of Service;

(vi) providing, managing or accessing digital wallets for holding digital assets;

(vii) access to smart contracts on and/or interacting with the Push Protocol, the Website or the App;

(viii) sending and receiving notifications and Content from various channels on the Push Protocol;

(ix) making payments to you for participation in any blockchain, network or platform developed or managed by us (as applicable);

(x) various products and/or services related to digital assets;

(xi) any escrow, courier, anti-counterfeiting or dispute resolution services;

(xii) transactions and clearing or reporting on these transactions;

(xiii) carrying out research, planning and statistical analysis; and/or

(xiv) analytics for the purposes of developing or improving our products, services, security, service quality, staff training, and advertising strategies;

(b) assessing and processing applications, instructions, transactions, or requests from you or our customers;

(c) communicating with you, including providing you with updates on changes to products, services and banking facilities (whether made available by us or through us) including any additions, expansions, suspensions and replacements of or to such products, services and banking facilities and their terms and conditions;

(d) managing our infrastructure and business operations and complying with internal policies and procedures;

(e) responding to queries or feedback;

(f) addressing or investigating any complaints, claims or disputes;

(g) verifying your identity for the purposes of providing facilities, products or services, which would require comparison of your personal information against third party databases and/or provision of such information to third party service providers;

(h) conducting credit checks, screenings or due diligence checks as may be required under applicable law, regulation or directive;

(i) complying with all applicable laws, regulations, rules, directives, orders, instructions and requests from any local or foreign authorities, including regulatory, governmental, tax and law enforcement authorities or other authorities;

(j) enforcing obligations owed to us;

(k) monitoring products and services provided by or made available through us;

(l) complying with obligations and requirements imposed by us from time to time by any credit bureau or credit information sharing services of which we are a member or subscriber;

(m) creating and maintaining credit and risk related models;

(n) financial reporting, regulatory reporting, management reporting, risk management (including monitoring credit exposures, preventing, detecting and investigating crime, including fraud and any form of financial crime), audit and record keeping purposes;

(o) enabling any actual or proposed assignee or transferee, participant or sub-participant of Push's rights or obligations to evaluate any proposed transaction;

(p) enforcing obligations owed to us; and/or

(q) seeking professional advice, including legal or tax advice.

We may also use personal data for purposes set out in the Terms of Service that govern our relationship with you or our customer.

1.3 Use of personal data for marketing purposes

We may use your personal data to offer you products or services, including special offers, promotions, contests or entitlements that may be of interest to you or for which you may be eligible. Such marketing messages may be sent to you in various modes including but not limited to electronic mail, direct mailers, short message service, telephone calls, facsimile and other mobile messaging services. In doing so, we will comply with all applicable data protection and privacy laws.

In respect of sending telemarketing messages to your telephone number via short message service, telephone calls, facsimile and other mobile messaging services, please be assured that we shall only do so if we have your clear and unambiguous consent in writing or other recorded form to do so or if you have not otherwise made the appropriate registration of that number with the Do Not Call Registry. If we have an ongoing relationship with you and you have not indicated to us that you do not wish to receive telemarketing messages sent to your telephone number, we may send you telemarketing messages to that number related to the subject of our ongoing relationship via short message service, facsimile and other mobile messaging services (other than a voice or video call).

You may at any time request that we stop contacting you for marketing purposes via selected or all modes.

To find out more on how you can change the way we use your personal data for marketing purposes, please contact us at support@push.org.

Nothing in this section shall vary or supersede the Terms of Service that govern our relationship with you.

1.4 Disclosure and sharing of personal data

We may from time to time and in compliance with all applicable laws on data privacy, disclose your personal data to any personnel of Push or to third parties (including without limitation banks, financial institutions, credit card companies, credit bureaus and their respective service providers, companies providing services relating to insurance and/or reinsurance to us, and associations of insurance companies, agents, contractors or third party service providers who provide services to us such as telecommunications, information technology, payment, data processing, storage and archival, and our professional advisers such as our auditors and lawyers, and regulators and authorities), whether located in Singapore or elsewhere, in order to carry out the purposes set out above. Please be assured that when we disclose your personal data to such parties, we require them to ensure that any personal data disclosed to them are kept confidential and secure.

For more information about the third parties with whom we share your personal data, you may, where appropriate, wish to refer to the agreement(s) and/or Terms of Service that govern our relationship with you or our customer. You may also contact us for more information (please see section 1.9 below).

We wish to emphasise that Push does not sell personal data to any third parties and we shall remain fully compliant of any duty or obligation of confidentiality imposed on us under the applicable agreement(s) and/or Terms of Service that govern our relationship with you or our customer or any applicable law.

You are responsible for ensuring that the personal data you provide to us is accurate, complete, and not misleading and that such personal data is kept up to date. You acknowledge that failure on your part to do so may result in our inability to provide you with the products and services you have requested. To update your personal data, please contact us (please see section 1.9 below for contact details). Where you provide us with personal data concerning individuals other than yourself, you are responsible for obtaining all legally required consents from the concerned individuals and you shall retain proof of such consent(s), such proof to be provided to us upon our request.

We may transfer, store, process and/or deal with your personal data outside Singapore. In doing so, we will comply with all applicable data protection and privacy laws.

1.5 Cookies and related technologies

The Website uses cookies. A cookie is a small text file placed on your computer or mobile device when you visit a Website or use an app. Cookies collect information about users and their visit to the Website or use of the app, such as their Internet protocol (IP) address, how they arrived at the Website (for example, through a search engine or a link from another Website), how they navigate within the Website or app, browser information, computer or device type, operating system, internet service provider, website usage, referring/exit pages, platform type, date/time stamp, number of clicks, and ads viewed. We use cookies and other technologies to facilitate your internet sessions and use of our apps, offer you products and/or services according to your preferred settings, track use of our websites and apps and to compile statistics about activities carried out on our websites.

You may set up your web browser to block cookies from monitoring your website visit. You may also remove cookies stored from your computer or mobile device. However, if you do block cookies you may not be able to use certain features and functions of our web sites.

1.6 Other web sites

Our websites may contain links to other websites which are not maintained by Push. This Policy only applies to the websites of Push. When visiting these third party websites, you should read their privacy policies which will apply to your use of such websites.

1.7 Retention of personal data

Your personal data is retained as long as the purpose for which it was collected remains and until it is no longer necessary for any legal or business purposes.

1.8 Queries, Access/Correction Requests and Withdrawal of Consent

If you:

(a) have queries about our data protection processes and practices;

(b) wish to request access to and/or make corrections to your personal data in our possession or under our control; or

(c) wish to withdraw your consent to our collection, use or disclosure of your personal data,

please submit a written request (with supporting documents, (if any) to our Compliance Officer at: support@push.org. Our Compliance Officer shall endeavour to respond to you within 30 days of your submission. Please note that if you withdraw your consent to any or all use or disclosure of your personal data, depending on the nature of your request, we may not be in a position to continue to provide our services or products to you or administer any contractual relationship in place. Such withdrawal may also result in the termination of any agreement you may have with us. Our legal rights and remedies are expressly reserved in such event.

We may charge you a fee for processing your request for access. Such a fee depends on the nature and complexity of your access request. Information on the processing fee will be made available to you.

1.9 Contact information

To contact us on any aspect of this Policy or your personal data or to provide any feedback that you may have, please contact our Compliance Officer at support@push.org.

1.10 Governing Law and Jurisdiction

This Policy and your use of the Website shall be governed and construed in accordance with the laws of Singapore. You agree to submit to the exclusive jurisdiction of the Singapore courts.

1.11 Amendments and updates to Push Privacy Policy

We reserve the right to amend this Policy from time to time to ensure that this Policy is consistent with any developments to the way Push uses your personal data or any changes to the laws and regulations applicable to Push. We will make available the updated Policy on the Website. You are encouraged to visit the Website from time to time to ensure that you are well informed of our latest policies in relation to personal data protection. All communications, transactions and dealings with us shall be subject to the latest version of this Policy in force at the time.

1.12 For European Union or European Economic Area Residents

This section applies if you are an individual located in the European Union or European Economic Area. Subject to applicable law, you have the following additional rights in relation to your personal data:

(a) the right to access your personal data (if you ask us, we will confirm whether we are processing your personal data in a structured, commonly used and machine-readable format and, if so, provide you with a copy of that personal data (along with certain other details). If you require additional copies, we may need to charge a reasonable fee;

(b) the right to ensure the accuracy of your personal data;

(c) the right to have us delete your personal data (we will do so in some circumstances, such as where we no longer need it, but do note that we may not delete your data when other interests outweigh your right to deletion);

(d) the right to restrict further processing of your personal data (unless we demonstrate compelling legitimate grounds for the processing);

(e) rights in relation to automated decision-making and profiling (you have the right to be free from decisions based solely on automated processing of your personal data, including profiling, that affect you, unless such processing is necessary for entering into, or the performance of, a contract between you and us or you provide your explicit consent to such processing);

(f) the right to withdraw consent (if we rely on your consent to process your personal data, you have the right to withdraw that consent at any time, but provided always that this shall not affect the lawfulness of processing based on your prior consent); and

(g) the right to complain to a supervisory authority in your country of residence in the event that data is misused.

If you believe that our processing of your personal information infringes data protection laws, you have a legal right to lodge a complaint with a supervisory authority responsible for data protection. You may do so in the EU member state of your residence, your place of work or the place of the alleged infringement. You may exercise any of your rights in relation to your personal data by contacting our Compliance Officer at: support@push.org.

1.13 Contact information

This Policy applies in conjunction with any other notices, contractual clauses and consent clauses that apply in relation to the collection, use and disclosure of your personal data by us. We may revise this Policy from time to time without any prior notice. You may determine if any such revision has taken place by referring to the date on which this Policy was last updated.

By using the Website and/or any services provided by Push, you signify your acceptance of this Policy and terms of service. If you do not agree to this Policy or terms of service, please do not use the Website or any services provided by Push. Your continued use of the Website following the posting of changes to this Policy will be deemed your acceptance of those changes.

\ No newline at end of file diff --git a/privacymobile/index.html b/privacymobile/index.html index 1c8cddb898f..245260e8a1a 100644 --- a/privacymobile/index.html +++ b/privacymobile/index.html @@ -14,8 +14,8 @@ - - + +
Push Metamask Snap is now live,Get started!

PRIVACY POLICY MOBILE APPS

Last Updated: 2nd November 2020

LAST UPDATED: 24TH SEPTEMBER 2022

SUMMARY

We recognise our responsibilities in relation to the collection, holding, processing, use and/or transfer of personal data. Your privacy is of utmost importance to us.

This policy (the Policy) outlines how we collect, use, store and disclose your personal data. Please take a moment to read about how we collect, use and/or disclose your personal data so that you know and understand the purposes for which we may collect, use and/or disclose your personal data. By accessing the website at push.org, app.push.org or staging.push.org or any other subdomains of push.org (the Website(s)), you agree and consent to Ethereum Push Notification Service Foundation (the Company), its related corporations, business units and affiliates, as well as their respective representatives and/or agents (collectively referred to herein as “Push”, “us”, “we” or “our”), collecting, using, disclosing and sharing amongst themselves the personal data, and to disclosing such personal data to relevant third party providers. This Policy supplements but does not supersede nor replace any other consent which you may have previously provided to us nor does it affect any rights that we may have at law in connection with the collection, use and/or disclosure of your personal data. We may from time to time update this Policy to ensure that this Policy is consistent with our future developments, industry trends and/or any changes in legal or regulatory requirements. Subject to your rights at law, the prevailing terms of this Policy shall apply. For the avoidance of doubt, this Policy forms part of the Terms of Service governing your relationship with us and should be read in conjunction with such Terms of Service. All capitalised terms used but not defined herein shall have the meaning ascribed to them in the Terms of Service.

The security of your personal data is important to us. At each stage of data collection, use and disclosure, Push has in place physical, electronic, administrative and procedural safeguards to protect the personal data stored with us. However, do note that no transmission of personal data over the internet can be guaranteed to be 100% secure – accordingly and despite our efforts, Push cannot guarantee or warrant the security of any information you transmit to us, or to or from our online services. Push shall not have any responsibility or liability for the security of information transmitted via the internet.

This policy (the Policy) outlines how we collect, use, store and disclose your personal data. Please take a moment to read about how we collect, use and/or disclose your personal data so that you know and understand the purposes for which we may collect, use and/or disclose your personal data. By accessing the "Push” application available on Google Play or Apple App Store (the App), you agree and consent to Ethereum Push Notification Service Foundation (the Company), its related corporations, business units and affiliates, as well as their respective representatives and/or agents (collectively referred to herein as Push, us, we or our), collecting, using, disclosing and sharing amongst themselves the personal data, and to disclosing such personal data to relevant third party providers. This Policy supplements but does not supersede nor replace any other consent which you may have previously provided to us nor does it affect any rights that we may have at law in connection with the collection, use and/or disclosure of your personal data. We may from time to time update this Policy to ensure that this Policy is consistent with our future developments, industry trends and/or any changes in legal or regulatory requirements. Subject to your rights at law, the prevailing terms of this Policy shall apply. For the avoidance of doubt, this Policy forms part of the terms and conditions governing your relationship with us and should be read in conjunction with such terms and conditions.

1 What personal data is collected by Push

"Personal data” means data, whether true or not, about an individual who can be identified (i) from that data, or (ii) from that data and other information to which the organisation has or is likely to have access. Personal data may be collected when you interact with our services or use the App, or may be received by Push from third-party databases or service providers that provide business information. For example, Push may collect personal data such as particulars of digital wallet addresses, transactions performed by said digital wallet addresses, public cryptographic key relating to digital wallet addresses on distributed ledger networks and/or similar information.

2 PERSONAL DATA AND THE BLOCKCHAIN

Blockchain technology, also known as distributed ledger technology (DLT), is at the core of our business. Blockchains are decentralized and made up of digitally recorded data in a chain of packages called "blocks”. The manner in which these blocks are linked is chronological, meaning that the data is very difficult to alter once recorded. Since the ledger may be distributed all over the world (across several "nodes” which usually replicate the ledger) this means there is no single person making decisions or otherwise administering the system (such as an operator of a cloud computing system), and that there is no centralized place where it is located either.

Accordingly, by design, a blockchain’s data cannot be changed or deleted and is said to be "immutable”. This may affect your ability to exercise your rights such as your right to erasure ("right to be forgotten”), or your rights to object or restrict processing of your personal data. Data on the blockchain cannot be erased and cannot be changed. Although smart contracts may be used to revoke certain access rights, and some content may be made invisible to others, it is not deleted.

In certain circumstances, in order to comply with our contractual obligations to you (such as delivery of tokens or provision of other services) it will be necessary to collect certain personal data, such as your wallet address, onto the blockchain; this is done through a smart contract and requires you to execute such transactions using your wallet’s private key.

The ultimate decisions to (a) transact on the blockchain using your wallet address, as well as (b) share the public key relating to your wallet address with anyone (including us) rests with you. IF YOU WANT TO ENSURE YOUR PRIVACY RIGHTS ARE NOT AFFECTED IN ANY WAY, YOU SHOULD NOT TRANSACT ON BLOCKCHAINS AS CERTAIN RIGHTS MAY NOT BE FULLY AVAILABLE OR EXERCISABLE BY YOU OR US DUE TO THE TECHNOLOGICAL INFRASTRUCTURE OF THE BLOCKCHAIN. IN PARTICULAR THE BLOCKCHAIN IS AVAILABLE TO THE PUBLIC AND ANY PERSONAL DATA SHARED ON THE BLOCKCHAIN WILL BECOME PUBLICLY AVAILABLE.

3 PURPOSES FOR COLLECTION, USE AND DISCLOSURE OF YOUR PERSONAL DATA

Push may collect, use and/or disclose your personal data for its legitimate interests or business purposes, including operations for these purposes. These may include, without limitation, the following:

(a) developing and providing facilities, products or services (whether made available by us or through us), including but not limited to:

(i) services for sending of push-notifications, information updates, notices or correspondence;

(ii) acting as intermediaries through any blockchain, network or platform;

(iii) recording and/or encryption on any blockchain, network or platform;

(iv) promoting advertisements or marketing material, whether from us or third parties;

(v) various products and/or services (whether digital or not, and whether provided through an external service provider or otherwise);

(vi) making payments for participation in any blockchain, network or platform developed or managed by us (as applicable);

(vii) carrying out research, planning and statistical analysis;

(viii) trouble-shooting, technical maintenance and bug fixes; and/or

(ix) analytics for the purposes of developing or improving our products, services, security, service quality, staff training, and advertising strategies;

(b) communicating with you, including providing you with updates on changes to services or products (whether made available by us or through us) including any additions, expansions, suspensions and replacements of or to such services or products and their terms and conditions;

(c) managing our infrastructure and business operations and complying with internal policies and procedures;

(d) responding to queries, feedback or complaint;

(e) complying with all applicable laws, regulations, rules, directives, orders, instructions and requests from any local or foreign authorities, including regulatory, governmental, tax and law enforcement authorities or other authorities;

(f) enabling any actual or proposed assignee or transferee, participant or sub-participant of Push's rights or obligations to evaluate any proposed transaction;

(g) enforcing obligations owed to us, protecting our rights or property, and protecting against legal liability; and/or

(h) seeking professional advice, including legal or tax advice.

We may also use personal data for purposes set out in the terms and conditions that govern our relationship with you or our customer.

4 USE OF PERSONAL DATA FOR MARKETING PURPOSES

We may use your personal data to offer you products or services, including special offers, promotions, contests or entitlements that may be of interest to you or for which you may be eligible. Such marketing messages may be sent to you in various modes including but not limited to electronic mail, direct mailers, short message service, telephone calls, facsimile and other mobile messaging services. In doing so, we will comply with all applicable data protection and privacy laws.

In respect of sending telemarketing messages to your telephone number via short message service, telephone calls, facsimile and other mobile messaging services, please be assured that we shall only do so if we have your clear and unambiguous consent in writing or other recorded form to do so or if you have not otherwise made the appropriate registration of that number with the Do Not Call Registry. If we have an ongoing relationship with you and you have not indicated to us that you do not wish to receive telemarketing messages sent to your telephone number, we may send you telemarketing messages to that number related to the subject of our ongoing relationship via short message service, facsimile and other mobile messaging services (other than a voice or video call).

You may at any time request that we stop contacting you for marketing purposes via selected or all modes.

To find out more on how you can change the way we use your personal data for marketing purposes, please contact us.

Nothing in this Policy shall vary or supersede the terms and conditions that govern our relationship with you.

5 DISCLOSURE AND SHARING OF PERSONAL DATA

We may from time to time and in compliance with all applicable laws on data privacy, disclose your personal data to any personnel of Push, group entities, or to third parties (including without limitation banks, financial institutions, credit card companies, credit bureaus and their respective service providers, companies providing services relating to insurance and/or reinsurance to us, and associations of insurance companies, agents, contractors or third party service providers who provide services to us such as telecommunications, information technology, payment, data processing, storage and archival, and our professional advisers such as our auditors and lawyers, and regulators and authorities), located in any jurisdiction, in order to carry out the purposes set out above. Please be assured that when we disclose your personal data to such parties, we will disclose only the personal information that is necessary to deliver the service required, and will also require them to ensure that any personal data disclosed to them are kept confidential and secure.

For more information about the third parties with whom we share your personal data, you may, where appropriate, wish to refer to the agreement(s) and/or terms and conditions that govern our relationship with you or our customer. You may also contact us for more information (please see section 11 below).

We wish to emphasise that Push does not sell personal data to any third parties and we shall remain fully compliant of any duty or obligation of confidentiality imposed on us under the applicable agreement(s) and/or terms and conditions that govern our relationship with you or our customer or any applicable law.

You are responsible for ensuring that the personal data you provide to us is accurate, complete, and not misleading and that such personal data is kept up to date. You acknowledge that failure on your part to do so may result in our inability to provide you with the products and services you have requested. To update your personal data, please contact us (please see section 11 below for contact details). Where you provide us with personal data concerning individuals other than yourself, you are responsible for obtaining all legally required consents from the concerned individuals and you shall retain proof of such consent(s), such proof to be provided to us upon our request.

We may transfer, store, process and/or deal with your personal data in any jurisdiction, and accordingly such personal data may be transferred to computers, servers or hardware located outside of your state, province, country or other governmental jurisdiction where the data protection laws may differ from those in your jurisdiction. Push will take all steps reasonably necessary to ensure that your data is treated securely and in accordance with this Policy and no transfer of your personal data will take place to an organisation or a country unless there are adequate controls in place including the security of your data and other personal information (including without limitation the Standard Contractual Clauses approved by the European Commission). Your consent to this Policy followed by your submission of such information represents your agreement to the transfer of personal data as described herein.

6 COOKIES/TOKENS AND RELATED TECHNOLOGIES

The App uses tokens to store a user's credentials for interacting with the App. A token is a small encrypted file placed on your computer or mobile device which may include an anonymous unique identifier and certain information about your use of the App, such as their Internet protocol (IP) address, browser information, computer or device type, operating system, internet service provider, App usage, date/time stamp, and functions as your credentials for accessing the App. We use tokens, cookies and other technologies to facilitate your internet sessions and use of the App, offer you customised products and/or services according to your preferred settings, display features and services which might be of interest to you (including ads on our services), track usage of the App, to compile statistics about activities carried out on the App, and to hold certain information.

You may set up your web browser to block or remove tokens stored from your computer or mobile device. However, if you do so, you may not be able to use certain features and functions of the App.

Tokens will also be deleted when you uninstall the App from your computer or mobile device.

7 RETENTION OF PERSONAL DATA

Your personal data is retained as long as the purpose for which it was collected remains and until it is no longer necessary for any legal or business purposes. This enables us to comply with legal and regulatory requirements or use it where we need to for our legitimate purposes, such as transfers of digital assets, and dealing with any disputes or concerns that may arise.

We may need to retain information for a longer period where we need the information to comply with regulatory or legal requirements or where we may need it for our legitimate purposes (e.g. to help us respond to queries or complaints, fighting fraud and financial crime, responding to requests from regulators etc).

When we no longer need to use personal data, we will remove it from our systems and records and/or take steps to anonymise it so that you can no longer be identified from it.

8 QUERIES, ACCESS/CORRECTION REQUESTS AND WITHDRAWAL OF CONSENT

If you:

(a) have queries about our data protection processes and practices;

(b) wish to request access to and/or make corrections to your personal data in our possession or under our control; or

(c) wish to withdraw your consent to our collection, use or disclosure of your personal data,

Please submit a written request (with supporting documents, (if any) to our Compliance Officer at: support@epns.io. Our Data Protection Officer shall respond to you within 30 days of your submission. Please note that if you withdraw your consent to any or all use or disclosure of your personal data, depending on the nature of your request, we may not be in a position to continue to provide our services or products to you or administer any contractual relationship in place. Such withdrawal may also result in the termination of any agreement you may have with us. Our legal rights and remedies are expressly reserved in such event.

We may charge you a fee for processing your request for access. Such a fee depends on the nature and complexity of your access request. Information on the processing fee will be made available to you.

9 CONTACT INFORMATION

To contact us on any aspect of this Policy or your personal data or to provide any feedback that you may have, please contact our Data Protection Officer at support@epns.io.

10 GOVERNING LAW AND JURISDICTION

This Policy and your use of the Website shall be governed and construed in accordance with the laws of Singapore. You agree to submit to the exclusive jurisdiction of the Singapore courts.

11 AMENDMENTS AND UPDATES TO PUSH PRIVACY POLICY

We reserve the right to amend this Policy from time to time to ensure that this Policy is consistent with any developments to the way Push uses your personal data or any changes to the laws and regulations applicable to Push. We will make available the updated Policy on the App. You are encouraged to visit the App from time to time to ensure that you are well informed of our latest policies in relation to personal data protection. All communications, transactions and dealings with us shall be subject to the latest version of this Policy in force at the time.

12 FOR EUROPEAN UNION OR EUROPEAN ECONOMIC AREA RESIDENTS

This section 12 applies if you are an individual located in the European Union or European Economic Area. Subject to applicable law, you have the following additional rights in relation to your personal data:

(a) the right to access your personal data (if you ask us, we will confirm whether we are processing your personal data in a structured, commonly used and machine-readable format and, if so, provide you with a copy of that personal data (along with certain other details). If you require additional copies, we may need to charge a reasonable fee;

(b) the right to ensure the accuracy of your personal data;

(c) the right to have us delete your personal data (we will do so in some circumstances, such as where we no longer need it, but do note that we may not delete your data when other interests outweigh your right to deletion);

(d) rights in relation to automated decision-making and profiling (you have the right to be free from decisions based solely on automated processing of your personal data, including profiling, that affect you, unless such processing is necessary for entering into, or the performance of, a contract between you and us or you provide your explicit consent to such processing);

(e) the right to restrict further processing of your personal data (unless we demonstrate compelling legitimate grounds for the processing);

(f) the right to withdraw consent (if we rely on your consent to process your personal data, you have the right to withdraw that consent at any time, but provided always that this shall not affect the lawfulness of processing based on your prior consent); and

(g) the right to complain to a supervisory authority in your country of residence in the event that data is misused.

If you believe that our processing of your personal information infringes data protection laws, you have a legal right to lodge a complaint with a supervisory authority responsible for data protection. You may do so in the EU member state of your residence, your place of work or the place of the alleged infringement. You may exercise any of your rights in relation to your personal data by contacting our Compliance Officer at: support@epns.io.

13 YOUR ACCEPTANCE OF THESE TERMS

This Policy applies in conjunction with any other notices, contractual clauses and consent clauses that apply in relation to the collection, use and disclosure of your personal data by us. We may revise this Policy from time to time without any prior notice. You may determine if any such revision has taken place by referring to the date on which this Policy was last updated.

By using the App and/or any services provided by Push, you signify your acceptance of this Policy and terms of service. If you do not agree to this Policy or terms of service, please do not use the App or any services provided by Push. Your continued use of the App following the posting of changes to this Policy will be deemed your acceptance of those changes.

\ No newline at end of file diff --git a/search/index.html b/search/index.html index cf5676c1902..d0c60628558 100644 --- a/search/index.html +++ b/search/index.html @@ -14,8 +14,8 @@ - - + +
Push Metamask Snap is now live,Get started!
Unlock new dimensions in your
web3 journey.
Join the conversation on Push Spaces
Space Image
\ No newline at end of file diff --git a/tos/index.html b/tos/index.html index 57412ed67d5..f62ce4ca1c3 100644 --- a/tos/index.html +++ b/tos/index.html @@ -14,8 +14,8 @@ - - + +