!function(e){var t={};function n(i){if(t[i])return t[i].exports;var r=t[i]={i:i,l:!1,exports:{}};return e[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(i,r,function(t){return e[t]}.bind(null,r));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/",n(n.s=32)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const{freeze:i,seal:r,keys:o,create:a,assign:s,defineProperty:c,getPrototypeOf:l,setPrototypeOf:u,getOwnPropertyDescriptor:h,getOwnPropertyNames:d,defineProperties:p,hasOwnProperty:f}=Object;t.freeze=i,t.seal=r,t.keys=o,t.create=a,t.assign=s,t.defineProperty=c,t.getPrototypeOf=l,t.setPrototypeOf=u,t.getOwnPropertyDescriptor=h,t.getOwnPropertyNames=d,t.defineProperties=p,t.hasOwnProperty=f;const{isArray:m}=Array;t.isArray=m;const{slice:v,splice:g,unshift:y,indexOf:b,push:_,map:x,join:w,forEach:M,reduce:E}=Array.prototype;t.ArraySlice=v,t.ArraySplice=g,t.ArrayUnshift=y,t.ArrayIndexOf=b,t.ArrayPush=_,t.ArrayMap=x,t.ArrayJoin=w,t.forEach=M,t.ArrayReduce=E;const{replace:T,toLowerCase:S,charCodeAt:A,slice:C}=String.prototype;function P(e){return void 0===e}t.StringReplace=T,t.StringToLowerCase=S,t.StringCharCodeAt=A,t.StringSlice=C,t.isUndefined=P,t.isNull=function(e){return null===e},t.isTrue=function(e){return!0===e},t.isFalse=function(e){return!1===e},t.isFunction=function(e){return"function"==typeof e},t.isObject=function(e){return"object"==typeof e},t.isString=function(e){return"string"==typeof e},t.isNumber=function(e){return"number"==typeof e};const L={}.toString;t.toString=function e(n){return n&&n.toString?m(n)?w.call(x.call(n,e),","):n.toString():"object"==typeof n?L.call(n):n+t.emptyString},t.getPropertyDescriptor=function(e,t){do{const n=h(e,t);if(!P(n))return n;e=l(e)}while(null!==e)},t.emptyString=""},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(0),r=n(5),o=n(18),a=n(19);const s={invariant(e,t){if(!e)throw new Error(`Invariant Violation: ${t}`)},isTrue(e,t){if(!e)throw new Error(`Assert Violation: ${t}`)},isFalse(e,t){if(e)throw new Error(`Assert Violation: ${t}`)},fail(e){throw new Error(e)},logError(e,t){let n=`[LWC error]: ${e}`;t&&(n=`${n}\n${function(e){const t=[];let n="",s=e;do{(l=s)instanceof Element&&-1!==r.tagNameGetter.call(l).indexOf("-")&&(i.ArrayPush.call(t,`${n}<${i.StringToLowerCase.call(r.tagNameGetter.call(s))}>`),n+="\t"),s=!((c=s)instanceof Element)&&"host"in c?a.ShadowRootHostGetter.call(s):o.parentNodeGetter.call(s)}while(!i.isNull(s));var c,l;return i.ArrayJoin.call(t,"\n")}(t)}`);try{throw new Error(n)}catch(e){console.error(e)}}};t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(0),r=n(8);let o=[];function a(){if(0===o.length)throw new Error("Internal Error: If callbackQueue is scheduled, it is because there must be at least one callback on this pending queue.");const e=o;o=[];for(let t=0,n=e.length;t0||i.length>0)&&i!==t){const r=s.hasDynamicChildren(t)?g.updateDynamicChildren:g.updateStaticChildren;k(e,e,()=>{f.startMeasure("patch",e)},()=>{r(n,i,t)},()=>{f.endMeasure("patch",e)})}e.state===b.connected&&function(e){r.default.isTrue(e&&"cmpRoot"in e,`${e} is not a vm.`);const{rendered:t}=h.Services;t&&h.invokeServiceHook(e,t);const{renderedCallback:n}=e.def;c.isUndefined(n)||(f.startMeasure("renderedCallback",e),d.invokeComponentCallback(e,n),f.endMeasure("renderedCallback",e))}(e)}(e,a.renderComponent(e))}}t.rerenderVM=function(e){r.default.isTrue(e&&"cmpRoot"in e,`${e} is not a vm.`),T(e)},t.appendRootVM=function(e){r.default.isTrue(e&&"cmpRoot"in e,`${e} is not a vm.`),C(e),T(e)},t.appendVM=function(e){r.default.isTrue(e&&"cmpRoot"in e,`${e} is not a vm.`),r.default.isTrue(e.state===b.created,`${e} cannot be recycled.`),C(e),T(e)},t.removeVM=function(e){r.default.isTrue(e&&"cmpRoot"in e,`${e} is not a vm.`),r.default.isTrue(e.state===b.connected,`${e} must be inserted.`),E(e)},t.removeRootVM=function(e){r.default.isTrue(e&&"cmpRoot"in e,`${e} is not a vm.`),E(e)},t.createVM=function(e,t,n){r.default.invariant(e instanceof HTMLElement,`VM creation requires a DOM element instead of ${e}.`);const i=o.getComponentDef(t),{isRoot:s,mode:l,owner:h}=n,d={idx:_+=1,state:b.created,isScheduled:!1,isDirty:!0,isRoot:c.isTrue(s),mode:l,def:i,owner:h,elm:e,data:u.EmptyObject,context:c.create(null),cmpTemplate:void 0,cmpProps:c.create(null),cmpTrack:c.create(null),cmpSlots:u.useSyntheticShadow?c.create(null):void 0,callHook:x,setHook:w,getHook:M,component:void 0,children:u.EmptyArray,aChildren:u.EmptyArray,velements:u.EmptyArray,deps:[],toString:()=>`[object:vm ${i.name} (${d.idx})]`};a.createComponent(d,t);const p=d;a.linkComponent(p)};let S=[];function A(){f.startGlobalMeasure(f.GlobalMeasurementPhase.REHYDRATE),r.default.invariant(S.length,`If rehydrateQueue was scheduled, it is because there must be at least one VM on this pending queue instead of ${S}.`);const e=S.sort((e,t)=>e.idx-t.idx);S=[];for(let t=0,n=e.length;t=0;e-=1){const n=t[e].elm;if(!c.isUndefined(n)){E(I(n))}}}function L(e){r.default.isTrue(e&&"cmpRoot"in e,`${e} is not a vm.`),e.children=u.EmptyArray,p.ShadowRootInnerHTMLSetter.call(e.cmpRoot,""),P(e)}function R(e){r.default.isTrue(e&&"cmpRoot"in e,`${e} is not a vm.`);const{elm:t}=e;return function(e){let t,n=e;for(;!c.isNull(n);){if(t=l.getInternalField(n,u.ViewModelReflection),!c.isUndefined(t)&&!c.isUndefined(t.def.errorCallback))return t;n=D(n)}}(t)}function O(e){const t=[];let n=e;do{const e=l.getInternalField(n,u.ViewModelReflection);if(!c.isUndefined(e)){const e=m.tagNameGetter.call(n),i=n.getAttribute("is");c.ArrayPush.call(t,`<${c.StringToLowerCase.call(e)}${i?' is="${is}':""}>`)}n=D(n)}while(!c.isNull(n));return t.reverse().join("\n\t")}function D(e){const t=v.parentElementGetter.call(e);return c.isNull(t)?function(e){r.default.isTrue(c.isNull(v.parentElementGetter.call(e)),`getHostElement should only be called if the parent element of ${e} is null`);const t=v.parentNodeGetter.call(e);return t instanceof y?p.ShadowRootHostGetter.call(t):null}(e):t}function I(e){{const t=l.getInternalField(e,u.ViewModelReflection);r.default.isTrue(t&&"cmpRoot"in t,`${t} is not a vm.`)}return l.getInternalField(e,u.ViewModelReflection)}function k(e,t,n,i,o){let a;r.default.isTrue(e&&"cmpRoot"in e,`${e} is not a vm.`),n();try{i()}catch(e){a=Object(e)}finally{if(o(),!c.isUndefined(a)){a.wcStack=a.wcStack||O(e.elm);const n=c.isNull(t)?void 0:R(t);if(c.isUndefined(n))throw a;L(e),f.startMeasure("errorCallback",n);const i=n.def.errorCallback;d.invokeComponentCallback(n,i,[a,a.wcStack]),f.endMeasure("errorCallback",n)}}}t.resetShadowRoot=L,t.scheduleRehydration=function(e){r.default.isTrue(e&&"cmpRoot"in e,`${e} is not a vm.`),e.isScheduled||(e.isScheduled=!0,0===S.length&&u.addCallbackToNextTick(A),c.ArrayPush.call(S,e))},t.getErrorComponentStack=O,t.isNodeFromTemplate=function(e){return!(c.isFalse(e instanceof Node)||e instanceof y||u.useSyntheticShadow&&c.isUndefined(e.$shadowResolver$)||!(e.getRootNode()instanceof y))},t.getCustomElementVM=I,t.getComponentVM=function(e){{const t=l.getHiddenField(e,u.ViewModelReflection);r.default.isTrue(t&&"cmpRoot"in t,`${t} is not a vm.`)}return l.getHiddenField(e,u.ViewModelReflection)},t.getShadowRootVM=function(e){{const t=l.getInternalField(e,u.ViewModelReflection);r.default.isTrue(t&&"cmpRoot"in t,`${t} is not a vm.`)}return l.getInternalField(e,u.ViewModelReflection)},t.allocateInSlot=function(e,t){r.default.isTrue(e&&"cmpRoot"in e,`${e} is not a vm.`),r.default.invariant(c.isObject(e.cmpSlots),"When doing manual allocation, there must be a cmpSlots object available.");const{cmpSlots:n}=e,i=e.cmpSlots=c.create(null);for(let e=0,n=t.length;e{const t=r.StringToLowerCase.call(r.StringReplace.call(e,/^aria/,"aria-"));a[t]=e,s[e]=t}),r.forEach.call(t.defaultDefHTMLPropertyNames,e=>{const t=r.StringToLowerCase.call(e);a[t]=e,s[e]=t}),r.forEach.call(["accessKey","readOnly","tabIndex","bgColor","colSpan","rowSpan","contentEditable","dateTime","formAction","isMap","maxLength","useMap"],e=>{const t=r.StringToLowerCase.call(e);a[t]=e,s[e]=t});const c=/-([a-z])/g;t.getPropNameFromAttrName=function(e){return r.isUndefined(a[e])&&(a[e]=r.StringReplace.call(e,c,e=>e[1].toUpperCase())),a[e]};const l=/[A-Z]/g;t.getAttrNameFromPropName=function(e){return r.isUndefined(s[e])&&(s[e]=r.StringReplace.call(e,l,e=>"-"+e.toLowerCase())),s[e]};let u,h=null;t.isAttributeLocked=function(e,t){return e!==h||t!==u},t.lockAttribute=function(e,t){h=null,u=void 0},t.unlockAttribute=function(e,t){h=e,u=t}},function(e,t,n){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const r=i(n(1)),o=n(39),a=n(40),s=n(0),c=n(3),l=n(22);t.isRendering=!1,t.vmBeingRendered=null,t.vmBeingConstructed=null,t.isBeingConstructed=function(e){return r.default.isTrue(e&&"cmpProps"in e,`${e} is not a vm.`),t.vmBeingConstructed===e},t.invokeComponentCallback=function(e,t,n){const{component:i,callHook:r,context:a,owner:s}=e,l=o.currentContext;let u;return c.runWithBoundaryProtection(e,s,()=>{o.establishContext(a)},()=>{u=r(i,t,n)},()=>{o.establishContext(l)}),u},t.invokeComponentConstructor=function(e,n){const i=t.vmBeingConstructed;r.default.isTrue(e&&"cmpProps"in e,`${e} is not a vm.`);const{context:a}=e,u=o.currentContext;let h;o.establishContext(a),l.startMeasure("constructor",e),t.vmBeingConstructed=e;try{const r=new n;if(t.vmBeingConstructed.component!==r)throw new TypeError("Invalid component constructor, the class should extend LightningElement.")}catch(e){h=Object(e)}finally{if(o.establishContext(u),l.endMeasure("constructor",e),t.vmBeingConstructed=i,!s.isUndefined(h))throw h.wcStack=c.getErrorComponentStack(e.elm),h}},t.invokeComponentRenderMethod=function(e){const{def:{render:n},callHook:i,component:r,context:s,owner:u}=e,h=o.currentContext,d=t.isRendering,p=t.vmBeingRendered;let f;return t.isRendering=!0,t.vmBeingRendered=e,c.runWithBoundaryProtection(e,u,()=>{o.establishContext(s),l.startMeasure("render",e),t.isRendering=!0,t.vmBeingRendered=e},()=>{const t=i(r,n);f=a.evaluateTemplate(e,t)},()=>{o.establishContext(h),l.endMeasure("render",e),t.isRendering=d,t.vmBeingRendered=p}),f||[]},t.invokeEventListener=function(e,t,n,i){const{callHook:a,owner:l,context:u}=e,h=o.currentContext;c.runWithBoundaryProtection(e,l,()=>{o.establishContext(u)},()=>{r.default.isTrue(s.isFunction(t),`Invalid event handler for event '${i.type}' on ${e}.`),a(n,t,[i])},()=>{o.establishContext(h)})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(0),r="Symbol(x)"===Symbol("x").toString();function o(e,t,n){i.defineProperty(e,t,{value:n})}function a(e,t){return e[t]}t.createFieldName=function(e){return r?Symbol(e):`$$lwc-${e}$$`},t.setInternalField=o,t.getInternalField=a;const s=new WeakMap;t.setHiddenField=r?(e,t,n)=>{let r=s.get(e);i.isUndefined(r)&&(r=i.create(null),s.set(e,r)),r[t]=n}:o,t.getHiddenField=r?(e,t)=>{const n=s.get(e);return!i.isUndefined(n)&&n[t]}:a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(5),r=n(0),o=n(2),{PatchedElement:a,PatchedSlotElement:s,PatchedNode:c}=o.useSyntheticShadow?Element.prototype.$lwcPolyfill$:{},l=new WeakMap;let u,h;t.markAsDynamicChildren=function(e){l.set(e,1)},t.hasDynamicChildren=function(e){return l.has(e)},t.patchTextNodeProto=function(e){r.isUndefined(u)&&(u=c(e).prototype),r.setPrototypeOf(e,u)},t.patchCommentNodeProto=function(e){r.isUndefined(h)&&(h=c(e).prototype),r.setPrototypeOf(e,h)};const d=r.create(null);t.patchElementProto=function(e,t){const{sel:n}=t;let o=d[n];r.isUndefined(o)&&(o=d[n]=function(e){switch(i.tagNameGetter.call(e)){case"SLOT":return s(e)}return a(e)}(e).prototype),r.setPrototypeOf(e,o)},t.patchCustomElementProto=function(e,t){const{def:n}=t;let i=n.patchedBridge;r.isUndefined(i)&&(i=n.patchedBridge=a(e)),r.setPrototypeOf(e,i.prototype)}},function(e,t,n){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const r=i(n(1)),o=n(0),a=n(6),s=n(7),c=n(3),l=n(5);function u(e){return o.assign({configurable:!0,enumerable:!0,writable:!0},e)}function h(e){return o.assign({configurable:!0,enumerable:!0},e)}let d=!1;function p(e,t){return`The \`${e}\` ${t} is available only on elements that use the \`lwc:dom="manual"\` directive.`}function f(e,t){const n=o.getPropertyDescriptor(e,"textContent"),i=o.getPropertyDescriptor(e,"nodeValue"),{appendChild:a,insertBefore:s,removeChild:c,replaceChild:l}=e;return{appendChild:u({value(e){return this instanceof Element&&o.isFalse(t.isPortal)&&r.default.logError(p("appendChild","method"),this),a.call(this,e)}}),insertBefore:u({value(e,n){return!d&&this instanceof Element&&o.isFalse(t.isPortal)&&r.default.logError(p("insertBefore","method"),this),s.call(this,e,n)}}),removeChild:u({value(e){return!d&&this instanceof Element&&o.isFalse(t.isPortal)&&r.default.logError(p("removeChild","method"),this),c.call(this,e)}}),replaceChild:u({value(e,n){return this instanceof Element&&o.isFalse(t.isPortal)&&r.default.logError(p("replaceChild","method"),this),l.call(this,e,n)}}),nodeValue:h({get(){return i.get.call(this)},set(e){!d&&this instanceof Element&&o.isFalse(t.isPortal)&&r.default.logError(p("nodeValue","property"),this),i.set.call(this,e)}}),textContent:h({get(){return n.get.call(this)},set(e){this instanceof Element&&o.isFalse(t.isPortal)&&r.default.logError(p("textContent","property"),this),n.set.call(this,e)}})}}function m(e){_(c.getCustomElementVM(this),e);return l.getAttribute.apply(this,o.ArraySlice.call(arguments))}function v(e,t){_(c.getCustomElementVM(this),e),l.setAttribute.apply(this,o.ArraySlice.call(arguments))}function g(e,t,n){_(c.getCustomElementVM(this),t),l.setAttributeNS.apply(this,o.ArraySlice.call(arguments))}function y(e){_(c.getCustomElementVM(this),e),l.removeAttribute.apply(this,o.ArraySlice.call(arguments))}function b(e,t){_(c.getCustomElementVM(this),t),l.removeAttributeNS.apply(this,o.ArraySlice.call(arguments))}function _(e,t){const n=o.isString(t)?a.getPropNameFromAttrName(o.StringToLowerCase.call(t)):null,{elm:i,def:{props:s}}=e;i.$fromTemplate$&&a.isAttributeLocked(i,t)&&s&&n&&s[n]&&r.default.logError(`Invalid attribute access for \`${t}\`. Use the corresponding property \`${n}\` instead.`,i)}t.unlockDomMutation=function(){d=!0},t.lockDomMutation=function(){d=!1},t.markNodeFromVNode=function(e){e.$fromTemplate$=!0},t.patchElementWithRestrictions=function(e,t){o.defineProperties(e,function(e,t){const n=f(e,t),i=o.getPropertyDescriptor(e,"innerHTML"),a=o.getPropertyDescriptor(e,"outerHTML");return o.assign(n,{innerHTML:h({get(){return i.get.call(this)},set(e){return o.isFalse(t.isPortal)&&r.default.logError(p("innerHTML","property"),this),i.set.call(this,e)}}),outerHTML:h({get(){return a.get.call(this)},set(e){throw new TypeError("Invalid attempt to set outerHTML on Element.")}})}),n}(e,t))},t.patchShadowRootWithRestrictions=function(e,t){o.defineProperties(e,function(e,t){const n=e.querySelector,i=e.querySelectorAll,a=e.addEventListener,l=f(e,t),d=o.getPropertyDescriptor(e,"innerHTML"),p=o.getPropertyDescriptor(e,"textContent");return o.assign(l,{innerHTML:h({get(){return d.get.call(this)},set(e){throw new TypeError("Invalid attempt to set innerHTML on ShadowRoot.")}}),textContent:h({get(){return p.get.call(this)},set(e){throw new TypeError("Invalid attempt to set textContent on ShadowRoot.")}}),addEventListener:u({value(t){return r.default.invariant(!s.isRendering,`${s.vmBeingRendered}.render() method has side effects on the state of ${o.toString(e)} by adding an event listener for "${t}".`),a.apply(this,arguments)}}),querySelector:u({value(){const e=c.getShadowRootVM(this);return r.default.isFalse(s.isBeingConstructed(e),`this.template.querySelector() cannot be called during the construction of the custom element for ${e} because no content has been rendered yet.`),n.apply(this,arguments)}}),querySelectorAll:u({value(){const e=c.getShadowRootVM(this);return r.default.isFalse(s.isBeingConstructed(e),`this.template.querySelectorAll() cannot be called during the construction of the custom element for ${e} because no content has been rendered yet.`),i.apply(this,arguments)}})}),o.forEach.call(o.getOwnPropertyNames({cloneNode:0,getElementById:0,getSelection:0,elementsFromPoint:0,dispatchEvent:0}),e=>{const t=h({get(){throw new Error(`Disallowed method "${e}" in ShadowRoot.`)}});l[e]=t}),l}(e,t))},t.patchCustomElementWithRestrictions=function(e,t){const n=function(e,t){const n=f(e,t),i=e.addEventListener,a=o.getPropertyDescriptor(e,"innerHTML"),c=o.getPropertyDescriptor(e,"outerHTML"),l=o.getPropertyDescriptor(e,"textContent");return o.assign(n,{innerHTML:h({get(){return a.get.call(this)},set(e){throw new TypeError("Invalid attempt to set innerHTML on HTMLElement.")}}),outerHTML:h({get(){return c.get.call(this)},set(e){throw new TypeError("Invalid attempt to set outerHTML on HTMLElement.")}}),textContent:h({get(){return l.get.call(this)},set(e){throw new TypeError("Invalid attempt to set textContent on HTMLElement.")}}),addEventListener:u({value(t){return r.default.invariant(!s.isRendering,`${s.vmBeingRendered}.render() method has side effects on the state of ${o.toString(e)} by adding an event listener for "${t}".`),i.apply(this,arguments)}}),getAttribute:u({value:m}),setAttribute:u({value:v}),setAttributeNS:u({value:g}),removeAttribute:u({value:y}),removeAttributeNS:u({value:b})})}(e,t),i=o.getPrototypeOf(e);o.setPrototypeOf(e,o.create(i,n))},t.patchComponentWithRestrictions=function(e){o.defineProperties(e,function(e){const t=e.setAttribute;return{setAttribute:u({value(e,n){if(o.isString(e)){const t=a.getPropNameFromAttrName(e);if(e===(a.globalHTMLProperties[t]&&a.globalHTMLProperties[t].attribute)){const{error:e}=a.globalHTMLProperties[t];e&&r.default.logError(e,c.getComponentVM(this).elm)}}t.apply(this,arguments)},configurable:!0,enumerable:!1}),tagName:h({get(){throw new Error("Usage of property `tagName` is disallowed because the component itself does not know which tagName will be used to create the element, therefore writing code that check for that value is error prone.")},configurable:!0,enumerable:!1})}}(e))},t.patchLightningElementPrototypeWithRestrictions=function(e){o.defineProperties(e,function(e){const t={};return o.forEach.call(o.getOwnPropertyNames(a.globalHTMLProperties),n=>{n in e||(t[n]=h({get(){const{error:e,attribute:t}=a.globalHTMLProperties[n],i=[];i.push(`Accessing the global HTML property "${n}" is disabled.`),e?i.push(e):t&&i.push(`Instead access it via \`this.getAttribute("${t}")\`.`),r.default.logError(i.join("\n"),c.getComponentVM(this).elm)},set(){const{readOnly:e}=a.globalHTMLProperties[n];e&&r.default.logError(`The global HTML property \`${n}\` is read-only.`)}}))}),t}(e))}},function(e,t,n){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const r=i(n(1)),o=n(0),a=n(8),s=n(6),c=n(2),l=n(12),u=new WeakMap;function h(e,t,n){{const t=e.name;r.default.isTrue(e.constructor,`Missing ${t}.constructor, ${t} should have a "constructor" property.`)}const{name:i,template:a}=t;let s=y.getDecoratorsRegisteredMeta(e);o.isUndefined(s)&&(y.registerDecorators(e,{publicMethods:p(e,"publicMethods"),publicProps:p(e,"publicProps"),track:p(e,"track"),wire:p(e,"wire")}),s=y.getDecoratorsRegisteredMeta(e));let{props:l,methods:u,wire:h,track:d}=s||c.EmptyObject;const m=e.prototype;let{connectedCallback:_,disconnectedCallback:x,renderedCallback:w,errorCallback:M,render:E}=m;const T=function(e,t){let n=o.getPrototypeOf(e);if(o.isNull(n))throw new ReferenceError(`Invalid prototype chain for ${t}, you must extend LightningElement.`);if(c.isCircularModuleDependency(n)){const e=c.resolveCircularModuleDependency(n);if(o.isNull(e))throw new ReferenceError(`Circular module dependency for ${t}, must resolve to a constructor that extends LightningElement.`);n=e===n?v.BaseLightningElement:e}return n}(e,n),S=T!==v.BaseLightningElement?f(T,n):null,A=o.isNull(S)?g.BaseBridgeElement:S.bridge,C=g.HTMLBridgeElementFactory(A,o.getOwnPropertyNames(l),o.getOwnPropertyNames(u));o.isNull(S)||(l=o.assign(o.create(null),S.props,l),u=o.assign(o.create(null),S.methods,u),h=S.wire||h?o.assign(o.create(null),S.wire,h):void 0,d=o.assign(o.create(null),S.track,d),_=_||S.connectedCallback,x=x||S.disconnectedCallback,w=w||S.renderedCallback,M=M||S.errorCallback,E=E||S.render);const P={ctor:e,name:i,wire:h,track:d,props:l=o.assign(o.create(null),b,l),methods:u,bridge:C,template:a,connectedCallback:_,disconnectedCallback:x,renderedCallback:w,errorCallback:M,render:E};return o.freeze(e.prototype),P}function d(e){if(!o.isFunction(e))return!1;if(e.prototype instanceof v.BaseLightningElement)return!0;let t=e;do{if(c.isCircularModuleDependency(t)){const e=c.resolveCircularModuleDependency(t);if(e===t)return!0;t=e}if(t===v.BaseLightningElement)return!0}while(!o.isNull(t)&&(t=o.getPrototypeOf(t)));return!1}function p(e,t){const n=o.getOwnPropertyDescriptor(e,t);return n&&n.value}function f(e,t){let n=u.get(e);if(o.isUndefined(n)){if(!d(e))throw new TypeError(`${e} is not a valid component, or does not extends LightningElement from "lwc". You probably forgot to add the extend clause on the class declaration.`);let i=l.getComponentRegisteredMeta(e);o.isUndefined(i)&&(i={template:void 0,name:e.name}),n=h(e,i,t||e.name),u.set(e,n)}return n}t.isComponentConstructor=d,t.getComponentDef=f,t.getComponentConstructor=function(e){let t=null;if(e instanceof HTMLElement){const n=a.getInternalField(e,c.ViewModelReflection);o.isUndefined(n)||(t=n.def.ctor)}return t},t.setElementProto=function(e,t){o.setPrototypeOf(e,t.bridge.prototype)};const m=n(20),v=n(28),g=n(26),y=n(23),b=o.ArrayReduce.call(o.getOwnPropertyNames(m.HTMLElementOriginalDescriptors),(e,t)=>{const n=s.getAttrNameFromPropName(t);return e[t]={config:3,type:"any",attr:n},e},o.create(null))},function(e,t,n){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const r=i(n(1)),o=n(7),a=n(0),s=n(16),c=n(3),l=n(5),u=new Map;function h(e){r.default.isTrue(e&&"cmpRoot"in e,`${e} is not a vm.`);const{deps:t}=e,n=t.length;if(n>0){for(let i=0;i-1,"when clearing up deps, the vm must be part of the collection."),a.ArraySplice.call(n,o,1)}t.length=0}}t.registerComponent=function(e,{name:t,tmpl:n}){return u.set(e,{name:t,template:n}),e},t.getComponentRegisteredMeta=function(e){return u.get(e)},t.createComponent=function(e,t){r.default.isTrue(e&&"cmpProps"in e,`${e} is not a vm.`),o.invokeComponentConstructor(e,t);const n=e;if(a.isUndefined(n.component))throw new ReferenceError(`Invalid construction for ${t}, you must extend LightningElement.`)},t.linkComponent=function(e){r.default.isTrue(e&&"cmpRoot"in e,`${e} is not a vm.`);const{def:{wire:t}}=e;if(t){const{wiring:t}=s.Services;t&&s.invokeServiceHook(e,t)}},t.clearReactiveListeners=h,t.renderComponent=function(e){r.default.isTrue(e&&"cmpRoot"in e,`${e} is not a vm.`),r.default.invariant(e.isDirty,`${e} is not dirty.`),h(e),function(e){r.default.isTrue(e&&"cmpRoot"in e,`${e} is not a vm.`),e.velements=[]}(e);const t=o.invokeComponentRenderMethod(e);return e.isDirty=!1,e.isScheduled=!1,r.default.invariant(a.isArray(t),`${e}.render() should always return an array of vnodes instead of ${t}`),t},t.markComponentAsDirty=function(e){r.default.isTrue(e&&"cmpRoot"in e,`${e} is not a vm.`),r.default.isFalse(e.isDirty,`markComponentAsDirty() for ${e} should not be called when the component is already dirty.`),r.default.isFalse(o.isRendering,`markComponentAsDirty() for ${e} cannot be called during rendering of ${o.vmBeingRendered}.`),e.isDirty=!0};const d=new WeakMap;t.getWrappedComponentsListener=function(e,t){if(r.default.isTrue(e&&"cmpRoot"in e,`${e} is not a vm.`),!a.isFunction(t))throw new TypeError;let n=d.get(t);return a.isUndefined(n)&&(n=function(n){o.invokeEventListener(e,t,void 0,n)},d.set(t,n)),n},t.getComponentAsString=function(e){const t=c.getComponentVM(e);return`<${a.StringToLowerCase.call(l.tagNameGetter.call(t.elm))}>`}},function(e,t,n){(function(n){var i,r=function(){this._tweens={},this._tweensAddedDuringUpdate={}};r.prototype={getAll:function(){return Object.keys(this._tweens).map(function(e){return this._tweens[e]}.bind(this))},removeAll:function(){this._tweens={}},add:function(e){this._tweens[e.getId()]=e,this._tweensAddedDuringUpdate[e.getId()]=e},remove:function(e){delete this._tweens[e.getId()],delete this._tweensAddedDuringUpdate[e.getId()]},update:function(e,t){var n=Object.keys(this._tweens);if(0===n.length)return!1;for(e=void 0!==e?e:a.now();n.length>0;){this._tweensAddedDuringUpdate={};for(var i=0;i1?1:n,i=this._easingFunction(n),this._valuesEnd)if(void 0!==this._valuesStart[t]){var r=this._valuesStart[t]||0,o=this._valuesEnd[t];o instanceof Array?this._object[t]=this._interpolationFunction(o,i):("string"==typeof o&&(o="+"===o.charAt(0)||"-"===o.charAt(0)?r+parseFloat(o):parseFloat(o)),"number"==typeof o&&(this._object[t]=r+(o-r)*i))}if(null!==this._onUpdateCallback&&this._onUpdateCallback(this._object,n),1===n){if(this._repeat>0){for(t in isFinite(this._repeat)&&this._repeat--,this._valuesStartRepeat){if("string"==typeof this._valuesEnd[t]&&(this._valuesStartRepeat[t]=this._valuesStartRepeat[t]+parseFloat(this._valuesEnd[t])),this._yoyo){var a=this._valuesStartRepeat[t];this._valuesStartRepeat[t]=this._valuesEnd[t],this._valuesEnd[t]=a}this._valuesStart[t]=this._valuesStartRepeat[t]}return this._yoyo&&(this._reversed=!this._reversed),void 0!==this._repeatDelayTime?this._startTime=e+this._repeatDelayTime:this._startTime=e+this._delayTime,null!==this._onRepeatCallback&&this._onRepeatCallback(this._object),!0}null!==this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var s=0,c=this._chainedTweens.length;s1?o(e[n],e[n-1],n-i):o(e[r],e[r+1>n?n:r+1],i-r)},Bezier:function(e,t){for(var n=0,i=e.length-1,r=Math.pow,o=a.Interpolation.Utils.Bernstein,s=0;s<=i;s++)n+=r(1-t,i-s)*r(t,s)*e[s]*o(i,s);return n},CatmullRom:function(e,t){var n=e.length-1,i=n*t,r=Math.floor(i),o=a.Interpolation.Utils.CatmullRom;return e[0]===e[n]?(t<0&&(r=Math.floor(i=n*(1+t))),o(e[(r-1+n)%n],e[r],e[(r+1)%n],e[(r+2)%n],i-r)):t<0?e[0]-(o(e[0],e[0],e[1],e[1],-i)-e[0]):t>1?e[n]-(o(e[n],e[n],e[n-1],e[n-1],i-n)-e[n]):o(e[r?r-1:0],e[r],e[n1;n--)t*=n;return o[e]=t,t}),CatmullRom:function(e,t,n,i,r){var o=.5*(n-e),a=.5*(i-t),s=r*r;return(2*t-2*n+o+a)*(r*s)+(-3*t+3*n-2*o-a)*s+o*r+t}}},void 0===(i=function(){return a}.apply(t,[]))||(e.exports=i)}).call(this,n(59))},function(e,t,n){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const r=i(n(45)),o=n(15);function a(e){return e}t.reactiveMembrane=new r.default({valueObserved:o.observeMutation,valueMutated:o.notifyMutation,valueDistortion:a}),t.unwrap=function(e){const n=t.reactiveMembrane.unwrapProxy(e);return n!==e?a(n):e}},function(e,t,n){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const r=i(n(1)),o=n(0),a=new WeakMap;t.notifyMutation=function(e,t){r.default.invariant(!l.isRendering,`Mutating property ${o.toString(t)} of ${o.toString(e)} is not allowed during the rendering life-cycle of ${l.vmBeingRendered}.`);const n=a.get(e);if(!o.isUndefined(n)){const e=n[t];if(e){const t=e.length;for(let n=0;n0,"Optimize invokeServiceHook() to be invoked only when needed");const{component:n,data:i,def:a,context:s}=e;for(let e=0,r=t.length;e{const n=i.getPropertyDescriptor(HTMLElement.prototype,e);i.isUndefined(n)||(t.HTMLElementOriginalDescriptors[e]=n)}),i.forEach.call(r.defaultDefHTMLPropertyNames,e=>{const n=i.getPropertyDescriptor(HTMLElement.prototype,e);i.isUndefined(n)||(t.HTMLElementOriginalDescriptors[e]=n)})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=new Set;function r(){return[]}t.defaultEmptyTemplate=r,i.add(r),t.isTemplateRegistered=function(e){return i.has(e)},t.registerTemplate=function(e){return i.add(e),e},t.sanitizeAttribute=function(e,t,n,i){return i}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(5),r=n(0);!function(e){e.REHYDRATE="lwc-rehydrate",e.HYDRATE="lwc-hydrate"}(t.GlobalMeasurementPhase||(t.GlobalMeasurementPhase={}));const o="undefined"!=typeof performance&&"function"==typeof performance.mark&&"function"==typeof performance.clearMarks&&"function"==typeof performance.measure&&"function"==typeof performance.clearMeasures;function a(e,t){return`<${r.StringToLowerCase.call(i.tagNameGetter.call(t.elm))} (${t.idx})> - ${e}`}function s(e){performance.mark(e)}function c(e,t){performance.measure(e,t),performance.clearMarks(t),performance.clearMarks(e)}function l(){}t.startMeasure=o?function(e,t){s(a(e,t))}:l,t.endMeasure=o?function(e,t){const n=a(e,t);c(n,n)}:l,t.startGlobalMeasure=o?function(e,t){s(r.isUndefined(t)?e:a(e,t))}:l,t.endGlobalMeasure=o?function(e,t){c(e,r.isUndefined(t)?e:a(e,t))}:l},function(e,t,n){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const r=i(n(1)),o=n(0),a=i(n(29)),s=i(n(24)),c=i(n(30)),l=n(2),u=n(6),h=i(n(31)),d=new Map;t.registerDecorators=function(e,t){const n=o.create(null),i=function(e,t){return o.isUndefined(t)||0===o.getOwnPropertyNames(t).length?l.EmptyObject:o.getOwnPropertyNames(t).reduce((e,n)=>{const i=u.getAttrNameFromPropName(n);return e[n]=o.assign({config:0,type:"any",attr:i},t[n]),e},o.create(null))}(0,t.publicProps),p=(v=e,g=t.publicMethods,o.isUndefined(g)||0===g.length?l.EmptyObject:g.reduce((e,t)=>(r.default.isTrue(o.isFunction(v.prototype[t]),`Component "${v.name}" should have a method \`${t}\` instead of ${v.prototype[t]}.`),e[t]=v.prototype[t],e),o.create(null))),f=function(e,t){if(!o.isUndefined(t)&&0!==o.getOwnPropertyNames(t).length)return o.assign(o.create(null),t)}(0,t.wire),m=function(e,t){return o.isUndefined(t)||0===o.getOwnPropertyNames(t).length?l.EmptyObject:o.assign(o.create(null),t)}(0,t.track);var v,g;d.set(e,{props:i,methods:p,wire:f,track:m});for(const e in i)n[e]=c.default;if(f)for(const e in f){const t=f[e];t.method||(n[e]=a.default(t.adapter,t.params))}if(m)for(const e in m)n[e]=s.default;return h.default(e,n),e},t.getDecoratorsRegisteredMeta=function(e){return d.get(e)}},function(e,t,n){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const r=i(n(1)),o=n(0),a=n(7),s=n(15),c=n(3),l=n(14);function u(e,t,n){return{get(){const e=c.getComponentVM(this);return r.default.isTrue(e&&"cmpRoot"in e,`${e} is not a vm.`),s.observeMutation(this,t),e.cmpTrack[t]},set(e){const n=c.getComponentVM(this);r.default.isTrue(n&&"cmpRoot"in n,`${n} is not a vm.`),r.default.invariant(!a.isRendering,`${a.vmBeingRendered}.render() method has side effects on the state of ${n}.${String(t)}`);const i=l.reactiveMembrane.getProxy(e);i!==n.cmpTrack[t]&&(n.cmpTrack[t]=i,o.isFalse(n.isDirty)&&s.notifyMutation(this,t))},enumerable:n,configurable:!0}}t.default=function(e,t,n){if(1===arguments.length)return l.reactiveMembrane.getProxy(e);if(3!==arguments.length&&r.default.fail("@track decorator can only be used with one argument to return a trackable object, or as a decorator function."),!o.isUndefined(n)){const{get:e,set:t,configurable:i,writable:o}=n;r.default.isTrue(!e&&!t,"Compiler Error: A @track decorator can only be applied to a public field."),r.default.isTrue(!1!==i,"Compiler Error: A @track decorator can only be applied to a configurable property."),r.default.isTrue(!1!==o,"Compiler Error: A @track decorator can only be applied to a writable property.")}return u(e,t,!!o.isUndefined(n)||!0===n.enumerable)},t.createTrackedPropertyDescriptor=u},function(e,t,n){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const r=i(n(1)),o=n(7),a=n(0),s=n(2),c=n(41),l=n(9),u=n(16),h=n(10),d=115,p=118,f=103,m="http://www.w3.org/2000/svg",v=Symbol.iterator,g={create:e=>{a.isUndefined(e.elm)&&(e.elm=document.createTextNode(e.text)),x(e),h.markNodeFromVNode(e.elm),c.createTextHook(e)},update:c.updateNodeHook,insert:c.insertNodeHook,move:c.insertNodeHook,remove:c.removeNodeHook},y={create:e=>{a.isUndefined(e.elm)&&(e.elm=document.createComment(e.text)),x(e),h.markNodeFromVNode(e.elm),c.createCommentHook(e)},update:c.updateNodeHook,insert:c.insertNodeHook,move:c.insertNodeHook,remove:c.removeNodeHook},b={create:e=>{const{data:t,sel:n,elm:i}=e,{ns:r}=t;a.isUndefined(i)&&(e.elm=a.isUndefined(r)?document.createElement(n):document.createElementNS(r,n)),x(e),h.markNodeFromVNode(e.elm),c.fallbackElmHook(e),c.createElmHook(e)},update:(e,t)=>{c.updateElmHook(e,t),c.updateChildrenHook(e,t)},insert:(e,t,n)=>{c.insertNodeHook(e,t,n),c.createChildrenHook(e)},move:(e,t,n)=>{c.insertNodeHook(e,t,n)},remove:(e,t)=>{c.removeNodeHook(e,t),c.removeElmHook(e)}},_={create:e=>{const{sel:t,elm:n}=e;a.isUndefined(n)&&(e.elm=document.createElement(t)),x(e),h.markNodeFromVNode(e.elm),c.createViewModelHook(e),c.allocateChildrenHook(e),c.createCustomElmHook(e)},update:(e,t)=>{c.updateCustomElmHook(e,t),c.allocateChildrenHook(t),c.updateChildrenHook(e,t),c.rerenderCustomElmHook(t)},insert:(e,t,n)=>{c.insertNodeHook(e,t,n),c.createChildrenHook(e),c.insertCustomElmHook(e)},move:(e,t,n)=>{c.insertNodeHook(e,t,n)},remove:(e,t)=>{c.removeNodeHook(e,t),c.removeCustomElmHook(e)}};function x(e){e.elm.$shadowResolver$=e.owner.cmpRoot.$shadowResolver$}function w(e,t,n){r.default.isTrue(a.isString(e),"h() 1st argument sel must be a string."),r.default.isTrue(a.isObject(t),"h() 2nd argument data must be an object."),r.default.isTrue(a.isArray(n),"h() 3rd argument children must be an array."),r.default.isTrue("key"in t,` <${e}> "key" attribute is invalid or missing for ${o.vmBeingRendered}. Key inside iterator is either undefined or null.`),r.default.isFalse(t.className&&t.classMap,"vnode.data.className and vnode.data.classMap ambiguous declaration."),r.default.isFalse(t.styleMap&&t.style,"vnode.data.styleMap and vnode.data.style ambiguous declaration."),t.style&&!a.isString(t.style)&&r.default.logError(`Invalid 'style' attribute passed to <${e}> is ignored. This attribute must be a string value.`,o.vmBeingRendered.elm),a.forEach.call(n,e=>{null!=e&&r.default.isTrue(e&&"sel"in e&&"data"in e&&"children"in e&&"text"in e&&"elm"in e&&"key"in e,`${e} is not a vnode.`)});const{key:i}=t;const s={sel:e,data:t,children:n,text:void 0,elm:void 0,key:i,hook:b,owner:o.vmBeingRendered};return 3===e.length&&a.StringCharCodeAt.call(e,0)===d&&a.StringCharCodeAt.call(e,1)===p&&a.StringCharCodeAt.call(e,2)===f&&function e(t){const{data:n,children:i,sel:r}=t;if(n.ns=m,a.isArray(i)&&"foreignObject"!==r)for(let t=0,n=i.length;t0&&!(a.isTrue(e)||a.isFalse(e));return t&&r.default.logError(`Invalid tabindex value \`${a.toString(e)}\` in template for ${o.vmBeingRendered}. This attribute must be set to 0 or -1.`,o.vmBeingRendered.elm),t?0:e},t.s=function(e,t,n,i){r.default.isTrue(a.isString(e),"s() 1st argument slotName must be a string."),r.default.isTrue(a.isObject(t),"s() 2nd argument data must be an object."),r.default.isTrue(a.isArray(n),"h() 3rd argument children must be an array."),a.isUndefined(i)||a.isUndefined(i[e])||0===i[e].length||(n=i[e]);const o=w("slot",t,n);return s.useSyntheticShadow&&l.markAsDynamicChildren(n),o},t.c=function(e,t,n,i){s.isCircularModuleDependency(t)&&(t=s.resolveCircularModuleDependency(t)),r.default.isTrue(a.isString(e),"c() 1st argument sel must be a string."),r.default.isTrue(a.isFunction(t),"c() 2nd argument Ctor must be a function."),r.default.isTrue(a.isObject(n),"c() 3nd argument data must be an object."),r.default.isTrue(3===arguments.length||a.isArray(i),"c() 4nd argument data must be an array."),r.default.isFalse(n.className&&n.classMap,"vnode.data.className and vnode.data.classMap ambiguous declaration."),r.default.isFalse(n.styleMap&&n.style,"vnode.data.styleMap and vnode.data.style ambiguous declaration."),n.style&&!a.isString(n.style)&&r.default.logError(`Invalid 'style' attribute passed to <${e}> is ignored. This attribute must be a string value.`,o.vmBeingRendered.elm),4===arguments.length&&a.forEach.call(i,e=>{null!=e&&r.default.isTrue(e&&"sel"in e&&"data"in e&&"children"in e&&"text"in e&&"elm"in e&&"key"in e,`${e} is not a vnode.`)});const{key:c}=n,l={sel:e,data:n,children:i=3===arguments.length?s.EmptyArray:i,text:void 0,elm:void 0,key:c,hook:_,ctor:t,owner:o.vmBeingRendered,mode:"open"};return function(e){a.ArrayPush.call(o.vmBeingRendered.velements,e)}(l),l},t.i=function(e,t){const n=[];if(l.markAsDynamicChildren(n),a.isUndefined(e)||null===e)return r.default.logError(`Invalid template iteration for value "${a.toString(e)}" in ${o.vmBeingRendered}. It must be an Array or an iterable Object.`,o.vmBeingRendered.elm),n;r.default.isFalse(a.isUndefined(e[v]),`Invalid template iteration for value \`${a.toString(e)}\` in ${o.vmBeingRendered}. It must be an array-like object and not \`null\` nor \`undefined\`.`);const i=e[v]();r.default.isTrue(i&&a.isFunction(i.next),`Invalid iterator function for "${a.toString(e)}" in ${o.vmBeingRendered}.`);let s,c,u=i.next(),h=0,{value:d,done:p}=u;for(s=a.create(null);!1===p;){p=(u=i.next()).done;const e=t(d,h,0===h,p);a.isArray(e)?a.ArrayPush.apply(n,e):a.ArrayPush.call(n,e);{const t=a.isArray(e)?e:[e];a.forEach.call(t,e=>{if(!a.isNull(e)&&a.isObject(e)&&!a.isUndefined(e.sel)){const{key:t}=e;a.isString(t)||a.isNumber(t)?(1===s[t]&&a.isUndefined(c)&&(c=`Duplicated "key" attribute value for "<${e.sel}>" in ${o.vmBeingRendered} for item number ${h}. A key with value "${e.key}" appears more than once in the iteration. Key values must be unique numbers or strings.`),s[t]=1):a.isUndefined(c)&&(c=`Invalid "key" attribute value in "<${e.sel}>" in ${o.vmBeingRendered} for item number ${h}. Set a unique "key" value on all iterated child elements.`)}})}h+=1,d=u.value}return a.isUndefined(c)||r.default.logError(c,o.vmBeingRendered.elm),n},t.f=function(e){r.default.isTrue(a.isArray(e),"flattening api can only work with arrays.");const t=e.length,n=[];l.markAsDynamicChildren(n);for(let i=0;if){const t=n[g+1];a(e,h=r(t)?t.elm:null,n,p,g)}else!function(e,t,n,i){for(;n<=i;++n){const i=t[n];r(i)&&i.hook.remove(i,e)}}(e,t,d,f)},t.updateStaticChildren=function(e,t,n){const{length:i}=n;if(0===t.length)return void a(e,null,n,0,i);let o=null;for(let a=i-1;a>=0;a-=1){const i=n[a],c=t[a];i!==c&&(r(c)?r(i)?(s(c,i),o=i.elm):c.hook.remove(c,e):r(i)&&(i.hook.create(i),i.hook.insert(i,e,o),o=i.elm))}}},function(e,t,n){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const r=i(n(1)),o=n(0),a=n(20),s=n(10),c=n(12),l=n(8),u=n(2),h=n(7),d=n(3),p=n(15),f=n(19),m=n(10),v=n(6),g=n(21),y=Event;function b(e){return d.getComponentVM(e).elm}function _(){if(o.isNull(h.vmBeingConstructed))throw new ReferenceError;r.default.isTrue("cmpProps"in h.vmBeingConstructed,`${h.vmBeingConstructed} is not a vm.`),r.default.invariant(h.vmBeingConstructed.elm instanceof HTMLElement,`Component creation requires a DOM element to be associated to ${h.vmBeingConstructed}.`);const e=h.vmBeingConstructed,{elm:t,mode:n,def:{ctor:i}}=e,a=this;if(e.component=a,1===arguments.length){const{callHook:t,setHook:n,getHook:i}=arguments[0];e.callHook=t,e.setHook=n,e.getHook=i}const s={mode:n,delegatesFocus:!!i.delegatesFocus},c=t.attachShadow(s);l.setHiddenField(a,u.ViewModelReflection,e),l.setInternalField(t,u.ViewModelReflection,e),l.setInternalField(c,u.ViewModelReflection,e),e.cmpRoot=c,m.patchComponentWithRestrictions(a),m.patchShadowRootWithRestrictions(c,u.EmptyObject)}t.BaseLightningElement=_,_.prototype={constructor:_,dispatchEvent(e){const t=b(this),n=d.getComponentVM(this);{if(0===arguments.length)throw new Error(`Failed to execute 'dispatchEvent' on ${c.getComponentAsString(this)}: 1 argument required, but only 0 present.`);if(!(e instanceof y))throw new Error(`Failed to execute 'dispatchEvent' on ${c.getComponentAsString(this)}: parameter 1 is not of type 'Event'.`);const{type:i}=e;r.default.isFalse(h.isBeingConstructed(n),`this.dispatchEvent() should not be called during the construction of the custom element for ${c.getComponentAsString(this)} because no one is listening for the event "${i}" just yet.`),/^[a-z][a-z0-9_]*$/.test(i)||r.default.logError(`Invalid event type "${i}" dispatched in element ${c.getComponentAsString(this)}. Event name must ${["1) Start with a lowercase letter","2) Contain only lowercase letters, numbers, and underscores"].join(" ")}`,t)}return f.dispatchEvent.call(t,e)},addEventListener(e,t,n){const i=d.getComponentVM(this);r.default.isTrue(i&&"cmpRoot"in i,`${i} is not a vm.`),r.default.invariant(!h.isRendering,`${h.vmBeingRendered}.render() method has side effects on the state of ${i} by adding an event listener for "${e}".`),r.default.invariant(o.isFunction(t),`Invalid second argument for this.addEventListener() in ${i} for event "${e}". Expected an EventListener but received ${t}.`);const a=c.getWrappedComponentsListener(i,t);i.elm.addEventListener(e,a,n)},removeEventListener(e,t,n){const i=d.getComponentVM(this);r.default.isTrue(i&&"cmpRoot"in i,`${i} is not a vm.`);const o=c.getWrappedComponentsListener(i,t);i.elm.removeEventListener(e,o,n)},setAttributeNS(e,t,n){const i=b(this);r.default.isFalse(h.isBeingConstructed(d.getComponentVM(this)),`Failed to construct '${c.getComponentAsString(this)}': The result must not have attributes.`),v.unlockAttribute(i,t),i.setAttributeNS.apply(i,arguments),v.lockAttribute(i,t)},removeAttributeNS(e,t){const n=b(this);v.unlockAttribute(n,t),n.removeAttributeNS.apply(n,arguments),v.lockAttribute(n,t)},removeAttribute(e){const t=b(this);v.unlockAttribute(t,e),t.removeAttribute.apply(t,arguments),v.lockAttribute(t,e)},setAttribute(e,t){const n=b(this);r.default.isFalse(h.isBeingConstructed(d.getComponentVM(this)),`Failed to construct '${c.getComponentAsString(this)}': The result must not have attributes.`),v.unlockAttribute(n,e),n.setAttribute.apply(n,arguments),v.lockAttribute(n,e)},getAttribute(e){const t=b(this);v.unlockAttribute(t,e);const n=t.getAttribute.apply(t,arguments);return v.lockAttribute(t,e),n},getAttributeNS(e,t){const n=b(this);v.unlockAttribute(n,t);const i=n.getAttributeNS.apply(n,arguments);return v.lockAttribute(n,t),i},getBoundingClientRect(){const e=b(this);{const e=d.getComponentVM(this);r.default.isFalse(h.isBeingConstructed(e),`this.getBoundingClientRect() should not be called during the construction of the custom element for ${c.getComponentAsString(this)} because the element is not yet in the DOM, instead, you can use it in one of the available life-cycle hooks.`)}return e.getBoundingClientRect()},querySelector(e){const t=d.getComponentVM(this);r.default.isFalse(h.isBeingConstructed(t),`this.querySelector() cannot be called during the construction of the custom element for ${c.getComponentAsString(this)} because no children has been added to this element yet.`);const{elm:n}=t;return n.querySelector(e)},querySelectorAll(e){const t=d.getComponentVM(this);r.default.isFalse(h.isBeingConstructed(t),`this.querySelectorAll() cannot be called during the construction of the custom element for ${c.getComponentAsString(this)} because no children has been added to this element yet.`);const{elm:n}=t;return n.querySelectorAll(e)},getElementsByTagName(e){const t=d.getComponentVM(this);r.default.isFalse(h.isBeingConstructed(t),`this.getElementsByTagName() cannot be called during the construction of the custom element for ${c.getComponentAsString(this)} because no children has been added to this element yet.`);const{elm:n}=t;return n.getElementsByTagName(e)},getElementsByClassName(e){const t=d.getComponentVM(this);r.default.isFalse(h.isBeingConstructed(t),`this.getElementsByClassName() cannot be called during the construction of the custom element for ${c.getComponentAsString(this)} because no children has been added to this element yet.`);const{elm:n}=t;return n.getElementsByClassName(e)},get classList(){{const e=d.getComponentVM(this);r.default.isFalse(h.isBeingConstructed(e),`Failed to construct ${e}: The result must not have attributes. Adding or tampering with classname in constructor is not allowed in a web component, use connectedCallback() instead.`)}return b(this).classList},get template(){const e=d.getComponentVM(this);return r.default.isTrue(e&&"cmpRoot"in e,`${e} is not a vm.`),e.cmpRoot},get shadowRoot(){return null},render(){const e=d.getComponentVM(this),{template:t}=e.def;return o.isUndefined(t)?g.defaultEmptyTemplate:t},toString(){const e=d.getComponentVM(this);return r.default.isTrue(e&&"cmpRoot"in e,`${e} is not a vm.`),`[object ${e.def.name}]`}};const x=o.ArrayReduce.call(o.getOwnPropertyNames(a.HTMLElementOriginalDescriptors),(e,t)=>(e[t]=function(e,t){const{get:n,set:i,enumerable:a,configurable:s}=t;if(!o.isFunction(n))throw r.default.fail(`Detected invalid public property descriptor for HTMLElement.prototype.${e} definition. Missing the standard getter.`),new TypeError;if(!o.isFunction(i))throw r.default.fail(`Detected invalid public property descriptor for HTMLElement.prototype.${e} definition. Missing the standard setter.`),new TypeError;return{enumerable:a,configurable:s,get(){const t=d.getComponentVM(this);if(r.default.isTrue(t&&"cmpRoot"in t,`${t} is not a vm.`),!h.isBeingConstructed(t))return p.observeMutation(this,e),n.call(t.elm);{const n=t.elm.constructor.name;r.default.logError(`\`${n}\` constructor can't read the value of property \`${e}\` because the owner component hasn't set the value yet. Instead, use the \`${n}\` constructor to set a default value for the property.`,t.elm)}},set(t){const n=d.getComponentVM(this);return r.default.isTrue(n&&"cmpRoot"in n,`${n} is not a vm.`),r.default.invariant(!h.isRendering,`${h.vmBeingRendered}.render() method has side effects on the state of ${n}.${e}`),r.default.isFalse(h.isBeingConstructed(n),`Failed to construct '${c.getComponentAsString(this)}': The result must not have attributes.`),r.default.invariant(!o.isObject(t)||o.isNull(t),`Invalid value "${t}" for "${e}" of ${n}. Value cannot be an object, must be a primitive value.`),t!==n.cmpProps[e]&&(n.cmpProps[e]=t,o.isFalse(n.isDirty)&&p.notifyMutation(this,e)),i.call(n.elm,t)}}}(t,a.HTMLElementOriginalDescriptors[t]),e),o.create(null));o.defineProperties(_.prototype,x),s.patchLightningElementPrototypeWithRestrictions(_.prototype),o.freeze(_),o.seal(_.prototype)},function(e,t,n){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const r=n(24),o=i(n(1)),a=n(0);function s(e,t,n){if(!a.isUndefined(n)){const{get:e,set:t,configurable:i,writable:r}=n;o.default.isTrue(!e&&!t,"Compiler Error: A @wire decorator can only be applied to a public field."),o.default.isTrue(!1!==i,"Compiler Error: A @wire decorator can only be applied to a configurable property."),o.default.isTrue(!1!==r,"Compiler Error: A @wire decorator can only be applied to a writable property.")}return r.createTrackedPropertyDescriptor(e,t,!a.isObject(n)||!0===n.enumerable)}t.default=function(e,t){const n=arguments.length;if(n>0&&n<3)return s;throw o.default.fail("@wire(adapter, config?) may only be used as a decorator."),new TypeError}},function(e,t,n){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const r=i(n(1)),o=n(7),a=n(0),s=n(15),c=n(3),l=n(0),u=n(23);t.default=function(e,t,n){3!==arguments.length&&r.default.fail("@api decorator can only be used as a decorator function."),r.default.invariant(!n||l.isFunction(n.get)||l.isFunction(n.set),`Invalid property ${a.toString(t)} definition in ${e}, it cannot be a prototype definition if it is a public property. Instead use the constructor to define it.`),a.isObject(n)&&l.isFunction(n.set)&&r.default.isTrue(a.isObject(n)&&l.isFunction(n.get),`Missing getter for property ${a.toString(t)} decorated with @api in ${e}. You cannot have a setter without the corresponding getter.`);const i=u.getDecoratorsRegisteredMeta(e);return a.isObject(n)&&(l.isFunction(n.get)||l.isFunction(n.set))?(i.props[t].config=l.isFunction(n.set)?3:1,function(e,t,n){const{get:i,set:s,enumerable:u}=n;if(!l.isFunction(i))throw r.default.fail(`Invalid attempt to create public property descriptor ${a.toString(t)} in ${e}. It is missing the getter declaration with @api get ${a.toString(t)}() {} syntax.`),new TypeError;return{get(){{const e=c.getComponentVM(this);r.default.isTrue(e&&"cmpRoot"in e,`${e} is not a vm.`)}return i.call(this)},set(e){const n=c.getComponentVM(this);r.default.isTrue(n&&"cmpRoot"in n,`${n} is not a vm.`),r.default.invariant(!o.isRendering,`${o.vmBeingRendered}.render() method has side effects on the state of ${n}.${a.toString(t)}`),s?s.call(this,e):r.default.fail(`Invalid attempt to set a new value for property ${a.toString(t)} of ${n} that does not has a setter decorated with @api.`)},enumerable:u}}(e,t,n)):(i.props[t].config=0,function(e,t,n){return{get(){const e=c.getComponentVM(this);if(r.default.isTrue(e&&"cmpRoot"in e,`${e} is not a vm.`),!o.isBeingConstructed(e))return s.observeMutation(this,t),e.cmpProps[t];{const n=e.elm.constructor.name;r.default.logError(`\`${n}\` constructor can’t read the value of property \`${a.toString(t)}\` because the owner component hasn’t set the value yet. Instead, use the \`${n}\` constructor to set a default value for the property.`,e.elm)}},set(e){const n=c.getComponentVM(this);r.default.isTrue(n&&"cmpRoot"in n,`${n} is not a vm.`),r.default.invariant(!o.isRendering,`${o.vmBeingRendered}.render() method has side effects on the state of ${n}.${a.toString(t)}`),n.cmpProps[t]=e,a.isFalse(n.isDirty)&&s.notifyMutation(this,t)},enumerable:!!l.isUndefined(n)||n.enumerable}}(0,t,n))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(0);t.default=function(e,t){if(!i.isFunction(e)||null==t)throw new TypeError;const n=i.getOwnPropertyNames(t),r=e.prototype;for(let o=0,a=n.length;o{const e=a.getCustomElementVM(r);d.startGlobalMeasure(d.GlobalMeasurementPhase.HYDRATE,e),e.state===a.VMState.connected&&a.removeRootVM(e),a.appendRootVM(e),d.endGlobalMeasure(d.GlobalMeasurementPhase.HYDRATE,e)}),c.setInternalField(r,m,()=>{const e=a.getCustomElementVM(r);a.removeRootVM(e)}),r}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.currentContext={},t.establishContext=function(e){t.currentContext=e}},function(e,t,n){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});const o=i(n(1)),a=n(0),s=r(n(25)),c=n(3),l=n(2),u=n(21);t.registerTemplate=u.registerTemplate;const h=n(52),d=a.create(null);t.evaluateTemplate=function(e,t){o.default.isTrue(e&&"cmpRoot"in e,`${e} is not a vm.`),o.default.isTrue(a.isFunction(t),`evaluateTemplate() second argument must be an imported template instead of ${a.toString(t)}`);const{component:n,context:i,cmpSlots:r,cmpTemplate:p}=e;if(t!==p){if(a.isUndefined(p)||c.resetShadowRoot(e),!u.isTemplateRegistered(t))throw new TypeError(`Invalid template returned by the render() method on ${e}. It must return an imported template (e.g.: \`import html from "./${e.def.name}.html"\`), instead, it has returned: ${a.toString(t)}.`);e.cmpTemplate=t,i.tplCache=a.create(null),h.resetStyleAttributes(e);const{stylesheets:n,stylesheetTokens:r}=t;if(a.isUndefined(n)||0===n.length)i.styleVNode=null;else if(!a.isUndefined(r)){const{hostAttribute:t,shadowAttribute:o}=r;h.applyStyleAttributes(e,t,o),i.styleVNode=h.evaluateCSS(e,n,t,o)}!function(e,t){const{component:n}=e,{ids:i=[]}=t;a.forEach.call(i,t=>{t in n||o.default.logError(`The template rendered by ${e} references \`this.${t}\`, which is not declared. Check for a typo in the template.`,e.elm)})}(e,t)}o.default.isTrue(a.isObject(i.tplCache),`vm.context.tplCache must be an object associated to ${p}.`),function(e,t){const{cmpSlots:n=d}=e,{slots:i=l.EmptyArray}=t;for(const t in n)o.default.isTrue(a.isArray(n[t]),`Slots can only be set to an array, instead received ${a.toString(n[t])} for slot "${t}" in ${e}.`),""!==t&&-1===a.ArrayIndexOf.call(i,t)&&o.default.logError(`Ignoring unknown provided slot name "${t}" in ${e}. Check for a typo on the slot attribute.`,e.elm)}(e,t);const f=t.call(void 0,s,n,r,i.tplCache),{styleVNode:m}=i;return a.isNull(m)||a.ArrayUnshift.call(f,m),o.default.invariant(a.isArray(f),"Compiler should produce html functions that always return an array."),f}},function(e,t,n){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const r=i(n(1)),o=n(0),a=n(2),s=n(3),c=i(n(42)),l=i(n(43)),u=i(n(44)),h=i(n(47)),d=i(n(48)),p=i(n(49)),f=i(n(50)),m=i(n(51)),v=n(9),g=n(27),y=n(10),b=n(9),_=n(11),x=()=>void 0;function w(e,t){e.$shadowToken$=t}var M;t.updateNodeHook=function(e,t){const{text:n}=t;e.text!==n&&(y.unlockDomMutation(),t.elm.nodeValue=n,y.lockDomMutation())},t.insertNodeHook=function(e,t,n){y.unlockDomMutation(),t.insertBefore(e.elm,n),y.lockDomMutation()},t.removeNodeHook=function(e,t){y.unlockDomMutation(),t.removeChild(e.elm),y.lockDomMutation()},t.createTextHook=function(e){const t=e.elm;o.isTrue(a.useSyntheticShadow)&&b.patchTextNodeProto(t)},t.createCommentHook=function(e){const t=e.elm;o.isTrue(a.useSyntheticShadow)&&b.patchCommentNodeProto(t)},t.createElmHook=function(e){c.default.create(e),l.default.create(e),u.default.create(e),p.default.create(e),f.default.create(e),h.default.create(e),d.default.create(e),m.default.create(e)},function(e){e.manual="manual"}(M||(M={})),t.fallbackElmHook=function(e){const{owner:t,sel:n}=e,i=e.elm;if(o.isTrue(a.useSyntheticShadow)){const{data:{context:r}}=e,{shadowAttribute:a}=t.context;o.isUndefined(r)||o.isUndefined(r.lwc)||r.lwc.dom!==M.manual||function(e){e.$domManual$=!0}(i),w(i,a),b.patchElementProto(i,{sel:n})}{const{data:{context:t}}=e,n=!o.isUndefined(t)&&!o.isUndefined(t.lwc)&&t.lwc.dom===M.manual;y.patchElementWithRestrictions(i,{isPortal:n})}},t.updateElmHook=function(e,t){l.default.update(e,t),u.default.update(e,t),h.default.update(e,t),d.default.update(e,t)},t.insertCustomElmHook=function(e){const t=s.getCustomElementVM(e.elm);s.appendVM(t)},t.updateChildrenHook=function(e,t){const{children:n,owner:i}=t,r=v.hasDynamicChildren(n)?g.updateDynamicChildren:g.updateStaticChildren;s.runWithBoundaryProtection(i,i.owner,x,()=>{r(t.elm,e.children,n)},x)},t.allocateChildrenHook=function(e){const t=e.elm,n=s.getCustomElementVM(t),{children:i}=e;n.aChildren=i,o.isTrue(a.useSyntheticShadow)&&(s.allocateInSlot(n,i),e.children=a.EmptyArray)},t.createViewModelHook=function(e){const t=e.elm;if(o.hasOwnProperty.call(t,a.ViewModelReflection))return;const{mode:n,ctor:i,owner:c}=e,l=_.getComponentDef(i);if(_.setElementProto(t,l),o.isTrue(a.useSyntheticShadow)){const{shadowAttribute:e}=c.context;w(t,e),b.patchCustomElementProto(t,{def:l})}s.createVM(t,i,{mode:n,owner:c});const u=s.getCustomElementVM(t);r.default.isTrue(u&&"cmpRoot"in u,`${u} is not a vm.`),r.default.isTrue(o.isArray(e.children),"Invalid vnode for a custom element, it must have children defined."),y.patchCustomElementWithRestrictions(t,a.EmptyObject)},t.createCustomElmHook=function(e){c.default.create(e),l.default.create(e),u.default.create(e),p.default.create(e),f.default.create(e),h.default.create(e),d.default.create(e),m.default.create(e)},t.createChildrenHook=function(e){const{elm:t,children:n}=e;for(let e=0;eh(d,e),update:h}},function(e,t,n){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const r=i(n(1)),o=n(0),a=n(8),s=n(2),c=n(26),l=n(6);function u(e,t){return"input"===e&&("value"===t||"checked"===t)}function h(e,t){const n=t.data.props;if(o.isUndefined(n))return;const i=e.data.props;if(i===n)return;r.default.invariant(o.isUndefined(i)||o.keys(i).join(",")===o.keys(n).join(","),"vnode.data.props cannot change shape.");const h=t.elm,d=a.getInternalField(h,s.ViewModelReflection),p=o.isUndefined(i),f=!o.isUndefined(d),{sel:m}=t;for(const e in n){const t=n[e];e in h||r.default.fail(`Unknown public property "${e}" of element <${m}>. This is likely a typo on the corresponding attribute "${l.getAttrNameFromPropName(e)}".`),(p||t!==(u(m,e)?h[e]:i[e]))&&(f&&c.prepareForPropUpdate(d),h[e]=t)}}const d={data:{}};t.default={create:e=>h(d,e),update:h}},function(e,t,n){"use strict";n.r(t),function(e){const{isArray:n}=Array,{getPrototypeOf:i,create:r,defineProperty:o,defineProperties:a,isExtensible:s,getOwnPropertyDescriptor:c,getOwnPropertyNames:l,getOwnPropertySymbols:u,preventExtensions:h,hasOwnProperty:d}=Object,{push:p,concat:f,map:m}=Array.prototype,v={}.toString;function g(e){return void 0===e}function y(e){return"function"==typeof e}const b=new WeakMap;function _(e,t){b.set(e,t)}const x=e=>b.get(e)||e;function w(e,t){return e.valueIsObservable(t)?e.getProxy(t):t}function M(e,t,n){f.call(l(n),u(n)).forEach(i=>{let r=c(n,i);r.configurable||(r=k(e,r,w)),o(t,i,r)}),h(t)}class E{constructor(e,t){this.originalTarget=t,this.membrane=e}get(e,t){const{originalTarget:n,membrane:i}=this,r=n[t],{valueObserved:o}=i;return o(n,t),i.getProxy(r)}set(e,t,i){const{originalTarget:r,membrane:{valueMutated:o}}=this;return r[t]!==i?(r[t]=i,o(r,t)):"length"===t&&n(r)&&o(r,t),!0}deleteProperty(e,t){const{originalTarget:n,membrane:{valueMutated:i}}=this;return delete n[t],i(n,t),!0}apply(e,t,n){}construct(e,t,n){}has(e,t){const{originalTarget:n,membrane:{valueObserved:i}}=this;return i(n,t),t in n}ownKeys(e){const{originalTarget:t}=this;return f.call(l(t),u(t))}isExtensible(e){const t=s(e);if(!t)return t;const{originalTarget:n,membrane:i}=this,r=s(n);return r||M(i,e,n),r}setPrototypeOf(e,t){throw new Error(`Invalid setPrototypeOf invocation for reactive proxy ${n=this.originalTarget,n&&n.toString?n.toString():"object"==typeof n?v.call(n):n+""}. Prototype of reactive objects cannot be changed.`);var n}getPrototypeOf(e){const{originalTarget:t}=this;return i(t)}getOwnPropertyDescriptor(e,t){const{originalTarget:n,membrane:i}=this,{valueObserved:r}=this.membrane;r(n,t);let a=c(n,t);if(g(a))return a;const s=c(e,t);return g(s)?((a=k(i,a,w)).configurable||o(e,t,a),a):s}preventExtensions(e){const{originalTarget:t,membrane:n}=this;return M(n,e,t),h(t),!0}defineProperty(e,t,n){const{originalTarget:i,membrane:r}=this,{valueMutated:a}=r,{configurable:s}=n;if(d.call(n,"writable")&&!d.call(n,"value")){const e=c(i,t);n.value=e.value}return o(i,t,function(e){return d.call(e,"value")&&(e.value=x(e.value)),e}(n)),!1===s&&o(e,t,k(r,n,w)),a(i,t),!0}}function T(e,t){return e.valueIsObservable(t)?e.getReadOnlyProxy(t):t}class S{constructor(e,t){this.originalTarget=t,this.membrane=e}get(e,t){const{membrane:n,originalTarget:i}=this,r=i[t],{valueObserved:o}=n;return o(i,t),n.getReadOnlyProxy(r)}set(e,t,n){{const{originalTarget:e}=this;throw new Error(`Invalid mutation: Cannot set "${t.toString()}" on "${e}". "${e}" is read-only.`)}}deleteProperty(e,t){{const{originalTarget:e}=this;throw new Error(`Invalid mutation: Cannot delete "${t.toString()}" on "${e}". "${e}" is read-only.`)}}apply(e,t,n){}construct(e,t,n){}has(e,t){const{originalTarget:n,membrane:{valueObserved:i}}=this;return i(n,t),t in n}ownKeys(e){const{originalTarget:t}=this;return f.call(l(t),u(t))}setPrototypeOf(e,t){{const{originalTarget:e}=this;throw new Error(`Invalid prototype mutation: Cannot set prototype on "${e}". "${e}" prototype is read-only.`)}}getOwnPropertyDescriptor(e,t){const{originalTarget:n,membrane:i}=this,{valueObserved:r}=i;r(n,t);let a=c(n,t);if(g(a))return a;const s=c(e,t);return g(s)?(a=k(i,a,T),d.call(a,"set")&&(a.set=void 0),a.configurable||o(e,t,a),a):s}preventExtensions(e){{const{originalTarget:e}=this;throw new Error(`Invalid mutation: Cannot preventExtensions on ${e}". "${e} is read-only.`)}}defineProperty(e,t,n){{const{originalTarget:e}=this;throw new Error(`Invalid mutation: Cannot defineProperty "${t.toString()}" on "${e}". "${e}" is read-only.`)}}}const A={header:e=>{const t=x(e);return t&&t!==e?["object",{object:function e(t){if(n(t))return t.map(t=>{const n=x(t);return n!==t?e(n):t});const o=r(i(t)),a=l(t);return f.call(a,u(t)).reduce((n,i)=>{const r=t[i],o=x(r);return n[i]=o!==r?e(o):r,n},o)}(e)}]:null},hasBody:()=>!1,body:()=>null};function C(){return"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==e?e:{}}function P(e){let t=void 0;return n(e)?t=[]:"object"==typeof e&&(t={}),t}(function(){const e=C(),t=e.devtoolsFormatters||[];p.call(t,A),e.devtoolsFormatters=t})();const L=Object.prototype;function R(e){if(null===e)return!1;if("object"!=typeof e)return!1;if(n(e))return!0;const t=i(e);return t===L||null===t||null===i(t)}const O=(e,t)=>{},D=(e,t)=>{},I=e=>e;function k(e,t,n){const{set:i,get:r}=t;return d.call(t,"value")?t.value=n(e,t.value):(g(r)||(t.get=function(){return n(e,r.call(x(this)))}),g(i)||(t.set=function(t){i.call(x(this),e.unwrapProxy(t))})),t}t.default=class{constructor(e){if(this.valueDistortion=I,this.valueMutated=D,this.valueObserved=O,this.valueIsObservable=R,this.objectGraph=new WeakMap,!g(e)){const{valueDistortion:t,valueMutated:n,valueObserved:i,valueIsObservable:r}=e;this.valueDistortion=y(t)?t:I,this.valueMutated=y(n)?n:D,this.valueObserved=y(i)?i:O,this.valueIsObservable=y(r)?r:R}}getProxy(e){const t=x(e),n=this.valueDistortion(t);if(this.valueIsObservable(n)){const i=this.getReactiveState(t,n);return i.readOnly===e?e:i.reactive}return n}getReadOnlyProxy(e){e=x(e);const t=this.valueDistortion(e);return this.valueIsObservable(t)?this.getReactiveState(e,t).readOnly:t}unwrapProxy(e){return x(e)}getReactiveState(e,t){const{objectGraph:n}=this;let i=n.get(t);if(i)return i;const r=this;return i={get reactive(){const n=new E(r,t),i=new Proxy(P(t),n);return _(i,e),o(this,"reactive",{value:i}),i},get readOnly(){const n=new S(r,t),i=new Proxy(P(t),n);return _(i,e),o(this,"readOnly",{value:i}),i}},n.set(t,i),i}}}.call(this,n(46))},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(0),o=r.create(null);function a(e){if(null==e)return i.EmptyObject;e=r.isString(e)?e:e+"";let t=o[e];if(t)return t;t=r.create(null);let n,a=0;const s=e.length;for(n=0;na&&(t[r.StringSlice.call(e,a,n)]=!0),a=n+1);return n>a&&(t[r.StringSlice.call(e,a,n)]=!0),o[e]=t,r.freeze(t),t}function s(e,t){const{elm:n,data:{className:i}}=t,{data:{className:o}}=e;if(o===i)return;const{classList:s}=n,c=a(i),l=a(o);let u;for(u in l)r.isUndefined(c[u])&&s.remove(u);for(u in c)r.isUndefined(l[u])&&s.add(u)}const c={data:{}};t.default={create:e=>s(c,e),update:s}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(0),r=n(5);function o(e,t){const{style:n}=t.data;if(e.data.style===n)return;const o=t.elm,{style:a}=o;i.isString(n)&&""!==n?a.cssText=n:r.removeAttribute.call(o,"style")}const a={data:{}};t.default={create:e=>o(a,e),update:o}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(0);t.default={create:function(e){const{elm:t,data:{classMap:n}}=e;if(i.isUndefined(n))return;const{classList:r}=t;for(const e in n)r.add(e)}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(0);t.default={create:function(e){const{elm:t,data:{styleMap:n}}=e;if(i.isUndefined(n))return;const{style:r}=t;for(const e in n)r[e]=n[e]}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(0),r=n(2),o=n(8);const a={create:function(e){const{data:{context:t}}=e;if(i.isUndefined(t))return;const n=e.elm,a=o.getInternalField(n,r.ViewModelReflection);i.isUndefined(a)||i.assign(a.context,t)}};t.default=a},function(e,t,n){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});const o=i(n(1)),a=n(0),s=r(n(25)),c=n(2),l=n(5),u=a.create(null);function h(e){const t=document.createElement("style");return t.type="text/css",t.textContent=e,t}const d=document.head||document.body||document,p=a.create(null);function f(e,t,n,i,r){a.forEach.call(e,e=>{a.isArray(e)?f(e,t,n,i,r):r(e(t,n,i))})}t.resetStyleAttributes=function(e){const{context:t,elm:n}=e,i=t.hostAttribute;a.isUndefined(i)||l.removeAttribute.call(n,i),t.hostAttribute=t.shadowAttribute=void 0},t.applyStyleAttributes=function(e,t,n){const{context:i,elm:r}=e;l.setAttribute.call(r,t,""),i.hostAttribute=t,i.shadowAttribute=n},t.evaluateCSS=function(e,t,n,i){if(o.default.isTrue(e&&"cmpRoot"in e,`${e} is not a vm.`),o.default.isTrue(a.isArray(t),"Invalid stylesheets."),c.useSyntheticShadow)return f(t,`[${n}]`,`[${i}]`,!1,e=>{!function(e){if(a.isUndefined(p[e])){p[e]=!0;const t=h(e);d.appendChild(t)}}(e)}),null;{let e="";return f(t,a.emptyString,a.emptyString,!0,t=>{e+=t}),function(e){const t=s.h("style",{key:"style"},c.EmptyArray);return t.elm=e,t}(function(e){let t=u[e];if(a.isUndefined(t)){t=document.createDocumentFragment();const n=h(e);t.appendChild(n),u[e]=t}return t.cloneNode(!0).firstChild}(e))}}},function(e,t,n){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const r=i(n(1)),o=n(14);t.default=function(e){return 1!==arguments.length&&r.default.fail("@readonly cannot be used as a decorator just yet, use it as a function with one argument to produce a readonly version of the provided value."),o.reactiveMembrane.getReadOnlyProxy(e)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(0),r=n(3),o=n(2),a=n(11),s=n(6),c=n(9),l=n(10);t.buildCustomElementConstructor=function(e,t){var n;const{props:u,bridge:h}=a.getComponentDef(e),d={mode:"open",isRoot:!0,owner:null};if(i.isObject(t)&&!i.isNull(t)){const{mode:e}=t;"closed"===e&&(d.mode=e)}return(n=class extends h{constructor(){if(super(),i.isTrue(o.useSyntheticShadow)){const t=a.getComponentDef(e);c.patchCustomElementProto(this,{def:t})}r.createVM(this,e,d),l.patchCustomElementWithRestrictions(this,o.EmptyObject)}connectedCallback(){const e=r.getCustomElementVM(this);r.appendRootVM(e)}disconnectedCallback(){const e=r.getCustomElementVM(this);r.removeRootVM(e)}attributeChangedCallback(e,t,n){if(t===n)return;const r=s.getPropNameFromAttrName(e);i.isUndefined(u[r])||s.isAttributeLocked(this,e)&&(this[r]=n)}}).observedAttributes=i.ArrayMap.call(i.getOwnPropertyNames(u),e=>u[e].attr),n}},function(e,t){ /*! * fullscreen-polyfill * 1.0.2 - 5/23/2018 * https://github.com/nguyenj/fullscreen-polyfill#readme * (c) John Nguyen; MIT License */ !function(){"use strict";var e=["fullscreen","fullscreenEnabled","fullscreenElement","fullscreenchange","fullscreenerror","exitFullscreen","requestFullscreen"],t=["webkitIsFullScreen","webkitFullscreenEnabled","webkitFullscreenElement","webkitfullscreenchange","webkitfullscreenerror","webkitExitFullscreen","webkitRequestFullscreen"],n=["mozFullScreen","mozFullScreenEnabled","mozFullScreenElement","mozfullscreenchange","mozfullscreenerror","mozCancelFullScreen","mozRequestFullScreen"],i=["","msFullscreenEnabled","msFullscreenElement","MSFullscreenChange","MSFullscreenError","msExitFullscreen","msRequestFullscreen"];document||(document={});var r,o=(r=[e[1],t[1],n[1],i[1]].find(function(e){return document[e]}),[e,t,n,i].find(function(e){return e.find(function(e){return e===r})})||[]);function a(t,n){document[e[0]]=document[o[0]]||!!document[o[2]]||!1,document[e[1]]=document[o[1]]||!1,document[e[2]]=document[o[2]]||null,document.dispatchEvent(new Event(t),n.target)}document[e[1]]||(document[e[0]]=document[o[0]]||!!document[o[2]]||!1,document[e[1]]=document[o[1]]||!1,document[e[2]]=document[o[2]]||null,document.addEventListener(o[3],a.bind(document,e[3]),!1),document.addEventListener(o[4],a.bind(document,e[4]),!1),document[e[5]]=function(){return document[o[5]]()},Element.prototype[e[6]]=function(){return this[o[6]].apply(this,arguments)})}()},function(e,t){!function(e,t){"use strict";if("IntersectionObserver"in e&&"IntersectionObserverEntry"in e&&"intersectionRatio"in e.IntersectionObserverEntry.prototype)"isIntersecting"in e.IntersectionObserverEntry.prototype||Object.defineProperty(e.IntersectionObserverEntry.prototype,"isIntersecting",{get:function(){return this.intersectionRatio>0}});else{var n=[];r.prototype.THROTTLE_TIMEOUT=100,r.prototype.POLL_INTERVAL=null,r.prototype.USE_MUTATION_OBSERVER=!0,r.prototype.observe=function(e){if(!this._observationTargets.some(function(t){return t.element==e})){if(!e||1!=e.nodeType)throw new Error("target must be an Element");this._registerInstance(),this._observationTargets.push({element:e,entry:null}),this._monitorIntersections(),this._checkForIntersections()}},r.prototype.unobserve=function(e){this._observationTargets=this._observationTargets.filter(function(t){return t.element!=e}),this._observationTargets.length||(this._unmonitorIntersections(),this._unregisterInstance())},r.prototype.disconnect=function(){this._observationTargets=[],this._unmonitorIntersections(),this._unregisterInstance()},r.prototype.takeRecords=function(){var e=this._queuedEntries.slice();return this._queuedEntries=[],e},r.prototype._initThresholds=function(e){var t=e||[0];return Array.isArray(t)||(t=[t]),t.sort().filter(function(e,t,n){if("number"!=typeof e||isNaN(e)||e<0||e>1)throw new Error("threshold must be a number between 0 and 1 inclusively");return e!==n[t-1]})},r.prototype._parseRootMargin=function(e){var t=(e||"0px").split(/\s+/).map(function(e){var t=/^(-?\d*\.?\d+)(px|%)$/.exec(e);if(!t)throw new Error("rootMargin must be specified in pixels or percent");return{value:parseFloat(t[1]),unit:t[2]}});return t[1]=t[1]||t[0],t[2]=t[2]||t[0],t[3]=t[3]||t[1],t},r.prototype._monitorIntersections=function(){this._monitoringIntersections||(this._monitoringIntersections=!0,this.POLL_INTERVAL?this._monitoringInterval=setInterval(this._checkForIntersections,this.POLL_INTERVAL):(o(e,"resize",this._checkForIntersections,!0),o(t,"scroll",this._checkForIntersections,!0),this.USE_MUTATION_OBSERVER&&"MutationObserver"in e&&(this._domObserver=new MutationObserver(this._checkForIntersections),this._domObserver.observe(t,{attributes:!0,childList:!0,characterData:!0,subtree:!0}))))},r.prototype._unmonitorIntersections=function(){this._monitoringIntersections&&(this._monitoringIntersections=!1,clearInterval(this._monitoringInterval),this._monitoringInterval=null,a(e,"resize",this._checkForIntersections,!0),a(t,"scroll",this._checkForIntersections,!0),this._domObserver&&(this._domObserver.disconnect(),this._domObserver=null))},r.prototype._checkForIntersections=function(){var t=this._rootIsInDom(),n=t?this._getRootRect():{top:0,bottom:0,left:0,right:0,width:0,height:0};this._observationTargets.forEach(function(r){var o=r.element,a=s(o),c=this._rootContainsTarget(o),l=r.entry,u=t&&c&&this._computeTargetAndRootIntersection(o,n),h=r.entry=new i({time:e.performance&&performance.now&&performance.now(),target:o,boundingClientRect:a,rootBounds:n,intersectionRect:u});l?t&&c?this._hasCrossedThreshold(l,h)&&this._queuedEntries.push(h):l&&l.isIntersecting&&this._queuedEntries.push(h):this._queuedEntries.push(h)},this),this._queuedEntries.length&&this._callback(this.takeRecords(),this)},r.prototype._computeTargetAndRootIntersection=function(n,i){if("none"!=e.getComputedStyle(n).display){for(var r,o,a,c,u,h,d,p,f=s(n),m=l(n),v=!1;!v;){var g=null,y=1==m.nodeType?e.getComputedStyle(m):{};if("none"==y.display)return;if(m==this.root||m==t?(v=!0,g=i):m!=t.body&&m!=t.documentElement&&"visible"!=y.overflow&&(g=s(m)),g&&(r=g,o=f,a=void 0,c=void 0,u=void 0,h=void 0,d=void 0,p=void 0,a=Math.max(r.top,o.top),c=Math.min(r.bottom,o.bottom),u=Math.max(r.left,o.left),h=Math.min(r.right,o.right),p=c-a,!(f=(d=h-u)>=0&&p>=0&&{top:a,bottom:c,left:u,right:h,width:d,height:p})))break;m=l(m)}return f}},r.prototype._getRootRect=function(){var e;if(this.root)e=s(this.root);else{var n=t.documentElement,i=t.body;e={top:0,left:0,right:n.clientWidth||i.clientWidth,width:n.clientWidth||i.clientWidth,bottom:n.clientHeight||i.clientHeight,height:n.clientHeight||i.clientHeight}}return this._expandRectByRootMargin(e)},r.prototype._expandRectByRootMargin=function(e){var t=this._rootMarginValues.map(function(t,n){return"px"==t.unit?t.value:t.value*(n%2?e.width:e.height)/100}),n={top:e.top-t[0],right:e.right+t[1],bottom:e.bottom+t[2],left:e.left-t[3]};return n.width=n.right-n.left,n.height=n.bottom-n.top,n},r.prototype._hasCrossedThreshold=function(e,t){var n=e&&e.isIntersecting?e.intersectionRatio||0:-1,i=t.isIntersecting?t.intersectionRatio||0:-1;if(n!==i)for(var r=0;r0;)n[i]=arguments[i+1];return n.reduce(function(n,i){return n+e(t["border-"+i+"-width"])},0)}function n(n){var i=n.clientWidth,o=n.clientHeight;if(!i&&!o)return f;var a=getComputedStyle(n),s=function(t){for(var n={},i=0,r=["top","right","bottom","left"];i0},d.prototype.connect_=function(){a&&!this.connected_&&(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),h?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},d.prototype.disconnect_=function(){a&&this.connected_&&(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},d.prototype.onTransitionEnd_=function(e){var t=e.propertyName;l.some(function(e){return!!~t.indexOf(e)})&&this.refresh()},d.getInstance=function(){return this.instance_||(this.instance_=new d),this.instance_},d.instance_=null;var p=function(e,t){for(var n=0,i=Object.keys(t);n0};var b="undefined"!=typeof WeakMap?new WeakMap:new o,_=function(e){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var t=d.getInstance(),n=new y(e,t,this);b.set(this,n)};return["observe","unobserve","disconnect"].forEach(function(e){_.prototype[e]=function(){return(t=b.get(this))[e].apply(t,arguments);var t}}),"undefined"!=typeof ResizeObserver?ResizeObserver:_}()},function(e,t){(function(){"use strict";var e=new Set("annotation-xml color-profile font-face font-face-src font-face-uri font-face-format font-face-name missing-glyph".split(" "));function t(t){var n=e.has(t);return t=/^[a-z][.0-9_a-z]*-[\-.0-9_a-z]*$/.test(t),!n&&t}function n(e){var t=e.isConnected;if(void 0!==t)return t;for(;e&&!(e.__CE_isImportDocument||e instanceof Document);)e=e.parentNode||(window.ShadowRoot&&e instanceof ShadowRoot?e.host:void 0);return!(!e||!(e.__CE_isImportDocument||e instanceof Document))}function i(e,t){for(;t&&t!==e&&!t.nextSibling;)t=t.parentNode;return t&&t!==e?t.nextSibling:null}function r(e,t,n){n=void 0===n?new Set:n;for(var o=e;o;){if(o.nodeType===Node.ELEMENT_NODE){var a=o;t(a);var s=a.localName;if("link"===s&&"import"===a.getAttribute("rel")){if((o=a.import)instanceof Node&&!n.has(o))for(n.add(o),o=o.firstChild;o;o=o.nextSibling)r(o,t,n);o=i(e,a);continue}if("template"===s){o=i(e,a);continue}if(a=a.__CE_shadowRoot)for(a=a.firstChild;a;a=a.nextSibling)r(a,t,n)}o=o.firstChild?o.firstChild:i(e,o)}}function o(e,t,n){e[t]=n}function a(){this.a=new Map,this.g=new Map,this.c=[],this.f=[],this.b=!1}function s(e,t){e.b&&r(t,function(t){return c(e,t)})}function c(e,t){if(e.b&&!t.__CE_patched){t.__CE_patched=!0;for(var n=0;n1)for(var n=1;n.circular"+t+" {animation: rotate 2s linear infinite;height: 50px;width: 50px;}\n.loading-spinner"+t+">.circular"+t+">.path"+t+" {stroke-dasharray: 1, 200;stroke-dashoffset: 0;animation:\n dash 1.5s ease-in-out infinite,\n color 6s ease-in-out infinite;stroke-linecap: round;stroke: var(--loadingColor);}\n@keyframes rotate {100% {transform: rotate(360deg);}\n}@keyframes dash {0% {stroke-dasharray: 1, 200;stroke-dashoffset: 0;}\n50% {stroke-dasharray: 89, 200;stroke-dashoffset: -35;}\n100% {stroke-dasharray: 89, 200;stroke-dashoffset: -124;}\n}.exit-btn"+t+" {position: absolute;top: 10px;left: 10px;background: none;border: none;outline: none;width: 40px;height: 40px;z-index: 50;}\n.exit-btn-no-display"+t+" {display: none;}\n.control-prompt"+t+" {position: absolute;top: 50%;left: 50%;width: 40%;height: 40%;transform: translate(-50%, -50%);pointer-events: none;z-index: 5;}\n.control-prompt.visible"+t+" {transform: translate(-50%, -50%) scale(1);filter: drop-shadow(0px 2px 2px rgba(0,0,0, 0.25));opacity: 1;transition: transform 0.3s, opacity 0.3s;}\n.control-prompt.not-visible"+t+" {opacity: 0;transform: translate(-50%, -50%) scale(0);transition: transform 0.3s, opacity 0.3s;}\n.viewer__controls"+t+" {position: absolute;top: 10px;right: 10px;opacity: 0;transition: opacity 0.1s ease-in-out;}\n.container:hover:not(.not-visible)"+t+" .viewer__controls"+t+" {opacity: 1;z-index: 5;transition: opacity 0.1s ease-in-out;}\n.container.not-visible"+t+" .viewer__controls"+t+" {display: none;}\n[data-tooltip]"+t+" {position: relative;cursor: pointer;}\n[data-tooltip]"+t+"::before {filter: alpha(opacity=0);-ms-filter: \"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)\";-moz-opacity: 0;-khtml-opacity: 0;-webkit-transition: opacity 0.15s cubic-bezier(0.44, 0.13, 0.48, 0.87);-moz-transition: opacity 0.15s cubic-bezier(0.44, 0.13, 0.48, 0.87);-ms-transition: opacity 0.15s cubic-bezier(0.44, 0.13, 0.48, 0.87);-o-transition: opacity 0.15s cubic-bezier(0.44, 0.13, 0.48, 0.87);transition: opacity 0.15s cubic-bezier(0.44, 0.13, 0.48, 0.87);opacity: 0;background-size: 100% auto;pointer-events: none;content: '';z-index: 10;width: 0;height: 5px;border-top: 5px solid transparent;border-bottom: 5px solid transparent;border-left: 5px solid #3a3a3a;position: absolute;left: -10px;}\n[data-tooltip]"+t+'::after {filter: alpha(opacity=0);-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";-moz-opacity: 0;-khtml-opacity: 0;opacity: 0;pointer-events: none;-webkit-transition: opacity 0.15s cubic-bezier(0.44, 0.13, 0.48, 0.87);-moz-transition: opacity 0.15s cubic-bezier(0.44, 0.13, 0.48, 0.87);-ms-transition: opacity 0.15s cubic-bezier(0.44, 0.13, 0.48, 0.87);-o-transition: opacity 0.15s cubic-bezier(0.44, 0.13, 0.48, 0.87);transition: opacity 0.15s cubic-bezier(0.44, 0.13, 0.48, 0.87);background: #3a3a3a;color: #fff;content: attr(data-tooltip);padding: .3em .3em .3em .45em;position: absolute;white-space: nowrap;z-index: 10;font-size: 14px;font-weight: 500;font-style: normal;font-stretch: normal;line-height: 1.43;letter-spacing: 0.9px;right: 100%;top: 50%;-webkit-transform: translate(2px, -50%);-moz-transform: translate(2px, -50%);-ms-transform: translate(2px, -50%);transform: translate(-10px, -50%);}\n.viewer__controls-area'+t+" {display: inherit;width: 46px;}\n@media (any-hover: none) {.container:not(.not-visible)"+t+" .viewer__controls"+t+" {display: none;}\n.container:hover:not(.not-visible)"+t+" .viewer__controls"+t+" {display: none;}\n}.viewer__controls-list"+t+" {list-style: none;margin: 0;margin-block-start: 0;margin-block-end: 0;padding-inline-start: 0;}\n.viewer__controls-list"+t+" > li"+t+" {position: relative;}\n.viewer__controls-list"+t+" > li:not(:last-child)"+t+" {border-color: #ececec;border-bottom: 1px;}\n.viewer__controls-list"+t+" > li:not(:last-child)"+t+"::after {position: absolute;content: '';border-bottom: 1px solid rgba(50, 50, 50, 0.05);width: 28px;transform: translateX(8px);bottom: 0px;}\n.viewer__controls-btn"+t+" {background: white;width: 100%;height: 46px;border-radius: 0;border: none;display: flex;align-items: center;justify-content: center;font: inherit;list-style: none;outline: 0;stroke: black;padding: 0px;margin: 0px;}\n.card"+t+" {position: absolute;top: 50%;left: 50%;transform: translate(-50%, -50%);width: 80%;height: auto;background-color: white;box-shadow: 0 2px 20px rgba(0, 0, 0, 0.2);font-size: 14.5px;line-height: 1.45em;border-radius: 8px;box-sizing: border-box;z-index: 5;}\n.card-container"+t+" {opacity: 0;transition: opacity 0.4s linear;pointer-events: none;font-family: inherit;}\n.card-container.show"+t+" {opacity: 1;pointer-events: all;}\n.card.show"+t+" {z-index: 20;}\n.card__header"+t+" {display: flex;justify-content: space-between;align-items: center;padding: 5px 12px;background-color: rgb(252, 248, 248);border-radius: 6px;z-index: inherit;}\n.card__header"+t+" > h4"+t+" {margin: 0;font-size: 1.25rem;}\n.close-icon"+t+" {width: 30px;height: 30px;display: flex;justify-content: center;align-items: center;cursor: pointer;}\n.close-icon"+t+" > svg"+t+" {width: 16px;height: 16px;display: block;margin: 2px;}\n.card__desc"+t+" {margin: 0;padding: 12px;color: #333;white-space: pre-line;}\n.card__img"+t+" {width: 100%;height: 230px;object-fit: contain;object-position: center;display: block;}\n.card__video"+t+" {width: 100%;height: 230px;display: block;}\n.card__btn__container"+t+" {display: flex;font-family: inherit;padding: 0px 12px 12px;justify-content: flex-end;align-items: center;}\n.card__btn"+t+" {box-shadow: 0 3px 1px -2px rgba(0,0,0,.2), 0 2px 2px 0 rgba(0,0,0,.14), 0 1px 5px 0 rgba(0,0,0,.12);background-color: var(--marker-brand-color, #3f51b5);color: #fff;border: none;outline: 0;padding: 8px 16px;border-radius: 4px;font-size: 1rem;cursor: pointer;font-family: inherit;}\n"}];function a(e,t,n,i){const{b:r,s:o,h:a,t:s,gid:c,d:l,k:u,i:h,f:d}=e,{_m0:p,_m1:f,_m2:m,_m3:v,_m4:g,_m5:y,_m6:b,_m7:_}=i;return[o("annotation-slot",{styleMap:{display:"none"},attrs:{name:"annotation-slot"},key:2,on:{slotchange:p||(i._m0=r(t.onslotchange))}},[],n),a("a",{classMap:{trigger:!0},styleMap:{display:"none"},attrs:{href:"",rel:"ar"},key:3},[a("img",{key:4},[])]),a("div",{classMap:{"backdrop-container":!0},key:5},[t._backdropImage?a("img",{classMap:{backdrop:!0},attrs:{src:t._backdropImage,alt:t.title},key:7},[]):null]),a("div",{classMap:{"trigger-container":!0},key:8},[a("button",{classMap:{"ar-trigger-view":!0},styleMap:{display:"none"},key:9},[a("img",{classMap:{"ar-trigger-img":!0},attrs:{alt:"",src:"https://cdn.scapic.com/unified-viewer/ARKit_Glyph.svg"},key:10},[]),a("div",{classMap:{arParent_ios_text:!0},key:11},[s("View in your space")])])]),a("div",{classMap:{container:!0,"not-visible":!0},key:12},d([t.disableZoomControls?null:a("button",{className:t._getExitButtonClass,key:14,on:{click:f||(i._m1=r(t._handleExitFullScreen))}},[a("svg",{attrs:{height:"100%",width:"100%",fill:"#000000",x:"0px",y:"0px",viewBox:"0 0 100 100","enable-background":"new 0 0 100 100","xml:space":"preserve"},key:15},[a("g",{attrs:{fill:"#000000"},key:16},[a("polygon",{attrs:{points:"83.586,86.414 50,52.828 16.414,86.414 13.586,83.586 47.171,50 13.586,16.415 16.414,13.586 50,47.171 83.586,13.586 86.414,16.414 52.828,50 86.414,83.586"},key:17},[])])])]),t.disableZoomControls?null:a("div",{classMap:{viewer__controls:!0},key:18},[a("div",{classMap:{"viewer__controls-area":!0},key:19},[a("ul",{classMap:{"viewer__controls-list":!0},key:20},[a("li",{key:21},[a("button",{classMap:{"viewer__controls-btn":!0,"viewer__zoom-in-btn":!0},attrs:{"data-tooltip":"Zoom in (+)"},key:22,on:{click:m||(i._m2=r(t._zoomIn))}},[a("svg",{classMap:{"icon-zoom-in":!0},attrs:{"aria-hidden":"true",focusable:"false",role:"presentation",width:"18",height:"18",viewBox:"0 0 18 18"},key:23},[a("path",{attrs:{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 1v16M17 9H1"},key:24},[])])])]),a("li",{key:25},[a("button",{classMap:{"viewer__controls-btn":!0,"viewer__zoom-out-btn":!0},attrs:{"data-tooltip":"Zoom out (-)"},key:26,on:{click:v||(i._m3=r(t._zoomOut))}},[a("svg",{classMap:{"icon-zoom-out":!0},attrs:{"aria-hidden":"true",focusable:"false",role:"presentation",width:"18",height:"2",viewBox:"0 0 18 2"},key:27},[a("path",{attrs:{fill:"none","fill-rule":"evenodd","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M17 1H1.082"},key:28},[])])])]),a("li",{key:29},[a("button",{classMap:{"viewer__controls-btn":!0,"viewer__fullscreen-btn":!0},attrs:{"data-tooltip":"Full screen (f)"},key:30,on:{click:g||(i._m4=r(t._dispatchFullscreenBtn))}},[t._fullScreen?a("svg",{classMap:{"icon-exit-fullscreen":!0},attrs:{"aria-hidden":"true",focusable:"false",role:"presentation",width:"18",height:"18",viewBox:"0 0 18 18"},key:32},[a("path",{attrs:{fill:"none","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M17 5h-4V1M1 13h4v4M13 17v-4h4M5 1v4H1"},key:33},[])]):null,t._fullScreen?null:a("svg",{classMap:{"icon-enter-fullscreen":!0},attrs:{"aria-hidden":"true",focusable:"false",role:"presentation",width:"18",height:"18",viewBox:"0 0 18 18"},key:35},[a("path",{attrs:{fill:"none","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M13 1h4v4M5 17H1v-4M17 13v4h-4M1 5V1h4"},key:36},[])])])])])])]),a("canvas",{styleMap:{width:"inherit",height:"inherit"},attrs:{tabindex:"0",id:c("canvas")},key:37},[]),t._disableInteractionPrompt?null:a("img",{className:t._interactionHelperClass,attrs:{src:"https://cdn.scapic.com/unified-viewer/controlPrompt.svg",alt:""},key:39},[]),a("div",{className:t._loaderClassName,key:40},[t.isLoaderTypeSpinner?a("svg",{classMap:{circular:!0},attrs:{height:"50",width:"50"},key:42},[a("circle",{classMap:{path:!0},attrs:{cx:"25",cy:"25",r:"20",fill:"none","stroke-width":"6","stroke-miterlimit":"10"},key:43},[])]):null,t.isLoaderTypeImage?a("div",{classMap:{fill:!0,img__bg:!0},key:45},[]):null]),h(t._markers,function(e){return a("div",{classMap:{"card-container":!0},key:u(47,e.name)},[a("div",{classMap:{overlay:!0},key:48,on:{click:y||(i._m5=r(t._deactiveActiveMarker))}},[]),a("div",{classMap:{card:!0},attrs:{id:c(e.name)},key:49},[a("div",{classMap:{card__header:!0},key:50},[a("h4",{key:51},[l(e.title)]),a("div",{classMap:{"close-icon":!0},key:52,on:{click:b||(i._m6=r(t._deactiveActiveMarker))}},[a("svg",{attrs:{width:"90",height:"90",viewBox:"0 0 90 90",xmlns:"http://www.w3.org/2000/svg"},key:53},[a("path",{attrs:{d:"M55.386 44.999l32.461-32.461c2.87-2.869 2.87-7.517 0-10.386-2.869-2.87-7.517-2.87-10.386 0L45 34.613 12.538 2.152c-2.869-2.87-7.517-2.87-10.386 0-2.87 2.869-2.87 7.517 0 10.386l32.461 32.461L2.152 77.461c-2.87 2.869-2.87 7.517 0 10.386C3.587 89.283 5.466 90 7.345 90c1.879 0 3.758-.717 5.193-2.152L45 55.386l32.462 32.461C78.896 89.283 80.776 90 82.655 90c1.88 0 3.759-.717 5.193-2.152 2.87-2.869 2.87-7.517 0-10.386L55.386 44.999z",fill:"#000","fill-rule":"evenodd"},key:54},[])])])]),a("p",{classMap:{card__desc:!0},key:55},[l(e.description)]),e.image?a("img",{classMap:{card__img:!0},attrs:{src:e.image},key:57},[]):null,e.video?a("iframe",{classMap:{card__video:!0},attrs:{src:e.video,allow:"accelerometer; encrypted-media; gyroscope; picture-in-picture;",allowfullscreen:!0,frameborder:"0"},key:59},[]):null,e.button.text?a("div",{classMap:{card__btn__container:!0},key:61},[a("button",{classMap:{card__btn:!0},attrs:{"data-url":e.button.url},key:62,on:{click:_||(i._m7=r(t._navigateCTAButton))}},[l(e.button.text)])]):null])])})]))]}var s=Object(r.registerTemplate)(a);function c(){}a.slots=["annotation-slot"],a.stylesheets=[],o&&a.stylesheets.push.apply(a.stylesheets,o),a.stylesheetTokens={hostAttribute:"viewer-viewer.html-_viewer-host",shadowAttribute:"viewer-viewer.html-_viewer"},void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52)),void 0===Number.isInteger&&(Number.isInteger=function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e}),void 0===Math.sign&&(Math.sign=function(e){return e<0?-1:e>0?1:+e}),"name"in Function.prototype==!1&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*([^\(\s]*)/)[1]}}),void 0===Object.assign&&(Object.assign=function(e){if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),n=1;n>8&255]+e[t>>16&255]+e[t>>24&255]+"-"+e[255&n]+e[n>>8&255]+"-"+e[n>>16&15|64]+e[n>>24&255]+"-"+e[63&i|128]+e[i>>8&255]+"-"+e[i>>16&255]+e[i>>24&255]+e[255&r]+e[r>>8&255]+e[r>>16&255]+e[r>>24&255]).toUpperCase()}}(),clamp:function(e,t,n){return Math.max(t,Math.min(n,e))},euclideanModulo:function(e,t){return(e%t+t)%t},mapLinear:function(e,t,n,i,r){return i+(e-t)*(r-i)/(n-t)},lerp:function(e,t,n){return(1-n)*e+n*t},smoothstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*(3-2*e)},smootherstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*e*(e*(6*e-15)+10)},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},degToRad:function(e){return e*vn.DEG2RAD},radToDeg:function(e){return e*vn.RAD2DEG},isPowerOfTwo:function(e){return 0==(e&e-1)&&0!==e},ceilPowerOfTwo:function(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))},floorPowerOfTwo:function(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))}};function gn(e,t){this.x=e||0,this.y=t||0}function yn(e,t,n,i){this._x=e||0,this._y=t||0,this._z=n||0,this._w=void 0!==i?i:1}function bn(e,t,n){this.x=e||0,this.y=t||0,this.z=n||0}function _n(){this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}Object.defineProperties(gn.prototype,{width:{get:function(){return this.x},set:function(e){this.x=e}},height:{get:function(){return this.y},set:function(e){this.y=e}}}),Object.assign(gn.prototype,{isVector2:!0,set:function(e,t){return this.x=e,this.y=t,this},setScalar:function(e){return this.x=e,this.y=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setComponent:function(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:function(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(e){return this.x=e.x,this.y=e.y,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this)},addScalar:function(e){return this.x+=e,this.y+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this)},subScalar:function(e){return this.x-=e,this.y-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this},multiply:function(e){return this.x*=e.x,this.y*=e.y,this},multiplyScalar:function(e){return this.x*=e,this.y*=e,this},divide:function(e){return this.x/=e.x,this.y/=e.y,this},divideScalar:function(e){return this.multiplyScalar(1/e)},applyMatrix3:function(e){var t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this},clampScalar:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this},clampLength:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(e){return this.x*e.x+this.y*e.y},cross:function(e){return this.x*e.y-this.y*e.x},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length()||1)},angle:function(){var e=Math.atan2(this.y,this.x);return e<0&&(e+=2*Math.PI),e},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,n=this.y-e.y;return t*t+n*n},manhattanDistanceTo:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this},lerpVectors:function(e,t,n){return this.subVectors(t,e).multiplyScalar(n).add(e)},equals:function(e){return e.x===this.x&&e.y===this.y},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e},fromBufferAttribute:function(e,t,n){return void 0!==n&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this},rotateAround:function(e,t){var n=Math.cos(t),i=Math.sin(t),r=this.x-e.x,o=this.y-e.y;return this.x=r*n-o*i+e.x,this.y=r*i+o*n+e.y,this}}),Object.assign(yn,{slerp:function(e,t,n,i){return n.copy(e).slerp(t,i)},slerpFlat:function(e,t,n,i,r,o,a){var s=n[i+0],c=n[i+1],l=n[i+2],u=n[i+3],h=r[o+0],d=r[o+1],p=r[o+2],f=r[o+3];if(u!==f||s!==h||c!==d||l!==p){var m=1-a,v=s*h+c*d+l*p+u*f,g=v>=0?1:-1,y=1-v*v;if(y>Number.EPSILON){var b=Math.sqrt(y),_=Math.atan2(b,v*g);m=Math.sin(m*_)/b,a=Math.sin(a*_)/b}var x=a*g;if(s=s*m+h*x,c=c*m+d*x,l=l*m+p*x,u=u*m+f*x,m===1-a){var w=1/Math.sqrt(s*s+c*c+l*l+u*u);s*=w,c*=w,l*=w,u*=w}}e[t]=s,e[t+1]=c,e[t+2]=l,e[t+3]=u}}),Object.defineProperties(yn.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._onChangeCallback()}},y:{get:function(){return this._y},set:function(e){this._y=e,this._onChangeCallback()}},z:{get:function(){return this._z},set:function(e){this._z=e,this._onChangeCallback()}},w:{get:function(){return this._w},set:function(e){this._w=e,this._onChangeCallback()}}}),Object.assign(yn.prototype,{isQuaternion:!0,set:function(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this},setFromEuler:function(e,t){if(!e||!e.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var n=e._x,i=e._y,r=e._z,o=e.order,a=Math.cos,s=Math.sin,c=a(n/2),l=a(i/2),u=a(r/2),h=s(n/2),d=s(i/2),p=s(r/2);return"XYZ"===o?(this._x=h*l*u+c*d*p,this._y=c*d*u-h*l*p,this._z=c*l*p+h*d*u,this._w=c*l*u-h*d*p):"YXZ"===o?(this._x=h*l*u+c*d*p,this._y=c*d*u-h*l*p,this._z=c*l*p-h*d*u,this._w=c*l*u+h*d*p):"ZXY"===o?(this._x=h*l*u-c*d*p,this._y=c*d*u+h*l*p,this._z=c*l*p+h*d*u,this._w=c*l*u-h*d*p):"ZYX"===o?(this._x=h*l*u-c*d*p,this._y=c*d*u+h*l*p,this._z=c*l*p-h*d*u,this._w=c*l*u+h*d*p):"YZX"===o?(this._x=h*l*u+c*d*p,this._y=c*d*u+h*l*p,this._z=c*l*p-h*d*u,this._w=c*l*u-h*d*p):"XZY"===o&&(this._x=h*l*u-c*d*p,this._y=c*d*u-h*l*p,this._z=c*l*p+h*d*u,this._w=c*l*u+h*d*p),!1!==t&&this._onChangeCallback(),this},setFromAxisAngle:function(e,t){var n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this},setFromRotationMatrix:function(e){var t,n=e.elements,i=n[0],r=n[4],o=n[8],a=n[1],s=n[5],c=n[9],l=n[2],u=n[6],h=n[10],d=i+s+h;return d>0?(t=.5/Math.sqrt(d+1),this._w=.25/t,this._x=(u-c)*t,this._y=(o-l)*t,this._z=(a-r)*t):i>s&&i>h?(t=2*Math.sqrt(1+i-s-h),this._w=(u-c)/t,this._x=.25*t,this._y=(r+a)/t,this._z=(o+l)/t):s>h?(t=2*Math.sqrt(1+s-i-h),this._w=(o-l)/t,this._x=(r+a)/t,this._y=.25*t,this._z=(c+u)/t):(t=2*Math.sqrt(1+h-i-s),this._w=(a-r)/t,this._x=(o+l)/t,this._y=(c+u)/t,this._z=.25*t),this._onChangeCallback(),this},setFromUnitVectors:function(e,t){var n=e.dot(t)+1;return n<1e-6?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(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=n),this.normalize()},angleTo:function(e){return 2*Math.acos(Math.abs(vn.clamp(this.dot(e),-1,1)))},rotateTowards:function(e,t){var n=this.angleTo(e);if(0===n)return this;var i=Math.min(1,t/n);return this.slerp(e,i),this},inverse:function(){return this.conjugate()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this},dot:function(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(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:function(e,t){return void 0!==t?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(e,t)):this.multiplyQuaternions(this,e)},premultiply:function(e){return this.multiplyQuaternions(e,this)},multiplyQuaternions:function(e,t){var n=e._x,i=e._y,r=e._z,o=e._w,a=t._x,s=t._y,c=t._z,l=t._w;return this._x=n*l+o*a+i*c-r*s,this._y=i*l+o*s+r*a-n*c,this._z=r*l+o*c+n*s-i*a,this._w=o*l-n*a-i*s-r*c,this._onChangeCallback(),this},slerp:function(e,t){if(0===t)return this;if(1===t)return this.copy(e);var n=this._x,i=this._y,r=this._z,o=this._w,a=o*e._w+n*e._x+i*e._y+r*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=o,this._x=n,this._y=i,this._z=r,this;var s=1-a*a;if(s<=Number.EPSILON){var c=1-t;return this._w=c*o+t*this._w,this._x=c*n+t*this._x,this._y=c*i+t*this._y,this._z=c*r+t*this._z,this.normalize(),this._onChangeCallback(),this}var l=Math.sqrt(s),u=Math.atan2(l,a),h=Math.sin((1-t)*u)/l,d=Math.sin(t*u)/l;return this._w=o*h+this._w*d,this._x=n*h+this._x*d,this._y=i*h+this._y*d,this._z=r*h+this._z*d,this._onChangeCallback(),this},equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w},fromArray:function(e,t){return void 0===t&&(t=0),this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e},_onChange:function(e){return this._onChangeCallback=e,this},_onChangeCallback:function(){}}),Object.assign(bn.prototype,{isVector3:!0,set:function(e,t,n){return this.x=e,this.y=t,this.z=n,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(e,t)):(this.x*=e.x,this.y*=e.y,this.z*=e.z,this)},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this},multiplyVectors:function(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this},applyEuler:(u=new yn,function(e){return e&&e.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(u.setFromEuler(e))}),applyAxisAngle:function(){var e=new yn;return function(t,n){return this.applyQuaternion(e.setFromAxisAngle(t,n))}}(),applyMatrix3:function(e){var t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6]*i,this.y=r[1]*t+r[4]*n+r[7]*i,this.z=r[2]*t+r[5]*n+r[8]*i,this},applyMatrix4:function(e){var t=this.x,n=this.y,i=this.z,r=e.elements,o=1/(r[3]*t+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*t+r[4]*n+r[8]*i+r[12])*o,this.y=(r[1]*t+r[5]*n+r[9]*i+r[13])*o,this.z=(r[2]*t+r[6]*n+r[10]*i+r[14])*o,this},applyQuaternion:function(e){var t=this.x,n=this.y,i=this.z,r=e.x,o=e.y,a=e.z,s=e.w,c=s*t+o*i-a*n,l=s*n+a*t-r*i,u=s*i+r*n-o*t,h=-r*t-o*n-a*i;return this.x=c*s+h*-r+l*-a-u*-o,this.y=l*s+h*-o+u*-r-c*-a,this.z=u*s+h*-a+c*-o-l*-r,this},project:function(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)},unproject:function(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)},transformDirection:function(e){var t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[4]*n+r[8]*i,this.y=r[1]*t+r[5]*n+r[9]*i,this.z=r[2]*t+r[6]*n+r[10]*i,this.normalize()},divide:function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this},divideScalar:function(e){return this.multiplyScalar(1/e)},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this},clampScalar:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this},clampLength:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this},lerpVectors:function(e,t,n){return this.subVectors(t,e).multiplyScalar(n).add(e)},cross:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(e,t)):this.crossVectors(this,e)},crossVectors:function(e,t){var n=e.x,i=e.y,r=e.z,o=t.x,a=t.y,s=t.z;return this.x=i*s-r*a,this.y=r*o-n*s,this.z=n*a-i*o,this},projectOnVector:function(e){var t=e.dot(this)/e.lengthSq();return this.copy(e).multiplyScalar(t)},projectOnPlane:(l=new bn,function(e){return l.copy(this).projectOnVector(e),this.sub(l)}),reflect:function(){var e=new bn;return function(t){return this.sub(e.copy(t).multiplyScalar(2*this.dot(t)))}}(),angleTo:function(e){var t=this.dot(e)/Math.sqrt(this.lengthSq()*e.lengthSq());return Math.acos(vn.clamp(t,-1,1))},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i},manhattanDistanceTo:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)},setFromSpherical:function(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)},setFromSphericalCoords:function(e,t,n){var i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this},setFromCylindrical:function(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)},setFromCylindricalCoords:function(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this},setFromMatrixPosition:function(e){var t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this},setFromMatrixScale:function(e){var t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this},setFromMatrixColumn:function(e,t){return this.fromArray(e.elements,4*t)},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e},fromBufferAttribute:function(e,t,n){return void 0!==n&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}}),Object.assign(_n.prototype,{isMatrix3:!0,set:function(e,t,n,i,r,o,a,s,c){var l=this.elements;return l[0]=e,l[1]=i,l[2]=a,l[3]=t,l[4]=r,l[5]=s,l[6]=n,l[7]=o,l[8]=c,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(e){var t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this},setFromMatrix4:function(e){var 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},applyToBufferAttribute:function(e){void 0===h&&(h=new bn);for(var t=0,n=e.count;t2048||t.height>2048?t.toDataURL("image/jpeg",.6):t.toDataURL("image/png")}},Rn=0;function On(e,t,n,i,r,o,a,s,c,l){Object.defineProperty(this,"id",{value:Rn++}),this.uuid=vn.generateUUID(),this.name="",this.image=void 0!==e?e:On.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==t?t:On.DEFAULT_MAPPING,this.wrapS=void 0!==n?n:Ae,this.wrapT=void 0!==i?i:Ae,this.magFilter=void 0!==r?r:Ie,this.minFilter=void 0!==o?o:Fe,this.anisotropy=void 0!==c?c:1,this.format=void 0!==a?a:Qe,this.type=void 0!==s?s:Ue,this.offset=new gn(0,0),this.repeat=new gn(1,1),this.center=new gn(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new _n,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=void 0!==l?l:Gt,this.version=0,this.onUpdate=null}function Dn(e,t,n,i){this.x=e||0,this.y=t||0,this.z=n||0,this.w=void 0!==i?i:1}function In(e,t,n){this.width=e,this.height=t,this.scissor=new Dn(0,0,e,t),this.scissorTest=!1,this.viewport=new Dn(0,0,e,t),n=n||{},this.texture=new On(void 0,void 0,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),this.texture.image={},this.texture.image.width=e,this.texture.image.height=t,this.texture.generateMipmaps=void 0!==n.generateMipmaps&&n.generateMipmaps,this.texture.minFilter=void 0!==n.minFilter?n.minFilter:Ie,this.depthBuffer=void 0===n.depthBuffer||n.depthBuffer,this.stencilBuffer=void 0===n.stencilBuffer||n.stencilBuffer,this.depthTexture=void 0!==n.depthTexture?n.depthTexture:null}function kn(e,t,n){In.call(this,e,t,n),this.samples=4}function Nn(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}function Fn(e,t,n,i){this._x=e||0,this._y=t||0,this._z=n||0,this._order=i||Fn.DefaultOrder}function Bn(){this.mask=1}On.DEFAULT_IMAGE=void 0,On.DEFAULT_MAPPING=ye,On.prototype=Object.assign(Object.create(c.prototype),{constructor:On,isTexture:!0,updateMatrix:function(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.name=e.name,this.image=e.image,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.encoding=e.encoding,this},toJSON:function(e){var t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.textures[this.uuid])return e.textures[this.uuid];var n={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};if(void 0!==this.image){var i=this.image;if(void 0===i.uuid&&(i.uuid=vn.generateUUID()),!t&&void 0===e.images[i.uuid]){var r;if(Array.isArray(i)){r=[];for(var o=0,a=i.length;o1)switch(this.wrapS){case Se:e.x=e.x-Math.floor(e.x);break;case Ae:e.x=e.x<0?0:1;break;case Ce: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 Se:e.y=e.y-Math.floor(e.y);break;case Ae:e.y=e.y<0?0:1;break;case Ce: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}}),Object.defineProperty(On.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),Object.defineProperties(Dn.prototype,{width:{get:function(){return this.z},set:function(e){this.z=e}},height:{get:function(){return this.w},set:function(e){this.w=e}}}),Object.assign(Dn.prototype,{isVector4:!0,set:function(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this.w=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setW:function(e){return this.w=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this},addScaledVector:function(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:function(e,t){return void 0!==t?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this},applyMatrix4:function(e){var t=this.x,n=this.y,i=this.z,r=this.w,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*i+o[12]*r,this.y=o[1]*t+o[5]*n+o[9]*i+o[13]*r,this.z=o[2]*t+o[6]*n+o[10]*i+o[14]*r,this.w=o[3]*t+o[7]*n+o[11]*i+o[15]*r,this},divideScalar:function(e){return this.multiplyScalar(1/e)},setAxisAngleFromQuaternion:function(e){this.w=2*Math.acos(e.w);var 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:function(e){var t,n,i,r,o=e.elements,a=o[0],s=o[4],c=o[8],l=o[1],u=o[5],h=o[9],d=o[2],p=o[6],f=o[10];if(Math.abs(s-l)<.01&&Math.abs(c-d)<.01&&Math.abs(h-p)<.01){if(Math.abs(s+l)<.1&&Math.abs(c+d)<.1&&Math.abs(h+p)<.1&&Math.abs(a+u+f-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;var m=(a+1)/2,v=(u+1)/2,g=(f+1)/2,y=(s+l)/4,b=(c+d)/4,_=(h+p)/4;return m>v&&m>g?m<.01?(n=0,i=.707106781,r=.707106781):(i=y/(n=Math.sqrt(m)),r=b/n):v>g?v<.01?(n=.707106781,i=0,r=.707106781):(n=y/(i=Math.sqrt(v)),r=_/i):g<.01?(n=.707106781,i=.707106781,r=0):(n=b/(r=Math.sqrt(g)),i=_/r),this.set(n,i,r,t),this}var x=Math.sqrt((p-h)*(p-h)+(c-d)*(c-d)+(l-s)*(l-s));return Math.abs(x)<.001&&(x=1),this.x=(p-h)/x,this.y=(c-d)/x,this.z=(l-s)/x,this.w=Math.acos((a+u+f-1)/2),this},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this},clampScalar:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this},clampLength:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))},floor:function(){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:function(){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:function(){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:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this},lerpVectors:function(e,t,n){return this.subVectors(t,e).multiplyScalar(n).add(e)},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e},fromBufferAttribute:function(e,t,n){return void 0!==n&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}}),In.prototype=Object.assign(Object.create(c.prototype),{constructor:In,isWebGLRenderTarget:!0,setSize:function(e,t){this.width===e&&this.height===t||(this.width=e,this.height=t,this.texture.image.width=e,this.texture.image.height=t,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.width=e.width,this.height=e.height,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.depthTexture=e.depthTexture,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),kn.prototype=Object.assign(Object.create(In.prototype),{constructor:kn,isWebGLMultisampleRenderTarget:!0,copy:function(e){return In.prototype.copy.call(this,e),this.samples=e.samples,this}}),Object.assign(Nn.prototype,{isMatrix4:!0,set:function(e,t,n,i,r,o,a,s,c,l,u,h,d,p,f,m){var v=this.elements;return v[0]=e,v[4]=t,v[8]=n,v[12]=i,v[1]=r,v[5]=o,v[9]=a,v[13]=s,v[2]=c,v[6]=l,v[10]=u,v[14]=h,v[3]=d,v[7]=p,v[11]=f,v[15]=m,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},clone:function(){return(new Nn).fromArray(this.elements)},copy:function(e){var t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this},copyPosition:function(e){var t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this},extractBasis:function(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this},makeBasis:function(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this},extractRotation:function(){var e=new bn;return function(t){var n=this.elements,i=t.elements,r=1/e.setFromMatrixColumn(t,0).length(),o=1/e.setFromMatrixColumn(t,1).length(),a=1/e.setFromMatrixColumn(t,2).length();return n[0]=i[0]*r,n[1]=i[1]*r,n[2]=i[2]*r,n[3]=0,n[4]=i[4]*o,n[5]=i[5]*o,n[6]=i[6]*o,n[7]=0,n[8]=i[8]*a,n[9]=i[9]*a,n[10]=i[10]*a,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this}}(),makeRotationFromEuler:function(e){e&&e.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var t=this.elements,n=e.x,i=e.y,r=e.z,o=Math.cos(n),a=Math.sin(n),s=Math.cos(i),c=Math.sin(i),l=Math.cos(r),u=Math.sin(r);if("XYZ"===e.order){var h=o*l,d=o*u,p=a*l,f=a*u;t[0]=s*l,t[4]=-s*u,t[8]=c,t[1]=d+p*c,t[5]=h-f*c,t[9]=-a*s,t[2]=f-h*c,t[6]=p+d*c,t[10]=o*s}else if("YXZ"===e.order){var m=s*l,v=s*u,g=c*l,y=c*u;t[0]=m+y*a,t[4]=g*a-v,t[8]=o*c,t[1]=o*u,t[5]=o*l,t[9]=-a,t[2]=v*a-g,t[6]=y+m*a,t[10]=o*s}else if("ZXY"===e.order){m=s*l,v=s*u,g=c*l,y=c*u;t[0]=m-y*a,t[4]=-o*u,t[8]=g+v*a,t[1]=v+g*a,t[5]=o*l,t[9]=y-m*a,t[2]=-o*c,t[6]=a,t[10]=o*s}else if("ZYX"===e.order){h=o*l,d=o*u,p=a*l,f=a*u;t[0]=s*l,t[4]=p*c-d,t[8]=h*c+f,t[1]=s*u,t[5]=f*c+h,t[9]=d*c-p,t[2]=-c,t[6]=a*s,t[10]=o*s}else if("YZX"===e.order){var b=o*s,_=o*c,x=a*s,w=a*c;t[0]=s*l,t[4]=w-b*u,t[8]=x*u+_,t[1]=u,t[5]=o*l,t[9]=-a*l,t[2]=-c*l,t[6]=_*u+x,t[10]=b-w*u}else if("XZY"===e.order){b=o*s,_=o*c,x=a*s,w=a*c;t[0]=s*l,t[4]=-u,t[8]=c*l,t[1]=b*u+w,t[5]=o*l,t[9]=_*u-x,t[2]=x*u-_,t[6]=a*l,t[10]=w*u+b}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},makeRotationFromQuaternion:(Sn=new bn(0,0,0),An=new bn(1,1,1),function(e){return this.compose(Sn,e,An)}),lookAt:(Mn=new bn,En=new bn,Tn=new bn,function(e,t,n){var i=this.elements;return Tn.subVectors(e,t),0===Tn.lengthSq()&&(Tn.z=1),Tn.normalize(),Mn.crossVectors(n,Tn),0===Mn.lengthSq()&&(1===Math.abs(n.z)?Tn.x+=1e-4:Tn.z+=1e-4,Tn.normalize(),Mn.crossVectors(n,Tn)),Mn.normalize(),En.crossVectors(Tn,Mn),i[0]=Mn.x,i[4]=En.x,i[8]=Tn.x,i[1]=Mn.y,i[5]=En.y,i[9]=Tn.y,i[2]=Mn.z,i[6]=En.z,i[10]=Tn.z,this}),multiply:function(e,t){return void 0!==t?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(e,t)):this.multiplyMatrices(this,e)},premultiply:function(e){return this.multiplyMatrices(e,this)},multiplyMatrices:function(e,t){var n=e.elements,i=t.elements,r=this.elements,o=n[0],a=n[4],s=n[8],c=n[12],l=n[1],u=n[5],h=n[9],d=n[13],p=n[2],f=n[6],m=n[10],v=n[14],g=n[3],y=n[7],b=n[11],_=n[15],x=i[0],w=i[4],M=i[8],E=i[12],T=i[1],S=i[5],A=i[9],C=i[13],P=i[2],L=i[6],R=i[10],O=i[14],D=i[3],I=i[7],k=i[11],N=i[15];return r[0]=o*x+a*T+s*P+c*D,r[4]=o*w+a*S+s*L+c*I,r[8]=o*M+a*A+s*R+c*k,r[12]=o*E+a*C+s*O+c*N,r[1]=l*x+u*T+h*P+d*D,r[5]=l*w+u*S+h*L+d*I,r[9]=l*M+u*A+h*R+d*k,r[13]=l*E+u*C+h*O+d*N,r[2]=p*x+f*T+m*P+v*D,r[6]=p*w+f*S+m*L+v*I,r[10]=p*M+f*A+m*R+v*k,r[14]=p*E+f*C+m*O+v*N,r[3]=g*x+y*T+b*P+_*D,r[7]=g*w+y*S+b*L+_*I,r[11]=g*M+y*A+b*R+_*k,r[15]=g*E+y*C+b*O+_*N,this},multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this},applyToBufferAttribute:function(){var e=new bn;return function(t){for(var n=0,i=t.count;n1){for(var t=0;t1){for(var t=0;t0){i.children=[];for(s=0;s0&&(n.geometries=h),d.length>0&&(n.materials=d),p.length>0&&(n.textures=p),f.length>0&&(n.images=f),a.length>0&&(n.shapes=a)}return n.object=i,n;function m(e){var t=[];for(var n in e){var i=e[n];delete i.metadata,t.push(i)}return t}},clone:function(e){return(new this.constructor).copy(this,e)},copy:function(e,t){if(void 0===t&&(t=!0),this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),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.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(var n=0;nr&&(r=l),u>o&&(o=u),h>a&&(a=h)}return this.min.set(t,n,i),this.max.set(r,o,a),this},setFromBufferAttribute:function(e){for(var t=1/0,n=1/0,i=1/0,r=-1/0,o=-1/0,a=-1/0,s=0,c=e.count;sr&&(r=l),u>o&&(o=u),h>a&&(a=h)}return this.min.set(t,n,i),this.max.set(r,o,a),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,n=e.length;tthis.max.x||e.ythis.max.y||e.zthis.max.z)},containsBox:function(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:function(e,t){return void 0===t&&(console.warn("THREE.Box3: .getParameter() target is now required"),t=new bn),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:function(e){return!(e.max.xthis.max.x||e.max.ythis.max.y||e.max.zthis.max.z)},intersectsSphere:(Wn=new bn,function(e){return this.clampPoint(e.center,Wn),Wn.distanceToSquared(e.center)<=e.radius*e.radius}),intersectsPlane:function(e){var t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant},intersectsTriangle:function(){var e=new bn,t=new bn,n=new bn,i=new bn,r=new bn,o=new bn,a=new bn,s=new bn,c=new bn,l=new bn;function u(i){var r,o;for(r=0,o=i.length-3;r<=o;r+=3){a.fromArray(i,r);var s=c.x*Math.abs(a.x)+c.y*Math.abs(a.y)+c.z*Math.abs(a.z),l=e.dot(a),u=t.dot(a),h=n.dot(a);if(Math.max(-Math.max(l,u,h),Math.min(l,u,h))>s)return!1}return!0}return function(a){if(this.isEmpty())return!1;this.getCenter(s),c.subVectors(this.max,s),e.subVectors(a.a,s),t.subVectors(a.b,s),n.subVectors(a.c,s),i.subVectors(t,e),r.subVectors(n,t),o.subVectors(e,n);var h=[0,-i.z,i.y,0,-r.z,r.y,0,-o.z,o.y,i.z,0,-i.x,r.z,0,-r.x,o.z,0,-o.x,-i.y,i.x,0,-r.y,r.x,0,-o.y,o.x,0];return!!u(h)&&(!!u(h=[1,0,0,0,1,0,0,0,1])&&(l.crossVectors(i,r),u(h=[l.x,l.y,l.z])))}}(),clampPoint:function(e,t){return void 0===t&&(console.warn("THREE.Box3: .clampPoint() target is now required"),t=new bn),t.copy(e).clamp(this.min,this.max)},distanceToPoint:function(){var e=new bn;return function(t){return e.copy(t).clamp(this.min,this.max).sub(t).length()}}(),getBoundingSphere:function(){var e=new bn;return function(t){return void 0===t&&console.error("THREE.Box3: .getBoundingSphere() target is now required"),this.getCenter(t.center),t.radius=.5*this.getSize(e).length(),t}}(),intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},applyMatrix4:(Vn=[new bn,new bn,new bn,new bn,new bn,new bn,new bn,new bn],function(e){return this.isEmpty()?this:(Vn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Vn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Vn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Vn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Vn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Vn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Vn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Vn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Vn),this)}),translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}),Object.assign(li.prototype,{set:function(e,t){return this.center.copy(e),this.radius=t,this},setFromPoints:function(e,t){void 0===qn&&(qn=new ci);var n=this.center;void 0!==t?n.copy(t):qn.setFromPoints(e).getCenter(n);for(var i=0,r=0,o=e.length;rthis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t},getBoundingBox:function(e){return void 0===e&&(console.warn("THREE.Sphere: .getBoundingBox() target is now required"),e=new ci),e.set(this.center,this.center),e.expandByScalar(this.radius),e},applyMatrix4:function(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this},translate:function(e){return this.center.add(e),this},equals:function(e){return e.center.equals(this.center)&&e.radius===this.radius}}),Object.assign(ui.prototype,{set:function(e,t){return this.origin.copy(e),this.direction.copy(t),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this},at:function(e,t){return void 0===t&&(console.warn("THREE.Ray: .at() target is now required"),t=new bn),t.copy(this.direction).multiplyScalar(e).add(this.origin)},lookAt:function(e){return this.direction.copy(e).sub(this.origin).normalize(),this},recast:function(){var e=new bn;return function(t){return this.origin.copy(this.at(t,e)),this}}(),closestPointToPoint:function(e,t){void 0===t&&(console.warn("THREE.Ray: .closestPointToPoint() target is now required"),t=new bn),t.subVectors(e,this.origin);var n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.direction).multiplyScalar(n).add(this.origin)},distanceToPoint:function(e){return Math.sqrt(this.distanceSqToPoint(e))},distanceSqToPoint:function(){var e=new bn;return function(t){var n=e.subVectors(t,this.origin).dot(this.direction);return n<0?this.origin.distanceToSquared(t):(e.copy(this.direction).multiplyScalar(n).add(this.origin),e.distanceToSquared(t))}}(),distanceSqToSegment:(Yn=new bn,$n=new bn,Jn=new bn,function(e,t,n,i){Yn.copy(e).add(t).multiplyScalar(.5),$n.copy(t).sub(e).normalize(),Jn.copy(this.origin).sub(Yn);var r,o,a,s,c=.5*e.distanceTo(t),l=-this.direction.dot($n),u=Jn.dot(this.direction),h=-Jn.dot($n),d=Jn.lengthSq(),p=Math.abs(1-l*l);if(p>0)if(o=l*u-h,s=c*p,(r=l*h-u)>=0)if(o>=-s)if(o<=s){var f=1/p;a=(r*=f)*(r+l*(o*=f)+2*u)+o*(l*r+o+2*h)+d}else o=c,a=-(r=Math.max(0,-(l*o+u)))*r+o*(o+2*h)+d;else o=-c,a=-(r=Math.max(0,-(l*o+u)))*r+o*(o+2*h)+d;else o<=-s?a=-(r=Math.max(0,-(-l*c+u)))*r+(o=r>0?-c:Math.min(Math.max(-c,-h),c))*(o+2*h)+d:o<=s?(r=0,a=(o=Math.min(Math.max(-c,-h),c))*(o+2*h)+d):a=-(r=Math.max(0,-(l*c+u)))*r+(o=r>0?c:Math.min(Math.max(-c,-h),c))*(o+2*h)+d;else o=l>0?-c:c,a=-(r=Math.max(0,-(l*o+u)))*r+o*(o+2*h)+d;return n&&n.copy(this.direction).multiplyScalar(r).add(this.origin),i&&i.copy($n).multiplyScalar(o).add(Yn),a}),intersectSphere:function(){var e=new bn;return function(t,n){e.subVectors(t.center,this.origin);var i=e.dot(this.direction),r=e.dot(e)-i*i,o=t.radius*t.radius;if(r>o)return null;var a=Math.sqrt(o-r),s=i-a,c=i+a;return s<0&&c<0?null:s<0?this.at(c,n):this.at(s,n)}}(),intersectsSphere:function(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius},distanceToPlane:function(e){var t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;var n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null},intersectPlane:function(e,t){var n=this.distanceToPlane(e);return null===n?null:this.at(n,t)},intersectsPlane:function(e){var t=e.distanceToPoint(this.origin);return 0===t||e.normal.dot(this.direction)*t<0},intersectBox:function(e,t){var n,i,r,o,a,s,c=1/this.direction.x,l=1/this.direction.y,u=1/this.direction.z,h=this.origin;return c>=0?(n=(e.min.x-h.x)*c,i=(e.max.x-h.x)*c):(n=(e.max.x-h.x)*c,i=(e.min.x-h.x)*c),l>=0?(r=(e.min.y-h.y)*l,o=(e.max.y-h.y)*l):(r=(e.max.y-h.y)*l,o=(e.min.y-h.y)*l),n>o||r>i?null:((r>n||n!=n)&&(n=r),(o=0?(a=(e.min.z-h.z)*u,s=(e.max.z-h.z)*u):(a=(e.max.z-h.z)*u,s=(e.min.z-h.z)*u),n>s||a>i?null:((a>n||n!=n)&&(n=a),(s=0?n:i,t)))},intersectsBox:(Xn=new bn,function(e){return null!==this.intersectBox(e,Xn)}),intersectTriangle:function(){var e=new bn,t=new bn,n=new bn,i=new bn;return function(r,o,a,s,c){t.subVectors(o,r),n.subVectors(a,r),i.crossVectors(t,n);var l,u=this.direction.dot(i);if(u>0){if(s)return null;l=1}else{if(!(u<0))return null;l=-1,u=-u}e.subVectors(this.origin,r);var h=l*this.direction.dot(n.crossVectors(e,n));if(h<0)return null;var d=l*this.direction.dot(t.cross(e));if(d<0)return null;if(h+d>u)return null;var p=-l*e.dot(i);return p<0?null:this.at(p/u,c)}}(),applyMatrix4:function(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this},equals:function(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}}),Object.assign(hi,{getNormal:(Kn=new bn,function(e,t,n,i){void 0===i&&(console.warn("THREE.Triangle: .getNormal() target is now required"),i=new bn),i.subVectors(n,t),Kn.subVectors(e,t),i.cross(Kn);var r=i.lengthSq();return r>0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)}),getBarycoord:function(){var e=new bn,t=new bn,n=new bn;return function(i,r,o,a,s){e.subVectors(a,r),t.subVectors(o,r),n.subVectors(i,r);var c=e.dot(e),l=e.dot(t),u=e.dot(n),h=t.dot(t),d=t.dot(n),p=c*h-l*l;if(void 0===s&&(console.warn("THREE.Triangle: .getBarycoord() target is now required"),s=new bn),0===p)return s.set(-2,-1,-1);var f=1/p,m=(h*u-l*d)*f,v=(c*d-l*u)*f;return s.set(1-m-v,v,m)}}(),containsPoint:function(){var e=new bn;return function(t,n,i,r){return hi.getBarycoord(t,n,i,r,e),e.x>=0&&e.y>=0&&e.x+e.y<=1}}(),getUV:(Zn=new bn,function(e,t,n,i,r,o,a,s){return this.getBarycoord(e,t,n,i,Zn),s.set(0,0),s.addScaledVector(r,Zn.x),s.addScaledVector(o,Zn.y),s.addScaledVector(a,Zn.z),s}),isFrontFacing:function(){var e=new bn,t=new bn;return function(n,i,r,o){return e.subVectors(r,i),t.subVectors(n,i),e.cross(t).dot(o)<0}}()}),Object.assign(hi.prototype,{set:function(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this},setFromPointsAndIndices:function(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this},getArea:function(){var e=new bn,t=new bn;return function(){return e.subVectors(this.c,this.b),t.subVectors(this.a,this.b),.5*e.cross(t).length()}}(),getMidpoint:function(e){return void 0===e&&(console.warn("THREE.Triangle: .getMidpoint() target is now required"),e=new bn),e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},getNormal:function(e){return hi.getNormal(this.a,this.b,this.c,e)},getPlane:function(e){return void 0===e&&(console.warn("THREE.Triangle: .getPlane() target is now required"),e=new bn),e.setFromCoplanarPoints(this.a,this.b,this.c)},getBarycoord:function(e,t){return hi.getBarycoord(e,this.a,this.b,this.c,t)},getUV:function(e,t,n,i,r){return hi.getUV(e,this.a,this.b,this.c,t,n,i,r)},containsPoint:function(e){return hi.containsPoint(e,this.a,this.b,this.c)},isFrontFacing:function(e){return hi.isFrontFacing(this.a,this.b,this.c,e)},intersectsBox:function(e){return e.intersectsTriangle(this)},closestPointToPoint:(Qn=new bn,ei=new bn,ti=new bn,ni=new bn,ii=new bn,ri=new bn,function(e,t){void 0===t&&(console.warn("THREE.Triangle: .closestPointToPoint() target is now required"),t=new bn);var n,i,r=this.a,o=this.b,a=this.c;Qn.subVectors(o,r),ei.subVectors(a,r),ni.subVectors(e,r);var s=Qn.dot(ni),c=ei.dot(ni);if(s<=0&&c<=0)return t.copy(r);ii.subVectors(e,o);var l=Qn.dot(ii),u=ei.dot(ii);if(l>=0&&u<=l)return t.copy(o);var h=s*u-l*c;if(h<=0&&s>=0&&l<=0)return n=s/(s-l),t.copy(r).addScaledVector(Qn,n);ri.subVectors(e,a);var d=Qn.dot(ri),p=ei.dot(ri);if(p>=0&&d<=p)return t.copy(a);var f=d*c-s*p;if(f<=0&&c>=0&&p<=0)return i=c/(c-p),t.copy(r).addScaledVector(ei,i);var m=l*p-d*u;if(m<=0&&u-l>=0&&d-p>=0)return ti.subVectors(a,o),i=(u-l)/(u-l+(d-p)),t.copy(o).addScaledVector(ti,i);var v=1/(m+f+h);return n=f*v,i=h*v,t.copy(r).addScaledVector(Qn,n).addScaledVector(ei,i)}),equals:function(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}});var di,pi,fi,mi={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};function vi(e,t,n){return void 0===t&&void 0===n?this.set(e):this.setRGB(e,t,n)}function gi(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+6*(t-e)*(2/3-n):e}function yi(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function bi(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}function _i(e,t,n,i,r,o){this.a=e,this.b=t,this.c=n,this.normal=i&&i.isVector3?i:new bn,this.vertexNormals=Array.isArray(i)?i:[],this.color=r&&r.isColor?r:new vi,this.vertexColors=Array.isArray(r)?r:[],this.materialIndex=void 0!==o?o:0}Object.assign(vi.prototype,{isColor:!0,r:1,g:1,b:1,set:function(e){return e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e),this},setScalar:function(e){return this.r=e,this.g=e,this.b=e,this},setHex:function(e){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,this},setRGB:function(e,t,n){return this.r=e,this.g=t,this.b=n,this},setHSL:function(e,t,n){if(e=vn.euclideanModulo(e,1),t=vn.clamp(t,0,1),n=vn.clamp(n,0,1),0===t)this.r=this.g=this.b=n;else{var i=n<=.5?n*(1+t):n+t-n*t,r=2*n-i;this.r=gi(r,i,e+1/3),this.g=gi(r,i,e),this.b=gi(r,i,e-1/3)}return this},setStyle:function(e){function t(t){void 0!==t&&parseFloat(t)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}var n;if(n=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(e)){var i,r=n[1],o=n[2];switch(r){case"rgb":case"rgba":if(i=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))return this.r=Math.min(255,parseInt(i[1],10))/255,this.g=Math.min(255,parseInt(i[2],10))/255,this.b=Math.min(255,parseInt(i[3],10))/255,t(i[5]),this;if(i=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))return this.r=Math.min(100,parseInt(i[1],10))/100,this.g=Math.min(100,parseInt(i[2],10))/100,this.b=Math.min(100,parseInt(i[3],10))/100,t(i[5]),this;break;case"hsl":case"hsla":if(i=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o)){var a=parseFloat(i[1])/360,s=parseInt(i[2],10)/100,c=parseInt(i[3],10)/100;return t(i[5]),this.setHSL(a,s,c)}}}else if(n=/^\#([A-Fa-f0-9]+)$/.exec(e)){var l,u=(l=n[1]).length;if(3===u)return this.r=parseInt(l.charAt(0)+l.charAt(0),16)/255,this.g=parseInt(l.charAt(1)+l.charAt(1),16)/255,this.b=parseInt(l.charAt(2)+l.charAt(2),16)/255,this;if(6===u)return this.r=parseInt(l.charAt(0)+l.charAt(1),16)/255,this.g=parseInt(l.charAt(2)+l.charAt(3),16)/255,this.b=parseInt(l.charAt(4)+l.charAt(5),16)/255,this}e&&e.length>0&&(void 0!==(l=mi[e])?this.setHex(l):console.warn("THREE.Color: Unknown color "+e));return this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this},copyGammaToLinear:function(e,t){return void 0===t&&(t=2),this.r=Math.pow(e.r,t),this.g=Math.pow(e.g,t),this.b=Math.pow(e.b,t),this},copyLinearToGamma:function(e,t){void 0===t&&(t=2);var n=t>0?1/t:1;return this.r=Math.pow(e.r,n),this.g=Math.pow(e.g,n),this.b=Math.pow(e.b,n),this},convertGammaToLinear:function(e){return this.copyGammaToLinear(this,e),this},convertLinearToGamma:function(e){return this.copyLinearToGamma(this,e),this},copySRGBToLinear:function(e){return this.r=yi(e.r),this.g=yi(e.g),this.b=yi(e.b),this},copyLinearToSRGB:function(e){return this.r=bi(e.r),this.g=bi(e.g),this.b=bi(e.b),this},convertSRGBToLinear:function(){return this.copySRGBToLinear(this),this},convertLinearToSRGB:function(){return this.copyLinearToSRGB(this),this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(e){void 0===e&&(console.warn("THREE.Color: .getHSL() target is now required"),e={h:0,s:0,l:0});var t,n,i=this.r,r=this.g,o=this.b,a=Math.max(i,r,o),s=Math.min(i,r,o),c=(s+a)/2;if(s===a)t=0,n=0;else{var l=a-s;switch(n=c<=.5?l/(a+s):l/(2-a-s),a){case i:t=(r-o)/l+(rt&&(t=e[n]);return t}wi.prototype=Object.assign(Object.create(c.prototype),{constructor:wi,isMaterial:!0,onBeforeCompile:function(){},setValues:function(e){if(void 0!==e)for(var t in e){var n=e[t];if(void 0!==n)if("shading"!==t){var i=this[t];void 0!==i?i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n:console.warn("THREE."+this.type+": '"+t+"' is not a property of this material.")}else console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=n===C;else console.warn("THREE.Material: '"+t+"' parameter is undefined.")}},toJSON:function(e){var t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});var n={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function i(e){var t=[];for(var n in e){var i=e[n];delete i.metadata,t.push(i)}return t}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearCoat&&(n.clearCoat=this.clearCoat),void 0!==this.clearCoatRoughness&&(n.clearCoatRoughness=this.clearCoatRoughness),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,n.reflectivity=this.reflectivity,n.refractionRatio=this.refractionRatio,void 0!==this.combine&&(n.combine=this.combine),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity)),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.size&&(n.size=this.size),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==I&&(n.blending=this.blending),!0===this.flatShading&&(n.flatShading=this.flatShading),this.side!==T&&(n.side=this.side),this.vertexColors!==L&&(n.vertexColors=this.vertexColors),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.stencilWrite=this.stencilWrite,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilMask=this.stencilMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.morphTargets&&(n.morphTargets=!0),!0===this.morphNormals&&(n.morphNormals=!0),!0===this.skinning&&(n.skinning=!0),!1===this.visible&&(n.visible=!1),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),t){var r=i(e.textures),o=i(e.images);r.length>0&&(n.textures=r),o.length>0&&(n.images=o)}return n},clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.name=e.name,this.fog=e.fog,this.lights=e.lights,this.blending=e.blending,this.side=e.side,this.flatShading=e.flatShading,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.stencilWrite=e.stencilWrite,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilMask=e.stencilMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,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.premultipliedAlpha=e.premultipliedAlpha,this.visible=e.visible,this.userData=JSON.parse(JSON.stringify(e.userData)),this.clipShadows=e.clipShadows,this.clipIntersection=e.clipIntersection;var t=e.clippingPlanes,n=null;if(null!==t){var i=t.length;n=new Array(i);for(var r=0;r!==i;++r)n[r]=t[r].clone()}return this.clippingPlanes=n,this.shadowSide=e.shadowSide,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Mi.prototype=Object.create(wi.prototype),Mi.prototype.constructor=Mi,Mi.prototype.isMeshBasicMaterial=!0,Mi.prototype.copy=function(e){return wi.prototype.copy.call(this,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.skinning=e.skinning,this.morphTargets=e.morphTargets,this},Object.defineProperty(Ei.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),Object.assign(Ei.prototype,{isBufferAttribute:!0,onUploadCallback:function(){},setArray:function(e){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");return this.count=void 0!==e?e.length/this.itemSize:0,this.array=e,this},setDynamic:function(e){return this.dynamic=e,this},copy:function(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.dynamic=e.dynamic,this},copyAt:function(e,t,n){e*=this.itemSize,n*=t.itemSize;for(var i=0,r=this.itemSize;i0,a=r[1]&&r[1].length>0,s=e.morphTargets,c=s.length;if(c>0){t=[];for(var l=0;l0){u=[];for(l=0;l0&&0===n.length&&console.error("THREE.DirectGeometry: Faceless geometries are not supported.");for(l=0;l65535?Ri:Pi)(e,1):this.index=e},addAttribute:function(e,t){return t&&t.isBufferAttribute||t&&t.isInterleavedBufferAttribute?"index"===e?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(t),this):(this.attributes[e]=t,this):(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.addAttribute(e,new Ei(arguments[1],arguments[2])))},getAttribute:function(e){return this.attributes[e]},removeAttribute:function(e){return delete this.attributes[e],this},addGroup:function(e,t,n){this.groups.push({start:e,count:t,materialIndex:void 0!==n?n:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(e,t){this.drawRange.start=e,this.drawRange.count=t},applyMatrix:function(e){var t=this.attributes.position;void 0!==t&&(e.applyToBufferAttribute(t),t.needsUpdate=!0);var n=this.attributes.normal;void 0!==n&&((new _n).getNormalMatrix(e).applyToBufferAttribute(n),n.needsUpdate=!0);var i=this.attributes.tangent;void 0!==i&&((new _n).getNormalMatrix(e).applyToBufferAttribute(i),i.needsUpdate=!0);return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(){var e=new Nn;return function(t){return e.makeRotationX(t),this.applyMatrix(e),this}}(),rotateY:function(){var e=new Nn;return function(t){return e.makeRotationY(t),this.applyMatrix(e),this}}(),rotateZ:function(){var e=new Nn;return function(t){return e.makeRotationZ(t),this.applyMatrix(e),this}}(),translate:function(){var e=new Nn;return function(t,n,i){return e.makeTranslation(t,n,i),this.applyMatrix(e),this}}(),scale:function(){var e=new Nn;return function(t,n,i){return e.makeScale(t,n,i),this.applyMatrix(e),this}}(),lookAt:(Bi=new ai,function(e){Bi.lookAt(e),Bi.updateMatrix(),this.applyMatrix(Bi.matrix)}),center:(Fi=new bn,function(){return this.computeBoundingBox(),this.boundingBox.getCenter(Fi).negate(),this.translate(Fi.x,Fi.y,Fi.z),this}),setFromObject:function(e){var t=e.geometry;if(e.isPoints||e.isLine){var n=new Oi(3*t.vertices.length,3),i=new Oi(3*t.colors.length,3);if(this.addAttribute("position",n.copyVector3sArray(t.vertices)),this.addAttribute("color",i.copyColorsArray(t.colors)),t.lineDistances&&t.lineDistances.length===t.vertices.length){var r=new Oi(t.lineDistances.length,1);this.addAttribute("lineDistance",r.copyArray(t.lineDistances))}null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone())}else e.isMesh&&t&&t.isGeometry&&this.fromGeometry(t);return this},setFromPoints:function(e){for(var t=[],n=0,i=e.length;n0){var n=new Float32Array(3*e.normals.length);this.addAttribute("normal",new Ei(n,3).copyVector3sArray(e.normals))}if(e.colors.length>0){var i=new Float32Array(3*e.colors.length);this.addAttribute("color",new Ei(i,3).copyColorsArray(e.colors))}if(e.uvs.length>0){var r=new Float32Array(2*e.uvs.length);this.addAttribute("uv",new Ei(r,2).copyVector2sArray(e.uvs))}if(e.uvs2.length>0){var o=new Float32Array(2*e.uvs2.length);this.addAttribute("uv2",new Ei(o,2).copyVector2sArray(e.uvs2))}for(var a in this.groups=e.groups,e.morphTargets){for(var s=[],c=e.morphTargets[a],l=0,u=c.length;l0){var p=new Oi(4*e.skinIndices.length,4);this.addAttribute("skinIndex",p.copyVector4sArray(e.skinIndices))}if(e.skinWeights.length>0){var f=new Oi(4*e.skinWeights.length,4);this.addAttribute("skinWeight",f.copyVector4sArray(e.skinWeights))}return null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),this},computeBoundingBox:(Ni=new ci,function(){null===this.boundingBox&&(this.boundingBox=new ci);var e=this.attributes.position,t=this.morphAttributes.position;if(void 0!==e){if(this.boundingBox.setFromBufferAttribute(e),t)for(var n=0,i=t.length;n0&&(e.userData=this.userData),void 0!==this.parameters){var t=this.parameters;for(var n in t)void 0!==t[n]&&(e[n]=t[n]);return e}e.data={attributes:{}};var i=this.index;null!==i&&(e.data.index={type:i.array.constructor.name,array:Array.prototype.slice.call(i.array)});var r=this.attributes;for(var n in r){var o=(d=r[n]).toJSON();""!==d.name&&(o.name=d.name),e.data.attributes[n]=o}var a={},s=!1;for(var n in this.morphAttributes){for(var c=this.morphAttributes[n],l=[],u=0,h=c.length;u0&&(a[n]=l,s=!0)}s&&(e.data.morphAttributes=a);var p=this.groups;p.length>0&&(e.data.groups=JSON.parse(JSON.stringify(p)));var f=this.boundingSphere;return null!==f&&(e.data.boundingSphere={center:f.center.toArray(),radius:f.radius}),e},clone:function(){return(new zi).copy(this)},copy:function(e){var t,n,i;this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.name=e.name;var r=e.index;null!==r&&this.setIndex(r.clone());var o=e.attributes;for(t in o){var a=o[t];this.addAttribute(t,a.clone())}var s=e.morphAttributes;for(t in s){var c=[],l=s[t];for(n=0,i=l.length;n0){var a=r[o[0]];if(void 0!==a)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},e=0,t=a.length;e0&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}},raycast:function(){var e=new Nn,t=new ui,n=new li,i=new bn,r=new bn,o=new bn,a=new bn,s=new bn,c=new bn,l=new bn,u=new bn,h=new bn,d=new gn,p=new gn,f=new gn,m=new bn,v=new bn;function g(e,t,n,i,r,o,a,s){if(null===(t.side===S?i.intersectTriangle(a,o,r,!0,s):i.intersectTriangle(r,o,a,t.side!==A,s)))return null;v.copy(s),v.applyMatrix4(e.matrixWorld);var c=n.ray.origin.distanceTo(v);return cn.far?null:{distance:c,point:v.clone(),object:e}}function y(e,t,n,v,y,b,_,x,w,M,E){i.fromBufferAttribute(y,w),r.fromBufferAttribute(y,M),o.fromBufferAttribute(y,E);var T=e.morphTargetInfluences;if(t.morphTargets&&b&&T){l.set(0,0,0),u.set(0,0,0),h.set(0,0,0);for(var S=0,A=b.length;S0&&(I=B);for(var U=0,z=F.length;U0?1:-1,l.push(P.x,P.y,P.z),u.push(y/m),u.push(1-b/v),A+=1}}for(b=0;b0)for(l=0;l0&&(this.normalsNeedUpdate=!0)},computeFlatVertexNormals:function(){var e,t,n;for(this.computeFaceNormals(),e=0,t=this.faces.length;e0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var e,t,n,i,r;for(n=0,i=this.faces.length;n=0;n--){var f=d[n];for(this.faces.splice(f,1),a=0,s=this.faceVertexUvs.length;a0,v=p.vertexNormals.length>0,g=1!==p.color.r||1!==p.color.g||1!==p.color.b,y=p.vertexColors.length>0,b=0;if(b=M(b,0,0),b=M(b,1,!0),b=M(b,2,!1),b=M(b,3,f),b=M(b,4,m),b=M(b,5,v),b=M(b,6,g),b=M(b,7,y),a.push(b),a.push(p.a,p.b,p.c),a.push(p.materialIndex),f){var _=this.faceVertexUvs[0][r];a.push(S(_[0]),S(_[1]),S(_[2]))}if(m&&a.push(E(p.normal)),v){var x=p.vertexNormals;a.push(E(x[0]),E(x[1]),E(x[2]))}if(g&&a.push(T(p.color)),y){var w=p.vertexColors;a.push(T(w[0]),T(w[1]),T(w[2]))}}function M(e,t,n){return n?e|1<0&&(e.data.colors=l),h.length>0&&(e.data.uvs=[h]),e.data.faces=a,e},clone:function(){return(new ji).copy(this)},copy:function(e){var t,n,i,r,o,a;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;var s=e.vertices;for(t=0,n=s.length;t0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;var r={};for(var o in this.extensions)!0===this.extensions[o]&&(r[o]=!0);return Object.keys(r).length>0&&(t.extensions=r),t},Ki.prototype=Object.assign(Object.create(ai.prototype),{constructor:Ki,isCamera:!0,copy:function(e,t){return ai.prototype.copy.call(this,e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this},getWorldDirection:function(e){void 0===e&&(console.warn("THREE.Camera: .getWorldDirection() target is now required"),e=new bn),this.updateMatrixWorld(!0);var t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()},updateMatrixWorld:function(e){ai.prototype.updateMatrixWorld.call(this,e),this.matrixWorldInverse.getInverse(this.matrixWorld)},clone:function(){return(new this.constructor).copy(this)}}),Qi.prototype=Object.assign(Object.create(Ki.prototype),{constructor:Qi,isPerspectiveCamera:!0,copy:function(e,t){return Ki.prototype.copy.call(this,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:function(e){var t=.5*this.getFilmHeight()/e;this.fov=2*vn.RAD2DEG*Math.atan(t),this.updateProjectionMatrix()},getFocalLength:function(){var e=Math.tan(.5*vn.DEG2RAD*this.fov);return.5*this.getFilmHeight()/e},getEffectiveFOV:function(){return 2*vn.RAD2DEG*Math.atan(Math.tan(.5*vn.DEG2RAD*this.fov)/this.zoom)},getFilmWidth:function(){return this.filmGauge*Math.min(this.aspect,1)},getFilmHeight:function(){return this.filmGauge/Math.max(this.aspect,1)},setViewOffset:function(e,t,n,i,r,o){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=n,this.view.offsetY=i,this.view.width=r,this.view.height=o,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var e=this.near,t=e*Math.tan(.5*vn.DEG2RAD*this.fov)/this.zoom,n=2*t,i=this.aspect*n,r=-.5*i,o=this.view;if(null!==this.view&&this.view.enabled){var a=o.fullWidth,s=o.fullHeight;r+=o.offsetX*i/a,t-=o.offsetY*n/s,i*=o.width/a,n*=o.height/s}var c=this.filmOffset;0!==c&&(r+=e*c/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,t,t-n,e,this.far),this.projectionMatrixInverse.getInverse(this.projectionMatrix)},toJSON:function(e){var t=ai.prototype.toJSON.call(this,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}});var er,tr,nr=90,ir=1;function rr(e,t,n,i){ai.call(this),this.type="CubeCamera";var r=new Qi(nr,ir,e,t);r.up.set(0,-1,0),r.lookAt(new bn(1,0,0)),this.add(r);var o=new Qi(nr,ir,e,t);o.up.set(0,-1,0),o.lookAt(new bn(-1,0,0)),this.add(o);var a=new Qi(nr,ir,e,t);a.up.set(0,0,1),a.lookAt(new bn(0,1,0)),this.add(a);var s=new Qi(nr,ir,e,t);s.up.set(0,0,-1),s.lookAt(new bn(0,-1,0)),this.add(s);var c=new Qi(nr,ir,e,t);c.up.set(0,-1,0),c.lookAt(new bn(0,0,1)),this.add(c);var l=new Qi(nr,ir,e,t);l.up.set(0,-1,0),l.lookAt(new bn(0,0,-1)),this.add(l),i=i||{format:Ke,magFilter:Ie,minFilter:Ie},this.renderTarget=new or(n,n,i),this.renderTarget.texture.name="CubeCamera",this.update=function(e,t){null===this.parent&&this.updateMatrixWorld();var n=e.getRenderTarget(),i=this.renderTarget,u=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,e.setRenderTarget(i,0),e.render(t,r),e.setRenderTarget(i,1),e.render(t,o),e.setRenderTarget(i,2),e.render(t,a),e.setRenderTarget(i,3),e.render(t,s),e.setRenderTarget(i,4),e.render(t,c),i.texture.generateMipmaps=u,e.setRenderTarget(i,5),e.render(t,l),e.setRenderTarget(n)},this.clear=function(e,t,n,i){for(var r=e.getRenderTarget(),o=this.renderTarget,a=0;a<6;a++)e.setRenderTarget(o,a),e.clear(t,n,i);e.setRenderTarget(r)}}function or(e,t,n){In.call(this,e,t,n)}function ar(e,t,n,i,r,o,a,s,c,l,u,h){On.call(this,null,o,a,s,c,l,i,r,u,h),this.image={data:e,width:t,height:n},this.magFilter=void 0!==c?c:Pe,this.minFilter=void 0!==l?l:Pe,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}function sr(e,t){this.normal=void 0!==e?e:new bn(1,0,0),this.constant=void 0!==t?t:0}function cr(e,t,n,i,r,o){this.planes=[void 0!==e?e:new sr,void 0!==t?t:new sr,void 0!==n?n:new sr,void 0!==i?i:new sr,void 0!==r?r:new sr,void 0!==o?o:new sr]}rr.prototype=Object.create(ai.prototype),rr.prototype.constructor=rr,or.prototype=Object.create(In.prototype),or.prototype.constructor=or,or.prototype.isWebGLRenderTargetCube=!0,or.prototype.fromEquirectangularTexture=function(e,t){this.texture.type=t.type,this.texture.format=t.format,this.texture.encoding=t.encoding;var n=new si,i={uniforms:{tEquirect:{value:null}},vertexShader:["varying vec3 vWorldDirection;","vec3 transformDirection( in vec3 dir, in mat4 matrix ) {","\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );","}","void main() {","\tvWorldDirection = transformDirection( position, modelMatrix );","\t#include ","\t#include ","}"].join("\n"),fragmentShader:["uniform sampler2D tEquirect;","varying vec3 vWorldDirection;","#define RECIPROCAL_PI 0.31830988618","#define RECIPROCAL_PI2 0.15915494","void main() {","\tvec3 direction = normalize( vWorldDirection );","\tvec2 sampleUV;","\tsampleUV.y = asin( clamp( direction.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;","\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;","\tgl_FragColor = texture2D( tEquirect, sampleUV );","}"].join("\n")},r=new Zi({type:"CubemapFromEquirect",uniforms:qi(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:S,blending:D});r.uniforms.tEquirect.value=t;var o=new Gi(new Wi(5,5,5),r);n.add(o);var a=new rr(1,10,1);return a.renderTarget=this,a.renderTarget.texture.name="CubeCameraTexture",a.update(e,n),o.geometry.dispose(),o.material.dispose(),this},ar.prototype=Object.create(On.prototype),ar.prototype.constructor=ar,ar.prototype.isDataTexture=!0,Object.assign(sr.prototype,{isPlane:!0,set:function(e,t){return this.normal.copy(e),this.constant=t,this},setComponents:function(e,t,n,i){return this.normal.set(e,t,n),this.constant=i,this},setFromNormalAndCoplanarPoint:function(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this},setFromCoplanarPoints:function(){var e=new bn,t=new bn;return function(n,i,r){var o=e.subVectors(r,i).cross(t.subVectors(n,i)).normalize();return this.setFromNormalAndCoplanarPoint(o,n),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.normal.copy(e.normal),this.constant=e.constant,this},normalize:function(){var e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(e){return this.normal.dot(e)+this.constant},distanceToSphere:function(e){return this.distanceToPoint(e.center)-e.radius},projectPoint:function(e,t){return void 0===t&&(console.warn("THREE.Plane: .projectPoint() target is now required"),t=new bn),t.copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)},intersectLine:function(){var e=new bn;return function(t,n){void 0===n&&(console.warn("THREE.Plane: .intersectLine() target is now required"),n=new bn);var i=t.delta(e),r=this.normal.dot(i);if(0===r)return 0===this.distanceToPoint(t.start)?n.copy(t.start):void 0;var o=-(t.start.dot(this.normal)+this.constant)/r;return o<0||o>1?void 0:n.copy(i).multiplyScalar(o).add(t.start)}}(),intersectsLine:function(e){var t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0},intersectsBox:function(e){return e.intersectsPlane(this)},intersectsSphere:function(e){return e.intersectsPlane(this)},coplanarPoint:function(e){return void 0===e&&(console.warn("THREE.Plane: .coplanarPoint() target is now required"),e=new bn),e.copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var e=new bn,t=new _n;return function(n,i){var r=i||t.getNormalMatrix(n),o=this.coplanarPoint(e).applyMatrix4(n),a=this.normal.applyMatrix3(r).normalize();return this.constant=-o.dot(a),this}}(),translate:function(e){return this.constant-=e.dot(this.normal),this},equals:function(e){return e.normal.equals(this.normal)&&e.constant===this.constant}}),Object.assign(cr.prototype,{set:function(e,t,n,i,r,o){var a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(n),a[3].copy(i),a[4].copy(r),a[5].copy(o),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){for(var t=this.planes,n=0;n<6;n++)t[n].copy(e.planes[n]);return this},setFromMatrix:function(e){var t=this.planes,n=e.elements,i=n[0],r=n[1],o=n[2],a=n[3],s=n[4],c=n[5],l=n[6],u=n[7],h=n[8],d=n[9],p=n[10],f=n[11],m=n[12],v=n[13],g=n[14],y=n[15];return t[0].setComponents(a-i,u-s,f-h,y-m).normalize(),t[1].setComponents(a+i,u+s,f+h,y+m).normalize(),t[2].setComponents(a+r,u+c,f+d,y+v).normalize(),t[3].setComponents(a-r,u-c,f-d,y-v).normalize(),t[4].setComponents(a-o,u-l,f-p,y-g).normalize(),t[5].setComponents(a+o,u+l,f+p,y+g).normalize(),this},intersectsObject:(tr=new li,function(e){var t=e.geometry;return null===t.boundingSphere&&t.computeBoundingSphere(),tr.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(tr)}),intersectsSprite:function(){var e=new li;return function(t){return e.center.set(0,0,0),e.radius=.7071067811865476,e.applyMatrix4(t.matrixWorld),this.intersectsSphere(e)}}(),intersectsSphere:function(e){for(var t=this.planes,n=e.center,i=-e.radius,r=0;r<6;r++){if(t[r].distanceToPoint(n)0?e.max.x:e.min.x,er.y=i.normal.y>0?e.max.y:e.min.y,er.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(er)<0)return!1}return!0}),containsPoint:function(e){for(var t=this.planes,n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}});var lr={alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef ALPHATEST\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n\t#endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",begin_vertex:"vec3 transformed = vec3( position );",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"vec2 integrateSpecularBRDF( const in float dotNV, const in float roughness ) {\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\treturn vec2( -1.04, 1.04 ) * a004 + r.zw;\n}\nfloat punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n#else\n\tif( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t}\n\treturn 1.0;\n#endif\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nvec3 F_Schlick_RoughnessDependent( const in vec3 F0, const in float dotNV, const in float roughness ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotNV - 6.98316 ) * dotNV );\n\tvec3 Fr = max( vec3( 1.0 - roughness ), F0 ) - F0;\n\treturn Fr * fresnel + F0;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nvec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\treturn specularColor * brdf.x + brdf.y;\n}\nvoid BRDF_Specular_Multiscattering_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tvec3 F = F_Schlick_RoughnessDependent( specularColor, dotNV, roughness );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\tvec3 FssEss = F * brdf.x + brdf.y;\n\tfloat Ess = brdf.x + brdf.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\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_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}",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 ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\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 );\n\t\tfDet *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\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\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vViewPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vViewPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\tif ( clipped ) discard;\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\t#if ! defined( PHYSICAL ) && ! defined( PHONG ) && ! defined( MATCAP )\n\t\tvarying vec3 vViewPosition;\n\t#endif\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG ) && ! defined( MATCAP )\n\tvarying vec3 vViewPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG ) && ! defined( MATCAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif",color_fragment:"#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\n\tvColor.xyz = color.xyz;\n#endif",common:"#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI_HALF 1.5707963267949\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#define whiteCompliment(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float 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 average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\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}\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};\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}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\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 linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_textureSize (1024.0)\nint getFaceFromDirection(vec3 direction) {\n\tvec3 absDirection = abs(direction);\n\tint face = -1;\n\tif( absDirection.x > absDirection.z ) {\n\t\tif(absDirection.x > absDirection.y )\n\t\t\tface = direction.x > 0.0 ? 0 : 3;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\telse {\n\t\tif(absDirection.z > absDirection.y )\n\t\t\tface = direction.z > 0.0 ? 2 : 5;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\treturn face;\n}\n#define cubeUV_maxLods1 (log2(cubeUV_textureSize*0.25) - 1.0)\n#define cubeUV_rangeClamp (exp2((6.0 - 1.0) * 2.0))\nvec2 MipLevelInfo( vec3 vec, float roughnessLevel, float roughness ) {\n\tfloat scale = exp2(cubeUV_maxLods1 - roughnessLevel);\n\tfloat dxRoughness = dFdx(roughness);\n\tfloat dyRoughness = dFdy(roughness);\n\tvec3 dx = dFdx( vec * scale * dxRoughness );\n\tvec3 dy = dFdy( vec * scale * dyRoughness );\n\tfloat d = max( dot( dx, dx ), dot( dy, dy ) );\n\td = clamp(d, 1.0, cubeUV_rangeClamp);\n\tfloat mipLevel = 0.5 * log2(d);\n\treturn vec2(floor(mipLevel), fract(mipLevel));\n}\n#define cubeUV_maxLods2 (log2(cubeUV_textureSize*0.25) - 2.0)\n#define cubeUV_rcpTextureSize (1.0 / cubeUV_textureSize)\nvec2 getCubeUV(vec3 direction, float roughnessLevel, float mipLevel) {\n\tmipLevel = roughnessLevel > cubeUV_maxLods2 - 3.0 ? 0.0 : mipLevel;\n\tfloat a = 16.0 * cubeUV_rcpTextureSize;\n\tvec2 exp2_packed = exp2( vec2( roughnessLevel, mipLevel ) );\n\tvec2 rcp_exp2_packed = vec2( 1.0 ) / exp2_packed;\n\tfloat powScale = exp2_packed.x * exp2_packed.y;\n\tfloat scale = rcp_exp2_packed.x * rcp_exp2_packed.y * 0.25;\n\tfloat mipOffset = 0.75*(1.0 - rcp_exp2_packed.y) * rcp_exp2_packed.x;\n\tbool bRes = mipLevel == 0.0;\n\tscale = bRes && (scale < a) ? a : scale;\n\tvec3 r;\n\tvec2 offset;\n\tint face = getFaceFromDirection(direction);\n\tfloat rcpPowScale = 1.0 / powScale;\n\tif( face == 0) {\n\t\tr = vec3(direction.x, -direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 1) {\n\t\tr = vec3(direction.y, direction.x, direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 2) {\n\t\tr = vec3(direction.z, direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 3) {\n\t\tr = vec3(direction.x, direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse if( face == 4) {\n\t\tr = vec3(direction.y, direction.x, -direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse {\n\t\tr = vec3(direction.z, -direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\tr = normalize(r);\n\tfloat texelOffset = 0.5 * cubeUV_rcpTextureSize;\n\tvec2 s = ( r.yz / abs( r.x ) + vec2( 1.0 ) ) * 0.5;\n\tvec2 base = offset + vec2( texelOffset );\n\treturn base + s * ( scale - 2.0 * texelOffset );\n}\n#define cubeUV_maxLods3 (log2(cubeUV_textureSize*0.25) - 3.0)\nvec4 textureCubeUV( sampler2D envMap, vec3 reflectedDirection, float roughness ) {\n\tfloat roughnessVal = roughness* cubeUV_maxLods3;\n\tfloat r1 = floor(roughnessVal);\n\tfloat r2 = r1 + 1.0;\n\tfloat t = fract(roughnessVal);\n\tvec2 mipInfo = MipLevelInfo(reflectedDirection, r1, roughness);\n\tfloat s = mipInfo.y;\n\tfloat level0 = mipInfo.x;\n\tfloat level1 = level0 + 1.0;\n\tlevel1 = level1 > 5.0 ? 5.0 : level1;\n\tlevel0 += min( floor( s + 0.5 ), 5.0 );\n\tvec2 uv_10 = getCubeUV(reflectedDirection, r1, level0);\n\tvec4 color10 = envMapTexelToLinear(texture2D(envMap, uv_10));\n\tvec2 uv_20 = getCubeUV(reflectedDirection, r2, level0);\n\tvec4 color20 = envMapTexelToLinear(texture2D(envMap, uv_20));\n\tvec4 result = mix(color10, color20, t);\n\treturn vec4(result.rgb, 1.0);\n}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = normalMatrix * objectNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = normalMatrix * objectTangent;\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, uv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\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:"\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( gammaFactor ) ), value.a );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n\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.a );\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}\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n\tfloat maxComponent = max( max( value.r, value.g ), value.b );\n\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * value.a * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM = ceil( M * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = min( floor( D ) / 255.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n\tvec3 Xp_Y_XYZp = cLogLuvM * value.rgb;\n\tXp_Y_XYZp = max( Xp_Y_XYZp, vec3( 1e-6, 1e-6, 1e-6 ) );\n\tvec4 vResult;\n\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n\tvResult.w = fract( Le );\n\tvResult.z = ( Le - ( floor( vResult.w * 255.0 ) ) / 255.0 ) / 255.0;\n\treturn vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n\tfloat Le = value.z * 255.0 + value.w;\n\tvec3 Xp_Y_XYZp;\n\tXp_Y_XYZp.y = exp2( ( Le - 127.0 ) / 2.0 );\n\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n\tvec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb;\n\treturn vec4( max( vRGB, 0.0 ), 1.0 );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToVertex, 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#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\tvec2 sampleUV;\n\t\treflectVec = normalize( reflectVec );\n\t\tsampleUV.y = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\n\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\treflectVec = normalize( reflectVec );\n\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) );\n\t\tvec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\tenvColor = envMapTexelToLinear( envColor );\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_pars_fragment:"#if defined( USE_ENVMAP ) || defined( PHYSICAL )\n\tuniform float reflectivity;\n\tuniform float envMapIntensity;\n#endif\n#ifdef USE_ENVMAP\n\t#if ! defined( PHYSICAL ) && ( defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) )\n\t\tvarying vec3 vWorldPosition;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\tuniform float flipEnvMap;\n\tuniform int maxMipLevel;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( PHYSICAL )\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 )\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 ) && defined( PHYSICAL )\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, queryVec, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar + 0.79248 - 0.5 * log2( pow2( blinnShininessExponent ) + 1.0 );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in GeometricContext geometry, const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( -geometry.viewDir, geometry.normal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( -geometry.viewDir, geometry.normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( blinnShininessExponent, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, queryReflectVec, BlinnExponentToGGXRoughness(blinnShininessExponent ));\n\t\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\t\tvec2 sampleUV;\n\t\t\tsampleUV.y = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\t\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\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\tfogDepth = -mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float fogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * fogDepth * fogDepth * LOG2 ) );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, fogDepth );\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 fogDepth;\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 TOON\n\tuniform sampler2D gradientMap;\n\tvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\t\tfloat dotNL = dot( normal, lightDirection );\n\t\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t\t#ifdef USE_GRADIENTMAP\n\t\t\treturn texture2D( gradientMap, coord ).rgb;\n\t\t#else\n\t\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t\t#endif\n\t}\n#endif",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\treflectedLight.indirectDiffuse += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\nvIndirectFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n\tvIndirectBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n#endif",lights_pars_begin:"uniform 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 GeometricContext geometry ) {\n\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.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\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t\tfloat shadowCameraNear;\n\t\tfloat shadowCameraFar;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.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\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.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 GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif",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;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifdef TOON\n\t\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#else\n\t\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\t\tvec3 irradiance = dotNL * directLight.color;\n\t#endif\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, 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_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );\n#ifdef STANDARD\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.clearCoat = saturate( clearCoat );\tmaterial.clearCoatRoughness = clamp( clearCoatRoughness, 0.04, 1.0 );\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n\t#ifndef STANDARD\n\t\tfloat clearCoat;\n\t\tfloat clearCoatRoughness;\n\t#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearCoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\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.specularRoughness;\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#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifndef STANDARD\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.directSpecular += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry, material.specularColor, material.specularRoughness );\n\treflectedLight.directDiffuse += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\t#ifndef STANDARD\n\t\treflectedLight.directSpecular += irradiance * material.clearCoat * BRDF_Specular_GGX( directLight, geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifndef ENVMAP_TYPE_CUBE_UV\n\t\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\t#endif\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#ifndef STANDARD\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\tfloat dotNL = dotNV;\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\tfloat clearCoatInv = 1.0 - clearCoatDHR;\n\t#if defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec3 singleScattering = vec3( 0.0 );\n\t\tvec3 multiScattering = vec3( 0.0 );\n\t\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\t\tBRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering );\n\t\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n\t\treflectedLight.indirectSpecular += clearCoatInv * radiance * singleScattering;\n\t\treflectedLight.indirectDiffuse += multiScattering * cosineWeightedIrradiance;\n\t\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n\t#else\n\t\treflectedLight.indirectSpecular += clearCoatInv * radiance * BRDF_Specular_GGX_Environment( geometry, material.specularColor, material.specularRoughness );\n\t#endif\n\t#ifndef STANDARD\n\t\treflectedLight.indirectSpecular += clearCoatRadiance * material.clearCoat * BRDF_Specular_GGX_Environment( geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\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\n#define Material_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.specularRoughness )\n#define Material_ClearCoat_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.clearCoatRoughness )\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 = normalize( vViewPosition );\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( pointLight.shadow, directLight.visible ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( spotLight.shadow, directLight.visible ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( directionalLight.shadow, directLight.visible ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop\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#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\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\tvec3 lightMapIrradiance = texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tirradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getLightProbeIndirectRadiance( geometry, Material_BlinnShininessExponent( material ), maxMipLevel );\n\t#ifndef STANDARD\n\t\tclearCoatRadiance += getLightProbeIndirectRadiance( geometry, Material_ClearCoat_BlinnShininessExponent( material ), maxMipLevel );\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, irradiance, clearCoatRadiance, geometry, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = 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#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\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#else\n\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\tgl_Position.z *= gl_Position.w;\n\t#endif\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\tvec4 mapTexel = texture2D( map, uv );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\n\tuniform mat3 uvTransform;\n\tuniform sampler2D map;\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",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n\tobjectNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n\tobjectNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n\tobjectNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\t#ifndef USE_MORPHNORMALS\n\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n\ttransformed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n\ttransformed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n\ttransformed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\ttransformed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n\ttransformed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n\ttransformed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n\ttransformed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n\t#endif\n#endif",normal_fragment_begin:"#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\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 * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t\tbitangent = bitangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t#endif\n\t#endif\n#endif",normal_fragment_maps:"#ifdef USE_NORMALMAP\n\t#ifdef OBJECTSPACE_NORMALMAP\n\t\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\t#ifdef FLIP_SIDED\n\t\t\tnormal = - normal;\n\t\t#endif\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t#endif\n\t\tnormal = normalize( normalMatrix * normal );\n\t#else\n\t\t#ifdef USE_TANGENT\n\t\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\t\t\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\t\tmapN.xy = normalScale * mapN.xy;\n\t\t\tnormal = normalize( vTBN * mapN );\n\t\t#else\n\t\t\tnormal = perturbNormal2Arb( -vViewPosition, normal );\n\t\t#endif\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n\t#ifdef OBJECTSPACE_NORMALMAP\n\t\tuniform mat3 normalMatrix;\n\t#else\n\t\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\n\t\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\t\tvec2 st0 = dFdx( vUv.st );\n\t\t\tvec2 st1 = dFdy( vUv.st );\n\t\t\tfloat scale = sign( st1.t * st0.s - st0.t * st1.s );\n\t\t\tvec3 S = normalize( ( q0 * st1.t - q1 * st0.t ) * scale );\n\t\t\tvec3 T = normalize( ( - q0 * st1.s + q1 * st0.s ) * scale );\n\t\t\tvec3 N = normalize( surf_norm );\n\t\t\tmat3 tsn = mat3( S, T, N );\n\t\t\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\t\tmapN.xy *= normalScale;\n\t\t\tmapN.xy *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t\treturn normalize( tsn * mapN );\n\t\t}\n\t#endif\n#endif",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}\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 = modelViewMatrix * vec4( transformed, 1.0 );\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#if defined( DITHERING )\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#if defined( 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:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tfloat texture2DShadowLerp( sampler2D depths, vec2 size, vec2 uv, float compare ) {\n\t\tconst vec2 offset = vec2( 0.0, 1.0 );\n\t\tvec2 texelSize = vec2( 1.0 ) / size;\n\t\tvec2 centroidUV = floor( uv * size + 0.5 ) / size;\n\t\tfloat lb = texture2DCompare( depths, centroidUV + texelSize * offset.xx, compare );\n\t\tfloat lt = texture2DCompare( depths, centroidUV + texelSize * offset.xy, compare );\n\t\tfloat rb = texture2DCompare( depths, centroidUV + texelSize * offset.yx, compare );\n\t\tfloat rt = texture2DCompare( depths, centroidUV + texelSize * offset.yy, compare );\n\t\tvec2 f = fract( uv * size + 0.5 );\n\t\tfloat a = mix( lb, lt, f.y );\n\t\tfloat b = mix( rb, rt, f.y );\n\t\tfloat c = mix( a, b, f.x );\n\t\treturn c;\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\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\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 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\tshadow = (\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\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 )\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:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tDirectionalLight directionalLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tshadow *= bool( directionalLight.shadow ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tSpotLight spotLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tshadow *= bool( spotLight.shadow ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tPointLight pointLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tshadow *= bool( pointLight.shadow ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\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\t#ifdef BONE_TEXTURE\n\t\tuniform highp sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\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\t#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\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}\n#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )\nvec3 Uncharted2ToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\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 ACESFilmicToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( ( color * ( 2.51 * color + 0.03 ) ) / ( color * ( 2.43 * color + 0.59 ) + 0.14 ) );\n}",uv_pars_fragment:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif",uv_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\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#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = uv2;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP )\n\tvec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n#endif",background_frag:"uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include \n\t#include \n}",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}",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 = mapTexelToLinear( texColor );\n\tgl_FragColor.a *= opacity;\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}",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 \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\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - gl_FragCoord.z ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( gl_FragCoord.z );\n\t#endif\n}",depth_vert:"#include \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}",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 \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}",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}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV;\n\tsampleUV.y = asin( clamp( direction.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\n\tvec4 texColor = texture2D( tEquirect, sampleUV );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include \n\t#include \n}",equirect_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\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\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \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 \nvoid main() {\n\t#include \n\tvLineDistance = scale * lineDistance;\n\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\tgl_Position = projectionMatrix * mvPosition;\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 \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\treflectedLight.indirectDiffuse += texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\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\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\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#ifdef USE_ENVMAP\n\t#include \n\t#include \n\t#include \n\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}",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\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 \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\treflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;\n\t#else\n\t\treflectedLight.indirectDiffuse += vIndirectFront;\n\t#endif\n\t#include \n\treflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\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 \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\t#include \n\t#include \n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\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 \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\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\tmatcapColor = matcapTexelToLinear( matcapColor );\n\t#else\n\t\tvec4 matcapColor = vec4( 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\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 \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifndef FLAT_SHADED\n\t\tvNormal = normalize( transformedNormal );\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\tvViewPosition = - mvPosition.xyz;\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 \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\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\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 \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#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\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}",meshphysical_frag:"#define PHYSICAL\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifndef STANDARD\n\tuniform float clearCoat;\n\tuniform float clearCoatRoughness;\n#endif\nvarying vec3 vViewPosition;\n#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\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\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphysical_vert:"#define PHYSICAL\nvarying vec3 vViewPosition;\n#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\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#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\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}",normal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || ( defined( USE_NORMALMAP ) && ! defined( OBJECTSPACE_NORMALMAP ) )\n\tvarying vec3 vViewPosition;\n#endif\n#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\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}",normal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || ( defined( USE_NORMALMAP ) && ! defined( OBJECTSPACE_NORMALMAP ) )\n\tvarying vec3 vViewPosition;\n#endif\n#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\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#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\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( USE_NORMALMAP ) && ! defined( OBJECTSPACE_NORMALMAP ) )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\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\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\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\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 );\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}",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}",shadow_vert:"#include \n#include \nvoid main() {\n\t#include \n\t#include \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 \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\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\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 = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 );\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}"},ur={common:{diffuse:{value:new vi(15658734)},opacity:{value:1},map:{value:null},uvTransform:{value:new _n},alphaMap:{value:null}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},refractionRatio:{value:.98},maxMipLevel:{value:0}},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 gn(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 vi(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}}},points:{diffuse:{value:new vi(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},uvTransform:{value:new _n}},sprite:{diffuse:{value:new vi(15658734)},opacity:{value:1},center:{value:new gn(.5,.5)},rotation:{value:0},map:{value:null},uvTransform:{value:new _n}}},hr={basic:{uniforms:Xi([ur.common,ur.specularmap,ur.envmap,ur.aomap,ur.lightmap,ur.fog]),vertexShader:lr.meshbasic_vert,fragmentShader:lr.meshbasic_frag},lambert:{uniforms:Xi([ur.common,ur.specularmap,ur.envmap,ur.aomap,ur.lightmap,ur.emissivemap,ur.fog,ur.lights,{emissive:{value:new vi(0)}}]),vertexShader:lr.meshlambert_vert,fragmentShader:lr.meshlambert_frag},phong:{uniforms:Xi([ur.common,ur.specularmap,ur.envmap,ur.aomap,ur.lightmap,ur.emissivemap,ur.bumpmap,ur.normalmap,ur.displacementmap,ur.gradientmap,ur.fog,ur.lights,{emissive:{value:new vi(0)},specular:{value:new vi(1118481)},shininess:{value:30}}]),vertexShader:lr.meshphong_vert,fragmentShader:lr.meshphong_frag},standard:{uniforms:Xi([ur.common,ur.envmap,ur.aomap,ur.lightmap,ur.emissivemap,ur.bumpmap,ur.normalmap,ur.displacementmap,ur.roughnessmap,ur.metalnessmap,ur.fog,ur.lights,{emissive:{value:new vi(0)},roughness:{value:.5},metalness:{value:.5},envMapIntensity:{value:1}}]),vertexShader:lr.meshphysical_vert,fragmentShader:lr.meshphysical_frag},matcap:{uniforms:Xi([ur.common,ur.bumpmap,ur.normalmap,ur.displacementmap,ur.fog,{matcap:{value:null}}]),vertexShader:lr.meshmatcap_vert,fragmentShader:lr.meshmatcap_frag},points:{uniforms:Xi([ur.points,ur.fog]),vertexShader:lr.points_vert,fragmentShader:lr.points_frag},dashed:{uniforms:Xi([ur.common,ur.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:lr.linedashed_vert,fragmentShader:lr.linedashed_frag},depth:{uniforms:Xi([ur.common,ur.displacementmap]),vertexShader:lr.depth_vert,fragmentShader:lr.depth_frag},normal:{uniforms:Xi([ur.common,ur.bumpmap,ur.normalmap,ur.displacementmap,{opacity:{value:1}}]),vertexShader:lr.normal_vert,fragmentShader:lr.normal_frag},sprite:{uniforms:Xi([ur.sprite,ur.fog]),vertexShader:lr.sprite_vert,fragmentShader:lr.sprite_frag},background:{uniforms:{uvTransform:{value:new _n},t2D:{value:null}},vertexShader:lr.background_vert,fragmentShader:lr.background_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:lr.cube_vert,fragmentShader:lr.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:lr.equirect_vert,fragmentShader:lr.equirect_frag},distanceRGBA:{uniforms:Xi([ur.common,ur.displacementmap,{referencePosition:{value:new bn},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:lr.distanceRGBA_vert,fragmentShader:lr.distanceRGBA_frag},shadow:{uniforms:Xi([ur.lights,ur.fog,{color:{value:new vi(0)},opacity:{value:1}}]),vertexShader:lr.shadow_vert,fragmentShader:lr.shadow_frag}};function dr(){var e=null,t=!1,n=null;function i(r,o){!1!==t&&(n(r,o),e.requestAnimationFrame(i))}return{start:function(){!0!==t&&null!==n&&(e.requestAnimationFrame(i),t=!0)},stop:function(){t=!1},setAnimationLoop:function(e){n=e},setContext:function(t){e=t}}}function pr(e){var t=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),t.get(e)},remove:function(n){n.isInterleavedBufferAttribute&&(n=n.data);var i=t.get(n);i&&(e.deleteBuffer(i.buffer),t.delete(n))},update:function(n,i){n.isInterleavedBufferAttribute&&(n=n.data);var r=t.get(n);void 0===r?t.set(n,function(t,n){var i=t.array,r=t.dynamic?35048:35044,o=e.createBuffer();e.bindBuffer(n,o),e.bufferData(n,i,r),t.onUploadCallback();var a=5126;return i instanceof Float32Array?a=5126:i instanceof Float64Array?console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array."):i instanceof Uint16Array?a=5123:i instanceof Int16Array?a=5122:i instanceof Uint32Array?a=5125:i instanceof Int32Array?a=5124:i instanceof Int8Array?a=5120:i instanceof Uint8Array&&(a=5121),{buffer:o,type:a,bytesPerElement:i.BYTES_PER_ELEMENT,version:t.version}}(n,i)):r.version0&&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"}var o="undefined"!=typeof WebGL2RenderingContext&&e instanceof WebGL2RenderingContext,a=void 0!==n.precision?n.precision:"highp",s=r(a);s!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",s,"instead."),a=s);var c=!0===n.logarithmicDepthBuffer,l=e.getParameter(34930),u=e.getParameter(35660),h=e.getParameter(3379),d=e.getParameter(34076),p=e.getParameter(34921),f=e.getParameter(36347),m=e.getParameter(36348),v=e.getParameter(36349),g=u>0,y=o||!!t.get("OES_texture_float");return{isWebGL2:o,getMaxAnisotropy:function(){if(void 0!==i)return i;var n=t.get("EXT_texture_filter_anisotropic");return i=null!==n?e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0},getMaxPrecision:r,precision:a,logarithmicDepthBuffer:c,maxTextures:l,maxVertexTextures:u,maxTextureSize:h,maxCubemapSize:d,maxAttributes:p,maxVertexUniforms:f,maxVaryings:m,maxFragmentUniforms:v,vertexTextures:g,floatFragmentTextures:y,floatVertexTextures:g&&y,maxSamples:o?e.getParameter(36183):0}}function br(){var e=this,t=null,n=0,i=!1,r=!1,o=new sr,a=new _n,s={value:null,needsUpdate:!1};function c(){s.value!==t&&(s.value=t,s.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function l(t,n,i,r){var c=null!==t?t.length:0,l=null;if(0!==c){if(l=s.value,!0!==r||null===l){var u=i+4*c,h=n.matrixWorldInverse;a.getNormalMatrix(h),(null===l||l.length65535?Ri:Pi)(n,1);p.version=a,t.update(p,34963);var f=r[e.id];f&&t.remove(f),r[e.id]=p}return{get:function(e,t){var r=i[t.id];return r||(t.addEventListener("dispose",o),t.isBufferGeometry?r=t:t.isGeometry&&(void 0===t._bufferGeometry&&(t._bufferGeometry=(new zi).setFromObject(e)),r=t._bufferGeometry),i[t.id]=r,n.memory.geometries++,r)},update:function(e){var n=e.index,i=e.attributes;for(var r in null!==n&&t.update(n,34963),i)t.update(i[r],34962);var o=e.morphAttributes;for(var r in o)for(var a=o[r],s=0,c=a.length;s0)return e;var r=t*n,o=Ir[r];if(void 0===o&&(o=new Float32Array(r),Ir[r]=o),0!==t){i.toArray(o,0);for(var a=1,s=0;a!==t;++a)s+=n,e[a].toArray(o,s)}return o}function zr(e,t){if(e.length!==t.length)return!1;for(var n=0,i=e.length;n/gm,function(e,t){var n=lr[t];if(void 0===n)throw new Error("Can not resolve #include <"+t+">");return Io(n)})}function ko(e){return e.replace(/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,function(e,t,n,i){for(var r="",o=parseInt(t);o0?e.gammaFactor:1,x=a.isWebGL2?"":function(e,t,n){return[(e=e||{}).derivatives||t.envMapCubeUV||t.bumpMap||t.normalMap&&!t.objectSpaceNormalMap||t.flatShading?"#extension GL_OES_standard_derivatives : enable":"",(e.fragDepth||t.logarithmicDepthBuffer)&&n.get("EXT_frag_depth")?"#extension GL_EXT_frag_depth : enable":"",e.drawBuffers&&n.get("WEBGL_draw_buffers")?"#extension GL_EXT_draw_buffers : require":"",(e.shaderTextureLOD||t.envMap)&&n.get("EXT_shader_texture_lod")?"#extension GL_EXT_shader_texture_lod : enable":""].filter(Ro).join("\n")}(i.extensions,o,t),w=function(e){var t=[];for(var n in e){var i=e[n];!1!==i&&t.push("#define "+n+" "+i)}return t.join("\n")}(c),T=s.createProgram();if(i.isRawShaderMaterial?((m=[w].filter(Ro).join("\n")).length>0&&(m+="\n"),(v=[x,w].filter(Ro).join("\n")).length>0&&(v+="\n")):(m=["precision "+o.precision+" float;","precision "+o.precision+" int;","#define SHADER_NAME "+r.name,w,o.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+_,"#define MAX_BONES "+o.maxBones,o.useFog&&o.fog?"#define USE_FOG":"",o.useFog&&o.fogExp?"#define FOG_EXP2":"",o.map?"#define USE_MAP":"",o.envMap?"#define USE_ENVMAP":"",o.envMap?"#define "+p:"",o.lightMap?"#define USE_LIGHTMAP":"",o.aoMap?"#define USE_AOMAP":"",o.emissiveMap?"#define USE_EMISSIVEMAP":"",o.bumpMap?"#define USE_BUMPMAP":"",o.normalMap?"#define USE_NORMALMAP":"",o.normalMap&&o.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",o.displacementMap&&o.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",o.specularMap?"#define USE_SPECULARMAP":"",o.roughnessMap?"#define USE_ROUGHNESSMAP":"",o.metalnessMap?"#define USE_METALNESSMAP":"",o.alphaMap?"#define USE_ALPHAMAP":"",o.vertexTangents?"#define USE_TANGENT":"",o.vertexColors?"#define USE_COLOR":"",o.flatShading?"#define FLAT_SHADED":"",o.skinning?"#define USE_SKINNING":"",o.useVertexTexture?"#define BONE_TEXTURE":"",o.morphTargets?"#define USE_MORPHTARGETS":"",o.morphNormals&&!1===o.flatShading?"#define USE_MORPHNORMALS":"",o.doubleSided?"#define DOUBLE_SIDED":"",o.flipSided?"#define FLIP_SIDED":"",o.shadowMapEnabled?"#define USE_SHADOWMAP":"",o.shadowMapEnabled?"#define "+h:"",o.sizeAttenuation?"#define USE_SIZEATTENUATION":"",o.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",o.logarithmicDepthBuffer&&(a.isWebGL2||t.get("EXT_frag_depth"))?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#ifdef USE_COLOR","\tattribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS","\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(Ro).join("\n"),v=[x,"precision "+o.precision+" float;","precision "+o.precision+" int;","#define SHADER_NAME "+r.name,w,o.alphaTest?"#define ALPHATEST "+o.alphaTest+(o.alphaTest%1?"":".0"):"","#define GAMMA_FACTOR "+_,o.useFog&&o.fog?"#define USE_FOG":"",o.useFog&&o.fogExp?"#define FOG_EXP2":"",o.map?"#define USE_MAP":"",o.matcap?"#define USE_MATCAP":"",o.envMap?"#define USE_ENVMAP":"",o.envMap?"#define "+d:"",o.envMap?"#define "+p:"",o.envMap?"#define "+f:"",o.lightMap?"#define USE_LIGHTMAP":"",o.aoMap?"#define USE_AOMAP":"",o.emissiveMap?"#define USE_EMISSIVEMAP":"",o.bumpMap?"#define USE_BUMPMAP":"",o.normalMap?"#define USE_NORMALMAP":"",o.normalMap&&o.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",o.specularMap?"#define USE_SPECULARMAP":"",o.roughnessMap?"#define USE_ROUGHNESSMAP":"",o.metalnessMap?"#define USE_METALNESSMAP":"",o.alphaMap?"#define USE_ALPHAMAP":"",o.vertexTangents?"#define USE_TANGENT":"",o.vertexColors?"#define USE_COLOR":"",o.gradientMap?"#define USE_GRADIENTMAP":"",o.flatShading?"#define FLAT_SHADED":"",o.doubleSided?"#define DOUBLE_SIDED":"",o.flipSided?"#define FLIP_SIDED":"",o.shadowMapEnabled?"#define USE_SHADOWMAP":"",o.shadowMapEnabled?"#define "+h:"",o.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",o.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",o.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",o.logarithmicDepthBuffer&&(a.isWebGL2||t.get("EXT_frag_depth"))?"#define USE_LOGDEPTHBUF_EXT":"",o.envMap&&(a.isWebGL2||t.get("EXT_shader_texture_lod"))?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",o.toneMapping!==de?"#define TONE_MAPPING":"",o.toneMapping!==de?lr.tonemapping_pars_fragment:"",o.toneMapping!==de?Lo("toneMapping",o.toneMapping):"",o.dithering?"#define DITHERING":"",o.outputEncoding||o.mapEncoding||o.matcapEncoding||o.envMapEncoding||o.emissiveMapEncoding?lr.encodings_pars_fragment:"",o.mapEncoding?Po("mapTexelToLinear",o.mapEncoding):"",o.matcapEncoding?Po("matcapTexelToLinear",o.matcapEncoding):"",o.envMapEncoding?Po("envMapTexelToLinear",o.envMapEncoding):"",o.emissiveMapEncoding?Po("emissiveMapTexelToLinear",o.emissiveMapEncoding):"",o.outputEncoding?(g="linearToOutputTexel",y=o.outputEncoding,b=Ao(y),"vec4 "+g+"( vec4 value ) { return LinearTo"+b[0]+b[1]+"; }"):"",o.depthPacking?"#define DEPTH_PACKING "+i.depthPacking:"","\n"].filter(Ro).join("\n")),l=Do(l=Oo(l=Io(l),o),o),u=Do(u=Oo(u=Io(u),o),o),l=ko(l),u=ko(u),a.isWebGL2&&!i.isRawShaderMaterial){var S=!1,A=/^\s*#version\s+300\s+es\s*\n/;i.isShaderMaterial&&null!==l.match(A)&&null!==u.match(A)&&(S=!0,l=l.replace(A,""),u=u.replace(A,"")),m=["#version 300 es\n","#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+m,v=["#version 300 es\n","#define varying in",S?"":"out highp vec4 pc_fragColor;",S?"":"#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"+v}var C,P,L=v+u,R=To(s,35633,m+l),O=To(s,35632,L);if(s.attachShader(T,R),s.attachShader(T,O),void 0!==i.index0AttributeName?s.bindAttribLocation(T,0,i.index0AttributeName):!0===o.morphTargets&&s.bindAttribLocation(T,0,"position"),s.linkProgram(T),e.debug.checkShaderErrors){var D=s.getProgramInfoLog(T).trim(),I=s.getShaderInfoLog(R).trim(),k=s.getShaderInfoLog(O).trim(),N=!0,F=!0;if(!1===s.getProgramParameter(T,35714)){N=!1;var B=Co(s,R,"vertex"),U=Co(s,O,"fragment");console.error("THREE.WebGLProgram: shader error: ",s.getError(),"35715",s.getProgramParameter(T,35715),"gl.getProgramInfoLog",D,B,U)}else""!==D?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",D):""!==I&&""!==k||(F=!1);F&&(this.diagnostics={runnable:N,material:i,programLog:D,vertexShader:{log:I,prefix:m},fragmentShader:{log:k,prefix:v}})}return s.deleteShader(R),s.deleteShader(O),this.getUniforms=function(){return void 0===C&&(C=new Eo(s,T)),C},this.getAttributes=function(){return void 0===P&&(P=function(e,t){for(var n={},i=e.getProgramParameter(t,35721),r=0;r0,maxBones:d,useVertexTexture:n.floatVertexTextures,morphTargets:t.morphTargets,morphNormals:t.morphNormals,maxMorphTargets:e.maxMorphTargets,maxMorphNormals:e.maxMorphNormals,numDirLights:i.directional.length,numPointLights:i.point.length,numSpotLights:i.spot.length,numRectAreaLights:i.rectArea.length,numHemiLights:i.hemi.length,numClippingPlanes:c,numClipIntersection:l,dithering:t.dithering,shadowMapEnabled:e.shadowMap.enabled&&u.receiveShadow&&o.length>0,shadowMapType:e.shadowMap.type,toneMapping:e.toneMapping,physicallyCorrectLights:e.physicallyCorrectLights,premultipliedAlpha:t.premultipliedAlpha,alphaTest:t.alphaTest,doubleSided:t.side===A,flipSided:t.side===S,depthPacking:void 0!==t.depthPacking&&t.depthPacking}},this.getProgramCode=function(t,n){var i=[];if(n.shaderID?i.push(n.shaderID):(i.push(t.fragmentShader),i.push(t.vertexShader)),void 0!==t.defines)for(var r in t.defines)i.push(r),i.push(t.defines[r]);for(var a=0;a1&&n.sort(Uo),i.length>1&&i.sort(zo)}}}function Ho(){var e={};function t(n){var i=n.target;i.removeEventListener("dispose",t),delete e[i.id]}return{get:function(n,i){var r,o=e[n.id];return void 0===o?(r=new Go,e[n.id]={},e[n.id][i.id]=r,n.addEventListener("dispose",t)):void 0===(r=o[i.id])&&(r=new Go,o[i.id]=r),r},dispose:function(){e={}}}}function jo(){var e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];var n;switch(t.type){case"DirectionalLight":n={direction:new bn,color:new vi,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new gn};break;case"SpotLight":n={position:new bn,direction:new bn,color:new vi,distance:0,coneCos:0,penumbraCos:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new gn};break;case"PointLight":n={position:new bn,color:new vi,distance:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new gn,shadowCameraNear:1,shadowCameraFar:1e3};break;case"HemisphereLight":n={direction:new bn,skyColor:new vi,groundColor:new vi};break;case"RectAreaLight":n={color:new vi,position:new bn,halfWidth:new bn,halfHeight:new bn}}return e[t.id]=n,n}}}var Vo=0;function Wo(){for(var e=new jo,t={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,shadowsLength:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],point:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]},n=0;n<9;n++)t.probe.push(new bn);var i=new bn,r=new Nn,o=new Nn;return{setup:function(n,a,s){for(var c=0,l=0,u=0,h=0;h<9;h++)t.probe[h].set(0,0,0);for(var d=0,p=0,f=0,m=0,v=0,g=s.matrixWorldInverse,y=(h=0,n.length);h0:s&&s.isGeometry&&(g=s.morphTargets&&s.morphTargets.length>0)),t.isSkinnedMesh&&!1===n.skinning&&console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:",t);var y=t.isSkinnedMesh&&n.skinning,b=0;g&&(b|=l),y&&(b|=u),c=h[b]}if(e.localClippingEnabled&&!0===n.clipShadows&&0!==n.clippingPlanes.length){var _=c.uuid,x=n.uuid,w=f[_];void 0===w&&(w={},f[_]=w);var M=w[x];void 0===M&&(M=c.clone(),w[x]=M),c=M}return c.visible=n.visible,c.wireframe=n.wireframe,c.side=null!=n.shadowSide?n.shadowSide:m[n.side],c.clipShadows=n.clipShadows,c.clippingPlanes=n.clippingPlanes,c.clipIntersection=n.clipIntersection,c.wireframeLinewidth=n.wireframeLinewidth,c.linewidth=n.linewidth,i&&c.isMeshDistanceMaterial&&(c.referencePosition.copy(r),c.nearDistance=o,c.farDistance=a),c}function L(n,r,o,a){if(!1!==n.visible){if(n.layers.test(r.layers)&&(n.isMesh||n.isLine||n.isPoints)&&n.castShadow&&(!n.frustumCulled||i.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(o.matrixWorldInverse,n.matrixWorld);var s=t.update(n),l=n.material;if(Array.isArray(l))for(var u=s.groups,h=0,d=u.length;h=1):-1!==j.indexOf("OpenGL ES")&&(H=parseFloat(/^OpenGL\ ES\ ([0-9])/.exec(j)[1]),G=H>=2);var V=null,W={},q=new Dn,X=new Dn;function Y(t,n,i){var r=new Uint8Array(4),o=e.createTexture();e.bindTexture(t,o),e.texParameteri(t,10241,9728),e.texParameteri(t,10240,9728);for(var a=0;ai||e.height>i)&&(r=i/Math.max(e.width,e.height)),r<1||!0===t){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){var o=t?vn.floorPowerOfTwo:Math.floor,a=o(r*e.width),c=o(r*e.height);void 0===s&&(s=u(a,c));var l=n?u(a,c):s;return l.width=a,l.height=c,l.getContext("2d").drawImage(e,0,0,a,c),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+e.width+"x"+e.height+") to ("+a+"x"+c+")."),l}return"data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+e.width+"x"+e.height+")."),e}return e}function d(e){return vn.isPowerOfTwo(e.width)&&vn.isPowerOfTwo(e.height)}function p(e,t){return e.generateMipmaps&&t&&e.minFilter!==Pe&&e.minFilter!==Ie}function f(t,n,r,o){e.generateMipmap(t),i.get(n).__maxMipLevel=Math.log(Math.max(r,o))*Math.LOG2E}function m(e,n){if(!r.isWebGL2)return e;var i=e;return 6403===e&&(5126===n&&(i=33326),5131===n&&(i=33325),5121===n&&(i=33321)),6407===e&&(5126===n&&(i=34837),5131===n&&(i=34843),5121===n&&(i=32849)),6408===e&&(5126===n&&(i=34836),5131===n&&(i=34842),5121===n&&(i=32856)),33325===i||33326===i||34842===i||34836===i?t.get("EXT_color_buffer_float"):34843!==i&&34837!==i||console.warn("THREE.WebGLRenderer: Floating point textures with RGB format not supported. Please use RGBA instead."),i}function v(e){return e===Pe||e===Le||e===Oe?9728:9729}function g(t){var n=t.target;n.removeEventListener("dispose",g),function(t){var n=i.get(t);if(void 0===n.__webglInit)return;e.deleteTexture(n.__webglTexture),i.remove(t)}(n),n.isVideoTexture&&delete c[n.id],a.memory.textures--}function y(t){var n=t.target;n.removeEventListener("dispose",y),function(t){var n=i.get(t),r=i.get(t.texture);if(!t)return;void 0!==r.__webglTexture&&e.deleteTexture(r.__webglTexture);t.depthTexture&&t.depthTexture.dispose();if(t.isWebGLRenderTargetCube)for(var o=0;o<6;o++)e.deleteFramebuffer(n.__webglFramebuffer[o]),n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer[o]);else e.deleteFramebuffer(n.__webglFramebuffer),n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer);i.remove(t.texture),i.remove(t)}(n),a.memory.textures--}var b=0;function _(e,t){var r=i.get(e);if(e.isVideoTexture&&function(e){var t=e.id,n=a.render.frame;c[t]!==n&&(c[t]=n,e.update())}(e),e.version>0&&r.__version!==e.version){var o=e.image;if(void 0===o)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else{if(!1!==o.complete)return void T(r,e,t);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.activeTexture(33984+t),n.bindTexture(3553,r.__webglTexture)}function x(t,a){var s=i.get(t);if(6===t.image.length)if(t.version>0&&s.__version!==t.version){E(s,t),n.activeTexture(33984+a),n.bindTexture(34067,s.__webglTexture),e.pixelStorei(37440,t.flipY);for(var c=t&&t.isCompressedTexture,l=t.image[0]&&t.image[0].isDataTexture,u=[],v=0;v<6;v++)u[v]=c||l?l?t.image[v].image:t.image[v]:h(t.image[v],!1,!0,r.maxCubemapSize);var g=u[0],y=d(g)||r.isWebGL2,b=o.convert(t.format),_=o.convert(t.type),x=m(b,_);M(34067,t,y);for(v=0;v<6;v++)if(c)for(var w,T=u[v].mipmaps,S=0,A=T.length;S-1?n.compressedTexImage2D(34069+v,S,x,w.width,w.height,0,w.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):n.texImage2D(34069+v,S,x,w.width,w.height,0,b,_,w.data);else l?n.texImage2D(34069+v,0,x,u[v].width,u[v].height,0,b,_,u[v].data):n.texImage2D(34069+v,0,x,b,_,u[v]);s.__maxMipLevel=c?T.length-1:0,p(t,y)&&f(34067,t,g.width,g.height),s.__version=t.version,t.onUpdate&&t.onUpdate(t)}else n.activeTexture(33984+a),n.bindTexture(34067,s.__webglTexture)}function w(e,t){n.activeTexture(33984+t),n.bindTexture(34067,i.get(e).__webglTexture)}function M(n,a,s){var c;if(s?(e.texParameteri(n,10242,o.convert(a.wrapS)),e.texParameteri(n,10243,o.convert(a.wrapT)),32879!==n&&35866!==n||e.texParameteri(n,32882,o.convert(a.wrapR)),e.texParameteri(n,10240,o.convert(a.magFilter)),e.texParameteri(n,10241,o.convert(a.minFilter))):(e.texParameteri(n,10242,33071),e.texParameteri(n,10243,33071),32879!==n&&35866!==n||e.texParameteri(n,32882,33071),a.wrapS===Ae&&a.wrapT===Ae||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),e.texParameteri(n,10240,v(a.magFilter)),e.texParameteri(n,10241,v(a.minFilter)),a.minFilter!==Pe&&a.minFilter!==Ie&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),c=t.get("EXT_texture_filter_anisotropic")){if(a.type===We&&null===t.get("OES_texture_float_linear"))return;if(a.type===qe&&null===(r.isWebGL2||t.get("OES_texture_half_float_linear")))return;(a.anisotropy>1||i.get(a).__currentAnisotropy)&&(e.texParameterf(n,c.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,r.getMaxAnisotropy())),i.get(a).__currentAnisotropy=a.anisotropy)}}function E(t,n){void 0===t.__webglInit&&(t.__webglInit=!0,n.addEventListener("dispose",g),t.__webglTexture=e.createTexture(),a.memory.textures++)}function T(t,i,a){var s=3553;i.isDataTexture2DArray&&(s=35866),i.isDataTexture3D&&(s=32879),E(t,i),n.activeTexture(33984+a),n.bindTexture(s,t.__webglTexture),e.pixelStorei(37440,i.flipY),e.pixelStorei(37441,i.premultiplyAlpha),e.pixelStorei(3317,i.unpackAlignment);var c=function(e){return!r.isWebGL2&&(e.wrapS!==Ae||e.wrapT!==Ae||e.minFilter!==Pe&&e.minFilter!==Ie)}(i)&&!1===d(i.image),l=h(i.image,c,!1,r.maxTextureSize),u=d(l)||r.isWebGL2,v=o.convert(i.format),g=o.convert(i.type),y=m(v,g);M(s,i,u);var b,_=i.mipmaps;if(i.isDepthTexture){if(y=6402,i.type===We){if(!r.isWebGL2)throw new Error("Float Depth Texture only supported in WebGL2.0");y=36012}else r.isWebGL2&&(y=33189);i.format===it&&6402===y&&i.type!==He&&i.type!==Ve&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),i.type=He,g=o.convert(i.type)),i.format===rt&&(y=34041,i.type!==Je&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),i.type=Je,g=o.convert(i.type))),n.texImage2D(3553,0,y,l.width,l.height,0,v,g,null)}else if(i.isDataTexture)if(_.length>0&&u){for(var x=0,w=_.length;x-1?n.compressedTexImage2D(3553,x,y,b.width,b.height,0,b.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):n.texImage2D(3553,x,y,b.width,b.height,0,v,g,b.data);t.__maxMipLevel=_.length-1}else if(i.isDataTexture2DArray)n.texImage3D(35866,0,y,l.width,l.height,l.depth,0,v,g,l.data),t.__maxMipLevel=0;else if(i.isDataTexture3D)n.texImage3D(32879,0,y,l.width,l.height,l.depth,0,v,g,l.data),t.__maxMipLevel=0;else if(_.length>0&&u){for(x=0,w=_.length;x=r.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+r.maxTextures),b+=1,e},this.resetTextureUnits=function(){b=0},this.setTexture2D=_,this.setTexture2DArray=function(e,t){var r=i.get(e);e.version>0&&r.__version!==e.version?T(r,e,t):(n.activeTexture(33984+t),n.bindTexture(35866,r.__webglTexture))},this.setTexture3D=function(e,t){var r=i.get(e);e.version>0&&r.__version!==e.version?T(r,e,t):(n.activeTexture(33984+t),n.bindTexture(32879,r.__webglTexture))},this.setTextureCube=x,this.setTextureCubeDynamic=w,this.setupRenderTarget=function(t){var s=i.get(t),c=i.get(t.texture);t.addEventListener("dispose",y),c.__webglTexture=e.createTexture(),a.memory.textures++;var l=!0===t.isWebGLRenderTargetCube,u=!0===t.isWebGLMultisampleRenderTarget,h=d(t)||r.isWebGL2;if(l){s.__webglFramebuffer=[];for(var v=0;v<6;v++)s.__webglFramebuffer[v]=e.createFramebuffer()}else if(s.__webglFramebuffer=e.createFramebuffer(),u)if(r.isWebGL2){s.__webglMultisampledFramebuffer=e.createFramebuffer(),s.__webglColorRenderbuffer=e.createRenderbuffer(),e.bindRenderbuffer(36161,s.__webglColorRenderbuffer);var g=m(o.convert(t.texture.format),o.convert(t.texture.type)),b=P(t);e.renderbufferStorageMultisample(36161,b,g,t.width,t.height),e.bindFramebuffer(36160,s.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(36160,36064,36161,s.__webglColorRenderbuffer),e.bindRenderbuffer(36161,null),t.depthBuffer&&(s.__webglDepthRenderbuffer=e.createRenderbuffer(),A(s.__webglDepthRenderbuffer,t,!0)),e.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(l){for(n.bindTexture(34067,c.__webglTexture),M(34067,t.texture,h),v=0;v<6;v++)S(s.__webglFramebuffer[v],t,36064,34069+v);p(t.texture,h)&&f(34067,t.texture,t.width,t.height),n.bindTexture(34067,null)}else n.bindTexture(3553,c.__webglTexture),M(3553,t.texture,h),S(s.__webglFramebuffer,t,36064,3553),p(t.texture,h)&&f(3553,t.texture,t.width,t.height),n.bindTexture(3553,null);t.depthBuffer&&C(t)},this.updateRenderTargetMipmap=function(e){var t=e.texture;if(p(t,d(e)||r.isWebGL2)){var o=e.isWebGLRenderTargetCube?34067:3553,a=i.get(t).__webglTexture;n.bindTexture(o,a),f(o,t,e.width,e.height),n.bindTexture(o,null)}},this.updateMultisampleRenderTarget=function(t){if(t.isWebGLMultisampleRenderTarget)if(r.isWebGL2){var n=i.get(t);e.bindFramebuffer(36008,n.__webglMultisampledFramebuffer),e.bindFramebuffer(36009,n.__webglFramebuffer);var o=t.width,a=t.height,s=16384;t.depthBuffer&&(s|=256),t.stencilBuffer&&(s|=1024),e.blitFramebuffer(0,0,o,a,0,0,o,a,s,9728)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")},this.safeSetTexture2D=function(e,t){e&&e.isWebGLRenderTarget&&(!1===L&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),L=!0),e=e.texture),_(e,t)},this.safeSetTextureCube=function(e,t){e&&e.isWebGLRenderTargetCube&&(!1===R&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),R=!0),e=e.texture),e&&e.isCubeTexture||Array.isArray(e.image)&&6===e.image.length?x(e,t):w(e,t)}}function Qo(e,t,n){return{convert:function(e){var i;if(e===Se)return 10497;if(e===Ae)return 33071;if(e===Ce)return 33648;if(e===Pe)return 9728;if(e===Le)return 9984;if(e===Oe)return 9986;if(e===Ie)return 9729;if(e===ke)return 9985;if(e===Fe)return 9987;if(e===Ue)return 5121;if(e===Xe)return 32819;if(e===Ye)return 32820;if(e===$e)return 33635;if(e===ze)return 5120;if(e===Ge)return 5122;if(e===He)return 5123;if(e===je)return 5124;if(e===Ve)return 5125;if(e===We)return 5126;if(e===qe){if(n.isWebGL2)return 5131;if(null!==(i=t.get("OES_texture_half_float")))return i.HALF_FLOAT_OES}if(e===Ze)return 6406;if(e===Ke)return 6407;if(e===Qe)return 6408;if(e===et)return 6409;if(e===tt)return 6410;if(e===it)return 6402;if(e===rt)return 34041;if(e===ot)return 6403;if(e===U)return 32774;if(e===z)return 32778;if(e===G)return 32779;if(e===V)return 0;if(e===W)return 1;if(e===q)return 768;if(e===X)return 769;if(e===Y)return 770;if(e===$)return 771;if(e===J)return 772;if(e===Z)return 773;if(e===K)return 774;if(e===Q)return 775;if(e===ee)return 776;if((e===at||e===st||e===ct||e===lt)&&null!==(i=t.get("WEBGL_compressed_texture_s3tc"))){if(e===at)return i.COMPRESSED_RGB_S3TC_DXT1_EXT;if(e===st)return i.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(e===ct)return i.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(e===lt)return i.COMPRESSED_RGBA_S3TC_DXT5_EXT}if((e===ut||e===ht||e===dt||e===pt)&&null!==(i=t.get("WEBGL_compressed_texture_pvrtc"))){if(e===ut)return i.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(e===ht)return i.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(e===dt)return i.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(e===pt)return i.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(e===ft&&null!==(i=t.get("WEBGL_compressed_texture_etc1")))return i.COMPRESSED_RGB_ETC1_WEBGL;if((e===mt||e===vt||e===gt||e===yt||e===bt||e===_t||e===xt||e===wt||e===Mt||e===Et||e===Tt||e===St||e===At||e===Ct)&&null!==(i=t.get("WEBGL_compressed_texture_astc")))return e;if(e===H||e===j){if(n.isWebGL2){if(e===H)return 32775;if(e===j)return 32776}if(null!==(i=t.get("EXT_blend_minmax"))){if(e===H)return i.MIN_EXT;if(e===j)return i.MAX_EXT}}if(e===Je){if(n.isWebGL2)return 34042;if(null!==(i=t.get("WEBGL_depth_texture")))return i.UNSIGNED_INT_24_8_WEBGL}return 0}}}function ea(){ai.call(this),this.type="Group"}function ta(e){Qi.call(this),this.cameras=e||[]}Yo.prototype=Object.create(wi.prototype),Yo.prototype.constructor=Yo,Yo.prototype.isMeshDepthMaterial=!0,Yo.prototype.copy=function(e){return wi.prototype.copy.call(this,e),this.depthPacking=e.depthPacking,this.skinning=e.skinning,this.morphTargets=e.morphTargets,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},$o.prototype=Object.create(wi.prototype),$o.prototype.constructor=$o,$o.prototype.isMeshDistanceMaterial=!0,$o.prototype.copy=function(e){return wi.prototype.copy.call(this,e),this.referencePosition.copy(e.referencePosition),this.nearDistance=e.nearDistance,this.farDistance=e.farDistance,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this},ea.prototype=Object.assign(Object.create(ai.prototype),{constructor:ea,isGroup:!0}),ta.prototype=Object.assign(Object.create(Qi.prototype),{constructor:ta,isArrayCamera:!0});var na,ia,ra,oa,aa,sa,ca=new bn,la=new bn;function ua(e,t,n){ca.setFromMatrixPosition(t.matrixWorld),la.setFromMatrixPosition(n.matrixWorld);var i=ca.distanceTo(la),r=t.projectionMatrix.elements,o=n.projectionMatrix.elements,a=r[14]/(r[10]-1),s=r[14]/(r[10]+1),c=(r[9]+1)/r[5],l=(r[9]-1)/r[5],u=(r[8]-1)/r[0],h=(o[8]+1)/o[0],d=a*u,p=a*h,f=i/(-u+h),m=f*-u;t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(m),e.translateZ(f),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.getInverse(e.matrixWorld);var v=a+f,g=s+f,y=d-m,b=p+(i-m),_=c*s/g*v,x=l*s/g*v;e.projectionMatrix.makePerspective(y,b,_,x,v,g)}function ha(e){var t,n,i=this,r=null,o=null,a=null,s=[],c=new Nn,l=new Nn,u=1,h="local-floor";"undefined"!=typeof window&&"VRFrameData"in window&&(o=new window.VRFrameData,window.addEventListener("vrdisplaypresentchange",x,!1));var d=new Nn,p=new yn,f=new bn,m=new Qi;m.viewport=new Dn,m.layers.enable(1);var v=new Qi;v.viewport=new Dn,v.layers.enable(2);var g=new ta([m,v]);function y(){return null!==r&&!0===r.isPresenting}g.layers.enable(1),g.layers.enable(2);var b,_=new gn;function x(){if(y()){var o=r.getEyeParameters("left");t=2*o.renderWidth*u,n=o.renderHeight*u,b=e.getPixelRatio(),e.getSize(_),e.setDrawingBufferSize(t,n,1),m.viewport.set(0,0,t/2,n),v.viewport.set(t/2,0,t/2,n),T.start(),i.dispatchEvent({type:"sessionstart"})}else i.enabled&&e.setDrawingBufferSize(_.width,_.height,b),T.stop(),i.dispatchEvent({type:"sessionend"})}var w=[];function M(e){for(var t=navigator.getGamepads&&navigator.getGamepads(),n=0,i=0,r=t.length;n=0){var c=i[a];if(void 0!==c){var l=c.normalized,u=c.itemSize,h=x.get(c);if(void 0===h)continue;var d=h.buffer,p=h.type,y=h.bytesPerElement;if(c.isInterleavedBufferAttribute){var b=c.data,_=b.stride,w=c.offset;b&&b.isInstancedInterleavedBuffer?(g.enableAttributeAndDivisor(s,b.meshPerAttribute),void 0===n.maxInstancedCount&&(n.maxInstancedCount=b.meshPerAttribute*b.count)):g.enableAttribute(s),f.bindBuffer(34962,d),f.vertexAttribPointer(s,u,p,l,_*y,w*y)}else c.isInstancedBufferAttribute?(g.enableAttributeAndDivisor(s,c.meshPerAttribute),void 0===n.maxInstancedCount&&(n.maxInstancedCount=c.meshPerAttribute*c.count)):g.enableAttribute(s),f.bindBuffer(34962,d),f.vertexAttribPointer(s,u,p,l,0,0)}else if(void 0!==o){var M=o[a];if(void 0!==M)switch(M.length){case 2:f.vertexAttrib2fv(s,M);break;case 3:f.vertexAttrib3fv(s,M);break;case 4:f.vertexAttrib4fv(s,M);break;default:f.vertexAttrib1fv(s,M)}}}}g.disableUnusedAttributes()}(i,s,n),null!==u&&f.bindBuffer(34963,l.buffer));var y=1/0;null!==u?y=u.count:void 0!==h&&(y=h.count);var b=n.drawRange.start*d,_=n.drawRange.count*d,M=null!==o?o.start*d:0,E=null!==o?o.count*d:1/0,T=Math.max(b,M),S=Math.min(y,b+_,M+E)-1,A=Math.max(0,S-T+1);if(0!==A){if(r.isMesh)if(!0===i.wireframe)g.setLineWidth(i.wireframeLinewidth*oe()),p.setMode(1);else switch(r.drawMode){case Bt:p.setMode(4);break;case Ut:p.setMode(5);break;case zt:p.setMode(6)}else if(r.isLine){var C=i.linewidth;void 0===C&&(C=1),g.setLineWidth(C*oe()),r.isLineSegments?p.setMode(1):r.isLineLoop?p.setMode(2):p.setMode(3)}else r.isPoints?p.setMode(0):r.isSprite&&p.setMode(4);n&&n.isInstancedBufferGeometry?n.maxInstancedCount>0&&p.renderInstances(n,T,A):p.render(T,A)}},this.compile=function(e,t){(d=A.get(e,t)).init(),e.traverse(function(e){e.isLight&&(d.pushLight(e),e.castShadow&&d.pushShadow(e))}),d.setupLights(t),e.traverse(function(t){if(t.material)if(Array.isArray(t.material))for(var n=0;n=0&&e.numSupportedMorphTargets++}if(e.morphNormals){e.numSupportedMorphNormals=0;for(f=0;f=0&&e.numSupportedMorphNormals++}var m=i.shader.uniforms;(e.isShaderMaterial||e.isRawShaderMaterial)&&!0!==e.clipping||(i.numClippingPlanes=ee.numPlanes,i.numIntersection=ee.numIntersection,m.clippingPlanes=ee.uniform),i.fog=t,i.lightsStateVersion=a,e.lights&&(m.ambientLightColor.value=r.state.ambient,m.lightProbe.value=r.state.probe,m.directionalLights.value=r.state.directional,m.spotLights.value=r.state.spot,m.rectAreaLights.value=r.state.rectArea,m.pointLights.value=r.state.point,m.hemisphereLights.value=r.state.hemi,m.directionalShadowMap.value=r.state.directionalShadowMap,m.directionalShadowMatrix.value=r.state.directionalShadowMatrix,m.spotShadowMap.value=r.state.spotShadowMap,m.spotShadowMatrix.value=r.state.spotShadowMatrix,m.pointShadowMap.value=r.state.pointShadowMap,m.pointShadowMatrix.value=r.state.pointShadowMatrix);var v=i.program.getUniforms(),g=Eo.seqWithValue(v.seq,m);i.uniformsList=g}function _e(e,t,n,i){_.resetTextureUnits();var r=b.get(n),o=d.state.lights;if(te&&(ne||e!==H)){var a=e===H&&n.id===z;ee.setState(n.clippingPlanes,n.clipIntersection,n.clipShadows,e,r,a)}!1===n.needsUpdate&&(void 0===r.program?n.needsUpdate=!0:n.fog&&r.fog!==t?n.needsUpdate=!0:n.lights&&r.lightsStateVersion!==o.state.version?n.needsUpdate=!0:void 0===r.numClippingPlanes||r.numClippingPlanes===ee.numPlanes&&r.numIntersection===ee.numIntersection||(n.needsUpdate=!0)),n.needsUpdate&&(be(n,t,i),n.needsUpdate=!1);var s,c,l=!1,u=!1,h=!1,p=r.program,m=p.getUniforms(),y=r.shader.uniforms;if(g.useProgram(p.program)&&(l=!0,u=!0,h=!0),n.id!==z&&(z=n.id,u=!0),l||H!==e){if(m.setValue(f,"projectionMatrix",e.projectionMatrix),v.logarithmicDepthBuffer&&m.setValue(f,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),H!==e&&(H=e,u=!0,h=!0),n.isShaderMaterial||n.isMeshPhongMaterial||n.isMeshStandardMaterial||n.envMap){var x=m.map.cameraPosition;void 0!==x&&x.setValue(f,re.setFromMatrixPosition(e.matrixWorld))}(n.isMeshPhongMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial||n.skinning)&&m.setValue(f,"viewMatrix",e.matrixWorldInverse)}if(n.skinning){m.setOptional(f,i,"bindMatrix"),m.setOptional(f,i,"bindMatrixInverse");var w=i.skeleton;if(w){var M=w.bones;if(v.floatVertexTextures){if(void 0===w.boneTexture){var E=Math.sqrt(4*M.length);E=vn.ceilPowerOfTwo(E),E=Math.max(E,4);var T=new Float32Array(E*E*4);T.set(w.boneMatrices);var A=new ar(T,E,E,Qe,We);A.needsUpdate=!0,w.boneMatrices=T,w.boneTexture=A,w.boneTextureSize=E}m.setValue(f,"boneTexture",w.boneTexture,_),m.setValue(f,"boneTextureSize",w.boneTextureSize)}else m.setOptional(f,w,"boneMatrices")}}return u&&(m.setValue(f,"toneMappingExposure",D.toneMappingExposure),m.setValue(f,"toneMappingWhitePoint",D.toneMappingWhitePoint),n.lights&&(c=h,(s=y).ambientLightColor.needsUpdate=c,s.lightProbe.needsUpdate=c,s.directionalLights.needsUpdate=c,s.pointLights.needsUpdate=c,s.spotLights.needsUpdate=c,s.rectAreaLights.needsUpdate=c,s.hemisphereLights.needsUpdate=c),t&&n.fog&&function(e,t){e.fogColor.value.copy(t.color),t.isFog?(e.fogNear.value=t.near,e.fogFar.value=t.far):t.isFogExp2&&(e.fogDensity.value=t.density)}(y,t),n.isMeshBasicMaterial?xe(y,n):n.isMeshLambertMaterial?(xe(y,n),function(e,t){t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap)}(y,n)):n.isMeshPhongMaterial?(xe(y,n),n.isMeshToonMaterial?function(e,t){we(e,t),t.gradientMap&&(e.gradientMap.value=t.gradientMap)}(y,n):we(y,n)):n.isMeshStandardMaterial?(xe(y,n),n.isMeshPhysicalMaterial?function(e,t){Me(e,t),e.reflectivity.value=t.reflectivity,e.clearCoat.value=t.clearCoat,e.clearCoatRoughness.value=t.clearCoatRoughness}(y,n):Me(y,n)):n.isMeshMatcapMaterial?(xe(y,n),function(e,t){t.matcap&&(e.matcap.value=t.matcap);t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,t.side===S&&(e.bumpScale.value*=-1));t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===S&&e.normalScale.value.negate());t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(y,n)):n.isMeshDepthMaterial?(xe(y,n),function(e,t){t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(y,n)):n.isMeshDistanceMaterial?(xe(y,n),function(e,t){t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias);e.referencePosition.value.copy(t.referencePosition),e.nearDistance.value=t.nearDistance,e.farDistance.value=t.farDistance}(y,n)):n.isMeshNormalMaterial?(xe(y,n),function(e,t){t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,t.side===S&&(e.bumpScale.value*=-1));t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===S&&e.normalScale.value.negate());t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(y,n)):n.isLineBasicMaterial?(function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity}(y,n),n.isLineDashedMaterial&&function(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}(y,n)):n.isPointsMaterial?function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*$,e.scale.value=.5*Y,e.map.value=t.map,null!==t.map&&(!0===t.map.matrixAutoUpdate&&t.map.updateMatrix(),e.uvTransform.value.copy(t.map.matrix))}(y,n):n.isSpriteMaterial?function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.rotation.value=t.rotation,e.map.value=t.map,null!==t.map&&(!0===t.map.matrixAutoUpdate&&t.map.updateMatrix(),e.uvTransform.value.copy(t.map.matrix))}(y,n):n.isShadowMaterial&&(y.color.value.copy(n.color),y.opacity.value=n.opacity),void 0!==y.ltc_1&&(y.ltc_1.value=ur.LTC_1),void 0!==y.ltc_2&&(y.ltc_2.value=ur.LTC_2),Eo.upload(f,r.uniformsList,y,_)),n.isShaderMaterial&&!0===n.uniformsNeedUpdate&&(Eo.upload(f,r.uniformsList,y,_),n.uniformsNeedUpdate=!1),n.isSpriteMaterial&&m.setValue(f,"center",i.center),m.setValue(f,"modelViewMatrix",i.modelViewMatrix),m.setValue(f,"normalMatrix",i.normalMatrix),m.setValue(f,"modelMatrix",i.matrixWorld),p}function xe(e,t){var n;e.opacity.value=t.opacity,t.color&&e.diffuse.value.copy(t.color),t.emissive&&e.emissive.value.copy(t.emissive).multiplyScalar(t.emissiveIntensity),t.map&&(e.map.value=t.map),t.alphaMap&&(e.alphaMap.value=t.alphaMap),t.specularMap&&(e.specularMap.value=t.specularMap),t.envMap&&(e.envMap.value=t.envMap,e.flipEnvMap.value=t.envMap.isCubeTexture?-1:1,e.reflectivity.value=t.reflectivity,e.refractionRatio.value=t.refractionRatio,e.maxMipLevel.value=b.get(t.envMap).__maxMipLevel),t.lightMap&&(e.lightMap.value=t.lightMap,e.lightMapIntensity.value=t.lightMapIntensity),t.aoMap&&(e.aoMap.value=t.aoMap,e.aoMapIntensity.value=t.aoMapIntensity),t.map?n=t.map:t.specularMap?n=t.specularMap:t.displacementMap?n=t.displacementMap:t.normalMap?n=t.normalMap:t.bumpMap?n=t.bumpMap:t.roughnessMap?n=t.roughnessMap:t.metalnessMap?n=t.metalnessMap:t.alphaMap?n=t.alphaMap:t.emissiveMap&&(n=t.emissiveMap),void 0!==n&&(n.isWebGLRenderTarget&&(n=n.texture),!0===n.matrixAutoUpdate&&n.updateMatrix(),e.uvTransform.value.copy(n.matrix))}function we(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,t.side===S&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===S&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}function Me(e,t){e.roughness.value=t.roughness,e.metalness.value=t.metalness,t.roughnessMap&&(e.roughnessMap.value=t.roughnessMap),t.metalnessMap&&(e.metalnessMap.value=t.metalnessMap),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,t.side===S&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===S&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias),t.envMap&&(e.envMapIntensity.value=t.envMapIntensity)}ve.setAnimationLoop(function(e){ce.isPresenting()||me&&me(e)}),"undefined"!=typeof window&&ve.setContext(window),this.setAnimationLoop=function(e){me=e,ce.setAnimationLoop(e),ve.start()},this.render=function(e,t){var n,i;if(void 0!==arguments[2]&&(console.warn("THREE.WebGLRenderer.render(): the renderTarget argument has been removed. Use .setRenderTarget() instead."),n=arguments[2]),void 0!==arguments[3]&&(console.warn("THREE.WebGLRenderer.render(): the forceClear argument has been removed. Use .clear() instead."),i=arguments[3]),t&&t.isCamera){if(!I){G.geometry=null,G.program=null,G.wireframe=!1,z=-1,H=null,!0===e.autoUpdate&&e.updateMatrixWorld(),null===t.parent&&t.updateMatrixWorld(),ce.enabled&&(t=ce.getCamera(t)),(d=A.get(e,t)).init(),e.onBeforeRender(D,e,t,n||B),ie.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),Q.setFromMatrix(ie),ne=this.localClippingEnabled,te=ee.init(this.clippingPlanes,ne,t),(h=T.get(e,t)).init(),function e(t,n,i,r){if(!1===t.visible)return;var o=t.layers.test(n.layers);if(o)if(t.isGroup)i=t.renderOrder;else if(t.isLOD)!0===t.autoUpdate&&t.update(n);else if(t.isLight)d.pushLight(t),t.castShadow&&d.pushShadow(t);else if(t.isSprite){if(!t.frustumCulled||Q.intersectsSprite(t)){r&&re.setFromMatrixPosition(t.matrixWorld).applyMatrix4(ie);var a=M.update(t),s=t.material;s.visible&&h.push(t,a,s,i,re.z,null)}}else if(t.isImmediateRenderObject)r&&re.setFromMatrixPosition(t.matrixWorld).applyMatrix4(ie),h.push(t,null,t.material,i,re.z,null);else if((t.isMesh||t.isLine||t.isPoints)&&(t.isSkinnedMesh&&t.skeleton.update(),!t.frustumCulled||Q.intersectsObject(t))){r&&re.setFromMatrixPosition(t.matrixWorld).applyMatrix4(ie);var a=M.update(t),s=t.material;if(Array.isArray(s))for(var c=a.groups,l=0,u=c.length;l=0&&t<=e.width-i&&n>=0&&n<=e.height-r&&f.readPixels(t,n,i,r,O.convert(u),O.convert(h),o):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{c&&f.bindFramebuffer(36160,U)}}}else console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.")},this.copyFramebufferToTexture=function(e,t,n){var i=t.image.width,r=t.image.height,o=O.convert(t.format);_.setTexture2D(t,0),f.copyTexImage2D(3553,n||0,o,e.x,e.y,i,r,0)},this.copyTextureToTexture=function(e,t,n,i){var r=t.image.width,o=t.image.height,a=O.convert(n.format),s=O.convert(n.type);_.setTexture2D(n,0),t.isDataTexture?f.texSubImage2D(3553,i||0,e.x,e.y,r,o,a,s,t.image.data):f.texSubImage2D(3553,i||0,e.x,e.y,a,s,t.image)},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}function fa(e,t){this.name="",this.color=new vi(e),this.density=void 0!==t?t:25e-5}function ma(e,t,n){this.name="",this.color=new vi(e),this.near=void 0!==t?t:1,this.far=void 0!==n?n:1e3}function va(e,t){this.array=e,this.stride=t,this.count=void 0!==e?e.length/t:0,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.version=0}function ga(e,t,n,i){this.data=e,this.itemSize=t,this.offset=n,this.normalized=!0===i}function ya(e){wi.call(this),this.type="SpriteMaterial",this.color=new vi(16777215),this.map=null,this.rotation=0,this.sizeAttenuation=!0,this.lights=!1,this.transparent=!0,this.setValues(e)}function ba(e){if(ai.call(this),this.type="Sprite",void 0===na){na=new zi;var t=new va(new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),5);na.setIndex([0,1,2,0,2,3]),na.addAttribute("position",new ga(t,3,0,!1)),na.addAttribute("uv",new ga(t,2,3,!1))}this.geometry=na,this.material=void 0!==e?e:new ya,this.center=new gn(.5,.5)}function _a(){ai.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}function xa(e,t){e&&e.isGeometry&&console.error("THREE.SkinnedMesh no longer supports THREE.Geometry. Use THREE.BufferGeometry instead."),Gi.call(this,e,t),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new Nn,this.bindMatrixInverse=new Nn}function wa(e,t){if(e=e||[],this.bones=e.slice(0),this.boneMatrices=new Float32Array(16*this.bones.length),void 0===t)this.calculateInverses();else if(this.bones.length===t.length)this.boneInverses=t.slice(0);else{console.warn("THREE.Skeleton boneInverses is the wrong length."),this.boneInverses=[];for(var n=0,i=this.bones.length;n=0?(e(v-1e-5,m,h),d.subVectors(u,h)):(e(v+1e-5,m,h),d.subVectors(h,u)),m-1e-5>=0?(e(v,m-1e-5,h),p.subVectors(u,h)):(e(v,m+1e-5,h),p.subVectors(h,u)),l.crossVectors(d,p).normalize(),s.push(l.x,l.y,l.z),c.push(v,m)}}for(i=0;i.9&&a<.1&&(t<.2&&(o[e+0]+=1),n<.2&&(o[e+2]+=1),i<.2&&(o[e+4]+=1))}}()}(),this.addAttribute("position",new Oi(r,3)),this.addAttribute("normal",new Oi(r.slice(),3)),this.addAttribute("uv",new Oi(o,2)),0===i?this.computeVertexNormals():this.normalizeNormals()}function Ua(e,t){ji.call(this),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new za(e,t)),this.mergeVertices()}function za(e,t){Ba.call(this,[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],e,t),this.type="TetrahedronBufferGeometry",this.parameters={radius:e,detail:t}}function Ga(e,t){ji.call(this),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new Ha(e,t)),this.mergeVertices()}function Ha(e,t){Ba.call(this,[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],e,t),this.type="OctahedronBufferGeometry",this.parameters={radius:e,detail:t}}function ja(e,t){ji.call(this),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new Va(e,t)),this.mergeVertices()}function Va(e,t){var n=(1+Math.sqrt(5))/2,i=[-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1];Ba.call(this,i,[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],e,t),this.type="IcosahedronBufferGeometry",this.parameters={radius:e,detail:t}}function Wa(e,t){ji.call(this),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new qa(e,t)),this.mergeVertices()}function qa(e,t){var n=(1+Math.sqrt(5))/2,i=1/n,r=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-i,-n,0,-i,n,0,i,-n,0,i,n,-i,-n,0,-i,n,0,i,-n,0,i,n,0,-n,0,-i,n,0,-i,-n,0,i,n,0,i];Ba.call(this,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="DodecahedronBufferGeometry",this.parameters={radius:e,detail:t}}function Xa(e,t,n,i,r,o){ji.call(this),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:i,closed:r},void 0!==o&&console.warn("THREE.TubeGeometry: taper has been removed.");var a=new Ya(e,t,n,i,r);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals,this.fromBufferGeometry(a),this.mergeVertices()}function Ya(e,t,n,i,r){zi.call(this),this.type="TubeBufferGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:i,closed:r},t=t||64,n=n||1,i=i||8,r=r||!1;var o=e.computeFrenetFrames(t,r);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals;var a,s,c=new bn,l=new bn,u=new gn,h=new bn,d=[],p=[],f=[],m=[];function v(r){h=e.getPointAt(r/t,h);var a=o.normals[r],u=o.binormals[r];for(s=0;s<=i;s++){var f=s/i*Math.PI*2,m=Math.sin(f),v=-Math.cos(f);l.x=v*a.x+m*u.x,l.y=v*a.y+m*u.y,l.z=v*a.z+m*u.z,l.normalize(),p.push(l.x,l.y,l.z),c.x=h.x+n*l.x,c.y=h.y+n*l.y,c.z=h.z+n*l.z,d.push(c.x,c.y,c.z)}}!function(){for(a=0;ai.far||r.push({distance:y,point:e.clone(),uv:hi.getUV(e,a,s,c,l,u,h,new gn),face:null,object:this})}}}(),clone:function(){return new this.constructor(this.material).copy(this)},copy:function(e){return ai.prototype.copy.call(this,e),void 0!==e.center&&this.center.copy(e.center),this}}),_a.prototype=Object.assign(Object.create(ai.prototype),{constructor:_a,isLOD:!0,copy:function(e){ai.prototype.copy.call(this,e,!1);for(var t=e.levels,n=0,i=t.length;n1){e.setFromMatrixPosition(n.matrixWorld),t.setFromMatrixPosition(this.matrixWorld);var r=e.distanceTo(t);i[0].object.visible=!0;for(var o=1,a=i.length;o=i[o].distance;o++)i[o-1].object.visible=!1,i[o].object.visible=!0;for(;ol))p.applyMatrix4(this.matrixWorld),(E=i.ray.origin.distanceTo(p))i.far||r.push({distance:E,point:d.clone().applyMatrix4(this.matrixWorld),index:y,face:null,faceIndex:null,object:this})}else for(y=0,b=v.length/3-1;yl))p.applyMatrix4(this.matrixWorld),(E=i.ray.origin.distanceTo(p))i.far||r.push({distance:E,point:d.clone().applyMatrix4(this.matrixWorld),index:y,face:null,faceIndex:null,object:this})}}else if(a.isGeometry){var w=a.vertices,M=w.length;for(y=0;yl))p.applyMatrix4(this.matrixWorld),(E=i.ray.origin.distanceTo(p))i.far||r.push({distance:E,point:d.clone().applyMatrix4(this.matrixWorld),index:y,face:null,faceIndex:null,object:this})}}}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),Sa.prototype=Object.assign(Object.create(Ta.prototype),{constructor:Sa,isLineSegments:!0,computeLineDistances:function(){var e=new bn,t=new bn;return function(){var n=this.geometry;if(n.isBufferGeometry)if(null===n.index){for(var i=n.attributes.position,r=[],o=0,a=i.count;oi.far)return;r.push({distance:c,distanceToRay:Math.sqrt(a),point:d.clone(),index:n,face:null,object:o})}}}}(),updateMorphTargets:function(){var e,t,n,i=this.geometry;if(i.isBufferGeometry){var r=i.morphAttributes,o=Object.keys(r);if(o.length>0){var a=r[o[0]];if(void 0!==a)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},e=0,t=a.length;e0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),La.prototype=Object.assign(Object.create(On.prototype),{constructor:La,isVideoTexture:!0,update:function(){var e=this.image;e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}),Ra.prototype=Object.create(On.prototype),Ra.prototype.constructor=Ra,Ra.prototype.isCompressedTexture=!0,Oa.prototype=Object.create(On.prototype),Oa.prototype.constructor=Oa,Oa.prototype.isCanvasTexture=!0,Da.prototype=Object.create(On.prototype),Da.prototype.constructor=Da,Da.prototype.isDepthTexture=!0,Ia.prototype=Object.create(zi.prototype),Ia.prototype.constructor=Ia,ka.prototype=Object.create(ji.prototype),ka.prototype.constructor=ka,Na.prototype=Object.create(zi.prototype),Na.prototype.constructor=Na,Fa.prototype=Object.create(ji.prototype),Fa.prototype.constructor=Fa,Ba.prototype=Object.create(zi.prototype),Ba.prototype.constructor=Ba,Ua.prototype=Object.create(ji.prototype),Ua.prototype.constructor=Ua,za.prototype=Object.create(Ba.prototype),za.prototype.constructor=za,Ga.prototype=Object.create(ji.prototype),Ga.prototype.constructor=Ga,Ha.prototype=Object.create(Ba.prototype),Ha.prototype.constructor=Ha,ja.prototype=Object.create(ji.prototype),ja.prototype.constructor=ja,Va.prototype=Object.create(Ba.prototype),Va.prototype.constructor=Va,Wa.prototype=Object.create(ji.prototype),Wa.prototype.constructor=Wa,qa.prototype=Object.create(Ba.prototype),qa.prototype.constructor=qa,Xa.prototype=Object.create(ji.prototype),Xa.prototype.constructor=Xa,Ya.prototype=Object.create(zi.prototype),Ya.prototype.constructor=Ya,Ya.prototype.toJSON=function(){var e=zi.prototype.toJSON.call(this);return e.path=this.parameters.path.toJSON(),e},$a.prototype=Object.create(ji.prototype),$a.prototype.constructor=$a,Ja.prototype=Object.create(zi.prototype),Ja.prototype.constructor=Ja,Za.prototype=Object.create(ji.prototype),Za.prototype.constructor=Za,Ka.prototype=Object.create(zi.prototype),Ka.prototype.constructor=Ka;var Qa=function(e,t,n){n=n||2;var i,r,o,a,s,c,l,u=t&&t.length,h=u?t[0]*n:e.length,d=es(e,0,h,n,!0),p=[];if(!d||d.next===d.prev)return p;if(u&&(d=function(e,t,n,i){var r,o,a,s,c,l=[];for(r=0,o=t.length;r80*n){i=o=e[0],r=a=e[1];for(var f=n;fo&&(o=s),c>a&&(a=c);l=0!==(l=Math.max(o-i,a-r))?1/l:0}return ns(d,p,n,i,r,l),p};function es(e,t,n,i,r){var o,a;if(r===function(e,t,n,i){for(var r=0,o=t,a=n-i;o0)for(o=t;o=t;o-=i)a=ys(o,e[o],e[o+1],a);return a&&fs(a,a.next)&&(bs(a),a=a.next),a}function ts(e,t){if(!e)return e;t||(t=e);var n,i=e;do{if(n=!1,i.steiner||!fs(i,i.next)&&0!==ps(i.prev,i,i.next))i=i.next;else{if(bs(i),(i=t=i.prev)===i.next)break;n=!0}}while(n||i!==t);return t}function ns(e,t,n,i,r,o,a){if(e){!a&&o&&function(e,t,n,i){var r=e;do{null===r.z&&(r.z=ls(r.x,r.y,t,n,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==e);r.prevZ.nextZ=null,r.prevZ=null,function(e){var t,n,i,r,o,a,s,c,l=1;do{for(n=e,e=null,o=null,a=0;n;){for(a++,i=n,s=0,t=0;t0||c>0&&i;)0!==s&&(0===c||!i||n.z<=i.z)?(r=n,n=n.nextZ,s--):(r=i,i=i.nextZ,c--),o?o.nextZ=r:e=r,r.prevZ=o,o=r;n=i}o.nextZ=null,l*=2}while(a>1)}(r)}(e,i,r,o);for(var s,c,l=e;e.prev!==e.next;)if(s=e.prev,c=e.next,o?rs(e,i,r,o):is(e))t.push(s.i/n),t.push(e.i/n),t.push(c.i/n),bs(e),e=c.next,l=c.next;else if((e=c)===l){a?1===a?ns(e=os(e,t,n),t,n,i,r,o,2):2===a&&as(e,t,n,i,r,o):ns(ts(e),t,n,i,r,o,1);break}}}function is(e){var t=e.prev,n=e,i=e.next;if(ps(t,n,i)>=0)return!1;for(var r=e.next.next;r!==e.prev;){if(hs(t.x,t.y,n.x,n.y,i.x,i.y,r.x,r.y)&&ps(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function rs(e,t,n,i){var r=e.prev,o=e,a=e.next;if(ps(r,o,a)>=0)return!1;for(var s=r.xo.x?r.x>a.x?r.x:a.x:o.x>a.x?o.x:a.x,u=r.y>o.y?r.y>a.y?r.y:a.y:o.y>a.y?o.y:a.y,h=ls(s,c,t,n,i),d=ls(l,u,t,n,i),p=e.prevZ,f=e.nextZ;p&&p.z>=h&&f&&f.z<=d;){if(p!==e.prev&&p!==e.next&&hs(r.x,r.y,o.x,o.y,a.x,a.y,p.x,p.y)&&ps(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,f!==e.prev&&f!==e.next&&hs(r.x,r.y,o.x,o.y,a.x,a.y,f.x,f.y)&&ps(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(;p&&p.z>=h;){if(p!==e.prev&&p!==e.next&&hs(r.x,r.y,o.x,o.y,a.x,a.y,p.x,p.y)&&ps(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;f&&f.z<=d;){if(f!==e.prev&&f!==e.next&&hs(r.x,r.y,o.x,o.y,a.x,a.y,f.x,f.y)&&ps(f.prev,f,f.next)>=0)return!1;f=f.nextZ}return!0}function os(e,t,n){var i=e;do{var r=i.prev,o=i.next.next;!fs(r,o)&&ms(r,i,i.next,o)&&vs(r,o)&&vs(o,r)&&(t.push(r.i/n),t.push(i.i/n),t.push(o.i/n),bs(i),bs(i.next),i=e=o),i=i.next}while(i!==e);return i}function as(e,t,n,i,r,o){var a=e;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&ds(a,s)){var c=gs(a,s);return a=ts(a,a.next),c=ts(c,c.next),ns(a,t,n,i,r,o),void ns(c,t,n,i,r,o)}s=s.next}a=a.next}while(a!==e)}function ss(e,t){return e.x-t.x}function cs(e,t){if(t=function(e,t){var n,i=t,r=e.x,o=e.y,a=-1/0;do{if(o<=i.y&&o>=i.next.y&&i.next.y!==i.y){var s=i.x+(o-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(s<=r&&s>a){if(a=s,s===r){if(o===i.y)return i;if(o===i.next.y)return i.next}n=i.x=i.x&&i.x>=u&&r!==i.x&&hs(on.x)&&vs(i,e)&&(n=i,d=c),i=i.next;return n}(e,t)){var n=gs(t,e);ts(n,n.next)}}function ls(e,t,n,i,r){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*r)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)*r)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function us(e){var t=e,n=e;do{(t.x=0&&(e-a)*(i-s)-(n-a)*(t-s)>=0&&(n-a)*(o-s)-(r-a)*(i-s)>=0}function ds(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&ms(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&vs(e,t)&&vs(t,e)&&function(e,t){var n=e,i=!1,r=(e.x+t.x)/2,o=(e.y+t.y)/2;do{n.y>o!=n.next.y>o&&n.next.y!==n.y&&r<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next}while(n!==e);return i}(e,t)}function ps(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function fs(e,t){return e.x===t.x&&e.y===t.y}function ms(e,t,n,i){return!!(fs(e,n)&&fs(t,i)||fs(e,i)&&fs(n,t))||ps(e,t,n)>0!=ps(e,t,i)>0&&ps(n,i,e)>0!=ps(n,i,t)>0}function vs(e,t){return ps(e.prev,e,e.next)<0?ps(e,t,e.next)>=0&&ps(e,e.prev,t)>=0:ps(e,t,e.prev)<0||ps(e,e.next,t)<0}function gs(e,t){var n=new _s(e.i,e.x,e.y),i=new _s(t.i,t.x,t.y),r=e.next,o=t.prev;return e.next=t,t.prev=e,n.next=r,r.prev=n,i.next=n,n.prev=i,o.next=i,i.prev=o,i}function ys(e,t,n,i){var r=new _s(e,t,n);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function bs(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 _s(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}var xs={area:function(e){for(var t=e.length,n=0,i=t-1,r=0;r2&&e[t-1].equals(e[0])&&e.pop()}function Ms(e,t){for(var n=0;nNumber.EPSILON){var d=Math.sqrt(u),p=Math.sqrt(c*c+l*l),f=t.x-s/d,m=t.y+a/d,v=((n.x-l/p-f)*l-(n.y+c/p-m)*c)/(a*l-s*c),g=(i=f+a*v-e.x)*i+(r=m+s*v-e.y)*r;if(g<=2)return new gn(i,r);o=Math.sqrt(g/2)}else{var y=!1;a>Number.EPSILON?c>Number.EPSILON&&(y=!0):a<-Number.EPSILON?c<-Number.EPSILON&&(y=!0):Math.sign(s)===Math.sign(l)&&(y=!0),y?(i=-s,r=a,o=Math.sqrt(u)):(i=a,r=s,o=Math.sqrt(u/2))}return new gn(i/o,r/o)}for(var z=[],G=0,H=P.length,j=H-1,V=G+1;G=0;R--){for(D=R/p,I=u*Math.cos(D*Math.PI/2),O=h*Math.sin(D*Math.PI/2)+d,G=0,H=P.length;G=0;){n=G,(i=G-1)<0&&(i=e.length-1);var r=0,o=s+2*p;for(r=0;r0)&&f.push(w,M,T),(c!==n-1||l0&&g(!0),t>0&&g(!1)),this.setIndex(l),this.addAttribute("position",new Oi(u,3)),this.addAttribute("normal",new Oi(h,3)),this.addAttribute("uv",new Oi(d,2))}function Hs(e,t,n,i,r,o,a){zs.call(this,0,e,t,n,i,r,o,a),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:o,thetaLength:a}}function js(e,t,n,i,r,o,a){Gs.call(this,0,e,t,n,i,r,o,a),this.type="ConeBufferGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:o,thetaLength:a}}function Vs(e,t,n,i){ji.call(this),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:i},this.fromBufferGeometry(new Ws(e,t,n,i)),this.mergeVertices()}function Ws(e,t,n,i){zi.call(this),this.type="CircleBufferGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:i},e=e||1,t=void 0!==t?Math.max(3,t):8,n=void 0!==n?n:0,i=void 0!==i?i:2*Math.PI;var r,o,a=[],s=[],c=[],l=[],u=new bn,h=new gn;for(s.push(0,0,0),c.push(0,0,1),l.push(.5,.5),o=0,r=3;o<=t;o++,r+=3){var d=n+o/t*i;u.x=e*Math.cos(d),u.y=e*Math.sin(d),s.push(u.x,u.y,u.z),c.push(0,0,1),h.x=(s[r]/e+1)/2,h.y=(s[r+1]/e+1)/2,l.push(h.x,h.y)}for(r=1;r<=t;r++)a.push(r,r+1,0);this.setIndex(a),this.addAttribute("position",new Oi(s,3)),this.addAttribute("normal",new Oi(c,3)),this.addAttribute("uv",new Oi(l,2))}Cs.prototype=Object.create(ji.prototype),Cs.prototype.constructor=Cs,Ps.prototype=Object.create(Ts.prototype),Ps.prototype.constructor=Ps,Ls.prototype=Object.create(ji.prototype),Ls.prototype.constructor=Ls,Rs.prototype=Object.create(zi.prototype),Rs.prototype.constructor=Rs,Os.prototype=Object.create(ji.prototype),Os.prototype.constructor=Os,Ds.prototype=Object.create(zi.prototype),Ds.prototype.constructor=Ds,Is.prototype=Object.create(ji.prototype),Is.prototype.constructor=Is,ks.prototype=Object.create(zi.prototype),ks.prototype.constructor=ks,Ns.prototype=Object.create(ji.prototype),Ns.prototype.constructor=Ns,Ns.prototype.toJSON=function(){var e=ji.prototype.toJSON.call(this);return Bs(this.parameters.shapes,e)},Fs.prototype=Object.create(zi.prototype),Fs.prototype.constructor=Fs,Fs.prototype.toJSON=function(){var e=zi.prototype.toJSON.call(this);return Bs(this.parameters.shapes,e)},Us.prototype=Object.create(zi.prototype),Us.prototype.constructor=Us,zs.prototype=Object.create(ji.prototype),zs.prototype.constructor=zs,Gs.prototype=Object.create(zi.prototype),Gs.prototype.constructor=Gs,Hs.prototype=Object.create(zs.prototype),Hs.prototype.constructor=Hs,js.prototype=Object.create(Gs.prototype),js.prototype.constructor=js,Vs.prototype=Object.create(ji.prototype),Vs.prototype.constructor=Vs,Ws.prototype=Object.create(zi.prototype),Ws.prototype.constructor=Ws;var qs=Object.freeze({WireframeGeometry:Ia,ParametricGeometry:ka,ParametricBufferGeometry:Na,TetrahedronGeometry:Ua,TetrahedronBufferGeometry:za,OctahedronGeometry:Ga,OctahedronBufferGeometry:Ha,IcosahedronGeometry:ja,IcosahedronBufferGeometry:Va,DodecahedronGeometry:Wa,DodecahedronBufferGeometry:qa,PolyhedronGeometry:Fa,PolyhedronBufferGeometry:Ba,TubeGeometry:Xa,TubeBufferGeometry:Ya,TorusKnotGeometry:$a,TorusKnotBufferGeometry:Ja,TorusGeometry:Za,TorusBufferGeometry:Ka,TextGeometry:Cs,TextBufferGeometry:Ps,SphereGeometry:Ls,SphereBufferGeometry:Rs,RingGeometry:Os,RingBufferGeometry:Ds,PlaneGeometry:fr,PlaneBufferGeometry:mr,LatheGeometry:Is,LatheBufferGeometry:ks,ShapeGeometry:Ns,ShapeBufferGeometry:Fs,ExtrudeGeometry:Es,ExtrudeBufferGeometry:Ts,EdgesGeometry:Us,ConeGeometry:Hs,ConeBufferGeometry:js,CylinderGeometry:zs,CylinderBufferGeometry:Gs,CircleGeometry:Vs,CircleBufferGeometry:Ws,BoxGeometry:Vi,BoxBufferGeometry:Wi});function Xs(e){wi.call(this),this.type="ShadowMaterial",this.color=new vi(0),this.transparent=!0,this.setValues(e)}function Ys(e){Zi.call(this,e),this.type="RawShaderMaterial"}function $s(e){wi.call(this),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new vi(16777215),this.roughness=.5,this.metalness=.5,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new vi(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Zt,this.normalScale=new gn(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function Js(e){$s.call(this),this.defines={PHYSICAL:""},this.type="MeshPhysicalMaterial",this.reflectivity=.5,this.clearCoat=0,this.clearCoatRoughness=0,this.setValues(e)}function Zs(e){wi.call(this),this.type="MeshPhongMaterial",this.color=new vi(16777215),this.specular=new vi(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new vi(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Zt,this.normalScale=new gn(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=le,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function Ks(e){Zs.call(this),this.defines={TOON:""},this.type="MeshToonMaterial",this.gradientMap=null,this.setValues(e)}function Qs(e){wi.call(this),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Zt,this.normalScale=new gn(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function ec(e){wi.call(this),this.type="MeshLambertMaterial",this.color=new vi(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new vi(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=le,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function tc(e){wi.call(this),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new vi(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Zt,this.normalScale=new gn(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.lights=!1,this.setValues(e)}function nc(e){Ea.call(this),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}Xs.prototype=Object.create(wi.prototype),Xs.prototype.constructor=Xs,Xs.prototype.isShadowMaterial=!0,Xs.prototype.copy=function(e){return wi.prototype.copy.call(this,e),this.color.copy(e.color),this},Ys.prototype=Object.create(Zi.prototype),Ys.prototype.constructor=Ys,Ys.prototype.isRawShaderMaterial=!0,$s.prototype=Object.create(wi.prototype),$s.prototype.constructor=$s,$s.prototype.isMeshStandardMaterial=!0,$s.prototype.copy=function(e){return wi.prototype.copy.call(this,e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},Js.prototype=Object.create($s.prototype),Js.prototype.constructor=Js,Js.prototype.isMeshPhysicalMaterial=!0,Js.prototype.copy=function(e){return $s.prototype.copy.call(this,e),this.defines={PHYSICAL:""},this.reflectivity=e.reflectivity,this.clearCoat=e.clearCoat,this.clearCoatRoughness=e.clearCoatRoughness,this},Zs.prototype=Object.create(wi.prototype),Zs.prototype.constructor=Zs,Zs.prototype.isMeshPhongMaterial=!0,Zs.prototype.copy=function(e){return wi.prototype.copy.call(this,e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,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.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},Ks.prototype=Object.create(Zs.prototype),Ks.prototype.constructor=Ks,Ks.prototype.isMeshToonMaterial=!0,Ks.prototype.copy=function(e){return Zs.prototype.copy.call(this,e),this.gradientMap=e.gradientMap,this},Qs.prototype=Object.create(wi.prototype),Qs.prototype.constructor=Qs,Qs.prototype.isMeshNormalMaterial=!0,Qs.prototype.copy=function(e){return wi.prototype.copy.call(this,e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},ec.prototype=Object.create(wi.prototype),ec.prototype.constructor=ec,ec.prototype.isMeshLambertMaterial=!0,ec.prototype.copy=function(e){return wi.prototype.copy.call(this,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.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,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.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},tc.prototype=Object.create(wi.prototype),tc.prototype.constructor=tc,tc.prototype.isMeshMatcapMaterial=!0,tc.prototype.copy=function(e){return wi.prototype.copy.call(this,e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},nc.prototype=Object.create(Ea.prototype),nc.prototype.constructor=nc,nc.prototype.isLineDashedMaterial=!0,nc.prototype.copy=function(e){return Ea.prototype.copy.call(this,e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this};var ic=Object.freeze({ShadowMaterial:Xs,SpriteMaterial:ya,RawShaderMaterial:Ys,ShaderMaterial:Zi,PointsMaterial:Ca,MeshPhysicalMaterial:Js,MeshStandardMaterial:$s,MeshPhongMaterial:Zs,MeshToonMaterial:Ks,MeshNormalMaterial:Qs,MeshLambertMaterial:ec,MeshDepthMaterial:Yo,MeshDistanceMaterial:$o,MeshBasicMaterial:Mi,MeshMatcapMaterial:tc,LineDashedMaterial:nc,LineBasicMaterial:Ea,Material:wi}),rc={arraySlice:function(e,t,n){return rc.isTypedArray(e)?new e.constructor(e.subarray(t,void 0!==n?n:e.length)):e.slice(t,n)},convertArray:function(e,t,n){return!e||!n&&e.constructor===t?e:"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e)},isTypedArray:function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)},getKeyframeOrder:function(e){for(var t=e.length,n=new Array(t),i=0;i!==t;++i)n[i]=i;return n.sort(function(t,n){return e[t]-e[n]}),n},sortedArray:function(e,t,n){for(var i=e.length,r=new e.constructor(i),o=0,a=0;a!==i;++o)for(var s=n[o]*t,c=0;c!==t;++c)r[a++]=e[s+c];return r},flattenJSON:function(e,t,n,i){for(var r=1,o=e[0];void 0!==o&&void 0===o[i];)o=e[r++];if(void 0!==o){var a=o[i];if(void 0!==a)if(Array.isArray(a))do{void 0!==(a=o[i])&&(t.push(o.time),n.push.apply(n,a)),o=e[r++]}while(void 0!==o);else if(void 0!==a.toArray)do{void 0!==(a=o[i])&&(t.push(o.time),a.toArray(n,n.length)),o=e[r++]}while(void 0!==o);else do{void 0!==(a=o[i])&&(t.push(o.time),n.push(a)),o=e[r++]}while(void 0!==o)}}};function oc(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=void 0!==i?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n}function ac(e,t,n,i){oc.call(this,e,t,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0}function sc(e,t,n,i){oc.call(this,e,t,n,i)}function cc(e,t,n,i){oc.call(this,e,t,n,i)}function lc(e,t,n,i){if(void 0===e)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===t||0===t.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=rc.convertArray(t,this.TimeBufferType),this.values=rc.convertArray(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}function uc(e,t,n){lc.call(this,e,t,n)}function hc(e,t,n,i){lc.call(this,e,t,n,i)}function dc(e,t,n,i){lc.call(this,e,t,n,i)}function pc(e,t,n,i){oc.call(this,e,t,n,i)}function fc(e,t,n,i){lc.call(this,e,t,n,i)}function mc(e,t,n,i){lc.call(this,e,t,n,i)}function vc(e,t,n,i){lc.call(this,e,t,n,i)}function gc(e,t,n){this.name=e,this.tracks=n,this.duration=void 0!==t?t:-1,this.uuid=vn.generateUUID(),this.duration<0&&this.resetDuration()}function yc(e){if(void 0===e.type)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");var t=function(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return dc;case"vector":case"vector2":case"vector3":case"vector4":return vc;case"color":return hc;case"quaternion":return fc;case"bool":case"boolean":return uc;case"string":return mc}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+e)}(e.type);if(void 0===e.times){var n=[],i=[];rc.flattenJSON(e.keys,n,i,"value"),e.times=n,e.values=i}return void 0!==t.parse?t.parse(e):new t(e.name,e.times,e.values,e.interpolation)}Object.assign(oc.prototype,{evaluate:function(e){var t=this.parameterPositions,n=this._cachedIndex,i=t[n],r=t[n-1];e:{t:{var o;n:{i:if(!(e=r)break e;var s=t[1];e=(r=t[--n-1]))break t}o=n,n=0}for(;n>>1;et;)--o;if(++o,0!==r||o!==i){r>=o&&(r=(o=Math.max(o,1))-1);var a=this.getValueSize();this.times=rc.arraySlice(n,r,o),this.values=rc.arraySlice(this.values,r*a,o*a)}return this},validate:function(){var e=!0,t=this.getValueSize();t-Math.floor(t)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);var n=this.times,i=this.values,r=n.length;0===r&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);for(var o=null,a=0;a!==r;a++){var s=n[a];if("number"==typeof s&&isNaN(s)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,s),e=!1;break}if(null!==o&&o>s){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,s,o),e=!1;break}o=s}if(void 0!==i&&rc.isTypedArray(i)){a=0;for(var c=i.length;a!==c;++a){var l=i[a];if(isNaN(l)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,l),e=!1;break}}}return e},optimize:function(){for(var e=this.times,t=this.values,n=this.getValueSize(),i=this.getInterpolation()===It,r=1,o=e.length-1,a=1;a0){e[r]=e[o];for(f=o*n,m=r*n,d=0;d!==n;++d)t[m+d]=t[f+d];++r}return r!==e.length&&(this.times=rc.arraySlice(e,0,r),this.values=rc.arraySlice(t,0,r*n)),this},clone:function(){var e=rc.arraySlice(this.times,0),t=rc.arraySlice(this.values,0),n=new(0,this.constructor)(this.name,e,t);return n.createInterpolant=this.createInterpolant,n}}),uc.prototype=Object.assign(Object.create(lc.prototype),{constructor:uc,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:Ot,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),hc.prototype=Object.assign(Object.create(lc.prototype),{constructor:hc,ValueTypeName:"color"}),dc.prototype=Object.assign(Object.create(lc.prototype),{constructor:dc,ValueTypeName:"number"}),pc.prototype=Object.assign(Object.create(oc.prototype),{constructor:pc,interpolate_:function(e,t,n,i){for(var r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=e*a,c=(n-t)/(i-t),l=s+a;s!==l;s+=4)yn.slerpFlat(r,0,o,s-a,o,s,c);return r}}),fc.prototype=Object.assign(Object.create(lc.prototype),{constructor:fc,ValueTypeName:"quaternion",DefaultInterpolation:Dt,InterpolantFactoryMethodLinear:function(e){return new pc(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:void 0}),mc.prototype=Object.assign(Object.create(lc.prototype),{constructor:mc,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:Ot,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),vc.prototype=Object.assign(Object.create(lc.prototype),{constructor:vc,ValueTypeName:"vector"}),Object.assign(gc,{parse:function(e){for(var t=[],n=e.tracks,i=1/(e.fps||1),r=0,o=n.length;r!==o;++r)t.push(yc(n[r]).scale(i));return new gc(e.name,e.duration,t)},toJSON:function(e){for(var t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid},r=0,o=n.length;r!==o;++r)t.push(lc.toJSON(n[r]));return i},CreateFromMorphTargetSequence:function(e,t,n,i){for(var r=t.length,o=[],a=0;a1){var l=i[h=c[1]];l||(i[h]=l=[]),l.push(s)}}var u=[];for(var h in i)u.push(gc.CreateFromMorphTargetSequence(h,i[h],t,n));return u},parseAnimation:function(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;for(var n=function(e,t,n,i,r){if(0!==n.length){var o=[],a=[];rc.flattenJSON(n,o,a,i),0!==o.length&&r.push(new e(t,o,a))}},i=[],r=e.name||"default",o=e.length||-1,a=e.fps||30,s=e.hierarchy||[],c=0;c0||0===e.search(/^data\:image\/jpeg/);r.format=i?Ke:Qe,r.needsUpdate=!0,void 0!==t&&t(r)},n,i),r},setCrossOrigin:function(e){return this.crossOrigin=e,this},setPath:function(e){return this.path=e,this}}),Object.assign(Lc.prototype,{getPoint:function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null},getPointAt:function(e,t){var n=this.getUtoTmapping(e);return this.getPoint(n,t)},getPoints:function(e){void 0===e&&(e=5);for(var t=[],n=0;n<=e;n++)t.push(this.getPoint(n/e));return t},getSpacedPoints:function(e){void 0===e&&(e=5);for(var t=[],n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t},getLength:function(){var e=this.getLengths();return e[e.length-1]},getLengths:function(e){if(void 0===e&&(e=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var t,n,i=[],r=this.getPoint(0),o=0;for(i.push(0),n=1;n<=e;n++)o+=(t=this.getPoint(n/e)).distanceTo(r),i.push(o),r=t;return this.cacheArcLengths=i,i},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(e,t){var n,i=this.getLengths(),r=0,o=i.length;n=t||e*i[o-1];for(var a,s=0,c=o-1;s<=c;)if((a=i[r=Math.floor(s+(c-s)/2)]-n)<0)s=r+1;else{if(!(a>0)){c=r;break}c=r-1}if(i[r=c]===n)return r/(o-1);var l=i[r];return(r+(n-l)/(i[r+1]-l))/(o-1)},getTangent:function(e){var t=e-1e-4,n=e+1e-4;t<0&&(t=0),n>1&&(n=1);var i=this.getPoint(t);return this.getPoint(n).clone().sub(i).normalize()},getTangentAt:function(e){var t=this.getUtoTmapping(e);return this.getTangent(t)},computeFrenetFrames:function(e,t){var n,i,r,o=new bn,a=[],s=[],c=[],l=new bn,u=new Nn;for(n=0;n<=e;n++)i=n/e,a[n]=this.getTangentAt(i),a[n].normalize();s[0]=new bn,c[0]=new bn;var h=Number.MAX_VALUE,d=Math.abs(a[0].x),p=Math.abs(a[0].y),f=Math.abs(a[0].z);for(d<=h&&(h=d,o.set(1,0,0)),p<=h&&(h=p,o.set(0,1,0)),f<=h&&o.set(0,0,1),l.crossVectors(a[0],o).normalize(),s[0].crossVectors(a[0],l),c[0].crossVectors(a[0],s[0]),n=1;n<=e;n++)s[n]=s[n-1].clone(),c[n]=c[n-1].clone(),l.crossVectors(a[n-1],a[n]),l.length()>Number.EPSILON&&(l.normalize(),r=Math.acos(vn.clamp(a[n-1].dot(a[n]),-1,1)),s[n].applyMatrix4(u.makeRotationAxis(l,r))),c[n].crossVectors(a[n],s[n]);if(!0===t)for(r=Math.acos(vn.clamp(s[0].dot(s[e]),-1,1)),r/=e,a[0].dot(l.crossVectors(s[0],s[e]))>0&&(r=-r),n=1;n<=e;n++)s[n].applyMatrix4(u.makeRotationAxis(a[n],r*n)),c[n].crossVectors(a[n],s[n]);return{tangents:a,normals:s,binormals:c}},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this},toJSON:function(){var e={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e},fromJSON:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}),Rc.prototype=Object.create(Lc.prototype),Rc.prototype.constructor=Rc,Rc.prototype.isEllipseCurve=!0,Rc.prototype.getPoint=function(e,t){for(var n=t||new gn,i=2*Math.PI,r=this.aEndAngle-this.aStartAngle,o=Math.abs(r)i;)r-=i;r0?0:(Math.floor(Math.abs(u)/c)+1)*c:0===h&&u===c-1&&(u=c-2,h=1),this.closed||u>0?n=s[(u-1)%c]:(Ic.subVectors(s[0],s[1]).add(s[0]),n=Ic),i=s[u%c],r=s[(u+1)%c],this.closed||u+2i.length-2?i.length-1:o+1],u=i[o>i.length-3?i.length-1:o+2];return n.set(Uc(a,s.x,c.x,l.x,u.x),Uc(a,s.y,c.y,l.y,u.y)),n},Yc.prototype.copy=function(e){Lc.prototype.copy.call(this,e),this.points=[];for(var t=0,n=e.points.length;t=t){var r=n[i]-t,o=this.curves[i],a=o.getLength(),s=0===a?0:1-r/a;return o.getPointAt(s)}i++}return null},getLength:function(){var e=this.getCurveLengths();return e[e.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var e=[],t=0,n=0,i=this.curves.length;n1&&!n[n.length-1].equals(n[0])&&n.push(n[0]),n},copy:function(e){Lc.prototype.copy.call(this,e),this.curves=[];for(var t=0,n=e.curves.length;t0){var l=c.getPoint(0);l.equals(this.currentPoint)||this.lineTo(l.x,l.y)}this.curves.push(c);var u=c.getPoint(1);this.currentPoint.copy(u)},copy:function(e){return Jc.prototype.copy.call(this,e),this.currentPoint.copy(e.currentPoint),this},toJSON:function(){var e=Jc.prototype.toJSON.call(this);return e.currentPoint=this.currentPoint.toArray(),e},fromJSON:function(e){return Jc.prototype.fromJSON.call(this,e),this.currentPoint.fromArray(e.currentPoint),this}}),Kc.prototype=Object.assign(Object.create(Zc.prototype),{constructor:Kc,getPointsHoles:function(e){for(var t=[],n=0,i=this.holes.length;n0){var o=new Ac(new _c(t));o.setCrossOrigin(this.crossOrigin);for(var a=0,s=e.length;a0?new xa(a,s):new Gi(a,s),void 0!==e.drawMode&&i.setDrawMode(e.drawMode);break;case"LOD":i=new _a;break;case"Line":i=new Ta(r(e.geometry),o(e.material),e.mode);break;case"LineLoop":i=new Aa(r(e.geometry),o(e.material));break;case"LineSegments":i=new Sa(r(e.geometry),o(e.material));break;case"PointCloud":case"Points":i=new Pa(r(e.geometry),o(e.material));break;case"Sprite":i=new ba(o(e.material));break;case"Group":i=new ea;break;default:i=new ai}if(i.uuid=e.uuid,void 0!==e.name&&(i.name=e.name),void 0!==e.matrix?(i.matrix.fromArray(e.matrix),void 0!==e.matrixAutoUpdate&&(i.matrixAutoUpdate=e.matrixAutoUpdate),i.matrixAutoUpdate&&i.matrix.decompose(i.position,i.quaternion,i.scale)):(void 0!==e.position&&i.position.fromArray(e.position),void 0!==e.rotation&&i.rotation.fromArray(e.rotation),void 0!==e.quaternion&&i.quaternion.fromArray(e.quaternion),void 0!==e.scale&&i.scale.fromArray(e.scale)),void 0!==e.castShadow&&(i.castShadow=e.castShadow),void 0!==e.receiveShadow&&(i.receiveShadow=e.receiveShadow),e.shadow&&(void 0!==e.shadow.bias&&(i.shadow.bias=e.shadow.bias),void 0!==e.shadow.radius&&(i.shadow.radius=e.shadow.radius),void 0!==e.shadow.mapSize&&i.shadow.mapSize.fromArray(e.shadow.mapSize),void 0!==e.shadow.camera&&(i.shadow.camera=this.parseObject(e.shadow.camera))),void 0!==e.visible&&(i.visible=e.visible),void 0!==e.frustumCulled&&(i.frustumCulled=e.frustumCulled),void 0!==e.renderOrder&&(i.renderOrder=e.renderOrder),void 0!==e.userData&&(i.userData=e.userData),void 0!==e.layers&&(i.layers.mask=e.layers),void 0!==e.children)for(var c=e.children,l=0;lNumber.EPSILON){if(l<0&&(a=t[o],c=-c,s=t[r],l=-l),e.ys.y)continue;if(e.y===a.y){if(e.x===a.x)return!0}else{var u=l*(e.x-a.x)-c*(e.y-a.y);if(0===u)return!0;if(u<0)continue;i=!i}}else{if(e.y!==a.y)continue;if(s.x<=e.x&&e.x<=a.x||a.x<=e.x&&e.x<=s.x)return!0}}return i}var r=xs.isClockWise,o=this.subPaths;if(0===o.length)return[];if(!0===t)return n(o);var a,s,c,l=[];if(1===o.length)return s=o[0],(c=new Kc).curves=s.curves,l.push(c),l;var u=!r(o[0].getPoints());u=e?!u:u;var h,d,p=[],f=[],m=[],v=0;f[v]=void 0,m[v]=[];for(var g=0,y=o.length;g1){for(var b=!1,_=[],x=0,w=f.length;x0&&(b||(m=p))}g=0;for(var C=f.length;g0){this.source.connect(this.filters[0]);for(var e=1,t=this.filters.length;e0){this.source.disconnect(this.filters[0]);for(var e=1,t=this.filters.length;e=.5)for(var o=0;o!==r;++o)e[t+o]=e[n+o]},_slerp:function(e,t,n,i){yn.slerpFlat(e,t,e,t,e,n,i)},_lerp:function(e,t,n,i,r){for(var o=1-i,a=0;a!==r;++a){var s=t+a;e[s]=e[s]*o+e[n+a]*i}}});var Vl,Wl,ql,Xl,Yl,$l,Jl,Zl,Kl,Ql,eu,tu,nu,iu,ru;function ou(e,t,n){var i=n||au.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}function au(e,t,n){this.path=t,this.parsedPath=n||au.parseTrackName(t),this.node=au.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e}function su(){this.uuid=vn.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var e={};this._indicesByUUID=e;for(var t=0,n=arguments.length;t!==n;++t)e[arguments[t].uuid]=t;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};var i=this;this.stats={objects:{get total(){return i._objects.length},get inUse(){return this.total-i.nCachedObjects_}},get bindingsPerObject(){return i._bindings.length}}}function cu(e,t,n){this._mixer=e,this._clip=t,this._localRoot=n||null;for(var i=t.tracks,r=i.length,o=new Array(r),a={endingStart:kt,endingEnd:kt},s=0;s!==r;++s){var c=i[s].createInterpolant(null);o[s]=c,c.settings=a}this._interpolantSettings=a,this._interpolants=o,this._propertyBindings=new Array(r),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=Lt,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}function lu(e){this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}function uu(e){"string"==typeof e&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),e=arguments[1]),this.value=e}function hu(e,t,n){va.call(this,e,t),this.meshPerAttribute=n||1}function du(e,t,n,i){this.ray=new ui(e,t),this.near=n||0,this.far=i||1/0,this.params={Mesh:{},Line:{},LOD:{},Points:{threshold:1},Sprite:{}},Object.defineProperties(this.params,{PointCloud:{get:function(){return console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points."),this.Points}}})}function pu(e,t){return e.distance-t.distance}function fu(e,t,n,i){if(!1!==e.visible&&(e.raycast(t,n),!0===i))for(var r=e.children,o=0,a=r.length;o=t){var u=t++,h=e[u];n[h.uuid]=l,e[l]=h,n[c]=u,e[u]=s;for(var d=0,p=r;d!==p;++d){var f=i[d],m=f[u],v=f[l];f[l]=m,f[u]=v}}}this.nCachedObjects_=t},uncache:function(){for(var e=this._objects,t=e.length,n=this.nCachedObjects_,i=this._indicesByUUID,r=this._bindings,o=r.length,a=0,s=arguments.length;a!==s;++a){var c=arguments[a].uuid,l=i[c];if(void 0!==l)if(delete i[c],l0)for(var c=this._interpolants,l=this._propertyBindings,u=0,h=c.length;u!==h;++u)c[u].evaluate(a),l[u].accumulate(i,s)}else this._updateWeight(e)},_updateWeight:function(e){var t=0;if(this.enabled){t=this.weight;var n=this._weightInterpolant;if(null!==n){var i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),0===i&&(this.enabled=!1))}}return this._effectiveWeight=t,t},_updateTimeScale:function(e){var t=0;if(!this.paused){t=this.timeScale;var n=this._timeScaleInterpolant;if(null!==n)t*=n.evaluate(e)[0],e>n.parameterPositions[1]&&(this.stopWarping(),0===t?this.paused=!0:this.timeScale=t)}return this._effectiveTimeScale=t,t},_updateTime:function(e){var t=this.time+e,n=this._clip.duration,i=this.loop,r=this._loopCount,o=i===Rt;if(0===e)return-1===r?t:o&&1==(1&r)?n-t:t;if(i===Pt){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(t>=n)t=n;else{if(!(t<0)){this.time=t;break e}t=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=t,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(-1===r&&(e>=0?(r=0,this._setEndings(!0,0===this.repetitions,o)):this._setEndings(0===this.repetitions,!0,o)),t>=n||t<0){var a=Math.floor(t/n);t-=n*a,r+=Math.abs(a);var s=this.repetitions-r;if(s<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,t=e>0?n:0,this.time=t,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(1===s){var c=e<0;this._setEndings(c,!c,o)}else this._setEndings(!1,!1,o);this._loopCount=r,this.time=t,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this.time=t;if(o&&1==(1&r))return n-t}return t},_setEndings:function(e,t,n){var i=this._interpolantSettings;n?(i.endingStart=Nt,i.endingEnd=Nt):(i.endingStart=e?this.zeroSlopeAtStart?Nt:kt:Ft,i.endingEnd=t?this.zeroSlopeAtEnd?Nt:kt:Ft)},_scheduleFading:function(e,t,n){var i=this._mixer,r=i.time,o=this._weightInterpolant;null===o&&(o=i._lendControlInterpolant(),this._weightInterpolant=o);var a=o.parameterPositions,s=o.sampleValues;return a[0]=r,s[0]=t,a[1]=r+e,s[1]=n,this}}),lu.prototype=Object.assign(Object.create(c.prototype),{constructor:lu,_bindAction:function(e,t){var n=e._localRoot||this._root,i=e._clip.tracks,r=i.length,o=e._propertyBindings,a=e._interpolants,s=n.uuid,c=this._bindingsByRootAndName,l=c[s];void 0===l&&(l={},c[s]=l);for(var u=0;u!==r;++u){var h=i[u],d=h.name,p=l[d];if(void 0!==p)o[u]=p;else{if(void 0!==(p=o[u])){null===p._cacheIndex&&(++p.referenceCount,this._addInactiveBinding(p,s,d));continue}var f=t&&t._propertyBindings[u].binding.parsedPath;++(p=new jl(au.create(n,d,f),h.ValueTypeName,h.getValueSize())).referenceCount,this._addInactiveBinding(p,s,d),o[u]=p}a[u].resultBuffer=p.buffer}},_activateAction:function(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){var t=(e._localRoot||this._root).uuid,n=e._clip.uuid,i=this._actionsByClip[n];this._bindAction(e,i&&i.knownActions[0]),this._addInactiveAction(e,n,t)}for(var r=e._propertyBindings,o=0,a=r.length;o!==a;++o){var s=r[o];0==s.useCount++&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}},_deactivateAction:function(e){if(this._isActiveAction(e)){for(var t=e._propertyBindings,n=0,i=t.length;n!==i;++n){var r=t[n];0==--r.useCount&&(r.restoreOriginalState(),this._takeBackBinding(r))}this._takeBackAction(e)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var 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:function(e){var t=e._cacheIndex;return null!==t&&tthis.max.x||e.ythis.max.y)},containsBox:function(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:function(e,t){return void 0===t&&(console.warn("THREE.Box2: .getParameter() target is now required"),t=new gn),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:function(e){return!(e.max.xthis.max.x||e.max.ythis.max.y)},clampPoint:function(e,t){return void 0===t&&(console.warn("THREE.Box2: .clampPoint() target is now required"),t=new gn),t.copy(e).clamp(this.min,this.max)},distanceToPoint:function(){var e=new gn;return function(t){return e.copy(t).clamp(this.min,this.max).sub(t).length()}}(),intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}),Object.assign(yu.prototype,{set:function(e,t){return this.start.copy(e),this.end.copy(t),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.start.copy(e.start),this.end.copy(e.end),this},getCenter:function(e){return void 0===e&&(console.warn("THREE.Line3: .getCenter() target is now required"),e=new bn),e.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(e){return void 0===e&&(console.warn("THREE.Line3: .delta() target is now required"),e=new bn),e.subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(e,t){return void 0===t&&(console.warn("THREE.Line3: .at() target is now required"),t=new bn),this.delta(t).multiplyScalar(e).add(this.start)},closestPointToPointParameter:function(e,t){void 0===Ql&&(Ql=new bn,eu=new bn),Ql.subVectors(e,this.start),eu.subVectors(this.end,this.start);var n=eu.dot(eu),i=eu.dot(Ql)/n;return t&&(i=vn.clamp(i,0,1)),i},closestPointToPoint:function(e,t,n){var i=this.closestPointToPointParameter(e,t);return void 0===n&&(console.warn("THREE.Line3: .closestPointToPoint() target is now required"),n=new bn),this.delta(n).multiplyScalar(i).add(this.start)},applyMatrix4:function(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this},equals:function(e){return e.start.equals(this.start)&&e.end.equals(this.end)}}),bu.prototype=Object.create(ai.prototype),bu.prototype.constructor=bu,bu.prototype.isImmediateRenderObject=!0,_u.prototype=Object.create(Sa.prototype),_u.prototype.constructor=_u,_u.prototype.update=function(){var e=new bn,t=new bn,n=new _n;return function(){var i=["a","b","c"];this.object.updateMatrixWorld(!0),n.getNormalMatrix(this.object.matrixWorld);var r=this.object.matrixWorld,o=this.geometry.attributes.position,a=this.object.geometry;if(a&&a.isGeometry)for(var s=a.vertices,c=a.faces,l=0,u=0,h=c.length;u1&&e.multiplyScalar(1/t),this.children[0].material.color.copy(this.material.color)}},Eu.prototype.dispose=function(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()},Tu.prototype=Object.create(ai.prototype),Tu.prototype.constructor=Tu,Tu.prototype.dispose=function(){this.children[0].geometry.dispose(),this.children[0].material.dispose()},Tu.prototype.update=function(){var e=new bn,t=new vi,n=new vi;return function(){var i=this.children[0];if(void 0!==this.color)this.material.color.set(this.color);else{var r=i.geometry.getAttribute("color");t.copy(this.light.color),n.copy(this.light.groundColor);for(var o=0,a=r.count;o.99999?this.quaternion.set(0,0,0,1):e.y<-.99999?this.quaternion.set(1,0,0,0):(ru.set(e.z,0,-e.x).normalize(),iu=Math.acos(e.y),this.quaternion.setFromAxisAngle(ru,iu))}),Nu.prototype.setLength=function(e,t,n){void 0===t&&(t=.2*e),void 0===n&&(n=.2*t),this.line.scale.set(1,Math.max(0,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()},Nu.prototype.setColor=function(e){this.line.material.color.set(e),this.cone.material.color.set(e)},Nu.prototype.copy=function(e){return ai.prototype.copy.call(this,e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this},Nu.prototype.clone=function(){return(new this.constructor).copy(this)},Fu.prototype=Object.create(Sa.prototype),Fu.prototype.constructor=Fu;var Uu=0,zu=1;function Gu(e){return console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead."),e}function Hu(e){return void 0===e&&(e=[]),console.warn("THREE.MultiMaterial has been removed. Use an Array instead."),e.isMultiMaterial=!0,e.materials=e,e.clone=function(){return e.slice()},e}function ju(e,t){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new Pa(e,t)}function Vu(e){return console.warn("THREE.Particle has been renamed to THREE.Sprite."),new ba(e)}function Wu(e,t){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new Pa(e,t)}function qu(e){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new Ca(e)}function Xu(e){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new Ca(e)}function Yu(e){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new Ca(e)}function $u(e,t,n){return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),new bn(e,t,n)}function Ju(e,t){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setDynamic( true ) instead."),new Ei(e,t).setDynamic(!0)}function Zu(e,t){return console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead."),new Ti(e,t)}function Ku(e,t){return console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."),new Si(e,t)}function Qu(e,t){return console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."),new Ai(e,t)}function eh(e,t){return console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."),new Ci(e,t)}function th(e,t){return console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."),new Pi(e,t)}function nh(e,t){return console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead."),new Li(e,t)}function ih(e,t){return console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."),new Ri(e,t)}function rh(e,t){return console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."),new Oi(e,t)}function oh(e,t){return console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."),new Di(e,t)}function ah(e){console.warn("THREE.ClosedSplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),Bc.call(this,e),this.type="catmullrom",this.closed=!0}function sh(e){console.warn("THREE.SplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),Bc.call(this,e),this.type="catmullrom"}function ch(e){console.warn("THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead."),Bc.call(this,e),this.type="catmullrom"}function lh(e){return console.warn("THREE.AxisHelper has been renamed to THREE.AxesHelper."),new Fu(e)}function uh(e,t){return console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."),new Du(e,t)}function hh(e,t){return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),new Sa(new Us(e.geometry),new Ea({color:void 0!==t?t:16777215}))}function dh(e,t){return console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."),new Sa(new Ia(e.geometry),new Ea({color:void 0!==t?t:16777215}))}function ph(e){return console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."),new Mc(e)}function fh(e){return console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader."),new Sc(e)}Lc.create=function(e,t){return console.log("THREE.Curve.create() has been deprecated"),e.prototype=Object.create(Lc.prototype),e.prototype.constructor=e,e.prototype.getPoint=t,e},Object.assign(Jc.prototype,{createPointsGeometry:function(e){console.warn("THREE.CurvePath: .createPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");var t=this.getPoints(e);return this.createGeometry(t)},createSpacedPointsGeometry:function(e){console.warn("THREE.CurvePath: .createSpacedPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");var t=this.getSpacedPoints(e);return this.createGeometry(t)},createGeometry:function(e){console.warn("THREE.CurvePath: .createGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");for(var t=new ji,n=0,i=e.length;n1?n-1:0),r=1;r0&&t[0]};var Mh="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Eh=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},Th=function(){function e(e,t){for(var n=0;n=0;c--){var l=s[c],u=this.processInteractive(e,l,n,i,a);if(u){if(!l.parent)continue;a=!1,u&&(e.target&&(i=!1),o=!0)}}return r&&(i&&!e.target&&e.intersects[0]&&e.intersects[0].object===t&&(o=!0),t.interactive&&(o&&!e.target&&(e.data.target=e.target=t),n&&n(e,t,!!o))),o}},{key:"onClick",value:function(e){if("click"===e.type){var t=this.normalizeToPointerData(e);this.autoPreventDefault&&t[0].isNormalized&&e.preventDefault();var n=this.getInteractionDataForPointerId(t[0]),i=this.configureInteractionEventForDOMEvent(this.eventData,t[0],n);i.data.originalEvent=e,this.processInteractive(i,this.scene,this.processClick,!0),this.emit("click",i)}}},{key:"processClick",value:function(e,t,n){n&&this.triggerEvent(t,"click",e)}},{key:"onPointerDown",value:function(e){if(!this.supportsTouchEvents||"touch"!==e.pointerType){var t=this.normalizeToPointerData(e);this.autoPreventDefault&&t[0].isNormalized&&e.preventDefault();for(var n=t.length,i=0;i=0;c--){var l=s[c],u=this.processInteractive(e,l,n,i,a);if(u){if(!l.parent)continue;a=!1,u&&(e.target&&(i=!1),o=!0)}}return r&&(i&&!e.target&&e.intersects[0]&&e.intersects[0].object===t&&(o=!0),t.interactive&&(o&&!e.target&&(e.data.target=e.target=t),n&&n(e,t,!!o))),o}},{key:"onClick",value:function(e){if(this.isAble()&&"click"===e.type){var t=this.normalizeToPointerData(e);this.autoPreventDefault&&t[0].isNormalized&&e.preventDefault();var n=this.getInteractionDataForPointerId(t[0]),i=this.configureInteractionEventForDOMEvent(this.eventData,t[0],n);i.data.originalEvent=e,this.processInteractive(i,this.layer.scene,this.processClick,!0),this.emit("click",i)}}},{key:"processClick",value:function(e,t,n){n&&this.triggerEvent(t,"click",e)}},{key:"onPointerDown",value:function(e){if(this.isAble()&&(!this.supportsTouchEvents||"touch"!==e.pointerType)){var t=this.normalizeToPointerData(e);this.autoPreventDefault&&t[0].isNormalized&&e.preventDefault();for(var n=t.length,i=0;i200)&&(this.pt=Date.now(),this.snippet=Date.now()-this.pt),this.pt+=this.snippet}}]),t}(),Fh=function(e){function t(e,n,i,r){Eh(this,t),r=Object.assign({autoAttach:!1},r);var o=Ah(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,i,r));return o.ticker=new Nh,o.update=o.update.bind(o),o.on("addevents",function(){o.ticker.on("tick",o.update)}),o.on("removeevents",function(){o.ticker.off("tick",o.update)}),o.setTargetElement(o.renderer.domElement),o}return Sh(t,Dh),t}(),Bh=n(13),Uh=n.n(Bh);const zh=(()=>{const e=navigator.appVersion;switch(!0){case-1!==e.indexOf("Win"):return"Windows";case-1!==e.indexOf("Mac"):return"MacOS";case-1!==e.indexOf("X11"):return"UNIX";case-1!==e.indexOf("Linux"):return"Linux";default:return"Unknown"}})(),Gh=(()=>/android/i.test(navigator.userAgent))(),Hh=(()=>/iPad|iPhone|iPod/.test(navigator.userAgent)&&!self.MSStream)(),jh=(()=>navigator.userAgent.includes("Safari")&&navigator.vendor.includes("Apple"))(),Vh=Hh&&/Safari\//.test(navigator.userAgent),Wh=Hh&&/CriOS\//.test(navigator.userAgent),qh=(()=>!!(navigator.userAgent.match(/Android/i)||navigator.userAgent.match(/webOS/i)||navigator.userAgent.match(/iPhone/i)||navigator.userAgent.match(/iPad/i)||navigator.userAgent.match(/iPod/i)))(),Xh=(e,t)=>{try{let n=new URL(e);n.protocol="intent://";const i=self.location.toString(),r=new URL(i),o=encodeURIComponent(i),a="https",s=new URL(r.toString());return s.hash="#no-ar-core-detected",`${n.toString()}?link=${o}&title=${t}#Intent;scheme=${a};package=com.google.ar.core;action=android.intent.action.VIEW;S.browser_fallback_url=${encodeURIComponent(s.toString())};end;`}catch(e){return console.log("NO Android Src specified, will not trigger AR"),self.location.toString()}},Yh=(()=>{const e=document.createElement("a");return Boolean(e.relList&&e.relList.supports&&e.relList.supports("ar"))})(),$h=(()=>{const e=document.createElement("a");return e.setAttribute("rel","ar"),e.appendChild(document.createElement("img")),t=>{e.setAttribute("href",t),e.click()}})(),Jh=(()=>{let e=!1;return t=>{if(e)return;self.addEventListener("hashchange",()=>{"#no-ar-core-detected"!==self.location.hash||e||(e=!0,self.history.back())},{once:!0}),t.click()}})(),Zh=(()=>{const e=/\s+/g;return t=>t?t.split(e):[]})(),Kh=(e,t="rad")=>{const n=parseFloat(e.value);return self.isNaN(n)?"auto":"deg"===e.unit?"deg"===t?n:vn.degToRad(n):"deg"===t?vn.radToDeg(n):n},Qh=e=>Zh(e.trim()).map(e=>ed(e)),ed=(()=>{const e=/^((?:(?:#|[a-zA-Z])[a-zA-Z\d]*)|(?:-?[\d.]+))([a-zA-Z%]*)$/;return t=>{const n=t.match(e)||[];return{type:"value",value:n[1],unit:n[2]||null}}})(),td=e=>{const t=parseFloat(e.value);if(self.isNaN(t))return 0;let n;switch(e.unit){default:case"m":n=1;break;case"cm":n=.01;break;case"mm":n=.001}return t*n},nd=e=>{try{new URL(e);return!0}catch(e){return!1}},id=e=>{let t=void 0,n=-1;return e.forEach((e,i)=>{e>n&&(n=e,t=i)}),t},rd=(e,t)=>{if(!e||!t)return{x:null,y:null};const{clientX:n,clientY:i}=e;return{x:(n-t.left)/t.width*2-1,y:-(i-t.top)/t.height*2+1}},od={CANVAS:"canvas",LOADING:".loading",CONTAINER:".container",TRIGGER_VIEW:".ar-trigger-view",TRIGGER:".ar-trigger",TRIGGER_CONTAINER:".trigger-container",TRIGGER_VIEW_NO_DISPLAY:"no-display"},ad={RENDERER:"RENDERER",SCENE:"SCENE",CAMERA:"MAIN_CAMERA",ORBIT:"ORBIT_CONTROLS",AMBIENT_LIGHT:"AMBIENT_LIGHT",DIRECTIONAL_LIGHT:"DIRECTIONAL_LIGHT",PIVOT:"PIVOT",GRID:"SCENE_GRID",FLOOR:"SCENE-FLOOR",OBJECT:"MAIN_OBJECT",SHADOW_LIGHT:"SHADOW_LIGHT"},sd=60,cd=.01,ld=1e5,ud={x:5,y:1.6,z:2},hd={x:0,y:0,z:0},dd={enableZoom:!0,enablePan:!1,enableDamping:!0,dampingFactor:.125,minPolarAngle:0,maxPolarAngle:Math.PI/2,invertZoom:"Windows"===zh,rotateSpeed:.75,autoRotateSpeed:.0013497188790721718,panSpeed:.75},pd={color:16777215,intensity:.6},fd={color:16777215,intensity:2.512,position:{x:.5,y:0,z:.866}},md={antialias:!0,depth:!0,physicallyCorrectLights:!0,gammaFactor:2.2,precision:"highp",gammaOutput:!0,alpha:!0,color:0,intensity:0,toneMappingExposure:1,sortObjects:!0,shadowMap:{enabled:!0,type:E}},vd=1.5,gd=(vn.degToRad(25),vn.degToRad(20),1e3),yd="25deg 25deg auto",bd="http://cdn.scapic.com/unified-viewer/icons/edit.svg",_d=null!=self.IntersectionObserver,xd=null!=self.ResizeObserver,wd="https://cdn.scapic.com/unified-viewer/hdr/envMap.jpg",Md=2,Ed={ambient:pd.intensity,directional:fd.intensity};var Td=(e,{height:t,width:n})=>{const i=new Qi(sd,n/t,cd,ld);i.name=ad.CAMERA,i.position.set(ud.x,ud.y,ud.z),i.lookAt(hd.x,hd.y,hd.z),e.add(i)};const Sd=(e,t)=>{const n=(new ci).setFromObject(e),i=n.getCenter(new bn),r=n.getSize(new bn),{position:o}=e,a=new bn;let s,c;const l=Math.max(Math.abs(n.min.x+o.x),Math.abs(n.max.x+o.x)),u=Math.max(Math.abs(n.min.z+o.z),Math.abs(n.max.z+o.z)),h=Math.min(0,n.min.y+o.y),d=Math.max(0,n.max.y+o.y);a.y=(d+h)/2;const p=Math.max(d-a.y,a.y-h);return{modelDepth:s=2*Math.max(l,u),framedHeight:c=Math.max(2*p,s/t),targetVector:i,halfVec:new bn(l,p,u),center:i,size:r,boundingBox:n}},Ad=(e,t,n=60)=>{const i=e/2/Math.sin(n/2*Math.PI/180);return{framedDistance:i,idealCameraDistance:i+t}};var Cd=(e,{_initializeDisableShadowsOnAndroid:t,_initializeDisableShadowsOnIos:n,devicePixelRatio:i})=>{if(!(t&&Gh||n&&Hh)){let t=e.getObjectByName(ad.FLOOR);const n=e.getObjectByName(ad.OBJECT),{center:r,size:o,boundingBox:a}=Sd(n,i),s=o.length();if(t)t.position.y=targetBounds.min.y;else{(t=new Gi(new fr(1e3,1e3),new Xs({opacity:.1}))).name=ad.FLOOR,t.position.y=a.min.y,t.rotateX(-Math.PI/2),t.castShadow=!1,t.receiveShadow=!0,e.add(t)}let c=e.getObjectByName(ad.SHADOW_LIGHT);c||((c=new il("#ececec")).name=ad.SHADOW_LIGHT,c.castShadow=!0,c.shadow.mapSize.width=256,c.shadow.mapSize.height=256,c.shadow.camera.far=500,e.add(c)),c.position.set(r.x,r.y+3*s,r.z),c.lookAt(r)}},Pd=e=>{const t=e.getObjectByName(ad.GRID);t&&e.remove(t);const n=e.getObjectByName(ad.OBJECT),i=(new ci).setFromObject(n),r=i.getCenter(new bn),o=50,a=50,s=new ai;s.name=ad.GRID,s.position.x=r.x,s.position.y=i.min.y,s.position.z=r.z;const c=new Ca({color:15263976}),l=new Vs(1,8);for(let e=0;e{const n=new cl(pd.color,t.ambient),i=new sl(fd.color,t.directional);n.name=ad.AMBIENT_LIGHT,i.name=ad.DIRECTIONAL_LIGHT;const r=e.getObjectByName(ad.CAMERA);r.add(i),r.add(n)},Rd=(e,{_orbitControls:t,canvasDimensions:n,_cameraInitialDivider:i,_cameraTarget:r,_minZoom:o})=>{if(e){const a=e.getObjectByName(ad.OBJECT);if(a){(e=>{e&&(e.position.set(0,0,0),e.rotation.set(0,0,0),e.scale.set(1,1,1))})(a);const s=(n.width||1)/(n.height||1),c=e.getObjectByName(ad.CAMERA),{framedHeight:l,modelDepth:u,targetVector:h,center:d}=Sd(a,s),{idealCameraDistance:p}=Ad(l,u,c.getEffectiveFOV());if(t.setPosition(d.x,d.y,p/i,!1),t.maxDistance=10*p,isNaN(Number(o))?t.minDistance=u/2:t.minDistance=vn.clamp(Number(o),0,1/0),r){const{x:e,y:n,z:i}=r;t.setTarget(e,n,i,!1)}else t.setTarget(h.x,h.y,h.z,!1)}else;}},Od=(e,{_environmentImage:t,_environmentIntensity:n},i)=>{const r=e.getObjectByName(ad.OBJECT),o=(new Pc).load(t);o.mapping=xe,o.magFilter=Ie,o.minFilter=Fe,o.encoding=Ht,((e,t)=>{e.traverse(e=>{e.isMesh&&(Array.isArray(e.material)?e.material:[e.material]).forEach(t)})})(r,e=>{(e.isMeshStandardMaterial||e.isGLTFSpecularGlossinessMaterial)&&null==e.envMap&&(e.envMap=o,e.envMapIntensity=n,e.needsUpdate=!0)}),i&&i(o)},Dd=function(){function e(e){this.manager=void 0!==e?e:xc,this.dracoLoader=null,this.ddsLoader=null}function t(){var e={};return{get:function(t){return e[t]},add:function(t,n){e[t]=n},remove:function(t){delete e[t]},removeAll:function(){e={}}}}e.prototype={constructor:e,crossOrigin:"anonymous",load:function(e,t,n,i){var r,o=this;r=void 0!==this.resourcePath?this.resourcePath:void 0!==this.path?this.path:hl.extractUrlBase(e),o.manager.itemStart(e);var a=function(t){i?i(t):console.error(t),o.manager.itemError(e),o.manager.itemEnd(e)},s=new Mc(o.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),"use-credentials"===o.crossOrigin&&s.setWithCredentials(!0),s.load(e,function(n){try{o.parse(n,r,function(n){t(n),o.manager.itemEnd(e)},a)}catch(e){a(e)}},n,a)},setCrossOrigin:function(e){return this.crossOrigin=e,this},setPath:function(e){return this.path=e,this},setResourcePath:function(e){return this.resourcePath=e,this},setDRACOLoader:function(e){return this.dracoLoader=e,this},setDDSLoader:function(e){return this.ddsLoader=e,this},parse:function(e,t,s,c){var p,f={};if("string"==typeof e)p=e;else if(hl.decodeText(new Uint8Array(e,0,4))===a){try{f[n.KHR_BINARY_GLTF]=new l(e)}catch(e){return void(c&&c(e))}p=f[n.KHR_BINARY_GLTF].content}else p=hl.decodeText(new Uint8Array(e));var m=JSON.parse(p);if(void 0===m.asset||m.asset.version[0]<2)c&&c(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported. Use LegacyGLTFLoader instead."));else{if(m.extensionsUsed)for(var v=0;v=0&&console.warn('THREE.GLTFLoader: Unknown extension "'+g+'".')}}new H(m,f,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,manager:this.manager}).parse(s,c)}}};var n={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:"KHR_materials_pbrSpecularGlossiness",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",MSFT_TEXTURE_DDS:"MSFT_texture_dds"};function i(e){if(!e)throw new Error("THREE.GLTFLoader: Attempting to load .dds texture without importing DDSLoader");this.name=n.MSFT_TEXTURE_DDS,this.ddsLoader=e}function r(e){this.name=n.KHR_LIGHTS_PUNCTUAL;var t=e.extensions&&e.extensions[n.KHR_LIGHTS_PUNCTUAL]||{};this.lightDefs=t.lights||[]}function o(){this.name=n.KHR_MATERIALS_UNLIT}r.prototype.loadLight=function(e){var t,n=this.lightDefs[e],i=new vi(16777215);void 0!==n.color&&i.fromArray(n.color);var r=void 0!==n.range?n.range:0;switch(n.type){case"directional":(t=new sl(i)).target.position.set(0,0,-1),t.add(t.target);break;case"point":(t=new rl(i)).distance=r;break;case"spot":(t=new il(i)).distance=r,n.spot=n.spot||{},n.spot.innerConeAngle=void 0!==n.spot.innerConeAngle?n.spot.innerConeAngle:0,n.spot.outerConeAngle=void 0!==n.spot.outerConeAngle?n.spot.outerConeAngle:Math.PI/4,t.angle=n.spot.outerConeAngle,t.penumbra=1-n.spot.innerConeAngle/n.spot.outerConeAngle,t.target.position.set(0,0,-1),t.add(t.target);break;default:throw new Error('THREE.GLTFLoader: Unexpected light type, "'+n.type+'".')}return t.position.set(0,0,0),t.decay=2,void 0!==n.intensity&&(t.intensity=n.intensity),t.name=n.name||"light_"+e,Promise.resolve(t)},o.prototype.getMaterialType=function(){return Mi},o.prototype.extendParams=function(e,t,n){var i=[];e.color=new vi(1,1,1),e.opacity=1;var r=t.pbrMetallicRoughness;if(r){if(Array.isArray(r.baseColorFactor)){var o=r.baseColorFactor;e.color.fromArray(o),e.opacity=o[3]}void 0!==r.baseColorTexture&&i.push(n.assignTexture(e,"map",r.baseColorTexture))}return Promise.all(i)};var a="glTF",s=12,c={JSON:1313821514,BIN:5130562};function l(e){this.name=n.KHR_BINARY_GLTF,this.content=null,this.body=null;var t=new DataView(e,0,s);if(this.header={magic:hl.decodeText(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==a)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected. Use LegacyGLTFLoader instead.");for(var i=new DataView(e,s),r=0;r",a).replace("#include ",s).replace("#include ",c).replace("#include ",l).replace("#include ",u);delete o.roughness,delete o.metalness,delete o.roughnessMap,delete o.metalnessMap,o.specular={value:(new vi).setHex(1118481)},o.glossiness={value:.5},o.specularMap={value:null},o.glossinessMap={value:null},e.vertexShader=r.vertexShader,e.fragmentShader=h,e.uniforms=o,e.defines={STANDARD:""},e.color=new vi(1,1,1),e.opacity=1;var d=[];if(Array.isArray(i.diffuseFactor)){var p=i.diffuseFactor;e.color.fromArray(p),e.opacity=p[3]}if(void 0!==i.diffuseTexture&&d.push(n.assignTexture(e,"map",i.diffuseTexture)),e.emissive=new vi(0,0,0),e.glossiness=void 0!==i.glossinessFactor?i.glossinessFactor:1,e.specular=new vi(1,1,1),Array.isArray(i.specularFactor)&&e.specular.fromArray(i.specularFactor),void 0!==i.specularGlossinessTexture){var f=i.specularGlossinessTexture;d.push(n.assignTexture(e,"glossinessMap",f)),d.push(n.assignTexture(e,"specularMap",f))}return Promise.all(d)},createMaterial:function(e){var t=new Zi({defines:e.defines,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader,uniforms:e.uniforms,fog:!0,lights:!0,opacity:e.opacity,transparent:e.transparent});return t.isGLTFSpecularGlossinessMaterial=!0,t.color=e.color,t.map=void 0===e.map?null:e.map,t.lightMap=null,t.lightMapIntensity=1,t.aoMap=void 0===e.aoMap?null:e.aoMap,t.aoMapIntensity=1,t.emissive=e.emissive,t.emissiveIntensity=1,t.emissiveMap=void 0===e.emissiveMap?null:e.emissiveMap,t.bumpMap=void 0===e.bumpMap?null:e.bumpMap,t.bumpScale=1,t.normalMap=void 0===e.normalMap?null:e.normalMap,e.normalScale&&(t.normalScale=e.normalScale),t.displacementMap=null,t.displacementScale=1,t.displacementBias=0,t.specularMap=void 0===e.specularMap?null:e.specularMap,t.specular=e.specular,t.glossinessMap=void 0===e.glossinessMap?null:e.glossinessMap,t.glossiness=e.glossiness,t.alphaMap=null,t.envMap=void 0===e.envMap?null:e.envMap,t.envMapIntensity=1,t.refractionRatio=.98,t.extensions.derivatives=!0,t},cloneMaterial:function(e){var t=e.clone();t.isGLTFSpecularGlossinessMaterial=!0;for(var n=this.specularGlossinessParams,i=0,r=n.length;i=2&&(i[o++]=e.getY(r)),n>=3&&(i[o++]=e.getZ(r)),n>=4&&(i[o++]=e.getW(r));return new Ei(i,n,e.normalized)}return e.clone()}function H(e,n,i){this.json=e||{},this.extensions=n||{},this.options=i||{},this.cache=new t,this.primitiveCache={},this.textureLoader=new Pc(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.fileLoader=new Mc(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}function j(e,t,n){var i=t.attributes,r=[];function o(t,i){return n.getDependency("accessor",t).then(function(t){e.addAttribute(i,t)})}for(var a in i){var s=C[a]||a.toLowerCase();s in e.attributes||r.push(o(i[a],s))}if(void 0!==t.indices&&!e.index){var c=n.getDependency("accessor",t.indices).then(function(t){e.setIndex(t)});r.push(c)}return B(e,t),Promise.all(r).then(function(){return void 0!==t.targets?function(e,t,n){for(var i=!1,r=!1,o=0,a=t.length;o=2&&r.setY(T,x[M*a+1]),a>=3&&r.setZ(T,x[M*a+2]),a>=4&&r.setW(T,x[M*a+3]),a>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return r})},H.prototype.loadTexture=function(e){var t,i=this,r=this.json,o=this.options,a=this.textureLoader,s=window.URL||window.webkitURL,c=r.textures[e],l=c.extensions||{},u=(t=l[n.MSFT_TEXTURE_DDS]?r.images[l[n.MSFT_TEXTURE_DDS].source]:r.images[c.source]).uri,h=!1;return void 0!==t.bufferView&&(u=i.getDependency("bufferView",t.bufferView).then(function(e){h=!0;var n=new Blob([e],{type:t.mimeType});return u=s.createObjectURL(n)})),Promise.resolve(u).then(function(e){var t=Ll.Handlers.get(e);return t||(t=l[n.MSFT_TEXTURE_DDS]?i.extensions[n.MSFT_TEXTURE_DDS].ddsLoader:a),new Promise(function(n,i){t.load(N(e,o.path),n,void 0,i)})}).then(function(e){!0===h&&s.revokeObjectURL(u),e.flipY=!1,void 0!==c.name&&(e.name=c.name),t.mimeType in k&&(e.format=k[t.mimeType]);var n=(r.samplers||{})[c.sampler]||{};return e.magFilter=M[n.magFilter]||Ie,e.minFilter=M[n.minFilter]||Fe,e.wrapS=E[n.wrapS]||Se,e.wrapT=E[n.wrapT]||Se,e})},H.prototype.assignTexture=function(e,t,i){var r=this;return this.getDependency("texture",i.index).then(function(o){if(!o.isCompressedTexture)switch(t){case"aoMap":case"emissiveMap":case"metalnessMap":case"normalMap":case"roughnessMap":o.format=Ke}if(r.extensions[n.KHR_TEXTURE_TRANSFORM]){var a=void 0!==i.extensions?i.extensions[n.KHR_TEXTURE_TRANSFORM]:void 0;a&&(o=r.extensions[n.KHR_TEXTURE_TRANSFORM].extendTexture(o,a))}e[t]=o})},H.prototype.assignFinalMaterial=function(e){var t=e.geometry,i=e.material,r=this.extensions,o=void 0!==t.attributes.tangent,a=void 0!==t.attributes.color,s=void 0===t.attributes.normal,c=!0===e.isSkinnedMesh,l=Object.keys(t.morphAttributes).length>0,u=l&&void 0!==t.morphAttributes.normal;if(e.isPoints){var h="PointsMaterial:"+i.uuid,d=this.cache.get(h);d||(d=new Ca,wi.prototype.copy.call(d,i),d.color.copy(i.color),d.map=i.map,d.lights=!1,this.cache.add(h,d)),i=d}else if(e.isLine){h="LineBasicMaterial:"+i.uuid;var p=this.cache.get(h);p||(p=new Ea,wi.prototype.copy.call(p,i),p.color.copy(i.color),p.lights=!1,this.cache.add(h,p)),i=p}if(o||a||s||c||l){h="ClonedMaterial:"+i.uuid+":";i.isGLTFSpecularGlossinessMaterial&&(h+="specular-glossiness:"),c&&(h+="skinning:"),o&&(h+="vertex-tangents:"),a&&(h+="vertex-colors:"),s&&(h+="flat-shading:"),l&&(h+="morph-targets:"),u&&(h+="morph-normals:");var f=this.cache.get(h);f||(f=i.isGLTFSpecularGlossinessMaterial?r[n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].cloneMaterial(i):i.clone(),c&&(f.skinning=!0),o&&(f.vertexTangents=!0),a&&(f.vertexColors=O),s&&(f.flatShading=!0),l&&(f.morphTargets=!0),u&&(f.morphNormals=!0),this.cache.add(h,f)),i=f}i.aoMap&&void 0===t.attributes.uv2&&void 0!==t.attributes.uv&&(console.log("THREE.GLTFLoader: Duplicating UVs to support aoMap."),t.addAttribute("uv2",new Ei(t.attributes.uv.array,2))),i.isGLTFSpecularGlossinessMaterial&&(e.onBeforeRender=r[n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].refreshUniforms),e.material=i},H.prototype.loadMaterial=function(e){var t,i=this.json,r=this.extensions,o=i.materials[e],a={},s=o.extensions||{},c=[];if(s[n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]){var l=r[n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS];t=l.getMaterialType(),c.push(l.extendParams(a,o,this))}else if(s[n.KHR_MATERIALS_UNLIT]){var u=r[n.KHR_MATERIALS_UNLIT];t=u.getMaterialType(),c.push(u.extendParams(a,o,this))}else{t=$s;var h=o.pbrMetallicRoughness||{};if(a.color=new vi(1,1,1),a.opacity=1,Array.isArray(h.baseColorFactor)){var d=h.baseColorFactor;a.color.fromArray(d),a.opacity=d[3]}void 0!==h.baseColorTexture&&c.push(this.assignTexture(a,"map",h.baseColorTexture)),a.metalness=void 0!==h.metallicFactor?h.metallicFactor:1,a.roughness=void 0!==h.roughnessFactor?h.roughnessFactor:1,void 0!==h.metallicRoughnessTexture&&(c.push(this.assignTexture(a,"metalnessMap",h.metallicRoughnessTexture)),c.push(this.assignTexture(a,"roughnessMap",h.metallicRoughnessTexture)))}!0===o.doubleSided&&(a.side=A);var p=o.alphaMode||R;return p===I?a.transparent=!0:(a.transparent=!1,p===D&&(a.alphaTest=void 0!==o.alphaCutoff?o.alphaCutoff:.5)),void 0!==o.normalTexture&&t!==Mi&&(c.push(this.assignTexture(a,"normalMap",o.normalTexture)),a.normalScale=new gn(1,1),void 0!==o.normalTexture.scale&&a.normalScale.set(o.normalTexture.scale,o.normalTexture.scale)),void 0!==o.occlusionTexture&&t!==Mi&&(c.push(this.assignTexture(a,"aoMap",o.occlusionTexture)),void 0!==o.occlusionTexture.strength&&(a.aoMapIntensity=o.occlusionTexture.strength)),void 0!==o.emissiveFactor&&t!==Mi&&(a.emissive=(new vi).fromArray(o.emissiveFactor)),void 0!==o.emissiveTexture&&t!==Mi&&c.push(this.assignTexture(a,"emissiveMap",o.emissiveTexture)),Promise.all(c).then(function(){var e;return e=t===Zi?r[n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(a):new t(a),void 0!==o.name&&(e.name=o.name),e.map&&(e.map.encoding=Ht),e.emissiveMap&&(e.emissiveMap.encoding=Ht),e.specularMap&&(e.specularMap.encoding=Ht),B(e,o),o.extensions&&F(r,e,o),e})},H.prototype.loadGeometries=function(e){var t=this,i=this.extensions,r=this.primitiveCache;function o(e){return i[n.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then(function(n){return j(n,e,t)})}for(var a,s,c=[],l=0,u=e.length;l0&&U(l,n),l.name=n.name||"mesh_"+e,o.length>1&&(l.name+="_"+s),B(l,n),t.assignFinalMaterial(l),a.push(l)}if(1===a.length)return a[0];var p=new ea;for(s=0,c=a.length;s1){var n=s[c.mesh]++;(t=e.clone()).name+="_instance_"+n,t.onBeforeRender=e.onBeforeRender;for(var i=0,r=t.children.length;i1?new ea:1===e.length?e[0]:new ai)!==e[0])for(var n=0,i=e.length;n0&&console.log("Loaded a mesh.");else{if(s!=t.POINT_CLOUD){var c="DRACOLoader: Unknown geometry type.";throw console.error(c),new Error(c)}this.verbosity>0&&console.log("Loaded a point cloud.")}n(this.convertDracoGeometryTo3JS(t,a,s,o,i,r))},addAttributeToGeometry:function(e,t,n,i,r,o,a,s){if(0===o.ptr){var c="DRACOLoader: No attribute "+i;throw console.error(c),new Error(c)}var l,u,h=o.num_components(),d=n.num_points()*h;switch(r){case Float32Array:l=new e.DracoFloat32Array,t.GetAttributeFloatForAllPoints(n,o,l),s[i]=new Float32Array(d),u=Oi;break;case Int8Array:l=new e.DracoInt8Array,t.GetAttributeInt8ForAllPoints(n,o,l),s[i]=new Int8Array(d),u=Ti;break;case Int16Array:l=new e.DracoInt16Array,t.GetAttributeInt16ForAllPoints(n,o,l),s[i]=new Int16Array(d),u=Ci;break;case Int32Array:l=new e.DracoInt32Array,t.GetAttributeInt32ForAllPoints(n,o,l),s[i]=new Int32Array(d),u=Li;break;case Uint8Array:l=new e.DracoUInt8Array,t.GetAttributeUInt8ForAllPoints(n,o,l),s[i]=new Uint8Array(d),u=Si;break;case Uint16Array:l=new e.DracoUInt16Array,t.GetAttributeUInt16ForAllPoints(n,o,l),s[i]=new Uint16Array(d),u=Pi;break;case Uint32Array:l=new e.DracoUInt32Array,t.GetAttributeUInt32ForAllPoints(n,o,l),s[i]=new Uint32Array(d),u=Ri;break;default:c="DRACOLoader: Unexpected attribute type.";throw console.error(c),new Error(c)}for(var p=0;p0&&console.log("Number of faces loaded: "+u.toString())):u=0;var d=a.num_points(),p=a.num_attributes();this.verbosity>0&&(console.log("Number of points loaded: "+d.toString()),console.log("Number of attributes loaded: "+p.toString()));var f=t.GetAttributeId(a,e.POSITION);if(-1==f){l="DRACOLoader: No position attribute found.";throw console.error(l),e.destroy(t),e.destroy(a),new Error(l)}var m=t.GetAttribute(a,f),v={},g=new zi;if(r)for(var y in r){var b=o[y],_=r[y],x=t.GetAttributeByUniqueId(a,_);this.addAttributeToGeometry(e,t,a,y,b,x,g,v)}else for(var y in this.nativeAttributeMap){var w=t.GetAttributeId(a,e[this.nativeAttributeMap[y]]);if(-1!==w){this.verbosity>0&&console.log("Loaded "+y+" attribute.");x=t.GetAttribute(a,w);this.addAttributeToGeometry(e,t,a,y,Float32Array,x,g,v)}}if(n==e.TRIANGULAR_MESH)if(this.drawMode===Ut){var M=new e.DracoInt32Array;t.GetTriangleStripsFromMesh(a,M),v.indices=new Uint32Array(M.size());for(var E=0;E65535?Ri:Pi)(v.indices,1));var C=new e.AttributeQuantizationTransform;if(C.InitFromAttribute(m)){g.attributes.position.isQuantized=!0,g.attributes.position.maxRange=C.range(),g.attributes.position.numQuantizationBits=C.quantization_bits(),g.attributes.position.minValues=new Float32Array(3);for(E=0;E<3;++E)g.attributes.position.minValues[E]=C.min_value(E)}return e.destroy(C),e.destroy(t),e.destroy(a),this.decode_time=h-c,this.import_time=performance.now()-h,this.verbosity>0&&(console.log("Decode time: "+this.decode_time),console.log("Import time: "+this.import_time)),g},isVersionSupported:function(e,t){Id.getDecoderModule().then(function(n){t(n.decoder.isVersionSupported(e))})},getAttributeOptions:function(e){return void 0===this.attributeOptions[e]&&(this.attributeOptions[e]={}),this.attributeOptions[e]}},Id.decoderPath="./",Id.decoderConfig={},Id.decoderModulePromise=null,Id.setDecoderPath=function(e){Id.decoderPath=e},Id.setDecoderConfig=function(e){var t=Id.decoderConfig.wasmBinary;Id.decoderConfig=e||{},Id.releaseDecoderModule(),t&&(Id.decoderConfig.wasmBinary=t)},Id.releaseDecoderModule=function(){Id.decoderModulePromise=null},Id.getDecoderModule=function(){var e=this,t=Id.decoderPath,n=Id.decoderConfig,i=Id.decoderModulePromise;return i||("undefined"!=typeof DracoDecoderModule?i=Promise.resolve():"object"!=typeof WebAssembly||"js"===n.type?i=Id._loadScript(t+"draco_decoder.js"):(n.wasmBinaryFile=t+"draco_decoder.wasm",i=Id._loadScript(t+"draco_wasm_wrapper.js").then(function(){return Id._loadArrayBuffer(n.wasmBinaryFile)}).then(function(e){n.wasmBinary=e})),i=i.then(function(){return new Promise(function(t){n.onModuleLoaded=function(n){e.timeLoaded=performance.now(),t({decoder:n})},DracoDecoderModule(n)})}),Id.decoderModulePromise=i,i)},Id._loadScript=function(e){var t=document.getElementById("decoder_script");null!==t&&t.parentNode.removeChild(t);var n=document.getElementsByTagName("head")[0],i=document.createElement("script");return i.id="decoder_script",i.type="text/javascript",i.src=e,new Promise(function(e){i.onload=e,n.appendChild(i)})},Id._loadArrayBuffer=function(e){var t=new Mc;return t.setResponseType("arraybuffer"),new Promise(function(n,i){t.load(e,n,void 0,i)})};var kd=(e,{_src:t,_requestID:n,_enableDracoSupport:i},r,o,a)=>{const s=new Dd;i&&(Id.setDecoderPath("https://cdn.scapic.com/unified-viewer/libs/draco/"),s.setDRACOLoader(new Id),Id.getDecoderModule()),s.load(t,t=>{let n;(n=e.getObjectByName(ad.OBJECT))&&e.remove(n),(n=t.scene).name=ad.OBJECT,n.traverse(e=>{e.isMesh&&(e.castShadow=!0,e.receiveShadow=!0)}),e.add(n),o(t)},e=>{if(r!==n){const{target:t}=e;t.abort()}},a)};const Nd=n(13);var Fd=(e,{_orbitControls:t,_cameraOrbit:n,devicePixelRatio:i,_cameraInitialDivider:r},o=800,a=(()=>{}))=>{const s=e.getObjectByName(ad.OBJECT);if(!s)return;const c=e.getObjectByName(ad.CAMERA),[l,u,h]=(e=>{try{const t=Qh(e);if(3===t.length){const[e,n,i]=t;return[Kh(e),Kh(n),"auto"===i.value?"auto":td(i)]}}catch(e){}return null})(n),d=t._spherical,{framedHeight:p,modelDepth:f}=Sd(s,i),{idealCameraDistance:m}=Ad(p,f,c.getEffectiveFOV()),v="auto"===l?d.theta:l,g="auto"===u?d.phi:u,y="auto"===h?m/r:h;if("auto"===l&&"auto"===u&&"auto"===h)setTimeout(()=>{a()},o);else{const e=new Nd.Tween({theta:d.theta,phi:d.phi,radius:d.radius}).to({phi:g,theta:v,radius:y},1e3).easing(Nd.Easing.Quadratic.In).delay(o).onUpdate(({theta:e,phi:n,radius:i})=>{t.rotateTo(e,n,!1),t.dollyTo(i,!1)}).onComplete(()=>{a(),t.saveState()});requestAnimationFrame(()=>{e.start()})}};const Bd=n(13),Ud=Symbol("fadeIn"),zd=Symbol("translateAndRotateIn"),Gd=Symbol("scaleIn"),Hd=Symbol("swirlIn"),jd=Symbol("swivelIn"),Vd=Symbol("vortex"),Wd={fadeIn:Ud,scaleIn:Gd,translateAndRotateIn:zd,swirlIn:Hd,swivelIn:jd,vortex:Vd};class qd extends c{constructor(e,t){super(),this[Ud]=(e=>{const t=this._scene.getObjectByName(ad.OBJECT);if(!t)return;t.traverse(e=>{e.isMesh&&(e.material.opacity=0,e.material.transparent=!0,e.material.needsUpdate=!0)});const n=new Bd.Tween({opacity:0}).to({opacity:1},1e3).easing(Bd.Easing.Quadratic.In).onUpdate(({opacity:e})=>{t.traverse(t=>{t.isMesh&&(t.material.opacity=e)})}).onComplete(()=>{this.dispatchEvent({type:e})}).delay(1e3);this.startAnim(n)}),this[Gd]=(e=>{const t=this._scene.getObjectByName(ad.OBJECT);if(!t)return;let n=new bn(1e-4,1e-4,1e-4);t.scale.copy(n);const i=new Bd.Tween({x:0,y:0,z:0}).to({x:1,y:1,z:1},1200).easing(Bd.Easing.Back.Out).onUpdate(({x:e,y:i,z:r})=>{n.set(e,i,r),t.scale.copy(n)}).onComplete(()=>{this.dispatchEvent({type:e})}).delay(1e3);this.startAnim(i)}),this[zd]=(e=>{const t=this._scene.getObjectByName(ad.OBJECT);if(!t)return;let{z:n,x:i,y:r}=t.position,o=new bn(t.position);const a=new Bd.Tween({z:-20}).to({z:n},1200).easing(Bd.Easing.Sinusoidal.In).onUpdate(({z:e})=>{o.set(i,r,e),t.position.copy(o)});this.startAnim(a),this[jd](e)}),this[Hd]=(e=>{const t=this._scene.getObjectByName(ad.OBJECT);if(!t)return;let{y:n,x:i,z:r}=t.position,{y:o,x:a,z:s}=t.rotation,c=new bn(i,n,r),l=new bn(1e-4,1e-4,1e-4);t.position.copy(c),t.scale.copy(l),t.rotation.set(a,o,s);const u=Sd(t).size.y,h=new Bd.Tween({ry:1,py:u,sx:0,sy:0,sz:0}).to({ry:o,py:n,sx:1,sy:1,sz:1},2200).easing(Bd.Easing.Quartic.InOut).onUpdate(({ry:e,py:n,sx:o,sy:u,sz:h})=>{c.set(i,n,r),l.set(o,u,h),t.position.copy(c),t.scale.copy(l),t.rotation.set(a,e,s)}).onComplete(()=>{this.dispatchEvent({type:e})}).delay(500);this.startAnim(h)}),this[Vd]=(e=>{const t=this._scene.getObjectByName(ad.OBJECT);if(!t)return;t.traverse(e=>{e.isMesh&&(e.material.opacity=.2,e.material.transparent=!0,e.material.needsUpdate=!0)});let{z:n,y:i,x:r}=t.rotation,o=new bn(1e-4,1e-4,1e-4);t.scale.copy(o),t.rotation.set(n,i,r);const a=new Bd.Tween({rz:10,py:-2,sx:0,sy:0,sz:0,opacity:.2}).to({rz:n,opacity:1,sx:1,sy:1,sz:1},2200).easing(Bd.Easing.Quartic.InOut).onUpdate(({rz:e,sx:n,sy:a,sz:s,opacity:c})=>{t.rotation.set(r,i,e),t.traverse(e=>{e.isMesh&&(e.material.opacity=c)}),o.set(n,a,s),t.scale.copy(o)}).onComplete(()=>{this.dispatchEvent({type:e})}).delay(500);this.startAnim(a)}),this[jd]=(e=>{const t=this._scene.getObjectByName(ad.OBJECT);if(!t)return;t.traverse(e=>{e.isMesh&&(e.material.opacity=.2,e.material.transparent=!0,e.material.needsUpdate=!0)});let{y:n,x:i,z:r}=t.rotation,o=new bn(1e-4,1e-4,1e-4);t.scale.copy(o),t.rotation.set(n,r,i);const a=new Bd.Tween({ry:10,py:-2,sx:0,sy:0,sz:0,opacity:.2}).to({ry:n,opacity:1,sx:1,sy:1,sz:1},2200).easing(Bd.Easing.Quartic.InOut).onUpdate(({ry:e,sx:n,sy:a,sz:s,opacity:c})=>{t.rotation.set(i,e,r),t.traverse(e=>{e.isMesh&&(e.material.opacity=c,e.material.needsUpdate=!0)}),o.set(n,a,s),t.scale.copy(o)}).onComplete(()=>{this.dispatchEvent({type:e})}).delay(500);this.startAnim(a)}),this._scene=e,this._renderer=t}rotatateAndJump(e){const t=this._scene.getObjectByName(ad.OBJECT);if(!t)return;let{y:n,x:i,z:r}=t.position,{y:o,x:a,z:s}=t.rotation;t.rotation.set(a,s,o);const c=new Bd.Tween({rx:a}).to({rx:-.2},1200).easing(Bd.Easing.Quartic.InOut).onUpdate(({rx:e})=>{t.rotation.set(e,o,s)}).delay(100),l=new Bd.Tween({py:n}).to({py:2},1200).easing(Bd.Easing.Quartic.InOut).onUpdate(({py:e})=>{t.position.copy(new bn(i,e,r))}).delay(500),u=new Bd.Tween({rx:-.2}).to({rx:a},500).easing(Bd.Easing.Quartic.InOut).onUpdate(({rx:e})=>{t.rotation.set(e,o,s)}).delay(1e3),h=new Bd.Tween({rx:a}).to({rx:-.2},500).easing(Bd.Easing.Quartic.InOut).onUpdate(({rx:e})=>{t.rotation.set(e,o,s)}).delay(1500),d=new Bd.Tween({py:2}).to({py:n},1200).easing(Bd.Easing.Quartic.InOut).onUpdate(({py:e})=>{t.position.copy(new bn(i,e,r))}).onComplete(()=>{this.dispatchEvent({type:e})}).delay(1500);this.startAnim(c),this.startAnim(l),this.startAnim(u),this.startAnim(h),this.startAnim(d)}startAnim(e){e.start()}}const Xd=n(13),Yd=.2,$d=.05,Jd=new mr(.4,.4),Zd=new Mi({opacity:1,flatShading:!1,side:T,transparent:!0});class Kd extends ea{constructor({iconUrl:e,position:t,name:n,scene:i,devicePixelRatio:r,brandColor:o,onClick:a=(()=>{}),onPointerIn:s=(()=>{}),onPointerOut:c=(()=>{})}){const l=i.getObjectByName(n);l&&i.remove(l),super();const u=(new Pc).load(e),h=Zd.clone();h.map=u,h.needsUpdate=!0,this._iconURL=e,this._scene=i,this._mainMesh=new Gi(Jd.clone(),h),this.add(this._mainMesh);const d=new Ws($d,360),p=new Ws(Yd,360),f=new Mi({color:o,opacity:1,flatShading:!0,side:A,transparent:!0});this._animatingCircles={small:new Gi(d,f.clone()),large:new Gi(p,f.clone())},this._animations={small:null,large:null},this.add(this._animatingCircles.small),this.add(this._animatingCircles.large),this.name=n,this._devicePixelRatio=r,this._positioncopy=t.clone(),this._clickHandler=a,this._brandColor=o,this._pointerOutHandler=c,this._pointerInHandler=s,this.position.copy(t),this._animatingCircles.small.position.z-=.024,this._animatingCircles.large.position.z-=.05,this._mainMesh.position.z+=.05,this._hoverScale=this.scale.clone().multiplyScalar(1.2),this._attachEvents(),this._startAnimation(),this.changeVisiblity(),this.renderOrder=1}changeVisiblity(e=!1){this.traverse(t=>{t.isMesh&&(t.material.visible=e,t.material.needsUpdate=!0)})}_startAnimation(){const{scale:e}=this._animatingCircles.small;this._animations.small=new Xd.Tween({scale:e.x,opacity:.6}).to({scale:12*e.x,opacity:0},1800).onStart(()=>{this._animatingCircles.small.scale.setX(e.x),this._animatingCircles.small.scale.setY(e.x),this._animatingCircles.small.material.opacity=1,this._animatingCircles.small.material.needsUpdate=!0}).repeat(1/0).easing(Xd.Easing.Quadratic.Out).onUpdate(({scale:e,opacity:t})=>{this._animatingCircles.small.scale.setX(e),this._animatingCircles.small.scale.setY(e),this._animatingCircles.small.material.opacity=t,this._animatingCircles.small.material.needsUpdate=!0});const{scale:t}=this._animatingCircles.large;this._animations.large=new Xd.Tween({scale:t.x,opacity:.6}).to({scale:2*t.x,opacity:0},1800).repeat(1/0).onStart(()=>{this._animatingCircles.large.scale.setX(t.x),this._animatingCircles.large.scale.setY(t.x),this._animatingCircles.large.material.opacity=1,this._animatingCircles.large.material.needsUpdate=!0}).easing(Xd.Easing.Quadratic.Out).onUpdate(({scale:e,opacity:t})=>{this._animatingCircles.large.scale.setX(e),this._animatingCircles.large.scale.setY(e),this._animatingCircles.large.material.opacity=t,this._animatingCircles.large.material.needsUpdate=!0}),this._animations.large.start(),this._animations.small.start()}_resetAnimation(){this._animations.small&&(this._animations.small.stop(),this._animations.small=null),this._animations.large&&(this._animations.large.stop(),this._animations.large=null)}_attachEvents(){this.on("pointermove",()=>{this._pointerInHandler()}),this.on("pointerout",()=>{this._pointerOutHandler()}),this.on("click",this._clickHandler),this.on("touchstart",this._clickHandler)}update(e){const{position:t}=e;this.lookAt(t.clone())}updateSize(e){const{size:t}=Sd(e,this._devicePixelRatio);this._resetAnimation(),this.position.copy(this._positioncopy).multiply(t).divideScalar(2),this._mainMesh.geometry.computeBoundingBox();const n=this._mainMesh.geometry.boundingBox.getSize(new bn),i=.075*t.length()/n.length();this._mainMesh.scale.setX(i),this._mainMesh.scale.setY(i),this._animatingCircles.large.scale.setX(i),this._animatingCircles.large.scale.setY(i),this._animatingCircles.small.scale.setX(i),this._animatingCircles.small.scale.setY(i),this._scalecopy=this.scale.clone(),this._hoverScale=this.scale.clone().multiplyScalar(1.2),this._startAnimation()}}var Qd=(e,{devicePixelRatio:t,canvasDimensions:n,_isScreenShotSession:i})=>{const r=new pa({antialias:md.antialias,canvas:e,depth:md.depth,precision:md.precision,alpha:md.alpha,preserveDrawingBuffer:Boolean(i)});return r.sortObjects=md.sortObjects,r.physicallyCorrectLights=md.physicallyCorrectLights,r.gammaOutput=md.gammaOutput,r.gammaFactor=md.gammaFactor,r.setClearColor(md.color,md.intensity),r.toneMappingExposure=md.toneMappingExposure,r.shadowMap.enabled=md.shadowMap.enabled,r.shadowMap.type=md.shadowMap.type,r.setPixelRatio(t),r.setSize(n.width,n.height),r}; /*! * camera-controls * https://github.com/yomotsu/camera-controls * (c) 2017 @yomotsu * Released under the MIT License. */function ep(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function tp(e,t){for(var n=0;n2&&void 0!==arguments[2]?arguments[2]:{};if(ep(this,t),r=this,(i=!(o=ip(t).call(this))||"object"!=typeof o&&"function"!=typeof o?op(r):o)._camera=e,i._yAxisUpSpace=(new ap.Quaternion).setFromUnitVectors(i._camera.up,sp),i._yAxisUpSpaceInverse=i._yAxisUpSpace.clone().inverse(),i._state=bp.NONE,i.enabled=!0,i._camera.isPerspectiveCamera?(i.minDistance=0,i.maxDistance=1/0):i._camera.isOrthographicCamera&&(i.minZoom=0,i.maxZoom=1/0),i.minPolarAngle=0,i.maxPolarAngle=Math.PI,i.minAzimuthAngle=-1/0,i.maxAzimuthAngle=1/0,i._boundary=new ap.Box3(new ap.Vector3(-1/0,-1/0,-1/0),new ap.Vector3(1/0,1/0,1/0)),i.boundaryFriction=0,i._boundaryEnclosesCamera=!1,i.dampingFactor=.05,i.draggingDampingFactor=.25,i.azimuthRotateSpeed=1,i.polarRotateSpeed=1,i.dollySpeed=1,i.truckSpeed=2,i.dollyToCursor=!1,i.verticalDragToForward=!1,i._domElement=n,i._viewport=null,i._target=new ap.Vector3,i._targetEnd=new ap.Vector3,i._spherical=(new ap.Spherical).setFromVector3(i._camera.position.applyQuaternion(i._yAxisUpSpace)),i._sphericalEnd=i._spherical.clone(),i._target0=i._target.clone(),i._position0=i._camera.position.clone(),i._zoom0=i._camera.zoom,i._dollyControlAmount=0,i._dollyControlCoord=new ap.Vector2,i._hasUpdated=!0,i.update(0),!i._domElement||a.ignoreDOMEventListeners)i._removeAllEventListeners=function(){};else{var s,c=function(e,t){if(t.set(0,0),function(e){return"TouchEvent"in window&&e instanceof TouchEvent}(e)){for(var n=0;n2&&void 0!==arguments[2]?arguments[2]:{};if(this._camera.isOrthographicCamera)console.warn("fitTo is not supported for OrthographicCamera");else{var i=n.paddingLeft||0,r=n.paddingRight||0,o=n.paddingBottom||0,a=n.paddingTop||0,s=e.isBox3?e.clone():(new ap.Box3).setFromObject(e),c=s.getSize(lp),l=c.x+i+r,u=c.y+a+o,h=c.z,d=this.getDistanceToFit(l,u,h);this.dollyTo(d,t);var p=s.getCenter(lp),f=p.x-(.5*i-.5*r),m=p.y+(.5*a-.5*o),v=p.z;this.moveTo(f,m,v,t),this._sanitizeSphericals(),this.rotateTo(0,90*ap.Math.DEG2RAD,t)}}},{key:"setLookAt",value:function(e,t,n,i,r,o,a){var s=lp.set(e,t,n),c=up.set(i,r,o);this._targetEnd.copy(c),this._sphericalEnd.setFromVector3(s.sub(c)),this._sanitizeSphericals(),a||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd)),this._hasUpdated=!0}},{key:"lerpLookAt",value:function(e,t,n,i,r,o,a,s,c,l,u,h,d,p){var f=lp.set(e,t,n),m=up.set(i,r,o);mp.setFromVector3(f.sub(m).applyQuaternion(this._yAxisUpSpace));var v=lp.set(l,u,h);this._targetEnd.copy(m).lerp(v,d);var g=up.set(a,s,c);vp.setFromVector3(g.sub(v).applyQuaternion(this._yAxisUpSpace));var y=vp.theta-mp.theta,b=vp.phi-mp.phi,_=vp.radius-mp.radius;this._sphericalEnd.set(mp.radius+_*d,mp.phi+b*d,mp.theta+y*d),this._sanitizeSphericals(),p||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd)),this._hasUpdated=!0}},{key:"setPosition",value:function(e,t,n,i){this.setLookAt(e,t,n,this._targetEnd.x,this._targetEnd.y,this._targetEnd.z,i)}},{key:"setTarget",value:function(e,t,n,i){var r=this.getPosition(lp);this.setLookAt(r.x,r.y,r.z,e,t,n,i)}},{key:"setBoundary",value:function(e){if(!e)return this._boundary.min.set(-1/0,-1/0,-1/0),this._boundary.max.set(1/0,1/0,1/0),void(this._hasUpdated=!0);this._boundary.copy(e),this._boundary.clampPoint(this._targetEnd,this._targetEnd),this._hasUpdated=!0}},{key:"setViewport",value:function(e,t,n,i){null!==e?(this._viewport=this._viewport||new ap.Vector4,"number"==typeof e?this._viewport.set(e,t,n,i):this._viewport.copy(e)):this._viewport=null}},{key:"getDistanceToFit",value:function(e,t,n){var i=this._camera,r=e/t,o=i.fov*ap.Math.DEG2RAD,a=i.aspect;return.5*(r.001||Math.abs(r)>.001||Math.abs(o)>.001||Math.abs(a.x)>.001||Math.abs(a.y)>.001||Math.abs(a.z)>.001?(this._spherical.set(this._spherical.radius+o*n,this._spherical.phi+r*n,this._spherical.theta+i*n),this._target.add(a.multiplyScalar(n)),this._hasUpdated=!0):(this._spherical.copy(this._sphericalEnd),this._target.copy(this._targetEnd)),0!==this._dollyControlAmount){if(this._camera.isPerspectiveCamera){var s=lp.copy(lp.setFromSpherical(this._sphericalEnd).applyQuaternion(this._yAxisUpSpaceInverse)).normalize().negate(),c=up.copy(s).cross(hp.copy(this._camera.up)).normalize();0===c.lengthSq()&&(c.x=1);var l=hp.crossVectors(c,s),u=this._sphericalEnd.radius*Math.tan(this._camera.fov*ap.Math.DEG2RAD*.5),h=(this._sphericalEnd.radius-this._dollyControlAmount-this._sphericalEnd.radius)/this._sphericalEnd.radius,d=lp.copy(this._targetEnd).add(c.multiplyScalar(this._dollyControlCoord.x*u*this._camera.aspect)).add(l.multiplyScalar(this._dollyControlCoord.y*u));this._targetEnd.lerp(d,h),this._target.copy(this._targetEnd)}this._dollyControlAmount=0}this._spherical.makeSafe(),this._camera.position.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(this._target),this._camera.lookAt(this._target),this._boundaryEnclosesCamera&&this._encloseToBoundary(this._camera.position.copy(this._target),lp.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse),1);var p=this._hasUpdated;return this._hasUpdated=!1,p&&this.dispatchEvent({type:"update"}),p}},{key:"toJSON",value:function(){return JSON.stringify({enabled:this.enabled,minDistance:this.minDistance,maxDistance:_p(this.maxDistance),minPolarAngle:this.minPolarAngle,maxPolarAngle:_p(this.maxPolarAngle),minAzimuthAngle:_p(this.minAzimuthAngle),maxAzimuthAngle:_p(this.maxAzimuthAngle),dampingFactor:this.dampingFactor,draggingDampingFactor:this.draggingDampingFactor,dollySpeed:this.dollySpeed,truckSpeed:this.truckSpeed,dollyToCursor:this.dollyToCursor,verticalDragToForward:this.verticalDragToForward,target:this._targetEnd.toArray(),position:this._camera.position.toArray(),target0:this._target0.toArray(),position0:this._position0.toArray()})}},{key:"fromJSON",value:function(e,t){var n=JSON.parse(e),i=(new ap.Vector3).fromArray(n.position);this.enabled=n.enabled,this.minDistance=n.minDistance,this.maxDistance=xp(n.maxDistance),this.minPolarAngle=n.minPolarAngle,this.maxPolarAngle=xp(n.maxPolarAngle),this.minAzimuthAngle=xp(n.minAzimuthAngle),this.maxAzimuthAngle=xp(n.maxAzimuthAngle),this.dampingFactor=n.dampingFactor,this.draggingDampingFactor=n.draggingDampingFactor,this.dollySpeed=n.dollySpeed,this.truckSpeed=n.truckSpeed,this.dollyToCursor=n.dollyToCursor,this.verticalDragToForward=n.verticalDragToForward,this._target0.fromArray(n.target0),this._position0.fromArray(n.position0),this._targetEnd.fromArray(n.target),this._sphericalEnd.setFromVector3(i.sub(this._target0).applyQuaternion(this._yAxisUpSpace)),t||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd)),this._hasUpdated=!0}},{key:"dispose",value:function(){this._removeAllEventListeners()}},{key:"_encloseToBoundary",value:function(e,t,n){var i=t.lengthSq();if(0===i)return e;var r=up.copy(t).add(e),o=this._boundary.clampPoint(r,hp).sub(r),a=o.lengthSq();if(0===a)return e.add(t);if(a===i)return e;if(0===n)return e.add(t).add(o);var s=1+n*a/t.dot(o);return e.add(up.copy(t).multiplyScalar(s)).add(o.multiplyScalar(1-n))}},{key:"_sanitizeSphericals",value:function(){this._sphericalEnd.theta=this._sphericalEnd.theta%yp,this._spherical.theta+=yp*Math.round((this._sphericalEnd.theta-this._spherical.theta)/yp)}},{key:"_getClientRect",value:function(e){var t=this._domElement.getBoundingClientRect();return e.x=t.left,e.y=t.top,this._viewport?(e.x+=this._viewport.x,e.y+=t.height-this._viewport.w-this._viewport.y,e.z=this._viewport.z,e.w=this._viewport.w):(e.z=t.width,e.w=t.height),e}},{key:"phiSpeed",set:function(e){console.warn("phiSpeed was renamed. use azimuthRotateSpeed instead"),this.azimuthRotateSpeed=e}},{key:"thetaSpeed",set:function(e){console.warn("thetaSpeed was renamed. use polarRotateSpeed instead"),this.polarRotateSpeed=e}},{key:"boundaryEnclosesCamera",get:function(){return this._boundaryEnclosesCamera},set:function(e){this._boundaryEnclosesCamera=e,this._hasUpdated=!0}}]),t}(),Mp=(e,{_canvas:t,_cameraMaxPolarAngle:n,_cameraMinPolarAngle:r,_cameraEnablePan:o,_cameraTarget:a,shouldDisableCameraControls:s})=>{wp.install({THREE:i});const c=e.getObjectByName(ad.CAMERA),l=new wp(c,t);if(l.enabled=!s,l.maxPolarAngle=n,l.minPolarAngle=r,l.truckSpeed=o?dd.panSpeed:0,l.invertZoom=dd.invertZoom,l.polarRotateSpeed=l.azimuthRotateSpeed=dd.rotateSpeed,a){const{x:e,y:t,z:n}=a;l.setTarget(e,t,n,!1)}return l},Ep=()=>{const e=new si;return e.name=ad.SCENE,e};var Tp=class{get timeScale(){return this.time/this.duration}get hasStopped(){return this.time>=this.duration}constructor(e){this.duration=e,this.time=0}reset(){this.time=0}stop(){this.time=this.duration}tick(e){this.time+=e,this.time>=this.duration&&(this.time=this.duration)}};const Sp=(e,t=new bn(0,0,0))=>{if(!e)return t;const n=e.split(" ").map(Number).filter(Boolean);return n.length<3?t:new bn(...n)},Ap=(e,t=Ed)=>{if(!e)return t;const n=e.split(" ").map(Number).filter(Boolean);return n.length<2?t:{ambient:n[0],directional:n[1]}},Cp=e=>"string"==typeof e&&(""===e||Boolean(e));function Pp(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}bc.enabled=!0;class Lp extends r.LightningElement{get isScreenshotSession(){return this._isScreenShotSession}set isScreenshotSession(e){this._isScreenShotSession=Cp(e),this._orbitControls&&this._handleScreenShotSessionChange()}get cameraPosition(){return this._orbitControls?`${this._orbitControls._camera.position.x} ${this._orbitControls._camera.position.y} ${this._orbitControls._camera.position.z}`:null}capture(e={}){const t=e.type||"image/png",n=e.quality||80;return new Promise((e,i)=>{this.isScreenshotSession||i(new Error("Cannot take screenshots when not initialized for it")),this._autoRotate&&i(new Error("Cannot take screenshots when not autorotate is enabled"));const{OBJECT:r}=ad;if(this._scene&&this._scene.getObjectByName(r)){const i=this._canvas.toDataURL(t,n);e(i)}else this.addEventListener("timerstart",()=>{const i=this._canvas.toDataURL(t,n);e(i)},{once:!0})})}rotateBy(e=90){return new Promise((t,n)=>{this._autoRotate&&n(new Error("Cannot rotate manually when not autorotate is enabled"));const{OBJECT:i}=ad;if(this._scene&&this._scene.getObjectByName(i)){let{theta:n}=this._orbitControls._sphericalEnd.clone();n=vn.radToDeg(n),Fd(this._scene,{_orbitControls:this._orbitControls,devicePixelRatio:this.devicePixelRatio,_cameraOrbit:`${n-e}deg auto auto`},t)}else this.addEventListener("timerstart",()=>{let{theta:n}=this._orbitControls._sphericalEnd.clone();n=vn.radToDeg(n),Fd(this._scene,{_orbitControls:this._orbitControls,devicePixelRatio:this.devicePixelRatio,_cameraOrbit:`${n-e}deg auto auto`},t)},{once:!0})})}pause(){this._renderer&&this._renderer.setAnimationLoop(null),this._orbitControls&&(this._orbitControls.enabled=!1)}resume(){if(this._renderer&&this._renderer.setAnimationLoop(this._animate),this._orbitControls&&(this._orbitControls.enabled=!this.shouldDisableCameraControls),this._scene){const e=this._scene.getObjectByName(ad.CAMERA);e&&Promise.resolve().then(()=>{this._renderer.render(this._scene,e)})}}get environmentImage(){return this._environmentImage}set environmentImage(e){this._environmentImage=e||wd}get environmentIntensity(){return this._environmentIntensity}set environmentIntensity(e){this._environmentIntensity=Number(e)||Md}set src(e){this._src=e,this._requestID=Math.random().toString(36).substr(2,7),this._canvas&&(this._loadObject(this._requestID),this.dispatchEvent(new CustomEvent("unload")),this._doTheDomThingy(!1))}get src(){return this._src}set androidSrc(e){this._androidSrc=e,this.canvas&&this._updateARHREF()}get androidSrc(){return this._androidSrc}set enableDracoSupport(e){this._enableDracoSupport=Cp(e)}get enableDracoSupport(){return this._enableDracoSupport}get iosSrc(){return this._iosSrc}set iosSrc(e){this._iosSrc=e}get title(){return this._title}set title(e){this._title="string"==typeof e?e:"ARModel"}get backdrop(){return this._backdropImage?this._backdropImage:this._backdrop}set backdrop(e){nd(e)?this._backdropImage=e:this._backdrop=e||"transparent",this._canvas&&this._setBackDrop()}get enableAr(){return this._enableAr}set enableAr(e){this._enableAr=Cp(e),this._domElements.arView&&this._updateEnableAr()}get buttonPlacement(){return this._buttonPlacement}set buttonPlacement(e){this._buttonPlacement=e,this._domElements.arTriggerContainer&&this._updateButtonParameters()}get arButtonBackdrop(){return this._arButtonBackdrop}set arButtonBackdrop(e){this._arButtonBackdrop=e,this._domElements.arTriggerContainer&&this._updateButtonParameters()}get loaderImage(){return this._loaderImage}set loaderImage(e){this._loaderImage=e,this._domElements.container&&this._setLoadingParams()}get cameraTarget(){return this._cameraTarget?this._cameraTarget.toArray().join(" "):null}set cameraTarget(e){this._cameraTarget=Sp(e),this._orbitControls&&this._handleCameraAttributes()}get loadingColor(){return this._loadingColor}set loadingColor(e){this._loadingColor=e,this._domElements.loading&&(this._loadingColor=e,this._setLoadingParams())}get loaderType(){return this._loaderType}set loaderType(e){this._loaderType=e}get autoRotate(){return this._autoRotate}set autoRotate(e){this._autoRotate=Cp(e),this._orbitControls&&this._handleAutoRotateChange()}get autoRotateStep(){return this._autoRotateStep}set autoRotateStep(e){this._autoRotateStep=Number(e)||dd.autoRotateSpeed}get minZoom(){return this._minZoom}set minZoom(e){this._minZoom=e,this._orbitControls&&this._handleCameraAttributes()}get cameraOrbit(){return this._cameraOrbit}set cameraOrbit(e){this._cameraOrbit=e,this._orbitControls&&this._handleCameraOrbit()}get disableCameraControls(){return this._disableCameraControls}set disableCameraControls(e){this._disableCameraControls=Cp(e),this._orbitControls&&this._handleCameraAttributes()}get disableInteractionPrompt(){return this._disableInteractionPrompt}set disableInteractionPrompt(e){this._disableInteractionPrompt=Cp(e)}get cameraMaxPolarAngle(){return this._cameraMaxPolarAngle}set cameraMaxPolarAngle(e){this._cameraMaxPolarAngle=parseFloat(e)||dd.maxPolarAngle,this._orbitControls&&this._handleCameraAttributes()}get cameraInitialDivider(){return this._cameraInitialDivider}set cameraInitialDivider(e){this._cameraInitialDivider=Boolean(Number(e))?Number(e):1}get cameraMinPolarAngle(){return this._cameraMinPolarAngle}set cameraMinPolarAngle(e){this._cameraMinPolarAngle=parseFloat(e)||dd.minPolarAngle,this._orbitControls&&this._handleCameraAttributes()}get cameraEnablePan(){return this._cameraEnablePan}set cameraEnablePan(e){this._cameraEnablePan=Cp(e)||dd.enablePan,this._orbitControls&&this._handleCameraAttributes()}get lightIntensity(){return this._lightIntensity}set lightIntensity(e){this._lightIntensity=Ap(e,Ed),this._scene&&this._handleLightChanges()}get disableZoomControls(){return!!jh||this._disableZoomControls}set disableZoomControls(e){this._disableZoomControls=Cp(e)}get entryAnimation(){return this._entryAnimation}set entryAnimation(e){this._entryAnimation=e}get initializeEnableAnimations(){return this._initializeEnableAnimations}set initializeEnableAnimations(e){this._initializeEnableAnimations=Cp(e)}get initializeEnableGrid(){return this._initializeEnableGrid}set initializeEnableGrid(e){this._initializeEnableGrid=Cp(e)}get initializeDisableShadowsOnAndroid(){return this._initializeDisableShadowsOnAndroid}set initializeDisableShadowsOnAndroid(e){this._initializeDisableShadowsOnAndroid=Cp(e)}get initializeDisableShadowsOnIos(){return this._initializeDisableShadowsOnIos}set initializeDisableShadowsOnIos(e){this._initializeDisableShadowsOnIos=Cp(e)}get _interactionHelperClass(){return this._controlsPrompt?"control-prompt visible":"control-prompt not-visible"}get _canAutoRotate(){return this._autoRotateStop&&this._autoRotate}get _getExitButtonClass(){return this._fullScreen?"exit-btn":"exit-btn exit-btn-no-display"}get _loaderClassName(){return`loading ${"none"!==this._loaderType?`loading-${this._loaderType}`:""}`}get _isMobile(){return qh}get _canLaunchQuicklook(){return Boolean(this._iosSrc)&&Hh&&Yh&&(Wh||Vh)}get _canLaunchSceneViewer(){return Boolean(this._androidSrc)&&Gh}constructor(){super(),this._isScreenShotSession=!1,this._environmentImage=wd,this._environmentIntensity=Md,this._src="",this._androidSrc="",this._enableDracoSupport=!1,this._iosSrc=void 0,this._title="ARModel",this._backdrop="transparent",this._backdropImage="",this._enableAr=!1,this._buttonPlacement="bottom",this._arButtonBackdrop="#4553d1",this._loaderImage="",this._cameraTarget=!1,this._loadingColor="#ffffff",this._loaderType="none",this._autoRotate=!1,this._autoRotateStep=dd.autoRotateSpeed,this._autoRotateStop=!1,this._minZoom="auto",this._cameraOrbit=yd,this._disableCameraControls=!1,this._disableInteractionPrompt=!1,this._cameraMaxPolarAngle=dd.maxPolarAngle,this._cameraInitialDivider=1,this._cameraMinPolarAngle=dd.minPolarAngle,this._cameraEnablePan=dd.enablePan,this._lightIntensity=Ed,this._disableZoomControls=!1,this._entryAnimation="",this._initializeEnableAnimations=!1,this._initializeEnableGrid=!1,this._initializeDisableShadowsOnAndroid=!1,this._initializeDisableShadowsOnIos=!1,this._fullScreen=!1,this._controlsPrompt=!1,this._markers=[],this._activeMarker=null,this._isVisible=!1,this._observeResize=(e=>{for(let t of e)t.target===this._domElements.container&&this._updateRendererSize()}),this._observerIntersection=(e=>{for(let t of e)t.target===this._domElements.container&&t.isIntersecting&&(this.dispatchEvent(new CustomEvent("visible")),this._isVisible=!0),t.target!==this._domElements.container||t.isIntersecting||(this.dispatchEvent(new CustomEvent("hidden")),this._isVisible=!1)}),this._entryPoint=(()=>{this._initDOMElements(),this._scene=Ep(),this._setupForAnimation(),this._renderer=Qd(this._canvas,this),this._loadObject(this._requestID),this._setBackDrop(),this._updateButtonParameters(),Td(this._scene,this.canvasDimensions),Ld(this._scene,this),this._orbitControls=Mp(this._scene,this),this._setCursor("grab"),this._effectContainer=new qd(this._scene,this._renderer),this._interactionray=new Fh(this._renderer,this._scene,this._scene.getObjectByName(ad.CAMERA)),this._rayCaster=new du,this._updateEnableAr(),this._attachTimerEvents()}),this._listenToDoubleClick=(e=>{if(this._orbitControls&&this._orbitControls.enabled){const t=this._canvas.getBoundingClientRect(),{x:n,y:i}=rd(e,t),r=this._scene.getObjectByName(ad.CAMERA),o=this._scene.getObjectByName(ad.OBJECT);this._rayCaster.setFromCamera({x:n,y:i},r);const a=this._rayCaster.intersectObject(o,!0),s=id(a.map(e=>e.distance));if(void 0!==s){const e=a[s],{point:t}=e;this._orbitControls.setTarget(t.x,t.y,t.z,!0)}else this._orbitControls.reset(!0)}}),this._animate=(e=>{const t=this._clock.getDelta(),n=this._scene.getObjectByName(ad.CAMERA);this.initializeEnableAnimations&&this._mixers[0]&&this._mixers[0].update(t),this._orbitControls&&this._orbitControls.update(t),this._timer.autoRotate&&(this._timer.autoRotate.hasStopped?this._timer.autoRotate.hasStopped&&this._rotateInternal(this._autoRotateStep,!0):this._timer.autoRotate.tick(t)),this._markers&&this._markers.forEach(e=>{e.threed.update(n)}),Uh.a.update(e),this._renderer.render(this._scene,n)}),this._fullScreenChangeHandler=(()=>{const e=Boolean(document.fullscreenElement);this._fullScreen=e,e?this._domElements.arTriggerContainer.classList.add(od.TRIGGER_VIEW_NO_DISPLAY):this._domElements.arTriggerContainer.classList.remove(od.TRIGGER_VIEW_NO_DISPLAY)}),this._handleInteractionTimer=(()=>{this._timeouts.interaction=setTimeout(()=>{this._controlsPrompt=!0},gd),this._orbitControls.addEventListener("controlstart",()=>{this._controlsPrompt?this._controlsPrompt=!1:clearTimeout(this._timeouts.interaction)},{once:!0})}),this._dispatchArActions=(()=>{const e=this._domElements.container;switch(!0){case this._canLaunchQuicklook:this.dispatchEvent(new CustomEvent("arclick",{detail:{type:"ios"}})),$h(this._iosSrc);break;case Gh:this.dispatchEvent(new CustomEvent("arclick",{detail:{type:"android"}})),Jh(this._domElements.trigger),e.requestFullscreen();break;default:this.dispatchEvent(new CustomEvent("arclick",{detail:{type:"non-ar-device"}})),e.requestFullscreen()}}),this._loadObject=(e=>{kd(this._scene,this,e,e=>{if(Cd(this._scene,this),Rd(this._scene,this,!0),this._updateMarkersBasedOnModel(),this.initializeEnableGrid&&Pd(this._scene),this.initializeEnableAnimations){const t=new lu(e.scene);this._mixers=[],e.animations.length>0&&(t.clipAction(e.animations[0]).play(),this._mixers.push(t))}this.dispatchEvent(new CustomEvent("dimensions",{detail:{dimensions:this.canvasDimensions}})),Od(this._scene,this,()=>{this._updateRendererSize(),this._waitForVisibility(()=>{this._doTheDomThingy(!0),this.dispatchEvent(new CustomEvent("loaded")),this._selectedAnim=Wd.hasOwnProperty(this._entryAnimation)?this._effectContainer[Wd[this._entryAnimation]]:null,this._figureAnimations()})})},e=>{console.error(e)})}),this._figureAnimations=(()=>{"image"!==this._loaderType&&this._selectedAnim?(this._selectedAnim(this.entryAnimation),this._effectContainer.addEventListener(this._entryAnimation,()=>{this._rotationHackHelper()})):Fd(this._scene,this,400,()=>{this.dispatchEvent(new CustomEvent("timerstart"))})}),this._rotationHackHelper=(()=>{"image"===this._loaderType?this.dispatchEvent(new CustomEvent("timerstart")):Fd(this._scene,this,0,()=>{this.dispatchEvent(new CustomEvent("timerstart"))})}),this._delay=((e,t=(()=>{}))=>{setTimeout(()=>{requestAnimationFrame(t)},e)}),this.devicePixelRatio=window.devicePixelRatio>2?2:window.devicePixelRatio,this._domElements={},this._timer={},this._possibleButtonPlacementValues=["top","top-left","top-right","bottom","bottom-left","bottom-right","bottom-center","top-center"],this._mixers=[],this.stats=null,this._init=!0,this._timeouts={},this._resizeObserver=null}get canvasDimensions(){if(this._canvas){const{width:e,height:t}=this._canvas.getBoundingClientRect();return{width:e,height:t}}return{width:null,height:null}}get isLoaderTypeSpinner(){return"spinner"===this._loaderType}get isLoaderTypeImage(){return"image"===this._loaderType}get shouldDisableCameraControls(){return this._disableCameraControls}arTriggerClassName(e=null){return null===e?`trigger-container-${this._buttonPlacement}`:`trigger-container-${e}`}renderedCallback(){this._init&&(this._entryPoint(),this._init=!1)}_deactiveActiveMarker(){const e=Object.assign({},function(e){for(var t=1;t{e.classList.contains("show")&&e.classList.remove("show")})}_initDOMElements(){this._canvas=this.template.querySelector(od.CANVAS),this._domElements.container=this.template.querySelector(od.CONTAINER),this._domElements.backdropContainer=this.template.querySelector(".backdrop-container"),this._domElements.arView=this.template.querySelector(od.TRIGGER_VIEW),this._domElements.arTriggerContainer=this.template.querySelector(od.TRIGGER_CONTAINER),this._domElements.loading=this.template.querySelector(od.LOADING),this._domElements.trigger=this.template.querySelector(".trigger"),self.addEventListener("fullscreenchange",()=>this._fullScreenChangeHandler()),this.addEventListener("timerstart",()=>this._handleInteractionTimer(),{once:!0}),this._setLoadingParams(),xd?(this._resizeObserver=new ResizeObserver(this._observeResize),this._resizeObserver.observe(this._domElements.container)):self.addEventListener("resize",()=>this._updateRendererSize()),_d?(this._intersectionObserver=new IntersectionObserver(this._observerIntersection,{threshold:0,root:null,rootMargin:"10px"}),this._intersectionObserver.observe(this._domElements.container)):this.dispatchEvent(new CustomEvent("visible")),this._updateARHREF()}_handleLightChanges(){const e=this._scene.getObjectByName(ad.AMBIENT_LIGHT),t=this._scene.getObjectByName(ad.DIRECTIONAL_LIGHT);e.intensity=this._lightIntensity.ambient,t.intensity=this._lightIntensity.directional}_updateARHREF(){switch(!0){case this._canLaunchQuicklook:this._domElements.trigger.href=this._iosSrc;break;case this._canLaunchSceneViewer:this._domElements.trigger.href=Xh(this._androidSrc,this._title)}}_setupForAnimation(){this._clock=new Bl}_rotateScreenshot(e){this._orbitControls.rotate(e,0,!0)}_rotateInternal(e,t=!1){const n=this._orbitControls._sphericalEnd.clone();this._orbitControls.rotateTo(n.theta-e,n.phi,t)}_setCursor(e){this._canvas&&this._canvas.style.setProperty("cursor",e)}_attachTimerEvents(){this.addEventListener("timerstart",()=>{this._markers.forEach(({threed:e})=>{e.changeVisiblity(!0)}),this._autoRotate&&(this._timer.autoRotate=new Tp(.6)),this._canvas.addEventListener("dblclick",this._listenToDoubleClick,{passive:!0})}),this.addEventListener("autorotatetimerend",()=>{this._autoRotate&&(this._timer.autoRotate=null)}),this._orbitControls.addEventListener("controlstart",e=>{this._setCursor("grabbing");const t=e.target.getTarget(),n=e.target.getPosition();this.dispatchEvent(new CustomEvent("controlstart",{detail:{originalEvent:e.originalEvent,cameraValues:{position:n.toArray().join(" "),target:t.toArray().join(" ")}}})),this._autoRotate&&(this._timer.autoRotate=null)}),this._orbitControls.addEventListener("controlend",e=>{this._setCursor("grab");const t=e.target.getTarget(),n=e.target.getPosition();this.dispatchEvent(new CustomEvent("controlend",{detail:{originalEvent:e.originalEvent,cameraValues:{position:n.toArray().join(" "),target:t.toArray().join(" ")}}})),this._autoRotate&&(this._timer.autoRotate=new Tp(1.2))}),this.addEventListener("markerclick",()=>{this._autoRotate&&(this._timer.autoRotate=null),this.template.querySelector(".card-container").focus(),document.addEventListener("keydown",e=>this._dismissModal(e),!1)}),this.addEventListener("markerexit",e=>{this._checkForActiveYoutubeVideosAndCloseIt(e.detail),this._setCursor("grab"),this._autoRotate&&(this._timer.autoRotate=new Tp(1.2)),document.removeEventListener("keydown",e=>this._dismissModal(e),!1)}),this.addEventListener("markermove",()=>{this._setCursor("pointer"),this._autoRotate&&(this._timer.autoRotate=null)}),this.addEventListener("markerpointerout",()=>{this._setCursor("grab"),this._autoRotate&&(this._timer.autoRotate=new Tp(1.2))}),this.addEventListener("unload",()=>{this._markers.forEach(({threed:e})=>{e.changeVisiblity(!1)})}),this.addEventListener("visible",()=>{this.resume()}),this.addEventListener("hidden",()=>{this.pause()}),this.addEventListener("unload",()=>{this._canvas.removeEventListener("dblclick",this._listenToDoubleClick,{passive:!0})})}_checkForActiveYoutubeVideosAndCloseIt({video:e}){if(e){let t=this.template.querySelector(`iframe[src="${e}"]`);t&&t.contentWindow.postMessage('{"event":"command","func":"stopVideo","args":""}',"*")}}_dismissModal(e){const{code:t,keyCode:n}=e;"Escape"!==t&&27!==n||this._deactiveActiveMarker()}_markerMove(e){this.dispatchEvent(new CustomEvent("markermove",{detail:{marker:e}}))}_markerPointerOut(e){this.dispatchEvent(new CustomEvent("markerpointerout",{detail:{marker:e}}))}_updateRendererSize(){const{height:e,width:t}=this.canvasDimensions;if(this._renderer.setSize(t,e,!1),this._scene){const n=this._scene.getObjectByName(ad.CAMERA);n&&(n.aspect=t/e,n.updateProjectionMatrix(),Rd(this._scene,this))}}_zoomIn(){this.dispatchEvent(new CustomEvent("zoom_in"));const e=this._scene.getObjectByName(ad.OBJECT);if(!e)return;const{size:t}=Sd(e,window.devicePixelRatio);this._orbitControls.dolly(-t.z/vd)}_zoomOut(){this.dispatchEvent(new CustomEvent("zoom_out"));const e=this._scene.getObjectByName(ad.OBJECT);if(!e)return;const{size:t}=Sd(e,window.devicePixelRatio);this._orbitControls.dolly(t.z/vd)}_dispatchFullscreenBtn(){const{_fullScreen:e}=this;if(e)this._handleExitFullScreen();else{this.template.host.requestFullscreen(),this.dispatchEvent(new CustomEvent("fullscreen_enter"))}}_updateEnableAr(){const{_enableAr:e}=this;e&&(this._canLaunchSceneViewer||this._canLaunchQuicklook)?(this._domElements.arView.addEventListener("click",this._dispatchArActions),this._domElements.arTriggerContainer.classList.remove(od.TRIGGER_VIEW_NO_DISPLAY)):(this._domElements.arView.removeEventListener("click",this._dispatchArActions),this._domElements.arTriggerContainer.classList.add(od.TRIGGER_VIEW_NO_DISPLAY))}_handleCameraOrbit(){Fd(this._scene,this,0,()=>{this.dispatchEvent(new CustomEvent("timerstart"))})}_updateButtonParameters(){this._domElements.arTriggerContainer.classList.forEach(e=>{this._possibleButtonPlacementValues.map(this.arTriggerClassName).includes(e)&&this._domElements.arTriggerContainer.classList.remove(e)}),this._domElements.arTriggerContainer.classList.add(this.arTriggerClassName()),this._domElements.arTriggerContainer.style.setProperty("--ar-btn-backdrop",this._arButtonBackdrop),this.dispatchEvent(new CustomEvent("buttonpropertieschange",{detail:{backdrop:this._arButtonBackdrop,placement:this._buttonPlacement}}))}_handleAutoRotateChange(){this._orbitControls.autoRotate=Boolean(this._autoRotate),this._autoRotate&&!this._orbitControls.autoRotateSpeed&&(this._orbitControls.autoRotateSpeed=dd.autoRotateSpeed)}_handleCameraAttributes(){if(this._orbitControls.enabled=!this.shouldDisableCameraControls,this._orbitControls.maxPolarAngle=this._cameraMaxPolarAngle,this._orbitControls.minPolarAngle=this._cameraMinPolarAngle,this._orbitControls.truckSpeed=this._cameraEnablePan?dd.panSpeed:0,this._cameraTarget){const{x:e,y:t,z:n}=this._cameraTarget;this._orbitControls.setTarget(e,t,n,!1)}let e;try{e=Number(this._minZoom)}catch(t){e="auto"}if(this._scene){const t=this._scene.getObjectByName(ad.OBJECT);if(t){const n=(this.canvasDimensions.width||1)/(this.canvasDimensions.height||1)*devicePixelRatio,{modelDepth:i}=Sd(t,n);this._orbitControls.minDistance="auto"===e?i/2:vn.clamp(e,0,1/0)}else;}}_handleScreenShotSessionChange(){this._orbitControls.enabled=!this.shouldDisableCameraControls}_doTheDomThingy(e){qh&&(this._domElements.arView.style.display=e?"flex":"none"),e&&(this._domElements.container.classList.remove("not-visible"),this._domElements.container.classList.add("visible"))}async _handleExitFullScreen(){try{this._fullScreen&&document.fullscreenElement&&(await document.exitFullscreen(),this.dispatchEvent(new CustomEvent("fullscreen_exit")))}catch(e){}}_navigateCTAButton(e){const{url:t}=e.target.dataset,n=document.createElement("a");n.href=t,n.target="_blank",n.click()}_setBackDrop(){this._domElements.backdropContainer.style.setProperty("--backdrop",this._backdrop),this.dispatchEvent(new CustomEvent("backdropchange"))}_setLoadingParams(){const{_loadingColor:e}=this._domElements.loading.style.getPropertyValue("--loadingColor");this._loadingColor&&this._loadingColor!==e&&(this._domElements.loading.style.setProperty("--loadingColor",this._loadingColor),this.dispatchEvent(new CustomEvent("loadingcolorchange")));const t=this.template.querySelector(".img__bg");if(t&&Boolean(this._loaderImage)){const e=this._domElements.loading.style.getPropertyValue("--loadingBg"),n=`url(${this._loaderImage})`;e!==n&&t.style.setProperty("--loadingBg",n)}}onslotchange(){const e=this.querySelector("div[slot='annotation-slot']");this._constructAnnotationsBasedOnRootNode(e)}_constructAnnotationsBasedOnRootNode(e){if(!(e instanceof HTMLElement))return;this._markers=[];const t=e.querySelectorAll("hotspot"),n=new vi(e.getAttribute("brand-color"))||new vi(0);t.forEach((e,t)=>{const i=e.querySelector("hotspot-title"),r=e.querySelector("hotspot-description"),o=e.querySelector("hotspot-image"),a=e.querySelector("hotspot-video"),s=e.querySelector("hotspot-button"),c={position:Sp(e.getAttribute("position")),iconUrl:e.getAttribute("icon-url")||bd,title:i?i.textContent:"",description:r?r.textContent:"",type:e.getAttribute("type"),name:`Marker-${t}`,threed:null,image:null,video:null,button:{text:null,url:null}};if(c.threed=new Kd({description:c.description,position:c.position,scene:this._scene,title:c.title,iconUrl:c.iconUrl,name:c.name,scale:c.scale,pixelRatio:this.devicePixelRatio,brandColor:n,onClick:()=>{this.dispatchEvent(new CustomEvent("markerclick",{detail:c})),this._activeMarker=c,this.template.querySelectorAll(".card-container").forEach(e=>{e.querySelector(".card").id.includes(c.name)&&e.classList.add("show")})},onPointerIn:()=>{this._markerMove(c)},onPointerOut:()=>{this._markerPointerOut(c)}}),Boolean(o))c.image=o.textContent;else if(Boolean(a)){let e;try{(e=new URL(a.textContent)).searchParams.set("enablejsapi","1"),e=e.toString()}catch(t){e=""}c.video=e}else Boolean(s)&&(c.button.text=s.textContent,c.button.url=s.getAttribute("url"));this._markers.push(c),this._scene.add(c.threed),this._updateMarkersBasedOnModel()}),this._domElements.container.style.setProperty("--marker-brand-color",`#${n.getHexString()}`)}_updateMarkersBasedOnModel(){const e=this._scene.getObjectByName(ad.OBJECT);e&&this._markers.forEach(t=>t.threed.updateSize(e))}_waitForVisibility(e=(()=>{})){this._isVisible?e():this.addEventListener("visible",()=>requestAnimationFrame(e),{once:!0})}disconnectedCallback(){self.removeEventListener("fullscreenchange",()=>this._fullScreenChangeHandler()),this._canvas.removeEventListener("dblclick",this._listenToDoubleClick,{passive:!0}),xd?this._resizeObserver.disconnect():self.removeEventListener("resize",()=>this._updateRendererSize()),_d&&this._intersectionObserver.disconnect(),this._orbitControls.dispose(),this._renderer.dispose(),this._enableDracoSupport&&Id.releaseDecoderModule()}}Lp.delegatesFocus=!0,Object(r.registerDecorators)(Lp,{publicProps:{isScreenshotSession:{config:3},cameraPosition:{config:1},environmentImage:{config:3},environmentIntensity:{config:3},src:{config:3},androidSrc:{config:3},enableDracoSupport:{config:3},iosSrc:{config:3},title:{config:3},backdrop:{config:3},enableAr:{config:3},buttonPlacement:{config:3},arButtonBackdrop:{config:3},loaderImage:{config:3},cameraTarget:{config:3},loadingColor:{config:3},loaderType:{config:3},autoRotate:{config:3},autoRotateStep:{config:3},minZoom:{config:3},cameraOrbit:{config:3},disableCameraControls:{config:3},disableInteractionPrompt:{config:3},cameraMaxPolarAngle:{config:3},cameraInitialDivider:{config:3},cameraMinPolarAngle:{config:3},cameraEnablePan:{config:3},lightIntensity:{config:3},disableZoomControls:{config:3},entryAnimation:{config:3},initializeEnableAnimations:{config:3},initializeEnableGrid:{config:3},initializeDisableShadowsOnAndroid:{config:3},initializeDisableShadowsOnIos:{config:3}},publicMethods:["capture","rotateBy","pause","resume"],track:{_isScreenShotSession:1,_environmentImage:1,_environmentIntensity:1,_src:1,_androidSrc:1,_enableDracoSupport:1,_iosSrc:1,_title:1,_backdrop:1,_backdropImage:1,_enableAr:1,_buttonPlacement:1,_arButtonBackdrop:1,_loaderImage:1,_cameraTarget:1,_loadingColor:1,_loaderType:1,_autoRotate:1,_autoRotateStep:1,_autoRotateStop:1,_minZoom:1,_cameraOrbit:1,_disableCameraControls:1,_disableInteractionPrompt:1,_cameraMaxPolarAngle:1,_cameraInitialDivider:1,_cameraMinPolarAngle:1,_cameraEnablePan:1,_lightIntensity:1,_disableZoomControls:1,_entryAnimation:1,_initializeEnableAnimations:1,_initializeEnableGrid:1,_initializeDisableShadowsOnAndroid:1,_initializeDisableShadowsOnIos:1,_fullScreen:1,_controlsPrompt:1,_markers:1,_activeMarker:1,_isVisible:1}});var Rp=Object(r.registerComponent)(Lp,{tmpl:s});customElements.define("unified-viewer",Object(r.buildCustomElementConstructor)(Rp))}]);